Merged in feat/SW-1452-city-page-filter-2 (pull request #1392)

feat(SW-1452): Added filtering and sorting to destination city pages

* feat(SW-1452): Added filtering and sorting to destination city pages

* feat(SW-1452): Added temporary component for country pages to avoid Context issues


Approved-by: Matilda Landström
This commit is contained in:
Erik Tiekstra
2025-02-25 13:02:38 +00:00
parent 8a564274c5
commit 3867baadd6
53 changed files with 1561 additions and 255 deletions
+46
View File
@@ -0,0 +1,46 @@
import type { ReadonlyURLSearchParams } from "next/navigation"
import type {
CategorizedFilters,
SortItem,
} from "../components/hotelFilterAndSort"
import type { SortOption } from "../enums/hotelFilterAndSort"
import type { HotelDataWithUrl } from "../hotel"
interface Actions {
submitFiltersAndSort: () => void
setPendingSort: (sort: SortOption) => void
togglePendingFilter: (filter: string) => void
clearPendingFilters: () => void
resetPendingValues: () => void
loadInitialHashFilter: (hash: string) => void
}
export interface SubmitCallbackData {
sort: SortOption
filters: string[]
basePath: string
}
export interface HotelDataState {
actions: Actions
allHotels: HotelDataWithUrl[]
activeHotels: HotelDataWithUrl[]
pendingSort: SortOption
activeSort: SortOption
pendingFilters: string[]
activeFilters: string[]
pendingCount: number
searchParams: ReadonlyURLSearchParams
allFilters: CategorizedFilters
allFilterSlugs: string[]
basePathnameWithoutFilters: string
sortItems: SortItem[]
initialHashFilterLoaded: boolean
}
export interface InitialState
extends Pick<HotelDataState, "allHotels" | "searchParams" | "sortItems"> {
pathname: string
filterFromUrl?: string
submitCallbackFn?: (data: SubmitCallbackData) => void
}