feat: remove temppage

This commit is contained in:
Simon Emanuelsson
2024-02-12 15:40:02 +01:00
parent e11186933b
commit b103d9ef12
14 changed files with 22 additions and 58 deletions

View File

@@ -8,16 +8,23 @@ import styles from "./puff.module.css"
import type { PuffProps } from "@/types/components/current/asides/puff" import type { PuffProps } from "@/types/components/current/asides/puff"
export default function Puff({ imageConnection, is_internal, link, link_text, pageConnection, system, text, title }: PuffProps) { export default function Puff({ imageConnection, is_internal, link, link_text, pageConnection, text, title }: PuffProps) {
return is_internal ? ( if (is_internal) {
<Link className={styles.link} href={link.href}> const page = pageConnection.edges[0]
<PuffContent if (!page?.node?.url) {
imageConnection={imageConnection} return null
text={text} }
title={title} return (
/> <Link className={styles.link} href={page.node.url}>
</Link> <PuffContent
) : ( imageConnection={imageConnection}
text={text}
title={title}
/>
</Link>
)
}
return (
<a className={styles.link} href={link.href} target="_blank"> <a className={styles.link} href={link.href} target="_blank">
<PuffContent <PuffContent
imageConnection={imageConnection} imageConnection={imageConnection}

View File

@@ -30,7 +30,6 @@ fragment ListItemInternalLink on CurrentBlocksPageBlocksListBlockListItemsListIt
node { node {
__typename __typename
...CurrentBlocksPageLink ...CurrentBlocksPageLink
...TempPageLink
} }
} }
} }

View File

@@ -11,7 +11,6 @@ fragment TextBlock on CurrentBlocksPageBlocksText {
__typename __typename
...CurrentBlocksPageLink ...CurrentBlocksPageLink
...Image ...Image
...TempPageLink
} }
} }
} }

View File

@@ -11,13 +11,6 @@ fragment Breadcrumbs on CurrentBlocksPage {
title title
url url
} }
... on TempPage {
breadcrumbs {
title
}
title
url
}
} }
} }
} }

View File

@@ -11,7 +11,6 @@ fragment Navigation on Footer {
edges { edges {
node { node {
__typename __typename
...TempPageLink
...CurrentBlocksPageLink ...CurrentBlocksPageLink
} }
} }

View File

@@ -6,12 +6,3 @@ fragment CurrentBlocksPageLink on CurrentBlocksPage {
title title
url url
} }
fragment TempPageLink on TempPage {
system {
uid
locale
}
title
url
}

View File

@@ -11,7 +11,6 @@ fragment Preamble on CurrentBlocksPage {
__typename __typename
...CurrentBlocksPageLink ...CurrentBlocksPageLink
...Image ...Image
...TempPageLink
} }
} }
} }

View File

@@ -20,7 +20,6 @@ fragment Puff on Puff {
node { node {
__typename __typename
...CurrentBlocksPageLink ...CurrentBlocksPageLink
...TempPageLink
} }
} }
} }

View File

@@ -1,7 +1,6 @@
import type { Edges } from "../utils/edges" import type { Edges } from "../utils/edges"
import type { TempPageLink } from "../utils/tempPageLink"
import type { PageLink } from "../utils/pageLink" import type { PageLink } from "../utils/pageLink"
import { Typename } from "../utils/typename" import type { Typename } from "../utils/typename"
enum ListItemStyleEnum { enum ListItemStyleEnum {
checkmark = "checkmark", checkmark = "checkmark",
@@ -36,7 +35,7 @@ type InternalLinkListItem = Typename<
link_text?: string link_text?: string
list_item_style: ListItemStyle list_item_style: ListItemStyle
subtitle?: string subtitle?: string
pageConnection: Edges<TempPageLink | PageLink> pageConnection: Edges<PageLink>
} }
}, },
BlockListItemsEnum.CurrentBlocksPageBlocksListBlockListItemsListItemInternalLink BlockListItemsEnum.CurrentBlocksPageBlocksListBlockListItemsListItemInternalLink

View File

@@ -33,11 +33,7 @@ export interface CurrentBlocksPageBreadcrumb extends SharedBreadcrumb {
__typename: EmbedEnum.CurrentBlocksPage __typename: EmbedEnum.CurrentBlocksPage
} }
export interface TempPageBreadcrumb extends SharedBreadcrumb { export type Breadcrumb = CurrentBlocksPageBreadcrumb
__typename: EmbedEnum.TempPage
}
export type Breadcrumb = CurrentBlocksPageBreadcrumb | TempPageBreadcrumb
export type Breadcrumbs = { export type Breadcrumbs = {
parentsConnection: Edges<Breadcrumb> parentsConnection: Edges<Breadcrumb>

View File

@@ -1,5 +1,4 @@
import type { SysAsset } from "./utils/asset" import type { SysAsset } from "./utils/asset"
import type { TempPageLinkType } from "./utils/tempPageLink"
import type { PageLinkType } from "./utils/pageLink" import type { PageLinkType } from "./utils/pageLink"
export type Embeds = TempPageLinkType | PageLinkType | SysAsset export type Embeds = PageLinkType | SysAsset

View File

@@ -1,7 +1,6 @@
import type { Image } from "../image" import type { Image } from "../image"
import type { Edges } from "./utils/edges" import type { Edges } from "./utils/edges"
import type { Embeds } from "./embeds" import type { Embeds } from "./embeds"
import type { TempPageLink } from "./utils/tempPageLink"
import type { PageLink } from "./utils/pageLink" import type { PageLink } from "./utils/pageLink"
import type { RTEDocument } from "../rte/node" import type { RTEDocument } from "../rte/node"
@@ -13,7 +12,7 @@ export type Puff = {
title: string title: string
} }
link_text?: string link_text?: string
pageConnection: Edges<TempPageLink | PageLink> pageConnection: Edges<PageLink>
system: { system: {
uid: string uid: string
} }

View File

@@ -1,7 +1,6 @@
export enum EmbedEnum { export enum EmbedEnum {
CurrentBlocksPage = "CurrentBlocksPage", CurrentBlocksPage = "CurrentBlocksPage",
SysAsset = "SysAsset", SysAsset = "SysAsset",
TempPage = "TempPage",
} }
export type Embed = keyof typeof EmbedEnum export type Embed = keyof typeof EmbedEnum

View File

@@ -1,14 +0,0 @@
import { Lang } from "@/types/lang"
import type { EmbedEnum } from "./embeds"
import type { Typename } from "./typename"
export type TempPageLink = {
system: {
uid: string
locale: Lang
}
title: string
url: string
}
export type TempPageLinkType = Typename<TempPageLink, EmbedEnum.TempPage>