@@ -11,6 +11,10 @@ import Tooltip from "@/components/ui/Tooltip.vue"
1111/** API */
1212import { fetchMainnetConstants , fetchMochaConstants , fetchArabicaConstants , fetchMammothConstants } from " @/services/api/main"
1313
14+ /** Store */
15+ import { useNotificationsStore } from " @/store/notifications"
16+ const notificationsStore = useNotificationsStore ()
17+
1418useHead ({
1519 title: " Celestia Constants - Celenium" ,
1620 link: [
@@ -150,6 +154,19 @@ const DescriptionMap = {
150154 evidence_max_bytes: " Maximum size in bytes used by evidence in a given block" ,
151155 validator_pub_key_types: " The type of public key used by validators" ,
152156}
157+
158+ const handleCopy = (text ) => {
159+ window .navigator .clipboard .writeText (text)
160+
161+ notificationsStore .create ({
162+ notification: {
163+ type: " info" ,
164+ icon: " check" ,
165+ title: " Successfully copied to clipboard" ,
166+ autoDestroy: true ,
167+ },
168+ })
169+ }
153170 </script >
154171
155172<template >
@@ -235,7 +252,11 @@ const DescriptionMap = {
235252 </Tooltip >
236253 </Flex >
237254 </td >
238- <td v-for =" network in networks" >
255+ <td
256+ v-for =" network in networks"
257+ @click =" constants[network].module[module] && handleCopy(constants[network].module[module][constant])"
258+ :copyable =" !!constants[network].module[module]"
259+ >
239260 <template v-if =" constants [network ].module [module ]" >
240261 <Flex align =" center" justify =" between" >
241262 <Flex v-if =" constantsToFormat.includes(constant)" direction =" column" gap =" 6" >
@@ -262,7 +283,7 @@ const DescriptionMap = {
262283 </template >
263284 </Tooltip >
264285
265- <CopyButton :text = " constants[network].module[module][constant] " :class =" $style.copy_button" />
286+ <Icon name = " copy " size = " 12 " color = " tertiary " :class =" $style.copy_button" />
266287 </Flex >
267288 </template >
268289 <template v-else >
@@ -311,8 +332,6 @@ const DescriptionMap = {
311332 }
312333
313334 & td {
314- /* height: 40px; */
315-
316335 border-bottom : 1px solid var (--outline-background );
317336
318337 padding : 12px ;
@@ -331,9 +350,17 @@ const DescriptionMap = {
331350 }
332351 }
333352
334- &:hover {
335- .copy _button {
336- opacity : 1 ;
353+ &[copyable = " true" ] {
354+ cursor : copy ;
355+
356+ transition : background 0.2s ease ;
357+
358+ &:hover {
359+ background : var (--app-background );
360+
361+ .copy _button {
362+ opacity : 1 ;
363+ }
337364 }
338365 }
339366 }
0 commit comments