|
| 1 | +<script setup> |
| 2 | +/** UI */ |
| 3 | +import Modal from "@/components/ui/Modal.vue" |
| 4 | +import Button from "@/components/ui/Button.vue" |
| 5 | +
|
| 6 | +/** Services */ |
| 7 | +import { comma } from "@/services/utils" |
| 8 | +
|
| 9 | +/** Stores */ |
| 10 | +import { useCacheStore } from "@/store/cache.store" |
| 11 | +const cacheStore = useCacheStore() |
| 12 | +
|
| 13 | +const emit = defineEmits(["onClose"]) |
| 14 | +const props = defineProps({ |
| 15 | + show: Boolean, |
| 16 | +}) |
| 17 | +
|
| 18 | +const token = computed(() => cacheStore.current.hyperlaneToken) |
| 19 | +
|
| 20 | +const handleNavigate = (target) => { |
| 21 | + emit("onClose") |
| 22 | + navigateTo(target) |
| 23 | +} |
| 24 | +</script> |
| 25 | + |
| 26 | +<template> |
| 27 | + <Modal :show="show" @onClose="emit('onClose')" width="500" disable-trap> |
| 28 | + <Flex align="center" direction="column" gap="16"> |
| 29 | + <Flex wide align="center" gap="6"> |
| 30 | + <Icon name="hyperlane" size="14" color="primary" /> |
| 31 | + <Text size="14" weight="600" color="primary">Hyperlane Token</Text> |
| 32 | + </Flex> |
| 33 | + |
| 34 | + <Flex wide gap="16"> |
| 35 | + <Flex wide direction="column" gap="8" :class="[$style.card]"> |
| 36 | + <Flex align="center" gap="4"> |
| 37 | + <Icon name="arrow-narrow-up-right-circle" size="12" color="purple" /> |
| 38 | + <Text size="12" weight="600" color="secondary">Sent</Text> |
| 39 | + </Flex> |
| 40 | + |
| 41 | + <Text size="13" weight="600" color="primary" mono> |
| 42 | + {{ comma(token.sent / 1_000_000) }} <Text color="tertiary">TIA</Text> |
| 43 | + </Text> |
| 44 | + |
| 45 | + <Text size="12" weight="600" color="tertiary" mono> {{ token.sent_transfers }} transfers </Text> |
| 46 | + </Flex> |
| 47 | + |
| 48 | + <Flex wide direction="column" gap="8" :class="[$style.card]"> |
| 49 | + <Flex align="center" gap="4"> |
| 50 | + <Icon name="arrow-narrow-up-right-circle" size="12" color="brand" style="transform: scale(1, -1)" /> |
| 51 | + <Text size="12" weight="600" color="secondary">Received</Text> |
| 52 | + </Flex> |
| 53 | + |
| 54 | + <Text size="13" weight="600" color="primary" mono> |
| 55 | + {{ comma(token.received / 1_000_000) }} <Text color="tertiary">TIA</Text> |
| 56 | + </Text> |
| 57 | + |
| 58 | + <Text size="12" weight="600" color="tertiary" mono> {{ token.received_transfers }} transfers </Text> |
| 59 | + </Flex> |
| 60 | + </Flex> |
| 61 | + |
| 62 | + <Flex wide justify="between" align="center" :class="[$style.card]"> |
| 63 | + <Flex direction="column" gap="8"> |
| 64 | + <Text size="12" weight="600" color="secondary">Owner</Text> |
| 65 | + |
| 66 | + <Flex align="center" gap="8"> |
| 67 | + <Text size="13" weight="600" color="primary" mono :class="['overflow_ellipsis', $style.address_text]"> |
| 68 | + {{ token.owner.hash }} |
| 69 | + </Text> |
| 70 | + <CopyButton :text="token.owner.hash" /> |
| 71 | + </Flex> |
| 72 | + </Flex> |
| 73 | + </Flex> |
| 74 | + |
| 75 | + <Flex wide direction="column" gap="16" :class="$style.card"> |
| 76 | + <Text size="12" weight="600" color="secondary">Details</Text> |
| 77 | + |
| 78 | + <Flex align="center" justify="between"> |
| 79 | + <Text size="12" weight="600" color="tertiary">Type</Text> |
| 80 | + |
| 81 | + <Text size="12" weight="600" color="primary" style="text-transform: capitalize"> |
| 82 | + {{ token.type }} |
| 83 | + </Text> |
| 84 | + </Flex> |
| 85 | + |
| 86 | + <Flex align="center" justify="between"> |
| 87 | + <Text size="12" weight="600" color="tertiary">ID</Text> |
| 88 | + |
| 89 | + <Flex align="center" gap="6"> |
| 90 | + <Text size="12" weight="600" color="primary" mono> |
| 91 | + {{ token.token_id.slice(0, 4).toUpperCase() }} |
| 92 | + </Text> |
| 93 | + |
| 94 | + <Flex align="center" gap="3"> |
| 95 | + <div v-for="dot in 3" class="dot" /> |
| 96 | + </Flex> |
| 97 | + |
| 98 | + <Text size="12" weight="600" color="primary" mono> |
| 99 | + {{ token.token_id.slice(-4).toUpperCase() }} |
| 100 | + </Text> |
| 101 | + |
| 102 | + <CopyButton :text="token.token_id" size="12" /> |
| 103 | + </Flex> |
| 104 | + </Flex> |
| 105 | + |
| 106 | + <Flex align="center" justify="between"> |
| 107 | + <Text size="12" weight="600" color="tertiary">Height</Text> |
| 108 | + |
| 109 | + <Text @click="handleNavigate(`/block/${token.height}`)" size="12" weight="600" color="primary" mono class="clickable"> |
| 110 | + {{ comma(token.height) }} |
| 111 | + </Text> |
| 112 | + </Flex> |
| 113 | + |
| 114 | + <Flex align="center" justify="between"> |
| 115 | + <Text size="12" weight="600" color="tertiary">Tx Hash</Text> |
| 116 | + |
| 117 | + <Flex @click="handleNavigate(`/tx/${transfer.tx_hash}`)" align="center" gap="6" class="clickable"> |
| 118 | + <Text size="12" weight="600" color="primary" mono> |
| 119 | + {{ token.tx_hash.slice(0, 4).toUpperCase() }} |
| 120 | + </Text> |
| 121 | + |
| 122 | + <Flex align="center" gap="3"> |
| 123 | + <div v-for="dot in 3" class="dot" /> |
| 124 | + </Flex> |
| 125 | + |
| 126 | + <Text size="12" weight="600" color="primary" mono> |
| 127 | + {{ token.tx_hash.slice(-4).toUpperCase() }} |
| 128 | + </Text> |
| 129 | + |
| 130 | + <CopyButton :text="token.tx_hash" size="12" /> |
| 131 | + </Flex> |
| 132 | + </Flex> |
| 133 | + |
| 134 | + <Flex align="center" justify="between"> |
| 135 | + <Text size="12" weight="600" color="tertiary">Mailbox</Text> |
| 136 | + |
| 137 | + <Flex align="center" gap="6"> |
| 138 | + <Text size="12" weight="600" color="primary" mono> |
| 139 | + {{ token.mailbox.slice(0, 4).toUpperCase() }} |
| 140 | + </Text> |
| 141 | + <Flex align="center" gap="3"> |
| 142 | + <div v-for="dot in 3" class="dot" /> |
| 143 | + </Flex> |
| 144 | + <Text size="12" weight="600" color="primary" mono> |
| 145 | + {{ token.mailbox.slice(-4).toUpperCase() }} |
| 146 | + </Text> |
| 147 | + <CopyButton :text="token.mailbox" size="12" /> |
| 148 | + </Flex> |
| 149 | + </Flex> |
| 150 | + </Flex> |
| 151 | + |
| 152 | + <Button @click="emit('onClose')" wide type="tertiary" size="small">Close</Button> |
| 153 | + </Flex> |
| 154 | + </Modal> |
| 155 | +</template> |
| 156 | + |
| 157 | +<style module> |
| 158 | +.card { |
| 159 | + border-radius: 8px; |
| 160 | + background: var(--op-5); |
| 161 | +
|
| 162 | + padding: 8px 12px 8px 8px; |
| 163 | +} |
| 164 | +
|
| 165 | +.address_text { |
| 166 | + flex: 1; |
| 167 | +} |
| 168 | +
|
| 169 | +.receipient_icon { |
| 170 | + border-radius: 50px; |
| 171 | + border: 2px solid var(--op-5); |
| 172 | + box-sizing: content-box; |
| 173 | +
|
| 174 | + padding: 2px; |
| 175 | +} |
| 176 | +</style> |
0 commit comments