Skip to content

Commit 32d9020

Browse files
authored
Merge pull request #62 from celenium-io/cls-sprint-16
2 parents b1d81e2 + c1f03dc commit 32d9020

36 files changed

+626
-517
lines changed

assets/icons.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"unselect": "M13 2C13 1.44772 12.5523 1 12 1C11.4477 1 11 1.44772 11 2V3.05493C6.82838 3.51608 3.51608 6.82838 3.05493 11H2C1.44772 11 1 11.4477 1 12C1 12.5523 1.44772 13 2 13H3.05493C3.51608 17.1716 6.82838 20.4839 11 20.9451V22C11 22.5523 11.4477 23 12 23C12.5523 23 13 22.5523 13 22V20.9451C17.1716 20.4839 20.4839 17.1716 20.9451 13H22C22.5523 13 23 12.5523 23 12C23 11.4477 22.5523 11 22 11H20.9451C20.4839 6.82838 17.1716 3.51608 13 3.05493V2ZM7 12C7 9.23858 9.23858 7 12 7C14.7614 7 17 9.23858 17 12C17 14.7614 14.7614 17 12 17C9.23858 17 7 14.7614 7 12Z",
2323
"download": "M12 2C12.5523 2 13 2.44772 13 3V12.5858L16.2929 9.29289C16.6834 8.90237 17.3166 8.90237 17.7071 9.29289C18.0976 9.68342 18.0976 10.3166 17.7071 10.7071L12.7071 15.7071C12.3166 16.0976 11.6834 16.0976 11.2929 15.7071L6.29289 10.7071C5.90237 10.3166 5.90237 9.68342 6.29289 9.29289C6.68342 8.90237 7.31658 8.90237 7.70711 9.29289L11 12.5858V3C11 2.44772 11.4477 2 12 2ZM4 15C4 14.4477 3.55229 14 3 14C2.44772 14 2 14.4477 2 15V16.2413V16.2414C1.99999 17.0464 1.99998 17.7106 2.04419 18.2518C2.09012 18.8139 2.18868 19.3306 2.43598 19.816C2.81947 20.5686 3.43139 21.1805 4.18404 21.564C4.66937 21.8113 5.18608 21.9099 5.74818 21.9558C6.28937 22 6.95373 22 7.7587 22H16.2413C17.0463 22 17.7106 22 18.2518 21.9558C18.8139 21.9099 19.3306 21.8113 19.816 21.564C20.5686 21.1805 21.1805 20.5686 21.564 19.816C21.8113 19.3306 21.9099 18.8139 21.9558 18.2518C22 17.7106 22 17.0463 22 16.2413V15C22 14.4477 21.5523 14 21 14C20.4477 14 20 14.4477 20 15V16.2C20 17.0566 19.9992 17.6389 19.9624 18.089C19.9266 18.5274 19.8617 18.7516 19.782 18.908C19.5903 19.2843 19.2843 19.5903 18.908 19.782C18.7516 19.8617 18.5274 19.9266 18.089 19.9624C17.6389 19.9992 17.0566 20 16.2 20H7.8C6.94342 20 6.36113 19.9992 5.91104 19.9624C5.47262 19.9266 5.24842 19.8617 5.09202 19.782C4.7157 19.5903 4.40973 19.2843 4.21799 18.908C4.1383 18.7516 4.07337 18.5274 4.03755 18.089C4.00078 17.6389 4 17.0566 4 16.2V15Z",
2424
"upload": "M12.7071 2.29289C12.3166 1.90237 11.6834 1.90237 11.2929 2.29289L6.29289 7.29289C5.90237 7.68342 5.90237 8.31658 6.29289 8.70711C6.68342 9.09763 7.31658 9.09763 7.70711 8.70711L11 5.41421V15C11 15.5523 11.4477 16 12 16C12.5523 16 13 15.5523 13 15V5.41421L16.2929 8.70711C16.6834 9.09763 17.3166 9.09763 17.7071 8.70711C18.0976 8.31658 18.0976 7.68342 17.7071 7.29289L12.7071 2.29289ZM4 15C4 14.4477 3.55229 14 3 14C2.44772 14 2 14.4477 2 15V16.2413V16.2414C1.99999 17.0464 1.99998 17.7106 2.04419 18.2518C2.09012 18.8139 2.18868 19.3306 2.43598 19.816C2.81947 20.5686 3.43139 21.1805 4.18404 21.564C4.66937 21.8113 5.18608 21.9099 5.74818 21.9558C6.28937 22 6.95373 22 7.7587 22H16.2413C17.0463 22 17.7106 22 18.2518 21.9558C18.8139 21.9099 19.3306 21.8113 19.816 21.564C20.5686 21.1805 21.1805 20.5686 21.564 19.816C21.8113 19.3306 21.9099 18.8139 21.9558 18.2518C22 17.7106 22 17.0463 22 16.2413V15C22 14.4477 21.5523 14 21 14C20.4477 14 20 14.4477 20 15V16.2C20 17.0566 19.9992 17.6389 19.9624 18.089C19.9266 18.5274 19.8617 18.7516 19.782 18.908C19.5903 19.2843 19.2843 19.5903 18.908 19.782C18.7516 19.8617 18.5274 19.9266 18.089 19.9624C17.6389 19.9992 17.0566 20 16.2 20H7.8C6.94342 20 6.36113 19.9992 5.91104 19.9624C5.47262 19.9266 5.24842 19.8617 5.09202 19.782C4.7157 19.5903 4.40973 19.2843 4.21799 18.908C4.1383 18.7516 4.07337 18.5274 4.03755 18.089C4.00078 17.6389 4 17.0566 4 16.2V15Z",
25+
"bookmark": "M9.7587 2H14.2413C15.0463 1.99999 15.7106 1.99998 16.2518 2.04419C16.8139 2.09012 17.3306 2.18868 17.816 2.43597C18.5686 2.81947 19.1805 3.43139 19.564 4.18404C19.8113 4.66937 19.9099 5.18608 19.9558 5.74817C20 6.28938 20 6.95374 20 7.75873V21C20 21.3565 19.8102 21.686 19.5019 21.8649C19.1936 22.0438 18.8134 22.0451 18.5039 21.8682L12 18.1518L5.49614 21.8682C5.18664 22.0451 4.80639 22.0438 4.49807 21.8649C4.18976 21.686 4 21.3565 4 21V7.7587C3.99999 6.95373 3.99998 6.28937 4.04419 5.74817C4.09012 5.18608 4.18868 4.66937 4.43597 4.18404C4.81947 3.43139 5.43139 2.81947 6.18404 2.43597C6.66937 2.18868 7.18608 2.09012 7.74817 2.04419C8.28937 1.99998 8.95373 1.99999 9.7587 2Z",
2526
"bookmark-plus": "M14.2413 2H9.7587C8.95374 1.99999 8.28937 1.99998 7.74818 2.04419C7.18608 2.09012 6.66937 2.18868 6.18404 2.43598C5.43139 2.81947 4.81947 3.43139 4.43598 4.18404C4.18868 4.66937 4.09012 5.18608 4.04419 5.74818C3.99998 6.28937 3.99999 6.95372 4 7.75869V21C4 21.3565 4.18976 21.686 4.49807 21.8649C4.80639 22.0438 5.18664 22.0451 5.49614 21.8682L12 18.1518L18.5039 21.8682C18.8134 22.0451 19.1936 22.0438 19.5019 21.8649C19.8102 21.686 20 21.3565 20 21V7.75873C20 6.95376 20 6.28937 19.9558 5.74818C19.9099 5.18608 19.8113 4.66937 19.564 4.18404C19.1805 3.43139 18.5686 2.81947 17.816 2.43598C17.3306 2.18868 16.8139 2.09012 16.2518 2.04419C15.7106 1.99998 15.0463 1.99999 14.2413 2ZM12 6C12.5523 6 13 6.44772 13 7V9H15C15.5523 9 16 9.44772 16 10C16 10.5523 15.5523 11 15 11H13V13C13 13.5523 12.5523 14 12 14C11.4477 14 11 13.5523 11 13V11H9C8.44772 11 8 10.5523 8 10C8 9.44772 8.44772 9 9 9H11V7C11 6.44772 11.4477 6 12 6Z",
2627
"bookmark-check": "M 14.242 2 C 15.046 2 15.71 2 16.252 2.044 C 16.814 2.09 17.331 2.189 17.816 2.436 C 18.569 2.819 19.181 3.431 19.564 4.184 C 19.811 4.669 19.91 5.186 19.956 5.749 C 20 6.289 20 6.954 20 7.759 L 20 21 C 20 21.356 19.81 21.686 19.502 21.865 C 19.194 22.043 18.813 22.045 18.504 21.868 L 12 18.152 L 5.496 21.868 C 5.187 22.045 4.806 22.043 4.498 21.865 C 4.19 21.686 4 21.356 4 21 L 4 7.758 C 4 6.954 4 6.29 4.045 5.748 C 4.091 5.186 4.19 4.669 4.437 4.184 C 4.82 3.431 5.432 2.819 6.185 2.436 C 6.67 2.189 7.187 2.09 7.75 2.044 C 8.29 2 8.955 2 9.76 2 Z M 16.207 8.707 C 16.586 8.315 16.581 7.691 16.195 7.305 C 15.809 6.919 15.185 6.914 14.793 7.293 L 11 11.086 L 9.707 9.793 C 9.315 9.414 8.691 9.419 8.305 9.805 C 7.919 10.191 7.914 10.815 8.293 11.207 L 10.293 13.207 C 10.683 13.597 11.317 13.597 11.707 13.207 Z",
2728
"bookmark-x": "M14.2413 2H9.7587C8.95374 1.99999 8.28937 1.99998 7.74818 2.04419C7.18608 2.09012 6.66937 2.18868 6.18404 2.43598C5.43139 2.81947 4.81947 3.43139 4.43598 4.18404C4.18868 4.66937 4.09012 5.18608 4.04419 5.74818C3.99998 6.28937 3.99999 6.95372 4 7.75869V21C4 21.3565 4.18976 21.686 4.49807 21.8649C4.80639 22.0438 5.18664 22.0451 5.49614 21.8682L12 18.1518L18.5039 21.8682C18.8134 22.0451 19.1936 22.0438 19.5019 21.8649C19.8102 21.686 20 21.3565 20 21V7.75873C20 6.95376 20 6.28937 19.9558 5.74818C19.9099 5.18608 19.8113 4.66937 19.564 4.18404C19.1805 3.43139 18.5686 2.81947 17.816 2.43598C17.3306 2.18868 16.8139 2.09012 16.2518 2.04419C15.7106 1.99998 15.0463 1.99999 14.2413 2ZM8.79289 6.79289C9.18342 6.40237 9.81658 6.40237 10.2071 6.79289L12 8.58579L13.7929 6.79289C14.1834 6.40237 14.8166 6.40237 15.2071 6.79289C15.5976 7.18342 15.5976 7.81658 15.2071 8.20711L13.4142 10L15.2071 11.7929C15.5976 12.1834 15.5976 12.8166 15.2071 13.2071C14.8166 13.5976 14.1834 13.5976 13.7929 13.2071L12 11.4142L10.2071 13.2071C9.81658 13.5976 9.18342 13.5976 8.79289 13.2071C8.40237 12.8166 8.40237 12.1834 8.79289 11.7929L10.5858 10L8.79289 8.20711C8.40237 7.81658 8.40237 7.18342 8.79289 6.79289Z",

assets/styles/base.scss

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ body {
245245
-webkit-font-smoothing: antialiased;
246246
-moz-osx-font-smoothing: grayscale;
247247

248-
user-select: none;
248+
user-select: text;
249249
}
250250

251251
*::-webkit-scrollbar {
@@ -338,3 +338,17 @@ body {
338338
.slide-leave-to {
339339
transform: translateY(-25px);
340340
}
341+
342+
.table_column_alias {
343+
max-width: 125px;
344+
345+
white-space: nowrap;
346+
overflow: hidden;
347+
text-overflow: ellipsis;
348+
}
349+
350+
.overflow_ellipsis {
351+
white-space: nowrap;
352+
overflow: hidden;
353+
text-overflow: ellipsis;
354+
}

components/AddressBadge.vue

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,26 @@
11
<script setup>
2-
defineProps({
2+
const props = defineProps({
33
hash: {
44
type: String,
55
required: true,
66
},
77
color: {
88
type: String,
99
default: "primary"
10-
}
10+
},
11+
})
12+
13+
const alias = computed(() => {
14+
const { $getDisplayName } = useNuxtApp()
15+
16+
return $getDisplayName('addresses', props.hash)
1117
})
1218
</script>
1319

1420
<template>
1521
<NuxtLink :to="`/address/${hash}`" @click.stop>
1622
<Flex align="center" gap="6">
17-
<template v-if="hash.startsWith('celestiavaloper')">
18-
<Text size="13" weight="600" :color="color"> celestiavaloper </Text>
19-
20-
<Flex align="center" gap="3">
21-
<div v-for="dot in 3" class="dot" />
22-
</Flex>
23-
24-
<Text size="13" weight="600" :color="color">
25-
{{ hash.slice(hash.length - 4, hash.length) }}
26-
</Text>
27-
</template>
28-
<template v-else-if="hash.startsWith('celestiavalcons')">
29-
<Text size="13" weight="600" :color="color"> celestiavalcons </Text>
30-
31-
<Flex align="center" gap="3">
32-
<div v-for="dot in 3" class="dot" />
33-
</Flex>
34-
35-
<Text size="13" weight="600" :color="color">
36-
{{ hash.slice(hash.length - 4, hash.length) }}
37-
</Text>
38-
</template>
39-
<template v-else>
40-
<Text size="13" weight="600" :color="color"> celestia </Text>
41-
42-
<Flex align="center" gap="3">
43-
<div v-for="dot in 3" class="dot" />
44-
</Flex>
45-
46-
<Text size="13" weight="600" :color="color">
47-
{{ hash.slice(hash.length - 4, hash.length) }}
48-
</Text>
49-
</template>
23+
<Text size="13" weight="600" :color="color"> {{ alias }} </Text>
5024
</Flex>
5125
</NuxtLink>
5226
</template>

components/BookmarkButton.vue

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
<script setup>
2+
/** UI */
3+
import Button from "@/components/ui/Button.vue"
4+
5+
/** Services */
6+
import { capitilize } from "~/services/utils"
7+
8+
/** Store */
9+
import { useBookmarksStore } from "@/store/bookmarks"
10+
import { useCacheStore } from "@/store/cache"
11+
import { useModalsStore } from "@/store/modals"
12+
import { useNotificationsStore } from "@/store/notifications"
13+
const bookmarksStore = useBookmarksStore()
14+
const cacheStore = useCacheStore()
15+
const modalsStore = useModalsStore()
16+
const notificationsStore = useNotificationsStore()
17+
18+
const props = defineProps({
19+
type: {
20+
type: String,
21+
required: true,
22+
},
23+
id: {
24+
type: [String, Number],
25+
required: true,
26+
},
27+
})
28+
29+
const router = useRouter()
30+
31+
const bookmark = ref(null)
32+
const isBookmarked = ref(false)
33+
const isButtonHovered = ref(false)
34+
const bookmarkText = computed(() => {
35+
if (isButtonHovered.value && isBookmarked.value) return "Remove"
36+
37+
return isBookmarked.value ? "Saved" : "Save"
38+
})
39+
40+
const handleBookmark = () => {
41+
if (!isBookmarked.value) {
42+
43+
let newBookmark = {
44+
id: props.id,
45+
type: capitilize(props.type),
46+
ts: new Date().getTime(),
47+
}
48+
49+
isBookmarked.value = bookmarksStore.addBookmark(newBookmark)
50+
51+
if (isBookmarked.value) {
52+
notificationsStore.create({
53+
notification: {
54+
type: "success",
55+
icon: "check",
56+
title: `${capitilize(props.type)} added to bookmarks`,
57+
description: "View all bookmarks on dedicated page",
58+
autoDestroy: true,
59+
actions: [
60+
{
61+
name: "Open Bookmarks",
62+
callback: () => {
63+
router.push("/bookmarks")
64+
},
65+
},
66+
],
67+
},
68+
})
69+
70+
cacheStore.current.bookmark = newBookmark
71+
modalsStore.open("edit_alias")
72+
}
73+
74+
} else {
75+
let notification = {}
76+
77+
if (bookmarksStore.removeBookmark(props.type, props.id)) {
78+
notification = {
79+
type: "success",
80+
icon: "check",
81+
title: `${capitilize(props.type)} removed from bookmarks`,
82+
autoDestroy: true,
83+
}
84+
85+
isBookmarked.value = false
86+
} else {
87+
notification = {
88+
type: "error",
89+
icon: "close",
90+
title: `Failed to remove the bookmark`,
91+
autoDestroy: true,
92+
}
93+
}
94+
95+
notificationsStore.create({
96+
notification: notification,
97+
})
98+
}
99+
}
100+
101+
onMounted(() => {
102+
isBookmarked.value = bookmarksStore.getBookmark(props.type, props.id) ? true : false
103+
})
104+
105+
</script>
106+
107+
<template>
108+
<Flex align="center" gap="8">
109+
<Button
110+
@click="handleBookmark"
111+
@mouseenter="isButtonHovered = true"
112+
@mouseleave="isButtonHovered = false"
113+
type="secondary"
114+
size="mini"
115+
>
116+
<Icon
117+
:name="isButtonHovered && isBookmarked ? 'close' : isBookmarked ? 'bookmark-check' : 'bookmark-plus'"
118+
size="12"
119+
:color="isBookmarked && !isButtonHovered ? 'green' : 'primary'"
120+
/>
121+
{{ bookmarkText }}
122+
</Button>
123+
</Flex>
124+
</template>
125+
126+
<style module>
127+
.items {
128+
overflow: hidden;
129+
}
130+
131+
.item {
132+
& a {
133+
display: flex;
134+
135+
&:hover {
136+
& span {
137+
color: var(--txt-primary);
138+
}
139+
}
140+
}
141+
}
142+
</style>

components/Connection.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,16 +149,16 @@ const handleDisconnect = () => {
149149
</Tooltip>
150150
151151
<Tooltip v-else-if="!isWalletAvailable" position="end">
152-
<Button type="white" size="small" disabled> Connect </Button>
152+
<Button type="white" size="mini" disabled> Connect </Button>
153153
154154
<template #content> Insall Keplr Wallet before connection </template>
155155
</Tooltip>
156156
157-
<Button v-else-if="!appStore.address" @click="handleConnect" type="white" size="small"> Connect </Button>
157+
<Button v-else-if="!appStore.address" @click="handleConnect" type="white" size="mini"> Connect </Button>
158158
159159
<Dropdown v-else>
160-
<Button type="secondary" size="small">
161-
<Icon name="address" size="14" color="primary" />
160+
<Button type="secondary" size="mini">
161+
<Icon name="address" size="13" color="primary" />
162162
{{ appStore.balance }} TIA
163163
</Button>
164164

components/TheHeader.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,20 @@ const handleNavigate = (url) => {
156156
</template>
157157
</Tooltip>
158158

159+
<Tooltip position="end" delay="250">
160+
<NuxtLink to="/bookmarks">
161+
<Button type="secondary" size="mini">
162+
<Icon name="bookmark" size="16" color="secondary" />
163+
</Button>
164+
</NuxtLink>
165+
166+
<template #content>
167+
<Flex align="center" gap="8">
168+
Open My Bookmarks
169+
</Flex>
170+
</template>
171+
</Tooltip>
172+
159173
<Connection :class="$style.connection_btn" />
160174
</Flex>
161175
</Flex>

components/cmd/CommandMenu.vue

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -922,35 +922,39 @@ const autocompleteGroup = computed(() => {
922922
})
923923
924924
const debouncedSearch = useDebounceFn(async (e) => {
925+
const bookmarks = bookmarksStore.searchBookmarks(searchTerm.value)
925926
const { data } = await search(searchTerm.value.trim())
927+
928+
data.value = [...bookmarks, ...data.value]
929+
926930
if (!data.value?.length) return
927931
928932
amp.log("showAutocomplete", { count: data.value.length, firstType: data.value[0].type })
929933
930934
autocompleteActions.value = []
931935
932-
for (let i = 0; i < Math.min(3, data.value.length); i++) {
936+
for (let i = 0; i < Math.min(5, data.value.length); i++) {
933937
let title
934938
let routerLink
935939
switch (data.value[i].type) {
936940
case "tx":
937-
title = data.value[i].result.hash
938-
routerLink = `/tx/${data.value[i].result.hash}`
941+
title = data.value[i].result.alias || data.value[i].result.hash
942+
routerLink = `/tx/${data.value[i].result.id || data.value[i].result.hash}`
939943
break
940944
941945
case "block":
942-
title = data.value[i].result.hash
943-
routerLink = `/block/${data.value[i].result.height}`
946+
title = data.value[i].result.alias || data.value[i].result.hash
947+
routerLink = `/block/${data.value[i].result.id || data.value[i].result.height}`
944948
break
945949
946950
case "namespace":
947-
title = data.value[i].result.hash
948-
routerLink = `/namespace/${data.value[i].result.namespace_id}`
951+
title = data.value[i].result.alias || data.value[i].result.hash
952+
routerLink = `/namespace/${data.value[i].result.id || data.value[i].result.namespace_id}`
949953
break
950954
951955
case "address":
952-
title = data.value[i].result.hash
953-
routerLink = `/address/${data.value[i].result.hash}`
956+
title = data.value[i].result.alias || data.value[i].result.hash
957+
routerLink = `/address/${data.value[i].result.id || data.value[i].result.hash}`
954958
break
955959
956960
case "rollup":
@@ -959,7 +963,7 @@ const debouncedSearch = useDebounceFn(async (e) => {
959963
break
960964
961965
case "validator":
962-
title = data.value[i].result.moniker ? data.value[i].result.moniker : data.value[i].result.address
966+
title = data.value[i].result.alias || data.value[i].result.moniker ? data.value[i].result.moniker : data.value[i].result.address
963967
routerLink = `/validator/${data.value[i].result.id}`
964968
break
965969
@@ -970,6 +974,7 @@ const debouncedSearch = useDebounceFn(async (e) => {
970974
autocompleteActions.value.push({
971975
id: id(),
972976
type: "callback",
977+
bookmark: data.value[i].bookmark,
973978
icon: data.value[i].type,
974979
title: title,
975980
subtitle: capitilize(data.value[i].type),

components/cmd/Item.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,13 @@ const props = defineProps({
2323
</Text>
2424
</Flex>
2525

26-
<Text v-if="action.subtitle" size="12" weight="600" color="tertiary">
27-
{{ action.subtitle }}
28-
</Text>
26+
<Flex align="center" gap="8">
27+
<Icon v-if="action.bookmark" name="bookmark-check" size="12" color="tertiary" />
28+
29+
<Text v-if="action.subtitle" size="12" weight="600" color="tertiary">
30+
{{ action.subtitle }}
31+
</Text>
32+
</Flex>
2933
</Flex>
3034
</template>
3135

components/data/BlocksTimeline/BlocksTimelineTable.vue

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -473,16 +473,8 @@ watch(
473473
<Flex align="center" gap="8">
474474
<Icon name="namespace" size="12" color="secondary" />
475475
476-
<Text size="13" weight="600" color="primary" mono>
477-
{{ getNamespaceID(ns.namespace_id).slice(0, 4) }}
478-
</Text>
479-
480-
<Flex align="center" gap="3">
481-
<div v-for="dot in 3" class="dot" />
482-
</Flex>
483-
484-
<Text size="13" weight="600" color="primary" mono>
485-
{{ getNamespaceID(ns.namespace_id).slice(-4) }}
476+
<Text size="13" weight="600" color="primary" mono class="overflow_ellipsis" style="max-width: 250px">
477+
{{ $getDisplayName('namespaces', ns.namespace_id) }}
486478
</Text>
487479
</Flex>
488480

0 commit comments

Comments
 (0)