-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Get TFT button in new Dashboard (#1086)
* add Get TFT button * fix color of toast * remove print line * update position of button * add icon before success or failure in toast * update 404 page * use alice client and remove callback * call connect method * fix getting tfts * use getGrid * check on network && add method to balance module * improve code readability * fix bug when solving conflict * reload balance * connect client again when connecting to alice
- Loading branch information
1 parent
8cf29ed
commit 885bada
Showing
6 changed files
with
106 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<template> | ||
<v-btn | ||
id="tftBtn" | ||
width="2000" | ||
color="white" | ||
@click="addTFT" | ||
class="px-lg-6 px-md-2 px-sm-0 mx-sm-0" | ||
style="color: white; max-width: 140px; width: auto; background-color: var(--primary)" | ||
:loading="loadingAddTFT" | ||
> | ||
GET TFT | ||
</v-btn> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { createToast } from "mosha-vue-toastify"; | ||
import { ref } from "vue"; | ||
import { useProfileManagerController } from "../components/profile_manager_controller.vue"; | ||
import { useProfileManager } from "../stores"; | ||
import { getGrid } from "../utils/grid"; | ||
export default { | ||
name: "FundsCard", | ||
setup() { | ||
const loadingAddTFT = ref(false); | ||
const profileManager = useProfileManager(); | ||
const ProfileManagerController = useProfileManagerController(); | ||
const addTFT = async () => { | ||
if (window.env.NETWORK !== "dev" && window.env.NETWORK !== "qa") { | ||
window.open("https://gettft.com/gettft/", "_blank"); | ||
} else { | ||
loadingAddTFT.value = true; | ||
try { | ||
const grid = await getGrid(profileManager.profile!); | ||
await grid?.balance.getMoreFunds(); | ||
await ProfileManagerController.reloadBalance(); | ||
loadingAddTFT.value = false; | ||
createToast(`Success!`, { | ||
position: "bottom-right", | ||
hideProgressBar: true, | ||
toastBackgroundColor: "#1aa18f", | ||
timeout: 5000, | ||
type: "success", | ||
showIcon: true, | ||
}); | ||
} catch (e) { | ||
loadingAddTFT.value = false; | ||
console.log("Error: ", e); | ||
createToast(`Get more TFT failed!`, { | ||
position: "bottom-right", | ||
hideProgressBar: true, | ||
toastBackgroundColor: "black", | ||
timeout: 5000, | ||
type: "danger", | ||
showIcon: true, | ||
}); | ||
} | ||
} | ||
}; | ||
return { | ||
loadingAddTFT, | ||
addTFT, | ||
}; | ||
}, | ||
}; | ||
</script> | ||
|
||
<style> | ||
#tftBtn { | ||
display: inline-block; | ||
min-width: 10px !important; | ||
} | ||
:root { | ||
--primary: #1aa18f; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters