Skip to content

Commit

Permalink
fix: filter activated builders (#377)
Browse files Browse the repository at this point in the history
* fix: filter activated builders

* fix: use constants
  • Loading branch information
antomor authored Nov 19, 2024
1 parent 45266c0 commit 41f80ba
Showing 1 changed file with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
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'
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/Select'
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()
Expand All @@ -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 (
Expand Down

0 comments on commit 41f80ba

Please sign in to comment.