From 41f80ba0cd679f3efe992bc2b1ab47f54471dc26 Mon Sep 17 00:00:00 2001 From: Antonio Morrone Date: Tue, 19 Nov 2024 13:09:14 +0000 Subject: [PATCH] fix: filter activated builders (#377) * fix: filter activated builders * fix: use constants --- .../components/Search/WhitelistSearch.tsx | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/app/collective-rewards/whitelist/components/Search/WhitelistSearch.tsx b/src/app/collective-rewards/whitelist/components/Search/WhitelistSearch.tsx index 63acc391..f5c61162 100644 --- a/src/app/collective-rewards/whitelist/components/Search/WhitelistSearch.tsx +++ b/src/app/collective-rewards/whitelist/components/Search/WhitelistSearch.tsx @@ -1,3 +1,8 @@ +import { + BuilderStatusActive, + BuilderStatusInProgress, + BuilderStatusShown, +} from '@/app/collective-rewards/types' import { BuilderStatusFilter, useWhitelistContext } from '@/app/collective-rewards/whitelist' import { useAlertContext } from '@/app/providers' import { Input } from '@/components/Input' @@ -5,6 +10,18 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@ import { Label } from '@/components/Typography' import { useEffect } from 'react' +type SelectOption = { + value: BuilderStatusShown | 'all' + label: string +} + +// TODO: are there other statuses to be considered? +const statuses: SelectOption[] = [ + { value: 'all', label: 'All' }, + { value: BuilderStatusActive, label: 'Activated' }, + { value: BuilderStatusInProgress, label: 'In progress' }, +] + export const WhitelistSearch = () => { const { search, filterBy, error: whitelistError } = useWhitelistContext() const { setMessage: setErrorMessage } = useAlertContext() @@ -20,13 +37,6 @@ export const WhitelistSearch = () => { } }, [whitelistError, setErrorMessage]) - // TODO: are there other statuses to be considered? - const statuses = [ - { value: 'all', label: 'All' }, - { value: 'Whitelisted', label: 'Whitelisted' }, - { value: 'In progress', label: 'In progress' }, - ] - const onValueChange = (value: string) => filterBy.onChange(value as BuilderStatusFilter) return (