Skip to content

Commit 22074fe

Browse files
committed
feat: add epoch and slot filter buttons for search on product landing page
See: FE-159
1 parent 7b41bcd commit 22074fe

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

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

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ const {
1919
2020
const { t: $t } = useTranslation()
2121
22+
export type BlockchainSearchFilters = 'address' | 'block' | 'epoch' | 'slot' | 'token' | 'transaction' | 'validator'
23+
2224
const emit = defineEmits<{
2325
(e: 'search', input: string): void,
24-
(e: 'click:example', type: 'address' | 'token' | 'transaction' | 'validator'): void,
26+
(e: 'click:example', type: BlockchainSearchFilters): void,
2527
}>()
2628
2729
const searchParams = defineModel<BlockchainSearchParams>({
@@ -34,21 +36,29 @@ const chips: { label: string, value: BlockchainSearchParams['types'][number] }[]
3436
value: 'address',
3537
},
3638
{
37-
label: $t('products.landing_page.search.types.transactions'),
38-
value: 'transaction',
39+
label: $t('products.landing_page.search.types.blocks'),
40+
value: 'block',
3941
},
4042
{
41-
label: $t('products.landing_page.search.types.validators_indices'),
42-
value: 'validator_by_index',
43+
label: $t('products.landing_page.search.types.epochs'),
44+
value: 'epoch',
4345
},
4446
{
45-
label: $t('products.landing_page.search.types.blocks'),
46-
value: 'block',
47+
label: $t('products.landing_page.search.types.slots'),
48+
value: 'slot',
4749
},
4850
{
4951
label: $t('products.landing_page.search.types.tokens'),
5052
value: 'token',
5153
},
54+
{
55+
label: $t('products.landing_page.search.types.transactions'),
56+
value: 'transaction',
57+
},
58+
{
59+
label: $t('products.landing_page.search.types.validators_indices'),
60+
value: 'validator_by_index',
61+
},
5262
]
5363
5464
const handleSearch = (input: string) => {
@@ -98,7 +108,7 @@ watch(hasResults, () => {
98108
isHistoryVisible.value = true
99109
})
100110
const searchInput = useTemplateRef<ComponentPublicInstance | null>('searchInput')
101-
const handleClickExample = (type: 'address' | 'token' | 'transaction' | 'validator') => {
111+
const handleClickExample = (type: BlockchainSearchFilters) => {
102112
emit('click:example', type)
103113
isHistoryVisible.value = false
104114
const input = searchInput.value?.$el.querySelector('input')

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<script setup lang="ts">
22
import type { BaseNavigationItem } from '#layers/base/app/components/BaseNavigationItem.vue'
3-
import type { BlockchainSearchParams } from '~/layers/products/app/components/BlockchainSearchInput.vue'
3+
import type {
4+
BlockchainSearchFilters,
5+
BlockchainSearchParams,
6+
} from '~/layers/products/app/components/BlockchainSearchInput.vue'
47
58
const isOpen = ref(false)
69
const { t: $t } = useTranslation()
@@ -73,7 +76,7 @@ const handleSearch = (input: string) => {
7376
execute()
7477
}
7578
76-
const handleExampleClick = (type: 'address' | 'token' | 'transaction' | 'validator') => {
79+
const handleExampleClick = (type: BlockchainSearchFilters) => {
7780
if (type === 'address') {
7881
searchParams.value = {
7982
...searchParams.value,

0 commit comments

Comments
 (0)