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"
export default function Puff({ imageConnection, is_internal, link, link_text, pageConnection, system, text, title }: PuffProps) {
return is_internal ? (
<Link className={styles.link} href={link.href}>
<PuffContent
imageConnection={imageConnection}
text={text}
title={title}
/>
</Link>
) : (
export default function Puff({ imageConnection, is_internal, link, link_text, pageConnection, text, title }: PuffProps) {
if (is_internal) {
const page = pageConnection.edges[0]
if (!page?.node?.url) {
return null
}
return (
<Link className={styles.link} href={page.node.url}>
<PuffContent
imageConnection={imageConnection}
text={text}
title={title}
/>
</Link>
)
}
return (
<a className={styles.link} href={link.href} target="_blank">
<PuffContent
imageConnection={imageConnection}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,5 +1,4 @@
import type { SysAsset } from "./utils/asset"
import type { TempPageLinkType } from "./utils/tempPageLink"
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 { Edges } from "./utils/edges"
import type { Embeds } from "./embeds"
import type { TempPageLink } from "./utils/tempPageLink"
import type { PageLink } from "./utils/pageLink"
import type { RTEDocument } from "../rte/node"
@@ -13,7 +12,7 @@ export type Puff = {
title: string
}
link_text?: string
pageConnection: Edges<TempPageLink | PageLink>
pageConnection: Edges<PageLink>
system: {
uid: string
}

View File

@@ -1,7 +1,6 @@
export enum EmbedEnum {
CurrentBlocksPage = "CurrentBlocksPage",
SysAsset = "SysAsset",
TempPage = "TempPage",
}
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>