From ec70acdf50a4dde4ddb8824535afd2781935a9b3 Mon Sep 17 00:00:00 2001 From: DrMint <29893320+DrMint@users.noreply.github.com> Date: Mon, 8 Apr 2024 13:59:09 +0200 Subject: [PATCH] Support for video/audio/images in folders + collectibles + media pages --- TODO.md | 6 +- src/components/AudioPlayer.astro | 27 +++++++ src/components/Button.astro | 10 ++- src/components/DownloadButton.astro | 44 +++++++++++ src/components/Link.astro | 8 ++ src/components/Previews/AudioPreview.astro | 38 +++++++++ .../Previews/CollectiblePreview.astro | 4 +- src/components/Previews/GenericPreview.astro | 79 +++++++++++++++---- src/components/Previews/ImagePreview.astro | 30 +++++++ src/components/Previews/PagePreview.astro | 4 +- src/components/Previews/VideoPreview.astro | 29 +++++++ .../RTLink/components/RTInternalLink.astro | 7 +- .../RTUpload/components/RTAudio.astro | 36 +++------ .../RTUpload/components/RTImage.astro | 14 ++-- .../RTUpload/components/RTVideo.astro | 39 +++------ src/components/VideoPlayer.astro | 33 ++++++++ src/i18n/wordings-keys.ts | 9 ++- src/pages/[locale]/audios/[id].astro | 63 +++++++++++++++ .../ContentsSection/ContentRow.astro | 66 +++++++++++++--- .../ContentsSection/InlineTagGroups.astro | 20 ++++- src/pages/[locale]/folders/[slug].astro | 19 ++++- src/pages/[locale]/images/[id].astro | 67 ++++++++++++++++ src/pages/[locale]/videos/[id].astro | 65 +++++++++++++++ 23 files changed, 613 insertions(+), 104 deletions(-) create mode 100644 src/components/AudioPlayer.astro create mode 100644 src/components/DownloadButton.astro create mode 100644 src/components/Previews/AudioPreview.astro create mode 100644 src/components/Previews/ImagePreview.astro create mode 100644 src/components/Previews/VideoPreview.astro create mode 100644 src/components/VideoPlayer.astro create mode 100644 src/pages/[locale]/audios/[id].astro create mode 100644 src/pages/[locale]/images/[id].astro create mode 100644 src/pages/[locale]/videos/[id].astro diff --git a/TODO.md b/TODO.md index e4830d8..b7c0b9c 100644 --- a/TODO.md +++ b/TODO.md @@ -3,13 +3,10 @@ ## Short term - [Timeline] inline links to pages not working (timeline 2026/06) -- Save cookies for longer than just the session -- [Image] media page -- [Video] media page -- [Audio] media page ## Mid term +- Save cookies for longer than just the session - [Scripts] Can't run the scripts using node (ts-node?) - Support for nameless section - [Timeline] Error if collectible not published? @@ -34,6 +31,7 @@ - Consider official search plugin for payload https://payloadcms.com/docs/plugins/search - Convert Rich text to simple text for indexing and open graph purposes - Anonymous comments +- [Images] add images group (which could be named or not) ## Bonus diff --git a/src/components/AudioPlayer.astro b/src/components/AudioPlayer.astro new file mode 100644 index 0000000..3e1bc00 --- /dev/null +++ b/src/components/AudioPlayer.astro @@ -0,0 +1,27 @@ +--- +import type { EndpointAudio } from "src/shared/payload/payload-sdk"; + +interface Props { + audio: EndpointAudio; +} + +const { + audio: { url, mimeType }, +} = Astro.props; +--- + +{/* ------------------------------------------- HTML ------------------------------------------- */} + + + +{/* ------------------------------------------- CSS -------------------------------------------- */} + + diff --git a/src/components/Button.astro b/src/components/Button.astro index fe61371..74ed15b 100644 --- a/src/components/Button.astro +++ b/src/components/Button.astro @@ -46,9 +46,13 @@ const { title, icon, class: className, ariaLabel, id } = Astro.props; transition-duration: 250ms; transition-property: padding-top, box-shadow, background-color, color, border-color; - &.with-title > svg { - width: 1.2em; - height: 1.2em; + &.with-title { + padding-right: 1.2em; + + & > svg { + width: 1.2em; + height: 1.2em; + } } > svg { diff --git a/src/components/DownloadButton.astro b/src/components/DownloadButton.astro new file mode 100644 index 0000000..f51808e --- /dev/null +++ b/src/components/DownloadButton.astro @@ -0,0 +1,44 @@ +--- +import { getI18n } from "src/i18n/i18n"; +import Button from "./Button.astro"; + +interface Props { + href: string; + filename: string; +} + +const { href, filename } = Astro.props; + +const { t } = await getI18n(Astro.locals.currentLocale); +--- + +{/* ------------------------------------------- HTML ------------------------------------------- */} + + +