From 9a1cbd28f726a049a3d1b616d432de2b2173e469 Mon Sep 17 00:00:00 2001 From: DrMint <29893320+DrMint@users.noreply.github.com> Date: Fri, 5 Apr 2024 22:43:18 +0200 Subject: [PATCH] Added tsc build --- .../AppLayout/components/Html.astro | 51 +++++++++++++++---- .../components/RTUpload/RTUpload.astro | 17 ++++++- .../RTUpload/components/RTAudio.astro | 32 ++++++++++++ .../RTUpload/components/RTVideo.astro | 29 +++++++++++ src/i18n/wordings-keys.ts | 20 ++++---- src/shared/payload/payload-sdk.ts | 20 +++++++- 6 files changed, 146 insertions(+), 23 deletions(-) create mode 100644 src/components/RichText/components/RTUpload/components/RTAudio.astro create mode 100644 src/components/RichText/components/RTUpload/components/RTVideo.astro diff --git a/src/components/AppLayout/components/Html.astro b/src/components/AppLayout/components/Html.astro index 6e3551a..33b6416 100644 --- a/src/components/AppLayout/components/Html.astro +++ b/src/components/AppLayout/components/Html.astro @@ -50,14 +50,23 @@ const { currentTheme } = Astro.locals; "light-theme": currentTheme === "light", "dark-theme": currentTheme === "dark", "texture-dots": !isIOS, - }}> + }} +> - - + + {/* Meta & OpenGraph */} @@ -71,7 +80,10 @@ const { currentTheme } = Astro.locals; - + @@ -121,7 +133,9 @@ const { currentTheme } = Astro.locals; -{/* ------------------------------------------- CSS -------------------------------------------- */} +{ + /* ------------------------------------------- CSS -------------------------------------------- */ +} -{/* ------------------------------------------- JS --------------------------------------------- */} +{ + /* ------------------------------------------- JS --------------------------------------------- */ +} diff --git a/src/components/RichText/components/RTUpload/RTUpload.astro b/src/components/RichText/components/RTUpload/RTUpload.astro index ea943e9..005046b 100644 --- a/src/components/RichText/components/RTUpload/RTUpload.astro +++ b/src/components/RichText/components/RTUpload/RTUpload.astro @@ -1,8 +1,15 @@ --- -import { isUploadNodeImageNode, type RichTextUploadNode } from "src/shared/payload/payload-sdk"; +import { + isUploadNodeAudioNode, + isUploadNodeImageNode, + isUploadNodeVideoNode, + type RichTextUploadNode, +} from "src/shared/payload/payload-sdk"; import type { RichTextContext } from "src/utils/richText"; import RTImage from "./components/RTImage.astro"; import ErrorMessage from "components/ErrorMessage.astro"; +import RTAudio from "./components/RTAudio.astro"; +import RTVideo from "./components/RTVideo.astro"; interface Props { node: RichTextUploadNode; @@ -12,11 +19,17 @@ interface Props { const { node, context } = Astro.props; --- -{/* ------------------------------------------- HTML ------------------------------------------- */} +{ + /* ------------------------------------------- HTML ------------------------------------------- */ +} { isUploadNodeImageNode(node) ? ( + ) : isUploadNodeAudioNode(node) ? ( + + ) : isUploadNodeVideoNode(node) ? ( + ) : ( + + + +{ + /* ------------------------------------------- CSS -------------------------------------------- */ +} + + diff --git a/src/components/RichText/components/RTUpload/components/RTVideo.astro b/src/components/RichText/components/RTUpload/components/RTVideo.astro new file mode 100644 index 0000000..99a90ad --- /dev/null +++ b/src/components/RichText/components/RTUpload/components/RTVideo.astro @@ -0,0 +1,29 @@ +--- +import { type RichTextUploadVideoNode } from "src/shared/payload/payload-sdk"; +import type { RichTextContext } from "src/utils/richText"; + +interface Props { + node: RichTextUploadVideoNode; + context: RichTextContext; +} + +const { node } = Astro.props; +--- + +{/* ------------------------------------------- HTML ------------------------------------------- */} + + + +{/* ------------------------------------------- CSS -------------------------------------------- */} + + diff --git a/src/i18n/wordings-keys.ts b/src/i18n/wordings-keys.ts index ebccd05..ce368e1 100644 --- a/src/i18n/wordings-keys.ts +++ b/src/i18n/wordings-keys.ts @@ -89,26 +89,26 @@ export type WordingKey = | "pages.tableOfContent.break" | "global.languageOverride.availableLanguages" | "timeline.title" - | "timeline.description" - | "timeline.eras.cataclysm" + | "timeline.eras.drakengard3" | "timeline.eras.drakengard" | "timeline.eras.drakengard2" - | "timeline.eras.drakengard3" | "timeline.eras.nier" | "timeline.eras.nierAutomata" - | "timeline.jumpTo" - | "timeline.notes.content" + | "timeline.eras.cataclysm" + | "timeline.description" | "timeline.notes.title" + | "timeline.notes.content" | "timeline.priorCataclysmNote.title" | "timeline.priorCataclysmNote.content" + | "timeline.jumpTo" | "timeline.year.during" - | "timeline.eventFooter.sources" | "timeline.eventFooter.languages" + | "timeline.eventFooter.sources" | "timeline.eventFooter.note" + | "global.sources.typeLabel.url" + | "global.sources.typeLabel.page" | "global.sources.typeLabel.collectible" - | "global.sources.typeLabel.collectible.range.custom" + | "global.sources.typeLabel.folder" | "global.sources.typeLabel.collectible.range.page" | "global.sources.typeLabel.collectible.range.timestamp" - | "global.sources.typeLabel.folder" - | "global.sources.typeLabel.page" - | "global.sources.typeLabel.url"; + | "global.sources.typeLabel.collectible.range.custom"; diff --git a/src/shared/payload/payload-sdk.ts b/src/shared/payload/payload-sdk.ts index 04564ff..96de979 100644 --- a/src/shared/payload/payload-sdk.ts +++ b/src/shared/payload/payload-sdk.ts @@ -1098,10 +1098,20 @@ export interface RichTextUploadNode extends RichTextNode { } export interface RichTextUploadImageNode extends RichTextUploadNode { - relationTo: "images" | "background-images"; + relationTo: Collections.Images; value: Image; } +export interface RichTextUploadVideoNode extends RichTextUploadNode { + relationTo: Collections.Videos; + value: Video; +} + +export interface RichTextUploadAudioNode extends RichTextUploadNode { + relationTo: Collections.Audios; + value: Audio; +} + export interface RichTextTextNode extends RichTextNode { type: "text"; format: number; @@ -1167,7 +1177,13 @@ export const isNodeUploadNode = (node: RichTextNode): node is RichTextUploadNode node.type === "upload"; export const isUploadNodeImageNode = (node: RichTextUploadNode): node is RichTextUploadImageNode => - node.relationTo === "images" || node.relationTo === "background-images"; + node.relationTo === Collections.Images; + + export const isUploadNodeVideoNode = (node: RichTextUploadNode): node is RichTextUploadVideoNode => + node.relationTo === Collections.Videos; + + export const isUploadNodeAudioNode = (node: RichTextUploadNode): node is RichTextUploadAudioNode => + node.relationTo === Collections.Audios; export const isNodeListNode = (node: RichTextNode): node is RichTextListNode => node.type === "list";