Skip to content

Commit 9b28390

Browse files
committed
feat: add latest epoch and latest block to landing page search
See: FE-163
1 parent f95f18e commit 9b28390

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

frontend/layers/products/app/components/BlockchainSearchInput.vue

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const { t: $t } = useTranslation()
2121
2222
const emit = defineEmits<{
2323
(e: 'search', input: string): void,
24-
(e: 'click:example', type: 'address' | 'token' | 'transaction' | 'validator'): void,
24+
(e: 'click:example', type: 'address' | 'latest_block' | 'latest_epoch' | 'token' | 'transaction' | 'validator'): void,
2525
}>()
2626
2727
const searchParams = defineModel<BlockchainSearchParams>({
@@ -98,7 +98,7 @@ watch(hasResults, () => {
9898
isHistoryVisible.value = true
9999
})
100100
const searchInput = useTemplateRef<ComponentPublicInstance | null>('searchInput')
101-
const handleClickExample = (type: 'address' | 'token' | 'transaction' | 'validator') => {
101+
const handleClickExample = (type: 'address' | 'latest_block' | 'latest_epoch' | 'token' | 'transaction' | 'validator') => {
102102
emit('click:example', type)
103103
isHistoryVisible.value = false
104104
const input = searchInput.value?.$el.querySelector('input')
@@ -124,16 +124,14 @@ const handleClickExample = (type: 'address' | 'token' | 'transaction' | 'validat
124124
<BaseChip
125125
:is-selected="false"
126126
icon="cube"
127-
:aria-label="$t('products.landing_page.search.examples.transaction')"
128-
@click="emit('click:example', 'transaction')"
127+
@click="handleClickExample('latest_block')"
129128
>
130129
{{ $t('products.landing_page.search.examples.latest_block') }}
131130
</BaseChip>
132131
<BaseChip
133132
:is-selected="false"
134133
icon="chart-line"
135-
:aria-label="$t('products.landing_page.search.examples.transaction')"
136-
@click="emit('click:example', 'transaction')"
134+
@click="handleClickExample('latest_epoch')"
137135
>
138136
{{ $t('products.landing_page.search.examples.latest_epoch') }}
139137
</BaseChip>

frontend/layers/products/app/pages/products/index.vue

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,28 @@ const handleSearch = (input: string) => {
7373
execute()
7474
}
7575
76-
const handleExampleClick = (type: 'address' | 'token' | 'transaction' | 'validator') => {
76+
const handleExampleClick = (type: 'address' | 'latest_block' | 'latest_epoch' | 'token' | 'transaction' | 'validator') => {
7777
if (type === 'address') {
7878
searchParams.value = {
7979
...searchParams.value,
8080
input: '0x5AbfEc25f74Cd88437631A7731906932776356f9',
8181
types: [ 'address' ],
8282
}
8383
}
84+
if (type === 'latest_block') {
85+
searchParams.value = {
86+
...searchParams.value,
87+
input: '/latest',
88+
types: [ 'block' ],
89+
}
90+
}
91+
if (type === 'latest_epoch') {
92+
searchParams.value = {
93+
...searchParams.value,
94+
input: '/latest',
95+
types: [ 'epoch' ],
96+
}
97+
}
8498
if (type === 'token') {
8599
searchParams.value = {
86100
...searchParams.value,

0 commit comments

Comments
 (0)