Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | import { HostingStatus, SleepingArrangement } from "proto/api_pb"; import { useState } from "react"; import { FilterOptions } from "../SearchPage"; import { initialState } from "./mapSearchReducers"; /** Local State for Search FilterDialog * This is so values can be changed in the dialog before being applied to the reducer state * On Apply click, all values are applied to the reducer state at once */ interface LocalSearchFilters { acceptsKids: boolean; acceptsPets: boolean; acceptsLastMinRequests: boolean; ageMin: number; ageMax: number; drinkingAllowed: boolean; completeProfile: boolean; lastActive: number; hasReferences: boolean; hasStrongVerification: boolean; hostingStatus: HostingStatus; numGuests: number | undefined; sleepingArrangement: SleepingArrangement; } export function useSearchFilters() { const [filters, setFilters] = useState(initialState.filters); // Update a single filter const updateFilter = (newFilters: Partial<FilterOptions>) => { setFilters((prevFilters) => ({ ...prevFilters, ...newFilters, })); }; const resetFilters = () => { setFilters(initialState.filters); }; return { filters, resetFilters, updateFilter, }; } export type { LocalSearchFilters }; |