feat(SW-66, SW-348): search functionality and ui
This commit is contained in:
27
types/trpc/routers/contentstack/accountPage.ts
Normal file
27
types/trpc/routers/contentstack/accountPage.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import {
|
||||
accountPageMetadataSchema,
|
||||
accountPageRefsSchema,
|
||||
accountPageSchema,
|
||||
blocksSchema,
|
||||
} from "@/server/routers/contentstack/accountPage/output"
|
||||
|
||||
export interface GetAccountPageRefsSchema
|
||||
extends z.input<typeof accountPageRefsSchema> {}
|
||||
|
||||
export interface AccountPageRefs
|
||||
extends z.output<typeof accountPageRefsSchema> {}
|
||||
|
||||
export interface GetAccountPageSchema
|
||||
extends z.input<typeof accountPageSchema> {}
|
||||
|
||||
export interface AccountPage extends z.output<typeof accountPageSchema> {}
|
||||
|
||||
export interface GetAccountpageMetadata
|
||||
extends z.output<typeof accountPageMetadataSchema> {}
|
||||
|
||||
export interface AccountPageMetadata
|
||||
extends z.output<typeof accountPageMetadataSchema> {}
|
||||
|
||||
export type Block = z.output<typeof blocksSchema>
|
||||
16
types/trpc/routers/contentstack/blocks.ts
Normal file
16
types/trpc/routers/contentstack/blocks.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { cardsGridSchema } from "@/server/routers/contentstack/schemas/blocks/cardsGrid"
|
||||
import { contentSchema } from "@/server/routers/contentstack/schemas/blocks/content"
|
||||
import { dynamicContentSchema } from "@/server/routers/contentstack/schemas/blocks/dynamicContent"
|
||||
import { shortcutsSchema } from "@/server/routers/contentstack/schemas/blocks/shortcuts"
|
||||
|
||||
import { textColsSchema } from "@/server/routers/contentstack/schemas/blocks/textCols"
|
||||
|
||||
export interface CardsGrid extends z.output<typeof cardsGridSchema> { }
|
||||
export interface Content extends z.output<typeof contentSchema> { }
|
||||
export interface DynamicContent extends z.output<typeof dynamicContentSchema> { }
|
||||
export interface Shortcuts extends z.output<typeof shortcutsSchema> { }
|
||||
export type Shortcut = Shortcuts["shortcuts"]
|
||||
export interface TextCols extends z.output<typeof textColsSchema> { }
|
||||
|
||||
@@ -1,103 +1,23 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import {
|
||||
cardBlock,
|
||||
contentPageBlockTextContent,
|
||||
contentPageCards,
|
||||
contentPageDynamicContent,
|
||||
contentPageJoinLoyaltyContact,
|
||||
contentPageShortcuts,
|
||||
contentPageSidebarDynamicContent,
|
||||
contentPageSidebarTextContent,
|
||||
contentPageTextCols,
|
||||
loyaltyCardBlock,
|
||||
validateContentPageRefsSchema,
|
||||
validateContentPageSchema,
|
||||
blocksSchema,
|
||||
contentPageRefsSchema,
|
||||
contentPageSchema,
|
||||
sidebarSchema,
|
||||
} from "@/server/routers/contentstack/contentPage/output"
|
||||
|
||||
import { ImageVaultAsset } from "@/types/components/imageVault"
|
||||
import { Embeds } from "@/types/requests/embeds"
|
||||
import { EdgesWithTotalCount } from "@/types/requests/utils/edges"
|
||||
import { RTEDocument } from "@/types/rte/node"
|
||||
export interface GetContentPageRefsSchema
|
||||
extends z.input<typeof contentPageRefsSchema> { }
|
||||
|
||||
export type ContentPageDataRaw = z.infer<typeof validateContentPageSchema>
|
||||
export interface ContentPageRefs
|
||||
extends z.output<typeof contentPageRefsSchema> { }
|
||||
|
||||
type ContentPageRaw = ContentPageDataRaw["content_page"]
|
||||
export interface GetContentPageSchema
|
||||
extends z.input<typeof contentPageSchema> { }
|
||||
|
||||
export type ContentPage = Omit<
|
||||
ContentPageRaw,
|
||||
"blocks" | "hero_image" | "sidebar"
|
||||
> & {
|
||||
heroImage?: ImageVaultAsset
|
||||
blocks: Block[]
|
||||
sidebar: Sidebar[]
|
||||
}
|
||||
export interface ContentPage extends z.output<typeof contentPageSchema> { }
|
||||
|
||||
export type ContentPageRefsDataRaw = z.infer<
|
||||
typeof validateContentPageRefsSchema
|
||||
>
|
||||
export type Block = z.output<typeof blocksSchema>
|
||||
|
||||
type SidebarContentRaw = z.infer<typeof contentPageSidebarTextContent>
|
||||
type SideBarDynamicContent = z.infer<typeof contentPageSidebarDynamicContent>
|
||||
export type JoinLoyaltyContact = z.infer<typeof contentPageJoinLoyaltyContact>
|
||||
export type RteSidebarContent = Omit<SidebarContentRaw, "content"> & {
|
||||
content: {
|
||||
content: {
|
||||
json: RTEDocument
|
||||
embedded_itemsConnection: EdgesWithTotalCount<Embeds>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export type Sidebar =
|
||||
| JoinLoyaltyContact
|
||||
| RteSidebarContent
|
||||
| SideBarDynamicContent
|
||||
|
||||
export type DynamicContent = z.infer<typeof contentPageDynamicContent>
|
||||
|
||||
type BlockContentRaw = z.infer<typeof contentPageBlockTextContent>
|
||||
export interface RteBlockContent extends BlockContentRaw {
|
||||
content: {
|
||||
content: {
|
||||
json: RTEDocument
|
||||
embedded_itemsConnection: EdgesWithTotalCount<Embeds>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export type Shortcuts = z.infer<typeof contentPageShortcuts>
|
||||
|
||||
type LoyaltyCardRaw = z.infer<typeof loyaltyCardBlock>
|
||||
type LoyaltyCard = Omit<LoyaltyCardRaw, "image"> & {
|
||||
image?: ImageVaultAsset
|
||||
}
|
||||
type CardRaw = z.infer<typeof cardBlock>
|
||||
type Card = Omit<CardRaw, "background_image"> & {
|
||||
backgroundImage?: ImageVaultAsset
|
||||
}
|
||||
type CardsGridRaw = z.infer<typeof contentPageCards>
|
||||
export type CardsGrid = Omit<CardsGridRaw, "cards"> & {
|
||||
cards: (LoyaltyCard | Card)[]
|
||||
}
|
||||
export type CardsRaw = CardsGrid["cards_grid"]["cards"][number]
|
||||
|
||||
type TextColsRaw = z.infer<typeof contentPageTextCols>
|
||||
export interface TextCols extends TextColsRaw {
|
||||
textCols: {
|
||||
columns: {
|
||||
title: string
|
||||
text: {
|
||||
json: RTEDocument
|
||||
embedded_itemsConnection: EdgesWithTotalCount<Embeds>
|
||||
}
|
||||
}[]
|
||||
}
|
||||
}
|
||||
|
||||
export type Block =
|
||||
| RteBlockContent
|
||||
| Shortcuts
|
||||
| CardsGrid
|
||||
| DynamicContent
|
||||
| TextCols
|
||||
export type SidebarBlock = z.output<typeof sidebarSchema>
|
||||
|
||||
15
types/trpc/routers/contentstack/hotelPage.ts
Normal file
15
types/trpc/routers/contentstack/hotelPage.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import {
|
||||
contentBlock,
|
||||
hotelPageSchema,
|
||||
} from "@/server/routers/contentstack/hotelPage/output"
|
||||
import { activitiesCard } from "@/server/routers/contentstack/schemas/blocks/activitiesCard"
|
||||
|
||||
// Will be extended once we introduce more functionality to our entries.
|
||||
export interface GetHotelPageData extends z.input<typeof hotelPageSchema> {}
|
||||
export interface HotelPage extends z.output<typeof hotelPageSchema> {}
|
||||
|
||||
export interface ActivitiesCard extends z.output<typeof activitiesCard> {}
|
||||
export type ActivityCard = ActivitiesCard["upcoming_activities_card"]
|
||||
export interface ContentBlock extends z.output<typeof contentBlock> {}
|
||||
23
types/trpc/routers/contentstack/loyaltyPage.ts
Normal file
23
types/trpc/routers/contentstack/loyaltyPage.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import {
|
||||
blocksSchema,
|
||||
loyaltyPageRefsSchema,
|
||||
loyaltyPageSchema,
|
||||
sidebarSchema,
|
||||
} from "@/server/routers/contentstack/loyaltyPage/output"
|
||||
|
||||
export interface GetLoyaltyPageRefsSchema
|
||||
extends z.input<typeof loyaltyPageRefsSchema> {}
|
||||
|
||||
export interface LoyaltyPageRefs
|
||||
extends z.output<typeof loyaltyPageRefsSchema> {}
|
||||
|
||||
export interface GetLoyaltyPageSchema
|
||||
extends z.input<typeof loyaltyPageSchema> {}
|
||||
|
||||
export interface LoyaltyPage extends z.output<typeof loyaltyPageSchema> {}
|
||||
|
||||
export type Block = z.output<typeof blocksSchema>
|
||||
|
||||
export type SidebarBlock = z.output<typeof sidebarSchema>
|
||||
12
types/trpc/routers/contentstack/sidebar.ts
Normal file
12
types/trpc/routers/contentstack/sidebar.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { joinLoyaltyContactSidebarSchema } from "@/server/routers/contentstack/loyaltyPage/output"
|
||||
import { contactSchema } from "@/server/routers/contentstack/schemas/sidebar/joinLoyaltyContact"
|
||||
|
||||
export interface JoinLoyaltyContact
|
||||
extends z.output<typeof joinLoyaltyContactSidebarSchema> {}
|
||||
type ContactsSchema = z.output<typeof contactSchema>
|
||||
export type Contacts = ContactsSchema["contact"]
|
||||
export interface Contact {
|
||||
contact: NonNullable<Contacts[number]>
|
||||
}
|
||||
8
types/trpc/routers/hotel/locations.ts
Normal file
8
types/trpc/routers/hotel/locations.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { apiLocationsSchema } from "@/server/routers/hotels/output"
|
||||
|
||||
export interface LocationSchema extends z.output<typeof apiLocationsSchema> {}
|
||||
|
||||
export type Locations = LocationSchema["data"]
|
||||
export type Location = Locations[number]
|
||||
5
types/trpc/routers/utils/embeds.ts
Normal file
5
types/trpc/routers/utils/embeds.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { z } from "zod"
|
||||
|
||||
import { contentEmbedsSchema } from "@/server/routers/contentstack/schemas/blocks/contentEmbeds"
|
||||
|
||||
export type Embeds = z.output<typeof contentEmbedsSchema>
|
||||
Reference in New Issue
Block a user