Merged in feature/autocomplete-search (pull request #1725)
Feature/autocomplete search * wip autocomplete search * add skeletons to loading * Using aumlauts/accents when searching will still give results remove unused reducer sort autocomplete results * remove testcode * Add tests for autocomplete * cleanup tests * use node@20 * use node 22 * use node22 * merge fix: search button outside of viewport * merge * remove more unused code * fix: error message when empty search field in booking widget * fix: don't display empty white box when search field is empty and no searchHistory is present * merge * fix: set height of shimmer for search skeleton * rename autocomplete trpc -> destinationsAutocomplete * more accute cache key naming * fix: able to control wether bookingwidget is visible on startPage fix: sticky booking widget under alert * remove unused code * fix: skeletons fix: error overlay on search startpage * remove extra .nvmrc * merge Approved-by: Linus Flood
This commit is contained in:
5
apps/scandic-web/types/DeepPartial.ts
Normal file
5
apps/scandic-web/types/DeepPartial.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export type DeepPartial<T> = T extends object
|
||||
? {
|
||||
[P in keyof T]?: DeepPartial<T[P]>
|
||||
}
|
||||
: T
|
||||
@@ -1,73 +1,12 @@
|
||||
import type { BookingWidgetType } from "@/types/components/bookingWidget"
|
||||
import type { Location } from "@/types/trpc/routers/hotel/locations"
|
||||
|
||||
export interface BookingWidgetFormProps {
|
||||
locations: Location[]
|
||||
type?: BookingWidgetType
|
||||
onClose: () => void
|
||||
}
|
||||
|
||||
export interface BookingWidgetFormContentProps {
|
||||
locations: Location[]
|
||||
formId: string
|
||||
onSubmit: () => void
|
||||
isSearching: boolean
|
||||
}
|
||||
|
||||
export enum ActionType {
|
||||
CLEAR_HISTORY_LOCATIONS = "CLEAR_HISTORY_LOCATIONS",
|
||||
CLEAR_SEARCH_LOCATIONS = "CLEAR_SEARCH_LOCATIONS",
|
||||
SEARCH_LOCATIONS = "SEARCH_LOCATIONS",
|
||||
SELECT_ITEM = "SELECT_ITEM",
|
||||
SET_STORAGE_DATA = "SET_STORAGE_DATA",
|
||||
}
|
||||
|
||||
interface ClearHistoryLocationsAction {
|
||||
type: ActionType.CLEAR_HISTORY_LOCATIONS
|
||||
}
|
||||
|
||||
interface ClearSearchLocationsAction {
|
||||
type: ActionType.CLEAR_SEARCH_LOCATIONS
|
||||
}
|
||||
|
||||
interface SearchLocationsAction {
|
||||
payload: {
|
||||
search: string
|
||||
}
|
||||
type: ActionType.SEARCH_LOCATIONS
|
||||
}
|
||||
|
||||
interface SetItemAction {
|
||||
payload: {
|
||||
location: Location
|
||||
searchHistory: Location[]
|
||||
}
|
||||
type: ActionType.SELECT_ITEM
|
||||
}
|
||||
|
||||
export interface SetStorageData {
|
||||
payload: {
|
||||
searchData?: Location
|
||||
searchHistory?: Location[]
|
||||
}
|
||||
type: ActionType.SET_STORAGE_DATA
|
||||
}
|
||||
|
||||
export type Action =
|
||||
| ClearHistoryLocationsAction
|
||||
| ClearSearchLocationsAction
|
||||
| SearchLocationsAction
|
||||
| SetItemAction
|
||||
| SetStorageData
|
||||
|
||||
export interface State {
|
||||
defaultLocations: Location[]
|
||||
locations: Location[]
|
||||
search: string
|
||||
searchData: Location | undefined
|
||||
searchHistory: Location[] | null
|
||||
}
|
||||
|
||||
export interface InitState extends Pick<State, "defaultLocations"> {
|
||||
initialValue?: string
|
||||
}
|
||||
|
||||
@@ -2,10 +2,9 @@ import type { VariantProps } from "class-variance-authority"
|
||||
import type { PropGetters } from "downshift"
|
||||
|
||||
import type { dialogVariants } from "@/components/Forms/BookingWidget/FormContent/Search/SearchList/Dialog/variants"
|
||||
import type { Location } from "../trpc/routers/hotel/locations"
|
||||
import type { AutoCompleteLocation } from "@/server/routers/autocomplete/schema"
|
||||
|
||||
export interface SearchProps {
|
||||
locations: Location[]
|
||||
handlePressEnter: () => void
|
||||
}
|
||||
|
||||
@@ -22,24 +21,8 @@ export interface SearchListProps {
|
||||
isOpen: boolean
|
||||
handleClearSearchHistory: () => void
|
||||
highlightedIndex: HighlightedIndex
|
||||
locations: Location[]
|
||||
search: string
|
||||
searchHistory: Location[] | null
|
||||
}
|
||||
|
||||
export interface ListProps
|
||||
extends Pick<
|
||||
SearchListProps,
|
||||
"getItemProps" | "highlightedIndex" | "locations"
|
||||
> {
|
||||
initialIndex?: number
|
||||
label?: string
|
||||
}
|
||||
|
||||
export interface ListItemProps
|
||||
extends Pick<SearchListProps, "getItemProps" | "highlightedIndex"> {
|
||||
index: number
|
||||
location: Location
|
||||
searchHistory: AutoCompleteLocation[] | null
|
||||
}
|
||||
|
||||
export interface DialogProps
|
||||
|
||||
Reference in New Issue
Block a user