From 470ba034027686ad0b7aa00f6895b07ef9d218e0 Mon Sep 17 00:00:00 2001 From: DrMint <29893320+DrMint@users.noreply.github.com> Date: Fri, 10 May 2024 11:24:44 +0200 Subject: [PATCH] Added gallery and scans pages --- TODO.md | 13 +- prettier.config.js => prettier.config.cjs | 0 .../InlineTagGroups.astro | 0 src/components/Lightbox.astro | 118 ++++++++ src/components/Previews/GenericPreview.astro | 2 +- src/i18n/i18n.ts | 59 ++++ src/i18n/wordings-keys.ts | 42 ++- .../_components/AvailabilityInfo.astro | 0 .../ContentsSection/ContentRow.astro | 2 +- .../ContentsSection/ContentsSection.astro | 0 .../{ => [slug]}/_components/ImageTile.astro | 15 +- .../{ => [slug]}/_components/PageInfo.astro | 0 .../{ => [slug]}/_components/PriceInfo.astro | 0 .../_components/ReleaseDateInfo.astro | 0 .../{ => [slug]}/_components/SizeInfo.astro | 0 .../_components/SubitemSection.astro | 0 .../{ => [slug]}/_components/WeightInfo.astro | 0 .../collectibles/[slug]/gallery/[index].astro | 42 +++ .../collectibles/[slug]/gallery/index.astro | 80 ++++++ .../{[slug].astro => [slug]/index.astro} | 39 +-- .../collectibles/[slug]/scans/[index].astro | 34 +++ .../scans/_components/ScanPreview.astro | 49 ++++ .../collectibles/[slug]/scans/index.astro | 215 ++++++++++++++ src/pages/[locale]/images/[id].astro | 68 +---- src/shared/payload/payload-sdk.ts | 263 +++++++++++++----- 25 files changed, 872 insertions(+), 169 deletions(-) rename prettier.config.js => prettier.config.cjs (100%) rename src/{pages/[locale]/collectibles/_components/ContentsSection => components}/InlineTagGroups.astro (100%) create mode 100644 src/components/Lightbox.astro rename src/pages/[locale]/collectibles/{ => [slug]}/_components/AvailabilityInfo.astro (100%) rename src/pages/[locale]/collectibles/{ => [slug]}/_components/ContentsSection/ContentRow.astro (98%) rename src/pages/[locale]/collectibles/{ => [slug]}/_components/ContentsSection/ContentsSection.astro (100%) rename src/pages/[locale]/collectibles/{ => [slug]}/_components/ImageTile.astro (86%) rename src/pages/[locale]/collectibles/{ => [slug]}/_components/PageInfo.astro (100%) rename src/pages/[locale]/collectibles/{ => [slug]}/_components/PriceInfo.astro (100%) rename src/pages/[locale]/collectibles/{ => [slug]}/_components/ReleaseDateInfo.astro (100%) rename src/pages/[locale]/collectibles/{ => [slug]}/_components/SizeInfo.astro (100%) rename src/pages/[locale]/collectibles/{ => [slug]}/_components/SubitemSection.astro (100%) rename src/pages/[locale]/collectibles/{ => [slug]}/_components/WeightInfo.astro (100%) create mode 100644 src/pages/[locale]/collectibles/[slug]/gallery/[index].astro create mode 100644 src/pages/[locale]/collectibles/[slug]/gallery/index.astro rename src/pages/[locale]/collectibles/{[slug].astro => [slug]/index.astro} (84%) create mode 100644 src/pages/[locale]/collectibles/[slug]/scans/[index].astro create mode 100644 src/pages/[locale]/collectibles/[slug]/scans/_components/ScanPreview.astro create mode 100644 src/pages/[locale]/collectibles/[slug]/scans/index.astro diff --git a/TODO.md b/TODO.md index 3335f12..6007070 100644 --- a/TODO.md +++ b/TODO.md @@ -2,21 +2,28 @@ ## Short term -- [Medias] Add Parent pages - [Timeline] inline links to pages not working (timeline 2026/06) +- Fix inconsistency with material-icon in Payload (with or without material-icon prefix) +- [Media] display filename alongside the localized title. +- [Media] Have a title, subtitle, pretitle just like everything else +- Background images some times lack gradient at the bottom and fade in before they could load +- Number of audio players seems limited (on Chrome and Firefox) ## Mid term +- [Medias] Add Parent pages +- [Scans] Adapt size of obi based on cover/dustjacket +- [Scans] Order of cover/dustjacket/obi should be based on the book's page order. +- [RichTextContent] Add autolink block support - 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? - [Timeline] Handle no JS for footers - [Timeline] Add details button in footer with credits + last updated / created -- [Collectibles] Create page for gallery -- [Collectibles] Create page for scans - When the tags overflow, the tag group name should be align start (see http://localhost:12499/en/pages/magnitude-negative-chapter-1) - [SDK] create a initPayload() that return a payload sdk (and stop hard wirring to ENV or node-cache) +- [Videos] see why no video on Firefox and no poster on Chrome https://v3.accords-library.com/en/videos/661b672825d380e548dbb8c8 ## Long term diff --git a/prettier.config.js b/prettier.config.cjs similarity index 100% rename from prettier.config.js rename to prettier.config.cjs diff --git a/src/pages/[locale]/collectibles/_components/ContentsSection/InlineTagGroups.astro b/src/components/InlineTagGroups.astro similarity index 100% rename from src/pages/[locale]/collectibles/_components/ContentsSection/InlineTagGroups.astro rename to src/components/InlineTagGroups.astro diff --git a/src/components/Lightbox.astro b/src/components/Lightbox.astro new file mode 100644 index 0000000..d865e46 --- /dev/null +++ b/src/components/Lightbox.astro @@ -0,0 +1,118 @@ +--- +import Button from "components/Button.astro"; +import { + type EndpointCredit, + type EndpointTagsGroup, + type PayloadImage, + type RichTextContent, +} from "src/shared/payload/payload-sdk"; +import RichText from "./RichText/RichText.astro"; +import TagGroups from "./TagGroups.astro"; +import Credits from "./Credits.astro"; +import DownloadButton from "./DownloadButton.astro"; + +interface Props { + previousImageHref?: string | undefined; + nextImageHref?: string | undefined; + image: PayloadImage; + title: string; + description?: RichTextContent | undefined; + tagGroups?: EndpointTagsGroup[] | undefined; + credits?: EndpointCredit[] | undefined; + filename?: string | undefined; +} + +const { + nextImageHref, + previousImageHref, + image: { url, width, height }, + tagGroups, + credits, + description, + title, + filename, +} = Astro.props; +--- + +{/* ------------------------------------------- HTML ------------------------------------------- */} + +
{formatScanIndexShort(index)}
+ + +{/* ------------------------------------------- CSS -------------------------------------------- */} + + diff --git a/src/pages/[locale]/collectibles/[slug]/scans/index.astro b/src/pages/[locale]/collectibles/[slug]/scans/index.astro new file mode 100644 index 0000000..69f4268 --- /dev/null +++ b/src/pages/[locale]/collectibles/[slug]/scans/index.astro @@ -0,0 +1,215 @@ +--- +import AppEmptyLayout from "components/AppLayout/AppEmptyLayout.astro"; +import AppLayoutTitle from "components/AppLayout/components/AppLayoutTitle.astro"; +import Credits from "components/Credits.astro"; +import RichText from "components/RichText/RichText.astro"; +import { getI18n } from "src/i18n/i18n"; +import { payload } from "src/shared/payload/payload-sdk"; +import { fetchOr404 } from "src/utils/responses"; +import ScanPreview from "./_components/ScanPreview.astro"; + +const slug = Astro.params.slug!; +const { getLocalizedMatch, t } = await getI18n(Astro.locals.currentLocale); + +const scans = await fetchOr404(() => payload.getCollectibleScans(slug)); +if (scans instanceof Response) { + return scans; +} + +const { translations, credits, cover, pages, dustjacket, obi, parentPages } = scans; + +const translation = getLocalizedMatch(translations); + +const hasInsideCover = cover ? Object.keys(cover).some((value) => value.includes("inside")) : false; +const hasOutsideCover = cover + ? Object.keys(cover).some((value) => !value.includes("inside")) + : false; + +const hasInsideDustjacket = dustjacket + ? Object.keys(dustjacket).some((value) => value.includes("inside")) + : false; +const hasOutsideDustjacket = dustjacket + ? Object.keys(dustjacket).some((value) => !value.includes("inside")) + : false; + +const hasInsideObi = obi ? Object.keys(obi).some((value) => value.includes("inside")) : false; +const hasOutsideObi = obi ? Object.keys(obi).some((value) => !value.includes("inside")) : false; +--- + +{/* ------------------------------------------- HTML ------------------------------------------- */} + +{t("collectibles.scans.dustjacket.description")}
+{t("collectibles.scans.obi.description")}
+