feat(SW-1446): add Jump to functionality to Destination Overview Page

This commit is contained in:
Michael Zetterberg
2025-03-19 06:56:38 +01:00
parent 85a90baa12
commit 9e84da45bc
44 changed files with 3069 additions and 1297 deletions

View File

@@ -17,10 +17,6 @@ export type DestinationsData = DestinationCountry[]
export type Cities = DestinationCountry["cities"]
export type HotelsSectionProps = {
destinations: DestinationsData
}
export type DestinationsListProps = {
destinations: DestinationsData
}

View File

@@ -0,0 +1,9 @@
import type { JumpToData, JumpToProps, LocationMatchResultsState } from "./"
export type ClientProps = {
results: LocationMatchResultsState
latest: NonNullable<LocationMatchResultsState>
setFilterString: (filter: string | null) => void
onAction: JumpToProps<JumpToData>["onAction"]
onClearHistory: () => void
}

View File

@@ -0,0 +1,44 @@
export type JumpToDataItem = {
id: string
displayName: string
type: "hotels" | "cities"
description: string
url: string
rankingNames: string[]
rankingKeywords: string[]
}
export type JumpToData = JumpToDataItem[]
export type JumpToHistory = {
id: JumpToDataItem["id"]
type: JumpToDataItem["type"]
}[]
export type JumpToProps<T extends { id: string }[]> = {
data: T
history: JumpToHistory
onAction: (id: T[number]["id"]) => void
onClearHistory: () => void
}
export type LocationMatch = {
id: string
displayName: string
type: string
description?: string
url?: string
}
export type ScoringMatch = LocationMatch & {
score: number
}
export type LocationMatchResult = {
id: string
name: string
children: LocationMatch[]
}
export type LocationMatchResults = LocationMatchResult[]
export type LocationMatchResultsState = LocationMatchResults | null

View File

@@ -0,0 +1,5 @@
import type { getJumpToData } from "@/lib/trpc/memoizedRequests"
export type JumpToResolverProps = {
dataPromise: ReturnType<typeof getJumpToData>
}

View File

@@ -0,0 +1,9 @@
import type { ClientProps } from "./client"
export type ResultHistoryProps = Pick<ClientProps, "onClearHistory"> & {
results: ClientProps["latest"]
}
export type ResultMatchesProps = Pick<ClientProps, "onAction"> & {
results: NonNullable<ClientProps["results"]>
}