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