Skip to content

Commit 91cae12

Browse files
committed
Add Mammoth faucet
1 parent 16e457f commit 91cae12

File tree

4 files changed

+39
-21
lines changed

4 files changed

+39
-21
lines changed

components/LeftSidebar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ const handleOnClose = () => {
322322
<DropdownItem @click="handleNavigate('https://celenium.io')">Mainnet</DropdownItem>
323323
<DropdownItem @click="handleNavigate('https://mocha-4.celenium.io')">Mocha-4</DropdownItem>
324324
<DropdownItem @click="handleNavigate('https://arabica.celenium.io')">Arabica</DropdownItem>
325-
<!-- <DropdownItem @click="handleNavigate('https://mammoth.celenium.io')">Mammoth</DropdownItem> -->
325+
<DropdownItem @click="handleNavigate('https://mammoth.celenium.io')">Mammoth</DropdownItem>
326326
</template>
327327
</Dropdown>
328328
</Flex>

components/ui/Dropdown/DropdownContainer.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const props = defineProps({
5555
},
5656
})
5757
58-
const emit = defineEmits(["onClose"])
58+
const emit = defineEmits(["onClose", "onOpen"])
5959
6060
const trigger = ref(null)
6161
const dropdown = ref(null)
@@ -70,6 +70,7 @@ watch(
7070
)
7171
7272
const toggleDropdown = (event) => {
73+
emit("onOpen")
7374
if (event) event.stopPropagation()
7475
if (props.disabled) return
7576
isOpen.value = !isOpen.value

pages/faucet.vue

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
import { executeFaucet, faucetAddress, fetchBalance } from "@/services/api/faucet"
44
55
/** Services */
6-
import { comma, splitAddress, tia } from "@/services/utils"
6+
import { capitilize, comma, splitAddress, tia } from "@/services/utils"
77
import { Server, useServerURL } from "@/services/config"
88
99
/** UI */
1010
import Button from "@/components/ui/Button.vue"
11+
import { Dropdown, DropdownItem } from "@/components/ui/Dropdown"
1112
import Input from "@/components/ui/Input.vue"
1213
import Tooltip from "@/components/ui/Tooltip.vue"
1314
@@ -72,6 +73,7 @@ const address = ref("")
7273
const account = ref()
7374
const network = ref("mocha")
7475
76+
const isNetworkSelectorOpen = ref(false)
7577
const fetchAccount = async() => {
7678
try {
7779
account.value = null
@@ -162,6 +164,7 @@ const handleReturnTokensClick = () => {
162164
if (
163165
(useServerURL().includes("mocha") && network.value === "mocha")
164166
|| (useServerURL().includes("arabica") && network.value === "arabica")
167+
|| (useServerURL().includes("mammoth") && network.value === "mammoth")
165168
) {
166169
cacheStore.current.address = { hash: faucetAddress }
167170
modalsStore.open("send")
@@ -170,12 +173,8 @@ const handleReturnTokensClick = () => {
170173
}
171174
}
172175
173-
const handleChangeNetwork = () => {
174-
if (network.value === 'mocha') {
175-
network.value = 'arabica'
176-
} else {
177-
network.value = 'mocha'
178-
}
176+
const handleChangeNetwork = (net) => {
177+
network.value = net
179178
}
180179
181180
const openedQuestion = ref(0)
@@ -272,20 +271,37 @@ onMounted(() => {
272271
<Flex direction="column" gap="48" wide>
273272
<Flex direction="column" gap="16" wide>
274273
<Flex align="center" justify="start" gap="16" wide>
275-
<Text align="center" size="12" color="secondary" weight="600">Network</Text>
276-
<Flex
277-
@click="handleChangeNetwork"
278-
align="center"
279-
justify="between"
274+
<Dropdown
275+
@onOpen="isNetworkSelectorOpen = true"
276+
@onClose="isNetworkSelectorOpen = false"
277+
position="end"
280278
:class="$style.network_selector"
281-
:style="{
282-
background: `linear-gradient(to ${network === 'mocha' ? 'right' : 'left'}, var(--op-3) 50%, transparent 50%)`,
283-
width: '110px'
284-
}"
285279
>
286-
<Text align="center" size="12" weight="600" :color="network === 'mocha' ? 'primary' : 'tertiary'">Mocha</Text>
287-
<Text align="center" size="12" weight="600" :color="network === 'arabica' ? 'primary' : 'tertiary'">Arabica</Text>
288-
</Flex>
280+
<Flex align="center" gap="8" justify="between">
281+
<Flex align="center" gap="8">
282+
<Icon name="globe" size="14" color="tertiary" />
283+
284+
<Text size="13" weight="600" color="secondary">
285+
{{ capitilize(network) }}
286+
</Text>
287+
</Flex>
288+
<Icon
289+
name="chevron"
290+
size="14"
291+
color="secondary"
292+
:style="{
293+
transform: `rotate(${isNetworkSelectorOpen ? '180' : '0'}deg)`,
294+
transition: 'all 0.2s ease'
295+
}"
296+
/>
297+
</Flex>
298+
299+
<template #popup>
300+
<DropdownItem @click="handleChangeNetwork('mocha')">Mocha</DropdownItem>
301+
<DropdownItem @click="handleChangeNetwork('arabica')">Arabica</DropdownItem>
302+
<DropdownItem @click="handleChangeNetwork('mammoth')">Mammoth</DropdownItem>
303+
</template>
304+
</Dropdown>
289305
</Flex>
290306
<Flex align="center" gap="6" wide>
291307
<Input

services/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,5 @@ export const quoteServiceURL = "https://quote.celenium.io/v1"
128128
export const faucetURL = {
129129
mocha: "https://api-faucet.celenium.io/v1",
130130
arabica: "https://api-arabica-faucet.celenium.io/v1",
131+
mammoth: "https://api-mammoth-faucet.celenium.io/v1",
131132
}

0 commit comments

Comments
 (0)