Skip to content

Commit 6d0b210

Browse files
authored
Merge branch 'dev' into leap
2 parents 6b4c9bc + 3999acd commit 6d0b210

File tree

19 files changed

+445
-192
lines changed

19 files changed

+445
-192
lines changed

app.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@ import { useNodeStore } from "@/store/node"
1717
import { useAppStore } from "@/store/app"
1818
import { useBookmarksStore } from "@/store/bookmarks"
1919
import { useSettingsStore } from "@/store/settings"
20+
import { useEnumStore } from "@/store/enums"
2021
const nodeStore = useNodeStore()
2122
const appStore = useAppStore()
2223
const bookmarksStore = useBookmarksStore()
2324
const settingsStore = useSettingsStore()
25+
const enumStore = useEnumStore()
26+
2427
bookmarksStore.$subscribe((mutation, state) => {
2528
localStorage.setItem("bookmarks", JSON.stringify(state.bookmarks))
2629
})
@@ -52,6 +55,8 @@ onMounted(async () => {
5255
const gasPrice = await fetchGasPrice()
5356
appStore.gas = gasPrice
5457
58+
await enumStore.init()
59+
5560
window.onbeforeunload = function () {
5661
Socket.close()
5762
}

components/modals/ConnectModal.vue

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Tooltip from "@/components/ui/Tooltip.vue"
66
77
/** Utils */
88
import { connect, syncBalance, getAccounts, disconnect } from "~/services/wallet"
9-
import { getNetworkName } from "@/services/utils/general"
9+
import { getNetworkName, isMainnet } from "@/services/utils/general"
1010
import amp from "@/services/amp"
1111
1212
/** Store */
@@ -124,7 +124,7 @@ const handleConnect = async (target) => {
124124
</Tooltip>
125125

126126
<Tooltip wide>
127-
<Flex @click="handleConnect('leap')" wide align="center" justify="between" :class="$style.wallet">
127+
<Flex @click="handleConnect('leap')" wide align="center" justify="between" :class="[$style.wallet, !isMainnet() && $style.disabled]">
128128
<Flex align="center" gap="12">
129129
<img src="@/assets/logos/leap.png" />
130130
<Text size="14" weight="600" color="primary">Leap Wallet</Text>
@@ -139,9 +139,11 @@ const handleConnect = async (target) => {
139139

140140
<template #content>
141141
{{
142-
hasLeap
143-
? "Leap is found in your extensions and ready to connect."
144-
: "Leap is not found in your extensions, install it."
142+
!isMainnet()
143+
? "Temporarily unavailable for test networks."
144+
: hasLeap
145+
? "Leap is found in your extensions and ready to connect."
146+
: "Leap is not found in your extensions, install it."
145147
}}
146148
</template>
147149
</Tooltip>
@@ -225,6 +227,12 @@ const handleConnect = async (target) => {
225227
226228
transition: all 0.2s ease;
227229
230+
&.disabled {
231+
opacity: 0.5;
232+
cursor: default;
233+
pointer-events: none;
234+
}
235+
228236
&:hover {
229237
box-shadow: inset 0 0 0 1px var(--op-10);
230238
}

components/modals/SendModal.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ const selectedGasFee = ref(gasFeeItems.value[0].name)
8282
const handleAmountInput = (e) => {
8383
if (!amount.value.length) amount.value = ""
8484
85-
const normalizedAmount = normalizeAmount(amount.value, 5, appStore.balance.toString())
85+
const normalizedAmount = normalizeAmount(amount.value, appStore.balance, appStore.balance.toString())
8686
if (typeof normalizedAmount === "string") {
8787
amount.value = normalizedAmount
8888
return
@@ -215,6 +215,7 @@ watch(
215215
216216
nextTick(() => {
217217
inputEl.value.inputEl.focus()
218+
amount.value = ""
218219
})
219220
} else {
220221
amount.value = 0

components/modules/address/AddressOverview.vue

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import VestingsTable from "./tables/VestingsTable.vue";
2222
2323
/** Services */
2424
import { comma, splitAddress } from "@/services/utils"
25-
import { MsgTypes } from "@/services/constants/messages"
2625
2726
/** API */
2827
import {
@@ -38,10 +37,12 @@ import {
3837
} from "@/services/api/address"
3938
4039
/** Store */
41-
import { useModalsStore } from "@/store/modals"
4240
import { useCacheStore } from "@/store/cache"
43-
const modalsStore = useModalsStore()
41+
import { useEnumStore } from "@/store/enums"
42+
import { useModalsStore } from "@/store/modals"
4443
const cacheStore = useCacheStore()
44+
const enumStore = useEnumStore()
45+
const modalsStore = useModalsStore()
4546
4647
const route = useRoute()
4748
const router = useRouter()
@@ -177,12 +178,14 @@ const onSort = (by) => {
177178
}
178179
179180
/** Filters */
181+
const msgTypes = computed(() => enumStore.enums.messageTypes.sort())
182+
180183
const filters = reactive({
181184
status: {
182185
success: false,
183186
failed: false,
184187
},
185-
message_type: MsgTypes.reduce((a, b) => ({ ...a, [b]: false }), {}),
188+
message_type: msgTypes.value?.reduce((a, b) => ({ ...a, [b]: false }), {}),
186189
})
187190
const hasActiveFilters = computed(() => {
188191
let has = false

components/modules/stats/BarChart.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const buildChart = (chart, cData, pData, onEnter, onLeave) => {
9595
9696
return `${tia(value, 2)} TIA`
9797
case 'seconds':
98-
return `${truncateDecimalPart(value / 1_000, 1)}s`
98+
return `${truncateDecimalPart(value / 1_000, 3)}s`
9999
default:
100100
return comma(value)
101101
}

components/modules/stats/LineChart.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ const buildChart = (chart, cData, pData, onEnter, onLeave) => {
8282
8383
return `${tia(value, 2)} TIA`
8484
case 'seconds':
85-
return `${truncateDecimalPart(value / 1_000, 1)}s`
85+
return `${truncateDecimalPart(value / 1_000, 3)}s`
8686
default:
8787
return comma(value)
8888
}

components/modules/stats/PieChartCard.vue

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const total = ref(0)
3232
3333
const prepareRollupsData = () => {
3434
let key = props.series.name
35-
props.data.forEach(el => {
35+
props.data?.forEach(el => {
3636
resData.value.push(
3737
{
3838
name: el.name,
@@ -303,6 +303,24 @@ onMounted(() => {
303303
animation-fill-mode: forwards;
304304
}
305305
306+
.loading {
307+
animation: loading 1s ease infinite;
308+
}
309+
310+
@keyframes loading {
311+
0% {
312+
opacity: 1;
313+
}
314+
315+
50% {
316+
opacity: 0.5;
317+
}
318+
319+
100% {
320+
opacity: 1;
321+
}
322+
}
323+
306324
@keyframes fadeIn {
307325
from {
308326
opacity: 0;

components/modules/stats/tabs/RollupsTab.vue

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,24 @@ import { getSeriesByGroupAndType } from "@/services/constants/stats.js"
1313
import { fetchRollups } from "@/services/api/rollup.js"
1414
1515
const isLoading = ref(false)
16-
const series = computed(() => getSeriesByGroupAndType('Rollups'))
16+
const series = ref()
1717
1818
const getRollups = async () => {
1919
isLoading.value = true
2020
21-
const data = await fetchRollups({
22-
limit: 100,
23-
})
21+
series.value = getSeriesByGroupAndType('Rollups')
2422
25-
series.value.data = data
23+
fetchRollups({ limit: 100 })
24+
.then((res) => {
25+
series.value.data = res
26+
})
27+
.finally(() => {
28+
isLoading.value = false
29+
})
2630
27-
isLoading.value = false
2831
}
2932
30-
onBeforeMount(async () => {
31-
await getRollups()
32-
})
33+
await getRollups()
3334
</script>
3435

3536
<template>
@@ -38,7 +39,6 @@ onBeforeMount(async () => {
3839
<Flex align="center" justify="between" wide :class="$style.section">
3940
<Flex align="center" gap="4">
4041
<Text size="16" weight="600" color="primary" justify="start">Overview</Text>
41-
<!-- <Text size="14" weight="600" color="tertiary">(top 10 rollups)</Text> -->
4242
</Flex>
4343

4444
<Button link="/rollups" type="secondary" size="mini">
@@ -50,14 +50,13 @@ onBeforeMount(async () => {
5050
<RollupsBubbleChart v-if="!isLoading" :series="series" />
5151
</Flex>
5252

53-
<Flex align="center" direction="column" gap="12" wide>
53+
<Flex v-if="!isLoading" align="center" direction="column" gap="12" wide>
5454
<Flex align="center" justify="between" wide :class="$style.section">
5555
<Text size="16" weight="600" color="primary" justify="start">Top Rollups</Text>
5656
</Flex>
5757

5858
<Flex align="center" justify="between" gap="16" wide :class="$style.charts_wrapper">
5959
<PieChartCard
60-
v-if="!isLoading"
6160
v-for="s in series"
6261
:series="s"
6362
:data="series.data"

pages/stats/[metric].vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import LineChart from "@/components/modules/stats/LineChart.vue"
99
import SquareSizeChart from "@/components/modules/stats/SquareSizeChart.vue"
1010
1111
/** Services */
12-
import { capitalizeAndReplaceUnderscore } from "@/services/utils"
1312
import { getStartChainDate } from "@/services/config"
1413
import { exportSVGToPNG, exportToCSV } from "@/services/utils/export"
14+
import { capitalizeAndReplaceUnderscore } from "@/services/utils"
1515
1616
/** API */
1717
import { fetchSeries, fetchSeriesCumulative } from "@/services/api/stats"
@@ -254,7 +254,7 @@ const handleCSVDownload = async () => {
254254
}
255255
256256
const handlePNGDownload = async () => {
257-
const svgElement = document.querySelector('#chart')
257+
const svgElement = document.getElementById('chart')
258258
259259
await exportSVGToPNG(svgElement, `${series.value.name}-${filters.from}-${filters.to}-${chartView.value}`)
260260

pages/txs.vue

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@ import MessageTypeBadge from "@/components/shared/MessageTypeBadge.vue"
1616
1717
/** Services */
1818
import { comma, space, splitAddress, tia } from "@/services/utils"
19-
import { MsgTypes } from "@/services/constants/messages"
2019
import { getStartChainDate } from "@/services/config"
2120
2221
/** API */
2322
import { fetchTransactions } from "@/services/api/tx"
2423
24+
/** Stores */
25+
import { useEnumStore } from "@/store/enums"
26+
const enumStore = useEnumStore()
27+
2528
useHead({
2629
title: "Transactions - Celestia Explorer",
2730
link: [
@@ -74,12 +77,13 @@ const route = useRoute()
7477
const router = useRouter()
7578
7679
/** Filters */
80+
const msgTypes = computed(() => enumStore.enums.messageTypes.sort())
7781
const filters = reactive({
7882
status: {
7983
success: false,
8084
failed: false,
8185
},
82-
message_type: MsgTypes.reduce((a, b) => ({ ...a, [b]: false }), {}),
86+
message_type: msgTypes.value?.reduce((a, b) => ({ ...a, [b]: false }), {}),
8387
from: "",
8488
to: "",
8589
})
@@ -326,6 +330,13 @@ watch(
326330
},
327331
)
328332
333+
watch(
334+
() => msgTypes.value,
335+
() => {
336+
filters.message_type = msgTypes.value?.reduce((a, b) => ({ ...a, [b]: false }), {})
337+
}
338+
)
339+
329340
const handleSort = (by) => {
330341
/** temp. only for time */
331342
if (!["time"].includes(by)) return

0 commit comments

Comments
 (0)