feat(SW-66, SW-348): search functionality and ui

This commit is contained in:
Simon Emanuelsson
2024-08-28 10:47:57 +02:00
parent b9dbcf7d90
commit af850c90e7
437 changed files with 7663 additions and 9881 deletions
+5
View File
@@ -0,0 +1,5 @@
import { CardsGrid } from "@/types/trpc/routers/contentstack/blocks"
export interface CardsGridProps extends Pick<CardsGrid, "cards_grid"> {
firstItem?: boolean
}
+20
View File
@@ -0,0 +1,20 @@
import type { DynamicContent } from "@/types/trpc/routers/contentstack/blocks"
interface PartialDynamicContent
extends Pick<DynamicContent, "dynamic_content"> {}
export interface DynamicContentProps extends PartialDynamicContent {
firstItem: boolean
}
export interface HowItWorksProps extends PartialDynamicContent {
firstItem: boolean
}
export interface LoyaltyLevelsProps extends PartialDynamicContent {
firstItem: boolean
}
export interface OverviewTableProps extends PartialDynamicContent {
firstItem: boolean
}
+9
View File
@@ -0,0 +1,9 @@
import type { Block as AccountPageBlock } from "@/types/trpc/routers/contentstack/accountPage"
import type { Block as ContentPageBlock } from "@/types/trpc/routers/contentstack/contentPage"
import type { Block as LoyaltyPageBlock } from "@/types/trpc/routers/contentstack/loyaltyPage"
export type Blocks = AccountPageBlock | ContentPageBlock | LoyaltyPageBlock
export interface BlocksProps {
blocks: Blocks[]
}
+3
View File
@@ -0,0 +1,3 @@
import type { TextCols } from "@/types/trpc/routers/contentstack/blocks"
export interface TextColProps extends Pick<TextCols, "text_cols"> { }
-109
View File
@@ -1,109 +0,0 @@
import { Lang } from "@/constants/languages"
import { membershipLevels } from "@/constants/membershipLevels"
import type { IntlFormatters } from "@formatjs/intl"
import {
Block,
CardsGrid,
DynamicContent,
TextCols,
} from "@/types/trpc/routers/contentstack/contentPage"
export type BlocksProps = {
blocks: Block[]
}
export type CardsGridProps = Pick<CardsGrid, "cards_grid"> & {
firstItem?: boolean
}
export type TextColsProps = {
textCols: TextCols["text_cols"]
}
export type DynamicContentProps = {
dynamicContent: DynamicContent["dynamic_content"]
firstItem: boolean
}
export type DynamicComponentProps = {
component: DynamicContent["dynamic_content"]["component"]
}
type BenefitTitle = { title: string }
export type Level = {
level: membershipLevels
name: string
requiredPoints: number
requiredNights?: number
benefits: BenefitTitle[]
}
export type LevelCardProps = {
formatMessage: IntlFormatters["formatMessage"]
lang: Lang
level: Level
}
export type BenefitCardProps = {
comparedValues: BenefitValueInformation[]
title: string
description: string
}
type BenefitValueInformation = {
unlocked: boolean
value?: string
valueDetails?: string
}
export type Benefit = {
name: string
description: string
unlocked: boolean
value?: string
valueDetails?: string
}
export type ComparisonLevel = {
level: membershipLevels
name: string
description: string
requirement: string
icon: string
benefits: Benefit[]
}
export type BenefitListProps = {
levels: ComparisonLevel[]
}
export type BenefitValueProps = {
benefit: BenefitValueInformation
}
export type MobileColumnHeaderProps = {
column: "A" | "B"
}
export type DesktopSelectColumns = {
column: MobileColumnHeaderProps["column"] | "C"
}
export type LargeTableProps = {
levels: ComparisonLevel[]
activeLevel: membershipLevels | null
Select?: (column: DesktopSelectColumns) => JSX.Element | null
}
export type BenefitTableHeaderProps = {
name: string
description: string
}
export type LevelSummaryProps = {
level: ComparisonLevel
showDescription?: boolean
}
-42
View File
@@ -1,42 +0,0 @@
import { Typename } from "@/types/requests/utils/typename"
import { JoinLoyaltyContact } from "@/types/trpc/routers/contentstack/contentPage"
export enum ContentBlocksTypenameEnum {
ContentPageBlocksContent = "ContentPageBlocksContent",
ContentPageBlocksShortcuts = "ContentPageBlocksShortcuts",
ContentPageBlocksCardsGrid = "ContentPageBlocksCardsGrid",
ContentPageBlocksDynamicContent = "ContentPageBlocksDynamicContent",
ContentPageBlocksTextCols = "ContentPageBlocksTextCols",
}
export enum CardsGridEnum {
LoyaltyCard = "LoyaltyCard",
Card = "Card",
}
export enum DynamicContentComponentEnum {
loyalty_levels = "loyalty_levels",
how_it_works = "how_it_works",
overview_table = "overview_table",
}
export enum SidebarTypenameEnum {
ContentPageSidebarJoinLoyaltyContact = "ContentPageSidebarJoinLoyaltyContact",
ContentPageSidebarContent = "ContentPageSidebarContent",
ContentPageSidebarDynamicContent = "ContentPageSidebarDynamicContent",
}
export type SidebarTypename = keyof typeof SidebarTypenameEnum
export enum JoinLoyaltyContactTypenameEnum {
ContentPageSidebarJoinLoyaltyContactBlockContactContact = "ContentPageSidebarJoinLoyaltyContactBlockContactContact",
}
export type JoinLoyaltyContactContact = Typename<
JoinLoyaltyContact["join_loyalty_contact"],
JoinLoyaltyContactTypenameEnum.ContentPageSidebarJoinLoyaltyContactBlockContactContact
>
export enum SidebarDynamicComponentEnum {
my_pages_navigation = "my_pages_navigation",
}
-22
View File
@@ -1,22 +0,0 @@
import { ContactFields } from "@/server/routers/contentstack/base/output"
import {
JoinLoyaltyContact,
Sidebar,
} from "@/types/trpc/routers/contentstack/contentPage"
export type SidebarProps = {
blocks: Sidebar[]
}
export type JoinLoyaltyContactProps = {
block: JoinLoyaltyContact["join_loyalty_contact"]
}
export type ContactProps = {
contactBlock: JoinLoyaltyContact["join_loyalty_contact"]["contact"]
}
export type ContactRowProps = {
contact: ContactFields
}
@@ -3,7 +3,7 @@ import type { Node } from "@/types/requests/utils/edges"
import type { RTENode } from "../rte/node"
import type { RenderOptions } from "../rte/option"
export type JsonToHtmlProps = {
export type DeprecatedJsonToHtmlProps = {
embeds: Node<Embeds>[]
nodes: RTENode[]
renderOptions?: RenderOptions
+55
View File
@@ -0,0 +1,55 @@
import type { Location, Locations } from "@/types/trpc/routers/hotel/locations"
export interface BookingWidgetFormProps {
locations: Locations
}
export interface BookingWidgetFormContentProps {
locations: Locations
}
export enum ActionType {
CLEAR_HISTORY_LOCATIONS = "CLEAR_HISTORY_LOCATIONS",
CLEAR_SEARCH_LOCATIONS = "CLEAR_SEARCH_LOCATIONS",
SEARCH_LOCATIONS = "SEARCH_LOCATIONS",
SELECT_ITEM = "SELECT_ITEM",
}
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: Locations
}
type: ActionType.SELECT_ITEM
}
export type Action =
| ClearHistoryLocationsAction
| ClearSearchLocationsAction
| SearchLocationsAction
| SetItemAction
export interface State {
defaultLocations: Locations
locations: Locations
search: string
searchData: Location | undefined
searchHistory: Locations | null
}
export interface InitState extends Pick<State, "defaultLocations"> {}
-3
View File
@@ -1,3 +0,0 @@
export enum HotelBlocksTypenameEnum {
HotelPageContentUpcomingActivitiesCard = "HotelPageContentUpcomingActivitiesCard",
}
-43
View File
@@ -1,43 +0,0 @@
import { Typename } from "@/types/requests/utils/typename"
import type { JoinLoyaltyContact } from "@/server/routers/contentstack/loyaltyPage/output"
export enum JoinLoyaltyContactTypenameEnum {
LoyaltyPageSidebarJoinLoyaltyContactBlockContactContact = "LoyaltyPageSidebarJoinLoyaltyContactBlockContactContact",
}
export type JoinLoyaltyContactContact = Typename<
JoinLoyaltyContact["join_loyalty_contact"],
JoinLoyaltyContactTypenameEnum.LoyaltyPageSidebarJoinLoyaltyContactBlockContactContact
>
export enum SidebarTypenameEnum {
LoyaltyPageSidebarJoinLoyaltyContact = "LoyaltyPageSidebarJoinLoyaltyContact",
LoyaltyPageSidebarContent = "LoyaltyPageSidebarContent",
LoyaltyPageSidebarDynamicContent = "LoyaltyPageSidebarDynamicContent",
}
export type SidebarTypename = keyof typeof SidebarTypenameEnum
export enum LoyaltySidebarDynamicComponentEnum {
my_pages_navigation = "my_pages_navigation",
}
export enum LoyaltyComponentEnum {
loyalty_levels = "loyalty_levels",
how_it_works = "how_it_works",
overview_table = "overview_table",
}
export type LoyaltyComponent = keyof typeof LoyaltyComponentEnum
export enum LoyaltyBlocksTypenameEnum {
LoyaltyPageBlocksDynamicContent = "LoyaltyPageBlocksDynamicContent",
LoyaltyPageBlocksContent = "LoyaltyPageBlocksContent",
LoyaltyPageBlocksShortcuts = "LoyaltyPageBlocksShortcuts",
LoyaltyPageBlocksCardsGrid = "LoyaltyPageBlocksCardsGrid",
}
export enum LoyaltyCardsGridEnum {
LoyaltyCard = "LoyaltyCard",
Card = "Card",
}
-23
View File
@@ -1,23 +0,0 @@
import { ContactFields } from "@/server/routers/contentstack/base/output"
import {
JoinLoyaltyContact,
Sidebar,
} from "@/server/routers/contentstack/loyaltyPage/output"
import { LangParams } from "@/types/params"
export type SidebarProps = {
blocks: Sidebar[]
}
export type JoinLoyaltyContactProps = {
block: JoinLoyaltyContact["join_loyalty_contact"]
}
export type ContactProps = {
contactBlock: JoinLoyaltyContact["join_loyalty_contact"]["contact"]
}
export type ContactRowProps = {
contact: ContactFields
}
+1 -1
View File
@@ -1,5 +1,5 @@
import { z } from "zod"
import { getMetaDataSchema } from "@/server/routers/contentstack/metadata/output"
import { getMetaDataSchema } from "@/server/routers/contentstack/schemas/metadata"
export interface MetaData extends z.infer<typeof getMetaDataSchema> {}
+4
View File
@@ -0,0 +1,4 @@
import { User } from "@/types/user"
export interface FriendProps
extends React.PropsWithChildren<Pick<User, "membership" | "name">> {}
@@ -0,0 +1,10 @@
import { VariantProps } from "class-variance-authority"
import { membershipNumberVariants } from "@/components/Blocks/DynamicContent/Overview/Friend/MembershipNumber/membershipNumberVariants"
import type { User } from "@/types/user"
export interface MembershipNumberProps
extends Omit<React.HTMLAttributes<HTMLDivElement>, "color">,
VariantProps<typeof membershipNumberVariants>,
Pick<User, "membership"> {}
+10 -12
View File
@@ -1,22 +1,20 @@
import { AccountPageContentItem } from "@/server/routers/contentstack/accountPage/output"
import { z } from "zod"
import { DynamicContentComponents } from "@/types/components/myPages/myPage/enums"
import { blocksSchema } from "@/server/routers/contentstack/accountPage/output"
export type AccountPageContentProps = {
component: DynamicContentComponents
props: {
title: string | null
subtitle: string | null
link?: { href: string; text: string }
}
}
import { DynamicContent } from "@/types/trpc/routers/contentstack/blocks"
export type AccountPageComponentProps = {
export interface AccountPageContentProps
extends Pick<DynamicContent, "dynamic_content"> {}
export interface AccountPageComponentProps {
title: string | null
subtitle: string | null
link?: { href: string; text: string }
}
type Content = z.output<typeof blocksSchema>
export type ContentProps = {
content: AccountPageContentItem[]
content: Content[]
}
@@ -1,6 +0,0 @@
import type { User } from "@/types/user"
export type ChallengesProps = {
journeys: User["journeys"]
victories: User["victories"]
}
@@ -1,4 +1,4 @@
import { awardPointsVariants } from "@/components/MyPages/Blocks/Points/EarnAndBurn/AwardPoints/awardPointsVariants"
import { awardPointsVariants } from "@/components/Blocks/DynamicContent/Points/EarnAndBurn/AwardPoints/awardPointsVariants"
import type { VariantProps } from "class-variance-authority"
-32
View File
@@ -1,32 +0,0 @@
export enum DynamicContentComponents {
membership_overview = "membership_overview",
points_overview = "points_overview",
soonest_stays = "soonest_stays",
previous_stays = "previous_stays",
upcoming_stays = "upcoming_stays",
current_benefits = "current_benefits",
next_benefits = "next_benefits",
my_points = "my_points",
expiring_points = "expiring_points",
earn_and_burn = "earn_and_burn",
}
export enum ContentEntries {
AccountPageContentDynamicContent = "AccountPageContentDynamicContent",
AccountPageContentShortcuts = "AccountPageContentShortcuts",
AccountPageContentTextContent = "AccountPageContentTextContent",
}
export enum RewardTransactionTypes {
stay = "stay",
rewardNight = "rewardnight",
enrollment = "enrollment",
expired = "expired",
redgift = "redgift",
ancillary = "ancillary",
pointShop = "pointshop",
tui_points = "tui_points",
mastercard_points = "mastercard_points",
stayAdj = "stay/adj",
othersAdj = "others/adj",
}
+3 -10
View File
@@ -1,12 +1,5 @@
export type ShortcutsProps = {
import type { Shortcut } from "@/types/trpc/routers/contentstack/blocks"
export interface ShortcutsProps extends Shortcut {
firstItem?: boolean
openInNewTab?: boolean
shortcuts: {
url: string
title: string
openInNewTab?: boolean
text?: string
}[]
subtitle: string | null
title: string | null
}
@@ -1,4 +1,3 @@
import type { Lang } from "@/constants/languages"
import type { UserQueryRouter } from "../user"
export type PreviousStaysResponse = Awaited<
@@ -1,38 +1,15 @@
import { Lang } from "@/constants/languages"
import { membershipLevels } from "@/constants/membershipLevels"
import {
Block,
CardsGrid,
DynamicContent,
RteBlockContent,
} from "@/server/routers/contentstack/loyaltyPage/output"
import { MembershipLevel } from "@/utils/user"
import type { IntlFormatters } from "@formatjs/intl"
export type BlocksProps = {
blocks: Block[]
}
export type DynamicContentProps = {
dynamicContent: DynamicContent["dynamic_content"]
firstItem: boolean
}
export type DynamicComponentProps = {
component: DynamicContent["dynamic_content"]["component"]
}
export type CardsGridProps = Pick<CardsGrid, "cards_grid"> & {
firstItem?: boolean
}
export type Content = { content: RteBlockContent["content"]["content"] }
type BenefitTitle = { title: string }
export type OverviewTableProps = { activeMembership: MembershipLevel | null }
export type OverviewTableClientProps = {
activeMembership: MembershipLevel | null
}
export type Level = {
level: membershipLevels
+54
View File
@@ -0,0 +1,54 @@
import { dialogVariants } from "@/components/Forms/BookingWidget/FormContent/Search/SearchList/Dialog/variants"
import type { VariantProps } from "class-variance-authority"
import type { PropGetters } from "downshift"
import type { Location, Locations } from "../trpc/routers/hotel/locations"
export interface SearchProps {
locations: Locations
}
type HighlightedIndex = number | null
export interface SearchListProps {
getItemProps: PropGetters<unknown>["getItemProps"]
getMenuProps: PropGetters<unknown>["getMenuProps"]
isOpen: boolean
highlightedIndex: HighlightedIndex
locations: Locations
search: string
searchHistory: Locations | null
}
export interface ListProps {
getItemProps: PropGetters<unknown>["getItemProps"]
highlightedIndex: HighlightedIndex
initialIndex?: number
label?: string
locations: Locations
}
export interface ListItemProps {
getItemProps: PropGetters<unknown>["getItemProps"]
highlightedIndex: HighlightedIndex
index: number
location: Location
}
export interface DialogProps
extends React.PropsWithChildren,
VariantProps<typeof dialogVariants> {
className?: string
getMenuProps: PropGetters<unknown>["getMenuProps"]
}
export interface ErrorDialogProps extends React.PropsWithChildren {
getMenuProps: PropGetters<unknown>["getMenuProps"]
}
export interface ClearSearchButtonProps {
getItemProps: PropGetters<unknown>["getItemProps"]
highlightedIndex: HighlightedIndex
index: number
}
+8
View File
@@ -0,0 +1,8 @@
import type { SidebarBlock as ContentPageSidebarBlock } from "@/types/trpc/routers/contentstack/contentPage"
import type { SidebarBlock as LoyaltyPageSidebarBlock } from "@/types/trpc/routers/contentstack/loyaltyPage"
export type Blocks = ContentPageSidebarBlock | LoyaltyPageSidebarBlock
export interface SidebarProps {
blocks: Blocks[]
}
@@ -0,0 +1,17 @@
import type {
Contacts,
JoinLoyaltyContact,
} from "@/types/trpc/routers/contentstack/sidebar"
import type { ContactFields } from "@/server/routers/contentstack/base/output"
export interface JoinLoyaltyContactProps {
block: JoinLoyaltyContact["join_loyalty_contact"]
}
export interface ContactProps {
contactBlock: Contacts
}
export interface ContactRowProps {
contact: ContactFields
}