diff --git a/components/SearchField.vue b/components/SearchField.vue index 5d7f3d6..dec1ad5 100644 --- a/components/SearchField.vue +++ b/components/SearchField.vue @@ -116,6 +116,8 @@ const handleSaveToHistory = (target) => { } const getResultPath = (result) => { + if (!result) return + switch (result.type) { case "address": return `/account/${result.body.hash}` @@ -133,29 +135,13 @@ const getResultPath = (result) => { } } -const getItemLink = (item) => { - switch (item.type) { - case "address": - return `/account/${result.body.hash}` - case "block": - return `/block/${result.body.height}` - case "validator": - return `/validator/${result.body.id}` - case "bridge": - return `/account/${result.body.address}` - - default: - return `/${item.type === 'address' ? 'account' : item.type}/${item.body.hash}` - } -} - const onKeydown = (e) => { if (e.code === "Escape") { show.value = false inputEl.value.blur() } - if (e.code === "Enter") { + if (e.code === "Enter" && results.value.length) { const target = results.value[0] router.push(getResultPath(target)) diff --git a/components/modules/account/AccountDeposits.vue b/components/modules/account/AccountDeposits.vue new file mode 100644 index 0000000..980cf8b --- /dev/null +++ b/components/modules/account/AccountDeposits.vue @@ -0,0 +1,35 @@ + + + + + diff --git a/components/modules/rollup/RollupDeposits.vue b/components/modules/rollup/RollupDeposits.vue new file mode 100644 index 0000000..da55cbb --- /dev/null +++ b/components/modules/rollup/RollupDeposits.vue @@ -0,0 +1,35 @@ + + + + + diff --git a/components/tables/AccountsTable.vue b/components/tables/AccountsTable.vue index 250c2c9..de5a27b 100644 --- a/components/tables/AccountsTable.vue +++ b/components/tables/AccountsTable.vue @@ -63,7 +63,7 @@ const props = defineProps({ Balance - {{ `${spaces(account.balances[0]?.value)}${account.balances.length ? account.balances[0]?.currency.toUpperCase() : ''}` }} + {{ `${spaces(account.balances[0]?.value)}${account.balances.length ? ' ' + account.balances[0]?.currency.toUpperCase() : ''}` }}
diff --git a/components/tables/ActionsTable.vue b/components/tables/ActionsTable.vue index fe9838a..50ca5d0 100644 --- a/components/tables/ActionsTable.vue +++ b/components/tables/ActionsTable.vue @@ -62,7 +62,7 @@ const handleOpenTx = async (action) => { - + {{ `Pushed ${getActionDataLength(act)} to` }} @@ -297,7 +297,7 @@ const handleOpenTx = async (action) => { Block - +
diff --git a/components/tables/DepositsTable.vue b/components/tables/DepositsTable.vue new file mode 100644 index 0000000..128717c --- /dev/null +++ b/components/tables/DepositsTable.vue @@ -0,0 +1,185 @@ + + + + + diff --git a/pages/account/[hash].vue b/pages/account/[hash].vue index e38ca47..bf64966 100644 --- a/pages/account/[hash].vue +++ b/pages/account/[hash].vue @@ -3,12 +3,13 @@ import { shortHash } from "~/services/utils" /** Modules */ +import AccountActions from "~/components/modules/account/AccountActions.vue" import AccountBridgeInfo from "~/components/modules/account/AccountBridgeInfo.vue" import AccountBridgeRoles from "~/components/modules/account/AccountBridgeRoles.vue" +import AccountDeposits from "~/components/modules/account/AccountDeposits.vue" import AccountMetadata from "~/components/modules/account/AccountMetadata.vue" -import AccountTransactions from "~/components/modules/account/AccountTransactions.vue" -import AccountActions from "~/components/modules/account/AccountActions.vue" import AccountRollups from "~/components/modules/account/AccountRollups.vue" +import AccountTransactions from "~/components/modules/account/AccountTransactions.vue" /** Components */ import RawDataView from "@/components/shared/RawDataView.vue" @@ -21,7 +22,7 @@ import Tooltip from "~/components/ui/Tooltip.vue" import { capitalizeAndReplaceUnderscore } from "~/services/utils" /** API */ -import { fetchAccountActions, fetchAccountBridgeRoles, fetchAccountByHash, fetchAccountRollups, fetchAccountTransactions } from "~/services/api/account.js" +import { fetchAccountActions, fetchAccountBridgeRoles, fetchAccountByHash, fetchAccountDeposits, fetchAccountRollups, fetchAccountTransactions } from "~/services/api/account.js" definePageMeta({ layout: "default", @@ -31,10 +32,12 @@ const route = useRoute() const router = useRouter() const account = ref() -const txs = ref([]) const actions = ref([]) -const rollups = ref([]) const bridgeRoles = ref([]) +const deposits = ref([]) +const rollups = ref([]) +const txs = ref([]) + const isLoading = ref(false) const { data } = await fetchAccountByHash(route.params.hash) @@ -127,6 +130,21 @@ const fetchBridgeRoles = async () => { isLoading.value = false } +const fetchDeposits = async () => { + isLoading.value = true + + const { data } = await fetchAccountDeposits({ + hash: account.value?.hash, + limit: limit.value, + offset: (page.value - 1) * limit.value, + sort: "desc", + }) + deposits.value = data.value + handleNextCondition.value = deposits.value.length < limit.value + + isLoading.value = false +} + const fetchData = async () => { switch (activeTab.value) { case "transactions": @@ -141,6 +159,9 @@ const fetchData = async () => { case "bridge_roles": fetchBridgeRoles() break + case "deposits": + fetchDeposits() + break } } @@ -169,7 +190,7 @@ useHead({ name: "description", content: `Astria Account ${account.value?.hash.toUpperCase().slice(0, 4)} ••• ${account.value?.hash .toUpperCase() - .slice(-4)}. The hash, actions, rollups, transactions.`, + .slice(-4)}. The hash, actions, rollups, transactions, deposits.`, }, { property: "og:title", @@ -181,7 +202,7 @@ useHead({ property: "og:description", content: `Astria Account ${account.value?.hash.toUpperCase().slice(0, 4)} ••• ${account.value?.hash .toUpperCase() - .slice(-4)}. The hash, actions, rollups, transactions.`, + .slice(-4)}. The hash, actions, rollups, transactions, deposits.`, }, { property: "og:url", @@ -197,17 +218,18 @@ useHead({ name: "twitter:description", content: `Astria Account ${account.value?.hash.toUpperCase().slice(0, 4)} ••• ${account.value?.hash .toUpperCase() - .slice(-4)}. The hash, actions, rollups, transactions.`, + .slice(-4)}. The hash, actions, rollups, transactions, deposits.`, }, ], }) const tabs = ref( [ - { name: "transactions", }, - { name: "actions" }, - { name: "rollups" }, - { name: "bridge_roles" }, + { name: "transactions", visible: true }, + { name: "actions", visible: true }, + { name: "rollups", visible: true }, + { name: "bridge_roles", visible: true }, + { name: "deposits", visible: account.value?.is_bridge }, ] ) const activeTab = ref(route.query.tab && tabs.value.map((tab) => tab.name).includes(route.query.tab) ? route.query.tab : tabs.value[0].name) @@ -240,8 +262,6 @@ watch( watch( () => page.value, async () => { - // console.log('isUpdatingPaage.value', isUpdatingPaage.value); - if (isUpdatingPaage.value) return await fetchData() @@ -269,7 +289,7 @@ watch( Account {{ shortHash(account.hash) }} - + diff --git a/pages/rollup/[hash].vue b/pages/rollup/[hash].vue index f46f012..7b76ca0 100644 --- a/pages/rollup/[hash].vue +++ b/pages/rollup/[hash].vue @@ -1,9 +1,11 @@