fix: add my pages nav sidebar for logged in users

This commit is contained in:
Christel Westerberg
2024-07-01 11:30:34 +02:00
parent 323df671d8
commit d206d576a7
13 changed files with 101 additions and 52 deletions

View File

@@ -8,6 +8,7 @@ import {
LoyaltyBlocksTypenameEnum,
LoyaltyCardsGridEnum,
LoyaltyComponentEnum,
LoyaltySidebarDynamicComponentEnum,
SidebarTypenameEnum,
} from "@/types/components/loyalty/enums"
import { Embeds } from "@/types/requests/embeds"
@@ -166,8 +167,16 @@ const loyaltyPageJoinLoyaltyContact = z.object({
}),
})
const loyaltyPageSidebarDynamicContent = z.object({
__typename: z.literal(SidebarTypenameEnum.LoyaltyPageSidebarDynamicContent),
dynamic_content: z.object({
component: z.nativeEnum(LoyaltySidebarDynamicComponentEnum),
}),
})
const loyaltyPageSidebarItem = z.discriminatedUnion("__typename", [
loyaltyPageSidebarTextContent,
loyaltyPageSidebarDynamicContent,
loyaltyPageJoinLoyaltyContact,
])
@@ -226,8 +235,13 @@ export type RteSidebarContent = Omit<SidebarContentRaw, "content"> & {
}
}
}
type SideBarDynamicContent = z.infer<typeof loyaltyPageSidebarDynamicContent>
export type JoinLoyaltyContact = z.infer<typeof loyaltyPageJoinLoyaltyContact>
export type Sidebar = JoinLoyaltyContact | RteSidebarContent
export type Sidebar =
| JoinLoyaltyContact
| RteSidebarContent
| SideBarDynamicContent
type LoyaltyPageDataRaw = z.infer<typeof validateLoyaltyPageSchema>
export type LoyaltyPage = Omit<LoyaltyPageDataRaw, "blocks" | "sidebar"> & {