Skip to content

Commit 6d5cffd

Browse files
committed
fix(txs): copy button
1 parent f1bf69f commit 6d5cffd

File tree

3 files changed

+29
-48
lines changed

3 files changed

+29
-48
lines changed

components/CopyButton.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const handleCopy = (target) => {
3535
@click.stop="handleCopy(text)"
3636
:name="!isCopied ? 'copy' : 'check'"
3737
size="12"
38-
:color="!isCopied ? 'secondary' : 'green'"
38+
:color="!isCopied ? 'tertiary' : 'green'"
3939
class="copyable"
4040
/>
4141
</template>

pages/namespaces.vue

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ import { space, formatBytes, comma, getNamespaceID } from "@/services/utils"
99
/** API */
1010
import { fetchNamespaces, fetchNamespacesCount } from "@/services/api/namespace"
1111
12-
/** Store */
13-
import { useNotificationsStore } from "@/store/notifications"
14-
const notificationsStore = useNotificationsStore()
15-
1612
useHead({
1713
title: "All Namespaces - Celestia Explorer",
1814
link: [
@@ -110,19 +106,6 @@ const handlePrev = () => {
110106
111107
page.value -= 1
112108
}
113-
114-
const handleCopy = (target) => {
115-
window.navigator.clipboard.writeText(target)
116-
117-
notificationsStore.create({
118-
notification: {
119-
type: "info",
120-
icon: "check",
121-
title: "Successfully copied to clipboard",
122-
autoDestroy: true,
123-
},
124-
})
125-
}
126109
</script>
127110

128111
<template>

pages/txs.vue

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ import { fetchTransactions } from "@/services/api/tx"
1717
1818
/** Store */
1919
import { useAppStore } from "@/store/app"
20-
import { useNotificationsStore } from "@/store/notifications"
2120
const appStore = useAppStore()
22-
const notificationsStore = useNotificationsStore()
2321
2422
useHead({
2523
title: "All Transactions - Celestia Explorer",
@@ -123,19 +121,6 @@ const handlePrev = () => {
123121
124122
page.value -= 1
125123
}
126-
127-
const handleCopy = (target) => {
128-
window.navigator.clipboard.writeText(target)
129-
130-
notificationsStore.create({
131-
notification: {
132-
type: "info",
133-
icon: "check",
134-
title: "Successfully copied to clipboard",
135-
autoDestroy: true,
136-
},
137-
})
138-
}
139124
</script>
140125

141126
<template>
@@ -194,24 +179,37 @@ const handleCopy = (target) => {
194179
>
195180
<td style="width: 1px">
196181
<Tooltip :disabled="!tx.hash" position="start">
197-
<Flex @click.stop="handleCopy(tx.hash)" class="copyable" align="center" gap="8">
198-
<Icon :name="tx.status === 'success' ? 'tx_success' : 'tx_error'" size="14" color="secondary" />
199-
200-
<template v-if="tx.hash">
201-
<Text size="13" weight="600" color="primary">{{ tx.hash.slice(0, 4).toUpperCase() }}</Text>
202-
203-
<Flex align="center" gap="3">
204-
<div v-for="dot in 3" class="dot" />
182+
<template v-if="tx.hash">
183+
<Flex align="center" gap="10">
184+
<Flex align="center" gap="6">
185+
<Icon
186+
:name="tx.status === 'success' ? 'tx_success' : 'tx_error'"
187+
size="14"
188+
color="secondary"
189+
/>
190+
191+
<Text size="13" weight="600" color="primary">{{
192+
tx.hash.slice(0, 4).toUpperCase()
193+
}}</Text>
194+
195+
<Flex align="center" gap="3">
196+
<div v-for="dot in 3" class="dot" />
197+
</Flex>
198+
199+
<Text size="13" weight="600" color="primary">
200+
{{ tx.hash.slice(tx.hash.length - 4, tx.hash.length).toUpperCase() }}
201+
</Text>
205202
</Flex>
206203

207-
<Text size="13" weight="600" color="primary">
208-
{{ tx.hash.slice(tx.hash.length - 4, tx.hash.length).toUpperCase() }}
209-
</Text>
210-
</template>
211-
<template v-else>
204+
<CopyButton :text="tx.hash" />
205+
</Flex>
206+
</template>
207+
<template v-else>
208+
<Flex align="center" gap="8">
209+
<Icon name="tx" size="14" color="secondary" />
212210
<Text size="13" weight="600" color="primary">Genesis</Text>
213-
</template>
214-
</Flex>
211+
</Flex>
212+
</template>
215213

216214
<template #content>
217215
{{ space(tx.hash).toUpperCase() }}

0 commit comments

Comments
 (0)