From ff8ea6d86a3e509f2b25504ac9e312a4cd67b1c6 Mon Sep 17 00:00:00 2001 From: Arvid Norlin Date: Thu, 11 Apr 2024 10:45:06 +0200 Subject: [PATCH] feat: add LoyaltyPage handling --- .../(live)/(protected)/my-pages/layout.tsx | 2 +- lib/graphql/Query/NavigationMyPages.graphql | 10 ++++++++++ types/requests/myPages/navigation.ts | 17 ++++++++++++++++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/app/[lang]/(live)/(protected)/my-pages/layout.tsx b/app/[lang]/(live)/(protected)/my-pages/layout.tsx index 352aa356d..086e8e28a 100644 --- a/app/[lang]/(live)/(protected)/my-pages/layout.tsx +++ b/app/[lang]/(live)/(protected)/my-pages/layout.tsx @@ -33,6 +33,7 @@ export default async function MyPagesLayout({ case PageLinkEnum.ContentPage: return node.web.url case PageLinkEnum.AccountPage: + case PageLinkEnum.LoyaltyPage: case PageLinkEnum.CodeDefinedPage: return node.url } @@ -40,7 +41,6 @@ export default async function MyPagesLayout({ return navigationItems.map(({ item }): MenuItem => { const { node } = item.pageConnection.edges[0] - console.log({ node }) const { title, system: { uid }, diff --git a/lib/graphql/Query/NavigationMyPages.graphql b/lib/graphql/Query/NavigationMyPages.graphql index 160818e96..09bcadc21 100644 --- a/lib/graphql/Query/NavigationMyPages.graphql +++ b/lib/graphql/Query/NavigationMyPages.graphql @@ -14,6 +14,14 @@ fragment AccountPage on AccountPage { } } +fragment LoyaltyPage on LoyaltyPage { + title + url + system { + uid + } +} + fragment ContentPage on ContentPage { title web { @@ -42,6 +50,7 @@ query GetNavigationMyPages { node { __typename ...AccountPage + ...LoyaltyPage ...CodeDefinedPage ...ContentPage } @@ -55,6 +64,7 @@ query GetNavigationMyPages { node { __typename ...AccountPage + ...LoyaltyPage ...ContentPage ...CodeDefinedPage } diff --git a/types/requests/myPages/navigation.ts b/types/requests/myPages/navigation.ts index b2493c72b..f1f787df3 100644 --- a/types/requests/myPages/navigation.ts +++ b/types/requests/myPages/navigation.ts @@ -6,6 +6,7 @@ export enum PageLinkEnum { AccountPage = "AccountPage", CodeDefinedPage = "CodeDefinedPage", ContentPage = "ContentPage", + LoyaltyPage = "LoyaltyPage", } export type MenuItem = { @@ -28,6 +29,16 @@ export type AccountPageLink = Typename< PageLinkEnum.AccountPage > +export type LoyaltyPageLink = Typename< + { + uid: string + title: string + url: string + system: { uid: string } + }, + PageLinkEnum.LoyaltyPage +> + export type CodeDefinedPageLink = Typename< { uid: string @@ -48,7 +59,11 @@ export type ContentPageLink = Typename< PageLinkEnum.ContentPage > -export type PageLink = CodeDefinedPageLink | ContentPageLink | AccountPageLink +export type PageLink = + | CodeDefinedPageLink + | ContentPageLink + | AccountPageLink + | LoyaltyPageLink export type NavigationItem = { item: {