feat: add initial RTE rendering to AccountPage
This commit is contained in:
@@ -6,13 +6,15 @@ import {
|
|||||||
DynamicContent,
|
DynamicContent,
|
||||||
DynamicContentComponents,
|
DynamicContentComponents,
|
||||||
} from "@/types/requests/myPages/accountpage"
|
} from "@/types/requests/myPages/accountpage"
|
||||||
|
import { User } from "@/types/user"
|
||||||
|
|
||||||
import CurrentBenefitsBlock from "@/components/MyPages/Blocks/Benefits/CurrentLevel"
|
import CurrentBenefitsBlock from "@/components/MyPages/Blocks/Benefits/CurrentLevel"
|
||||||
|
import JsonToHtml from "@/components/JsonToHtml"
|
||||||
import NextLevelBenefitsBlock from "@/components/MyPages/Blocks/Benefits/NextLevel"
|
import NextLevelBenefitsBlock from "@/components/MyPages/Blocks/Benefits/NextLevel"
|
||||||
import Overview from "@/components/MyPages/Blocks/Overview"
|
import Overview from "@/components/MyPages/Blocks/Overview"
|
||||||
import Shortcuts from "@/components/MyPages/Blocks/Shortcuts"
|
import Shortcuts from "@/components/MyPages/Blocks/Shortcuts"
|
||||||
import UpcomingStays from "@/components/MyPages/Blocks/Stays/Upcoming"
|
import UpcomingStays from "@/components/MyPages/Blocks/Stays/Upcoming"
|
||||||
import { User } from "@/types/user"
|
import { renderOptions } from "@/components/JsonToHtml/renderOptions"
|
||||||
|
|
||||||
function DynamicComponent({
|
function DynamicComponent({
|
||||||
user,
|
user,
|
||||||
@@ -93,6 +95,15 @@ export default function Content({
|
|||||||
title={item.title}
|
title={item.title}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
case ContentEntries.AccountPageContentTextContent:
|
||||||
|
console.log({ item })
|
||||||
|
return (
|
||||||
|
<JsonToHtml
|
||||||
|
embeds={[]}
|
||||||
|
nodes={item.text_content.content.json.children}
|
||||||
|
renderOptions={renderOptions}
|
||||||
|
/>
|
||||||
|
)
|
||||||
default:
|
default:
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
fragment AccountPageContentTextContent on AccountPageContentTextContent {
|
||||||
|
text_content {
|
||||||
|
content {
|
||||||
|
json
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
#import "../Fragments/MyPages/AccountPage/AccountPageContentDynamicContent.graphql"
|
#import "../Fragments/MyPages/AccountPage/AccountPageContentDynamicContent.graphql"
|
||||||
#import "../Fragments/MyPages/AccountPage/AccountPageContentShortcuts.graphql"
|
#import "../Fragments/MyPages/AccountPage/AccountPageContentShortcuts.graphql"
|
||||||
|
#import "../Fragments/MyPages/AccountPage/AccountPageContentTextContent.graphql"
|
||||||
|
|
||||||
query GetAccountPage($locale: String!, $url: String!) {
|
query GetAccountPage($locale: String!, $url: String!) {
|
||||||
all_account_page(limit: 1, locale: $locale, where: { url: $url }) {
|
all_account_page(limit: 1, locale: $locale, where: { url: $url }) {
|
||||||
@@ -10,6 +11,7 @@ query GetAccountPage($locale: String!, $url: String!) {
|
|||||||
__typename
|
__typename
|
||||||
...AccountPageContentDynamicContent
|
...AccountPageContentDynamicContent
|
||||||
...AccountPageContentShortcuts
|
...AccountPageContentShortcuts
|
||||||
|
...AccountPageContentTextContent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
total
|
total
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { AllRequestResponse } from "../utils/all"
|
|||||||
import type { Typename } from "../utils/typename"
|
import type { Typename } from "../utils/typename"
|
||||||
import type { Edges } from "../utils/edges"
|
import type { Edges } from "../utils/edges"
|
||||||
import { PageLink } from "../utils/pageLink"
|
import { PageLink } from "../utils/pageLink"
|
||||||
|
import { RTEDocument } from "@/types/rte/node"
|
||||||
|
|
||||||
export enum DynamicContentComponents {
|
export enum DynamicContentComponents {
|
||||||
membership_overview = "membership_overview",
|
membership_overview = "membership_overview",
|
||||||
@@ -15,6 +16,7 @@ export enum DynamicContentComponents {
|
|||||||
export enum ContentEntries {
|
export enum ContentEntries {
|
||||||
AccountPageContentDynamicContent = "AccountPageContentDynamicContent",
|
AccountPageContentDynamicContent = "AccountPageContentDynamicContent",
|
||||||
AccountPageContentShortcuts = "AccountPageContentShortcuts",
|
AccountPageContentShortcuts = "AccountPageContentShortcuts",
|
||||||
|
AccountPageContentTextContent = "AccountPageContentTextContent",
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Shortcut = {
|
export type Shortcut = {
|
||||||
@@ -43,9 +45,21 @@ export type AccountPageContentShortcuts = Typename<
|
|||||||
ContentEntries.AccountPageContentShortcuts
|
ContentEntries.AccountPageContentShortcuts
|
||||||
>
|
>
|
||||||
|
|
||||||
|
export type AccountPageContentTextContent = Typename<
|
||||||
|
{
|
||||||
|
text_content: {
|
||||||
|
content: {
|
||||||
|
json: RTEDocument
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
ContentEntries.AccountPageContentTextContent
|
||||||
|
>
|
||||||
|
|
||||||
export type AccountPageContentItem =
|
export type AccountPageContentItem =
|
||||||
| AccountPageDynamicContent
|
| AccountPageDynamicContent
|
||||||
| AccountPageContentShortcuts
|
| AccountPageContentShortcuts
|
||||||
|
| AccountPageContentTextContent
|
||||||
|
|
||||||
export type AccountPage = {
|
export type AccountPage = {
|
||||||
url: string
|
url: string
|
||||||
|
|||||||
Reference in New Issue
Block a user