From 65d0baffc90513e1c5ec9b662f4f7f5e5929908f Mon Sep 17 00:00:00 2001 From: Noman Date: Fri, 22 Mar 2024 01:48:10 -0400 Subject: [PATCH] WIP --- src/js/filters/CityFilters.tsx | 58 +++++++++++++++++++++++++++++++ src/js/filters/FilterBar.tsx | 2 ++ src/js/filters/FiltersContext.tsx | 21 ++++++++++- src/js/types.ts | 2 +- 4 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 src/js/filters/CityFilters.tsx diff --git a/src/js/filters/CityFilters.tsx b/src/js/filters/CityFilters.tsx new file mode 100644 index 0000000..0a0041e --- /dev/null +++ b/src/js/filters/CityFilters.tsx @@ -0,0 +1,58 @@ +import { useCallback, useContext, useMemo } from 'react'; +import { MultiValue } from 'react-select'; +import { Option, Venue } from '../types'; +import { useDb } from '../dbHooks'; +import { FilterSection } from './FilterSection'; +import { FiltersContext } from './FiltersContext'; +import { formatVenueName, sortByLabel } from '../utils'; +import { DropdownMultiselect } from './DropdownMultiselect'; + +const nothingFound = () => 'Nothing found'; + +export const CityFilters = () => { + const { + venues: { data: venues }, + } = useDb(); + + const { cityFilters, setCityFilters } = useContext(FiltersContext); + + const handleChange = useCallback( + (options: MultiValue