Skip to content

Commit 8027b8e

Browse files
committed
feat: add latest epoch and latest block to landing page search
See: FE-163
1 parent 22074fe commit 8027b8e

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const {
1919
2020
const { t: $t } = useTranslation()
2121
22-
export type BlockchainSearchFilters = 'address' | 'block' | 'epoch' | 'slot' | 'token' | 'transaction' | 'validator'
22+
export type BlockchainSearchFilters = 'address' | 'block' | 'epoch' | 'latest_block' | 'latest_epoch' | 'slot' | 'token' | 'transaction' | 'validator'
2323
2424
const emit = defineEmits<{
2525
(e: 'search', input: string): void,
@@ -131,7 +131,21 @@ const handleClickExample = (type: BlockchainSearchFilters) => {
131131
<template #search-examples>
132132
<div class="flex items-center">
133133
<section class="flex gap-lg">
134-
<div class="py-xs px-md border-gray-400 font-semibold text-gray-400">
134+
<BaseChip
135+
:is-selected="false"
136+
icon="cube"
137+
@click="handleClickExample('latest_block')"
138+
>
139+
{{ $t('products.landing_page.search.examples.latest_block') }}
140+
</BaseChip>
141+
<BaseChip
142+
:is-selected="false"
143+
icon="chart-line"
144+
@click="handleClickExample('latest_epoch')"
145+
>
146+
{{ $t('products.landing_page.search.examples.latest_epoch') }}
147+
</BaseChip>
148+
<div class="py-xs px-md border-l border-gray-400 font-semibold text-gray-400">
135149
{{ $t('products.landing_page.search.examples.title') }}
136150
</div>
137151
<BaseChip

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,20 @@ const handleExampleClick = (type: BlockchainSearchFilters) => {
8484
types: [ 'address' ],
8585
}
8686
}
87+
if (type === 'latest_block') {
88+
searchParams.value = {
89+
...searchParams.value,
90+
input: '/latest',
91+
types: [ 'block' ],
92+
}
93+
}
94+
if (type === 'latest_epoch') {
95+
searchParams.value = {
96+
...searchParams.value,
97+
input: '/latest',
98+
types: [ 'epoch' ],
99+
}
100+
}
87101
if (type === 'token') {
88102
searchParams.value = {
89103
...searchParams.value,

0 commit comments

Comments
 (0)