From 91cae125e3a01508718503ac2d25689819b7a47c Mon Sep 17 00:00:00 2001 From: GussevPM Date: Thu, 17 Apr 2025 01:17:54 +0200 Subject: [PATCH] Add Mammoth faucet --- components/LeftSidebar.vue | 2 +- components/ui/Dropdown/DropdownContainer.vue | 3 +- pages/faucet.vue | 54 +++++++++++++------- services/config.js | 1 + 4 files changed, 39 insertions(+), 21 deletions(-) diff --git a/components/LeftSidebar.vue b/components/LeftSidebar.vue index 6373a9a2..f33389bf 100644 --- a/components/LeftSidebar.vue +++ b/components/LeftSidebar.vue @@ -322,7 +322,7 @@ const handleOnClose = () => { Mainnet Mocha-4 Arabica - + Mammoth diff --git a/components/ui/Dropdown/DropdownContainer.vue b/components/ui/Dropdown/DropdownContainer.vue index 8ffad58c..f3acfb5c 100644 --- a/components/ui/Dropdown/DropdownContainer.vue +++ b/components/ui/Dropdown/DropdownContainer.vue @@ -55,7 +55,7 @@ const props = defineProps({ }, }) -const emit = defineEmits(["onClose"]) +const emit = defineEmits(["onClose", "onOpen"]) const trigger = ref(null) const dropdown = ref(null) @@ -70,6 +70,7 @@ watch( ) const toggleDropdown = (event) => { + emit("onOpen") if (event) event.stopPropagation() if (props.disabled) return isOpen.value = !isOpen.value diff --git a/pages/faucet.vue b/pages/faucet.vue index e7b26f55..0050380f 100644 --- a/pages/faucet.vue +++ b/pages/faucet.vue @@ -3,11 +3,12 @@ import { executeFaucet, faucetAddress, fetchBalance } from "@/services/api/faucet" /** Services */ -import { comma, splitAddress, tia } from "@/services/utils" +import { capitilize, comma, splitAddress, tia } from "@/services/utils" import { Server, useServerURL } from "@/services/config" /** UI */ import Button from "@/components/ui/Button.vue" +import { Dropdown, DropdownItem } from "@/components/ui/Dropdown" import Input from "@/components/ui/Input.vue" import Tooltip from "@/components/ui/Tooltip.vue" @@ -72,6 +73,7 @@ const address = ref("") const account = ref() const network = ref("mocha") +const isNetworkSelectorOpen = ref(false) const fetchAccount = async() => { try { account.value = null @@ -162,6 +164,7 @@ const handleReturnTokensClick = () => { if ( (useServerURL().includes("mocha") && network.value === "mocha") || (useServerURL().includes("arabica") && network.value === "arabica") + || (useServerURL().includes("mammoth") && network.value === "mammoth") ) { cacheStore.current.address = { hash: faucetAddress } modalsStore.open("send") @@ -170,12 +173,8 @@ const handleReturnTokensClick = () => { } } -const handleChangeNetwork = () => { - if (network.value === 'mocha') { - network.value = 'arabica' - } else { - network.value = 'mocha' - } +const handleChangeNetwork = (net) => { + network.value = net } const openedQuestion = ref(0) @@ -272,20 +271,37 @@ onMounted(() => { - Network - - Mocha - Arabica - + + + + + + {{ capitilize(network) }} + + + + + + +