|
| 1 | +<script setup> |
| 2 | +/** Vendor */ |
| 3 | +import { DateTime } from "luxon" |
| 4 | +
|
| 5 | +/** UI */ |
| 6 | +import Tooltip from "@/components/ui/Tooltip.vue" |
| 7 | +
|
| 8 | +/** Components */ |
| 9 | +import LinkToEntity from "@/components/shared/LinkToEntity.vue" |
| 10 | +
|
| 11 | +/** Services */ |
| 12 | +import { capitalize, formatBytes, midHash, spaces } from "@/services/utils" |
| 13 | +import { getRollupHashSafeURL } from "~/services/utils/rollups" |
| 14 | +
|
| 15 | +/** API */ |
| 16 | +import { fetchTxByHash } from "~/services/api/tx" |
| 17 | +
|
| 18 | +/** Store */ |
| 19 | +import { useSidebarsStore } from "@/store/sidebars" |
| 20 | +const sidebarsStore = useSidebarsStore() |
| 21 | +
|
| 22 | +const props = defineProps({ |
| 23 | + deposits: { |
| 24 | + type: Array, |
| 25 | + }, |
| 26 | +}) |
| 27 | +
|
| 28 | +const handleOpenTx = async (deposit) => { |
| 29 | + const { data } = await fetchTxByHash(deposit.tx_hash) |
| 30 | + if (data.value) { |
| 31 | + sidebarsStore.open("tx", data.value) |
| 32 | + } |
| 33 | +} |
| 34 | +</script> |
| 35 | + |
| 36 | +<template> |
| 37 | + <Flex direction="column" :class="$style.wrapper"> |
| 38 | + <Flex |
| 39 | + v-if="deposits" |
| 40 | + v-for="d in deposits" |
| 41 | + @click="handleOpenTx(d)" |
| 42 | + justify="between" |
| 43 | + align="center" |
| 44 | + :class="[$style.row, isLoading && $style.disabled]" |
| 45 | + > |
| 46 | + <Flex direction="column" gap="8"> |
| 47 | + <Flex align="center" gap="6"> |
| 48 | + <Icon name="role" size="16" color="secondary" /> |
| 49 | + |
| 50 | + <Flex v-if="d.bridge" gap="4"> |
| 51 | + <Text size="13" weight="500" color="primary"> |
| 52 | + {{ `Wired deposit of ${spaces(d.amount)} ${(d.asset).toUpperCase()} to` }} |
| 53 | + </Text> |
| 54 | + |
| 55 | + <LinkToEntity |
| 56 | + :entity="{ title: midHash(d.bridge), type: 'account', id: d.bridge }" |
| 57 | + color="primary" |
| 58 | + size="13" |
| 59 | + :class="$style.link" |
| 60 | + /> |
| 61 | + </Flex> |
| 62 | + |
| 63 | + <Text v-else size="13" weight="500" color="primary"> |
| 64 | + {{ `Received deposit of ${spaces(d.amount)} ${(d.asset).toUpperCase()}` }} |
| 65 | + </Text> |
| 66 | + </Flex> |
| 67 | + |
| 68 | + <Flex align="center" gap="8"> |
| 69 | + <Text size="12" color="tertiary">Block</Text> |
| 70 | + |
| 71 | + <LinkToEntity :entity="{ title: spaces(d.height), type: 'block', id: d.height }" color="secondary" :class="$style.link" /> |
| 72 | + |
| 73 | + <div :class="$style.dot" /> |
| 74 | + |
| 75 | + <Text size="12" color="tertiary"> {{ DateTime.fromISO(d.time).setLocale("en").toFormat("tt, LLL d, y") }} </Text> |
| 76 | + </Flex> |
| 77 | + </Flex> |
| 78 | + |
| 79 | + <Tooltip> |
| 80 | + <!-- <Flex align="center" gap="4"> |
| 81 | + <Text size="13" weight="600" color="primary"> {{ spaces(rollup.actions_count) }} </Text> |
| 82 | + |
| 83 | + <Icon name="action" size="13" color="tertiary" /> |
| 84 | + </Flex> |
| 85 | +
|
| 86 | + <template #content> |
| 87 | + <Text size="12" color="tertiary">Actions count</Text> |
| 88 | + </template> --> |
| 89 | + </Tooltip> |
| 90 | + </Flex> |
| 91 | + </Flex> |
| 92 | +</template> |
| 93 | + |
| 94 | +<style module> |
| 95 | +.wrapper { |
| 96 | + position: relative; |
| 97 | +} |
| 98 | +
|
| 99 | +.loading { |
| 100 | + position: absolute; |
| 101 | + top: 50%; |
| 102 | + left: 50%; |
| 103 | + transform: translateY(-50%) translateX(-50%); |
| 104 | +} |
| 105 | +
|
| 106 | +.row { |
| 107 | + height: 60px; |
| 108 | +
|
| 109 | + border-top: 1px solid var(--op-5); |
| 110 | +
|
| 111 | + cursor: pointer; |
| 112 | +
|
| 113 | + padding: 0 16px; |
| 114 | +
|
| 115 | + transition: all 0.2s ease; |
| 116 | +
|
| 117 | + &:hover { |
| 118 | + background: var(--op-5); |
| 119 | + } |
| 120 | +
|
| 121 | + &:first-child { |
| 122 | + border-top-left-radius: 8px; |
| 123 | + border-top-right-radius: 8px; |
| 124 | + border-top: none; |
| 125 | + } |
| 126 | +
|
| 127 | + &:last-child { |
| 128 | + border-bottom-left-radius: 8px; |
| 129 | + border-bottom-right-radius: 8px; |
| 130 | + } |
| 131 | +
|
| 132 | + &:active { |
| 133 | + background: var(--op-10); |
| 134 | + } |
| 135 | +
|
| 136 | + &.disabled { |
| 137 | + pointer-events: none; |
| 138 | + opacity: 0.2; |
| 139 | + } |
| 140 | +} |
| 141 | +
|
| 142 | +.row_general_list { |
| 143 | + height: 60px; |
| 144 | +
|
| 145 | + border-top: 1px solid var(--op-5); |
| 146 | +
|
| 147 | + cursor: pointer; |
| 148 | +
|
| 149 | + padding: 0 16px; |
| 150 | +
|
| 151 | + transition: all 0.2s ease; |
| 152 | +
|
| 153 | + &:hover { |
| 154 | + background: var(--op-5); |
| 155 | + } |
| 156 | + |
| 157 | + &:last-child { |
| 158 | + border-bottom-left-radius: 8px; |
| 159 | + border-bottom-right-radius: 8px; |
| 160 | + } |
| 161 | +
|
| 162 | + &:active { |
| 163 | + background: var(--op-10); |
| 164 | + } |
| 165 | +
|
| 166 | + &.disabled { |
| 167 | + pointer-events: none; |
| 168 | + opacity: 0.2; |
| 169 | + } |
| 170 | +} |
| 171 | +
|
| 172 | +.dot { |
| 173 | + width: 4px; |
| 174 | + height: 4px; |
| 175 | +
|
| 176 | + border-radius: 50%; |
| 177 | + background: var(--op-10); |
| 178 | +} |
| 179 | +
|
| 180 | +.link { |
| 181 | + overflow: hidden; |
| 182 | + text-overflow: ellipsis; |
| 183 | + white-space: nowrap; |
| 184 | +} |
| 185 | +</style> |
0 commit comments