Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .prettierrc

This file was deleted.

7 changes: 7 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": false,
"trailingComma": "all",
"printWidth": 140,
"tabWidth": 4,
"useTabs": true
}
70 changes: 40 additions & 30 deletions components/shared/tables/Events.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { fetchBlockEvents } from "@/services/api/block"
/** Store */
import { useModalsStore } from "@/store/modals.store"
import { useCacheStore } from "@/store/cache.store"

const modalsStore = useModalsStore()
const cacheStore = useCacheStore()

Expand Down Expand Up @@ -119,6 +120,15 @@ watch(
getEvents()
},
)

const formatEventAmount = (amount) => {
console.log(amount)
if (amount.endsWith("utia")) {
return `${tia(amount.replace("utia", ""))} TIA`
}

return amount.replace(/^(\d+)(.*)/, "$1 $2")
}
</script>

<template>
Expand Down Expand Up @@ -161,8 +171,8 @@ watch(
<Text size="12" weight="500" color="secondary">spent</Text>

<Text size="12" weight="500" color="primary" mono no-wrap>
{{ tia(event.data.amount.replace("utia", "")) }} TIA</Text
>
{{ event.data.amount ? formatEventAmount(event.data.amount) : 0 }}
</Text>
</Flex>
<!-- Event: coin_received -->
<Flex v-else-if="event.type === 'coin_received'" align="center" gap="4" color="secondary" :class="$style.text">
Expand All @@ -181,7 +191,7 @@ watch(
<Text size="12" weight="500" color="secondary">received</Text>

<Text size="12" weight="500" color="primary" mono no-wrap>
{{ tia(event.data.amount.replace("utia", "")) }} TIA
{{ event.data.amount ? formatEventAmount(event.data.amount) : 0 }}
</Text>
</Flex>
<!-- Event: delegate -->
Expand Down Expand Up @@ -223,8 +233,8 @@ watch(
<Text size="12" weight="500" color="secondary">sent</Text>

<Text size="12" weight="500" color="primary" mono no-wrap>
{{ tia(event.data.amount.replace("utia", "")) }} TIA</Text
>
{{ event.data.amount ? formatEventAmount(event.data.amount) : 0 }}
</Text>

<Text size="12" weight="500" color="secondary">to</Text>

Expand Down Expand Up @@ -297,8 +307,8 @@ watch(
<Text size="12" weight="500" color="secondary">paid</Text>

<Text size="12" weight="500" color="primary" mono no-wrap>
{{ tia(event.data.fee.replace("utia", "")) }} TIA</Text
>
{{ event.data.amount ? formatEventAmount(event.data.amount) : 0 }}
</Text>

<Text size="12" weight="500" color="secondary">fee</Text>
</template>
Expand Down Expand Up @@ -343,8 +353,8 @@ watch(
<Text size="12" weight="500" color="secondary">Withdrawal</Text>

<Text size="12" weight="500" color="primary" mono no-wrap>
{{ tia(event.data.amount.replace("utia", "")) }} TIA</Text
>
{{ event.data.amount ? formatEventAmount(event.data.amount) : 0 }}
</Text>

<Text size="12" weight="500" color="secondary">from</Text>

Expand All @@ -365,7 +375,7 @@ watch(
<Text size="12" weight="500" color="secondary">Commission</Text>

<Text size="12" weight="500" color="primary" mono no-wrap>
{{ tia(event.data.amount.replace("utia", "")) }} TIA
{{ event.data.amount ? formatEventAmount(event.data.amount) : 0 }}
</Text>
</Flex>
<!-- Event: proposer_reward -->
Expand All @@ -387,7 +397,7 @@ watch(
<Text size="12" weight="500" color="secondary">received rewards</Text>

<Text size="12" weight="500" color="primary" mono no-wrap>
{{ event.data.amount ? tia(event.data.amount.replace("utia", "")) : 0 }} TIA
{{ event.data.amount ? formatEventAmount(event.data.amount) : 0 }}
</Text>
</Flex>
<!-- Event: rewards -->
Expand All @@ -409,7 +419,7 @@ watch(
<Text size="12" weight="500" color="secondary">received rewards</Text>

<Text size="12" weight="500" color="primary" mono no-wrap>
{{ event.data.amount ? tia(event.data.amount.replace("utia", "")) : 0 }} TIA
{{ event.data.amount ? formatEventAmount(event.data.amount) : 0 }}
</Text>
</Flex>
<!-- Event: commission -->
Expand All @@ -429,7 +439,7 @@ watch(
<Text size="12" weight="500" color="secondary">received commission of</Text>

<Text size="12" weight="500" color="primary" mono no-wrap>
{{ event.data.amount ? tia(event.data.amount.replace("utia", "")) : 0 }} TIA
{{ event.data.amount ? formatEventAmount(event.data.amount) : 0 }}
</Text>
</Flex>
<!-- Event: coinbase -->
Expand All @@ -449,30 +459,30 @@ watch(
<Text size="12" weight="500" color="secondary">received</Text>

<Text size="12" weight="500" color="primary" mono no-wrap>
{{ event.data.amount ? tia(event.data.amount.replace("utia", "")) : 0 }} TIA
{{ event.data.amount ? formatEventAmount(event.data.amount) : 0 }}
</Text>
</Flex>
<!-- Event: mint -->
<Flex v-else-if="event.type === 'mint'" align="center" gap="4" color="secondary" :class="$style.text">
<Text size="12" weight="500" color="primary" mono no-wrap>
{{ event.data.amount ? tia(event.data.amount.replace("utia", "")) : 0 }} TIA</Text
>
{{ event.data.amount ? formatEventAmount(event.data.amount) : 0 }}
</Text>

<Text size="12" weight="500" color="secondary">was minted</Text>
</Flex>
<!-- Event: burn -->
<Flex v-else-if="event.type === 'burn'" align="center" gap="4" color="secondary" :class="$style.text">
<Text size="12" weight="500" color="primary" mono no-wrap>
{{ event.data.amount ? tia(event.data.amount.replace("utia", "")) : 0 }} TIA</Text
>
{{ event.data.amount ? formatEventAmount(event.data.amount) : 0 }}
</Text>

<Text size="12" weight="500" color="secondary">was burned</Text>
</Flex>
<!-- Event: unbond -->
<Flex v-else-if="event.type === 'unbond'" align="center" gap="4" color="secondary" :class="$style.text">
<Text size="12" weight="500" color="primary" mono no-wrap>
{{ event.data.amount ? tia(event.data.amount.replace("utia", "")) : 0 }} TIA</Text
>
{{ event.data.amount ? formatEventAmount(event.data.amount) : 0 }}
</Text>

<Text size="12" weight="500" color="secondary">will unbond from</Text>

Expand Down Expand Up @@ -503,8 +513,8 @@ watch(
<!-- Event: redelegate -->
<Flex v-else-if="event.type === 'redelegate'" align="center" gap="4" color="secondary" :class="$style.text">
<Text size="12" weight="500" color="primary" mono no-wrap>
{{ event.data.amount ? tia(event.data.amount.replace("utia", "")) : 0 }} TIA</Text
>
{{ event.data.amount ? formatEventAmount(event.data.amount) : 0 }}
</Text>

<Text size="12" weight="500" color="secondary">will redelegate from</Text>

Expand Down Expand Up @@ -549,8 +559,8 @@ watch(
<!-- Event: complete_unbonding -->
<Flex v-else-if="event.type === 'complete_unbonding'" align="center" gap="4" color="secondary" :class="$style.text">
<Text size="12" weight="500" color="primary" mono no-wrap>
{{ event.data.amount ? tia(event.data.amount.replace("utia", "")) : 0 }} TIA</Text
>
{{ event.data.amount ? formatEventAmount(event.data.amount) : 0 }}
</Text>

<Text size="12" weight="500" color="secondary">was unbonded from</Text>

Expand Down Expand Up @@ -583,8 +593,8 @@ watch(
<!-- Event: complete_redelegation -->
<Flex v-else-if="event.type === 'complete_redelegation'" align="center" gap="4" color="secondary" :class="$style.text">
<Text size="12" weight="500" color="primary" mono no-wrap>
{{ event.data.amount ? tia(event.data.amount.replace("utia", "")) : 0 }} TIA</Text
>
{{ event.data.amount ? formatEventAmount(event.data.amount) : 0 }}
</Text>

<Text size="12" weight="500" color="secondary">was redelegated from</Text>

Expand Down Expand Up @@ -651,8 +661,8 @@ watch(
<Text size="12" weight="500" color="secondary">Unbonding</Text>

<Text size="12" weight="500" color="primary" mono no-wrap>
{{ event.data.amount ? tia(event.data.amount.replace("utia", "")) : 0 }} TIA</Text
>
{{ event.data.amount ? formatEventAmount(event.data.amount) : 0 }}
</Text>

<Text size="12" weight="500" color="secondary">from</Text>

Expand Down Expand Up @@ -806,7 +816,7 @@ watch(
</Flex>

<Flex v-else direction="column" align="center" justify="center" gap="8" :class="$style.empty">
<Text size="13" weight="600" color="secondary" align="center"> No events </Text>
<Text size="13" weight="600" color="secondary" align="center"> No events</Text>
<Text size="12" weight="500" height="160" color="tertiary" align="center" style="max-width: 220px">
This block does not contain any events
</Text>
Expand All @@ -822,7 +832,7 @@ watch(
</Button>

<Button type="secondary" size="mini" disabled>
<Text size="12" weight="600" color="primary"> {{ page }} of {{ pages }} </Text>
<Text size="12" weight="600" color="primary"> {{ page }} of {{ pages }}</Text>
</Button>

<Button @click="handleNext" type="secondary" size="mini" :disabled="page === pages">
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"nuxt": "3.16.2",
"nuxt-og-image": "5.1.3",
"oxlint": "^1.0.0",
"prettier": "^3.8.1",
"sass": "1.66.1",
"sass-loader": "13.3.2",
"unenv": "^1.9.0",
Expand Down
Loading