From e854d88d898a83f0c951cb1b33e61cd2526b4aba Mon Sep 17 00:00:00 2001 From: DrMint <29893320+DrMint@users.noreply.github.com> Date: Sat, 22 Jun 2024 21:21:56 +0200 Subject: [PATCH] Added files support in folders and collectibles --- .env.example | 2 + TODO.md | 3 + package.json | 2 +- src/components/DownloadButton.astro | 23 +- src/components/Lightbox.astro | 2 +- src/components/Previews/FilePreview.astro | 71 +++++ src/i18n/wordings-keys.ts | 5 +- src/icons/image-file.svg | 8 + src/icons/pdf-file.svg | 8 + src/pages/[locale]/audios/[id].astro | 4 +- .../[slug]/_components/SubFilesSection.astro | 52 ++++ .../collectibles/[slug]/gallery/[index].astro | 5 +- .../[locale]/collectibles/[slug]/index.astro | 4 +- src/pages/[locale]/files/[id].astro | 200 ++++++++++++ src/pages/[locale]/folders/[slug].astro | 4 + src/pages/[locale]/images/[id].astro | 5 +- src/pages/[locale]/videos/[id].astro | 4 +- src/shared/openExchange/rates.json | 288 +++++++++--------- src/shared/payload/payload-sdk.ts | 152 ++++++--- src/utils/attributes.ts | 25 ++ src/utils/payload.ts | 17 +- 21 files changed, 682 insertions(+), 202 deletions(-) create mode 100644 src/components/Previews/FilePreview.astro create mode 100644 src/icons/image-file.svg create mode 100644 src/icons/pdf-file.svg create mode 100644 src/pages/[locale]/collectibles/[slug]/_components/SubFilesSection.astro create mode 100644 src/pages/[locale]/files/[id].astro diff --git a/.env.example b/.env.example index b46b414..be79076 100644 --- a/.env.example +++ b/.env.example @@ -8,6 +8,8 @@ PAYLOAD_USER=myemail@domain.com PAYLOAD_PASSWORD=somepassword123 WEB_HOOK_TOKEN=webhookd5e6ea45ef4e66eaa151612bdcb599df +ENABLE_PRECACHING=true + ## OPEN EXCHANGE RATE OER_APP_ID=oerappid5e6ea45ef4e66eaa151612bdcb599df diff --git a/TODO.md b/TODO.md index 2d40642..90e0ef1 100644 --- a/TODO.md +++ b/TODO.md @@ -9,6 +9,7 @@ ## Short term +- [Bugs] On android Chrome, the setting button in the header flashes for a few ms when the page is loading - [Feat] [caching] Use getURLs for precaching + precache everything - [Bugs] Make sure uploads name are slug-like and with an extension. - [Bugs] Nyupun can't upload subtitles files @@ -42,6 +43,8 @@ ## Long term +- [Feat] Invalidate Back/Forward Cache when changing language/theme/currency +- [Feat] Hovering on a preview card could give a more detailed summary/preview (with all attributes) - [Feat] Explore posibilities for View Transitions - [Feat] Revemp theme system using light-dark https://caniuse.com/mdn-css_types_color_light-dark - [Feat] Add reduce motion to element that zoom when hovering diff --git a/package.json b/package.json index d420064..3b81ee2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "v3.accords-library.com", - "version": "3.0.0-beta.5", + "version": "3.0.0-beta.6", "scripts": { "dev": "astro dev", "start": "astro dev", diff --git a/src/components/DownloadButton.astro b/src/components/DownloadButton.astro index f51808e..248a9f6 100644 --- a/src/components/DownloadButton.astro +++ b/src/components/DownloadButton.astro @@ -5,16 +5,21 @@ import Button from "./Button.astro"; interface Props { href: string; filename: string; + useBlob?: boolean; } -const { href, filename } = Astro.props; +const { href, filename, useBlob = false } = Astro.props; const { t } = await getI18n(Astro.locals.currentLocale); --- {/* ------------------------------------------- HTML ------------------------------------------- */} - +