From f8f98ec41edab22627592a3dfbd60d7999fc115d Mon Sep 17 00:00:00 2001
From: DrMint <29893320+DrMint@users.noreply.github.com>
Date: Thu, 11 May 2023 11:24:36 +0200
Subject: [PATCH] Add download button for scans archives
---
.env.example | 45 +++
README.md | 26 +-
public/local-data/websiteInterfaces.json | 15 +-
src/components/PreviewCard.tsx | 2 +-
src/graphql/icuParams.ts | 1 +
src/graphql/operations/getLibraryItem.graphql | 1 +
.../operations/getLibraryItemScans.graphql | 1 +
.../localDataGetWebsiteInterfaces.graphql | 1 +
src/pages/contents/folder/[slug].tsx | 6 +-
src/pages/library/[slug]/index.tsx | 297 ++++++++++--------
src/pages/library/[slug]/reader.tsx | 9 +
11 files changed, 238 insertions(+), 166 deletions(-)
create mode 100755 .env.example
diff --git a/.env.example b/.env.example
new file mode 100755
index 0000000..b1315e0
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,45 @@
+# /!\ For URLs, don't include the traling '/'
+
+# ┌─────────────────────┐
+# │ PRIVATE VARIABLES │
+# └─────────────────────┘
+
+## STRAPI
+
+URL_GRAPHQL=https://url-to.strapi-accords-library.com/graphql
+ACCESS_TOKEN=abcdef0123456789
+REVALIDATION_TOKEN=abcdef0123456789
+
+## MAILING
+
+SMTP_HOST=email.provider.com
+SMTP_USER=email@example.com
+SMTP_PASSWORD=mypassword123
+
+
+
+# ┌────────────────────┐
+# │ PUBLIC VARIABLES │
+# └────────────────────┘
+
+## ASSETS
+
+NEXT_PUBLIC_URL_CMS=https://url-to.strapi-accords-library.com
+NEXT_PUBLIC_URL_IMG=https://url-to.img-accords-library.com
+NEXT_PUBLIC_URL_WATCH=https://url-to.watch-accords-library.com
+NEXT_PUBLIC_URL_SELF=https://url-to-front-accords-library.com
+NEXT_PUBLIC_URL_SCANS_DOWNLOAD=https://url-to.search-accords-library.com
+
+## MEILISEARCH
+
+NEXT_PUBLIC_URL_MEILISEARCH=https://url-to.search-accords-library.com
+NEXT_PUBLIC_MEILISEARCH_KEY=abcdef0123456789
+
+## UMAMI
+
+NEXT_PUBLIC_UMAMI_URL=https://url-to.umami-accords-library.com
+NEXT_PUBLIC_UMAMI_ID=abcdef0123456789
+
+## OCR.SPACE
+
+NEXT_PUBLIC_API_OCR_KEY=abcdef0123456789
\ No newline at end of file
diff --git a/README.md b/README.md
index 200b12b..5ba7ea5 100644
--- a/README.md
+++ b/README.md
@@ -134,10 +134,11 @@ A detailled look at the technologies used in this repository:
- [ts-unused-exports](https://www.npmjs.com/package/ts-unused-exports) to find unused exported functions/constants...
- Other
+
- Custom book reader based on [Okuma-Reader](https://github.com/DrMint/Okuma-Reader)
- Support for [Material Symbols](https://fonts.google.com/icons)
- Custom lightbox using [react-zoom-pan-pinch](https://www.npmjs.com/package/react-zoom-pan-pinch)
- - Handle query params using [Zod](https://zod.dev/)
+ - Handle query params type-validation using [Zod](https://zod.dev/)
- A secret "Terminal" mode. Can you find it?
## Installation
@@ -148,31 +149,14 @@ cd accords-library.com
npm install
```
-Create a env file:
+Create a env file based on the example one:
```bash
+cp .env.example .env.local
nano .env.local
```
-Enter the following information:
-
-```
-URL_GRAPHQL=https://url-to.strapi-accords-library.com/graphql
-ACCESS_TOKEN=abcdef0123456789
-REVALIDATION_TOKEN=abcdef0123456789
-SMTP_HOST=email.provider.com
-SMTP_USER=email@example.com
-SMTP_PASSWORD=mypassword123
-NEXT_PUBLIC_URL_CMS=https://url-to.strapi-accords-library.com
-NEXT_PUBLIC_URL_IMG=https://url-to.img-accords-library.com
-NEXT_PUBLIC_URL_WATCH=https://url-to.watch-accords-library.com
-NEXT_PUBLIC_URL_SELF=https://url-to-front-accords-library.com
-NEXT_PUBLIC_URL_MEILISEARCH=https://url-to.search-accords-library.com
-NEXT_PUBLIC_MEILISEARCH_KEY=abcdef0123456789
-NEXT_PUBLIC_UMAMI_URL=https://url-to.umami-accords-library.com
-NEXT_PUBLIC_UMAMI_ID=abcdef0123456789
-NEXT_PUBLIC_API_OCR_KEY=abcdef0123456789
-```
+Change the variables
Run in dev mode:
diff --git a/public/local-data/websiteInterfaces.json b/public/local-data/websiteInterfaces.json
index a45e05f..3b6890a 100644
--- a/public/local-data/websiteInterfaces.json
+++ b/public/local-data/websiteInterfaces.json
@@ -185,7 +185,8 @@
"weapons_description": "A list of all the weapons across all of the games. All distinguished weapons come with an “account.” It’s a document with various details like how the weapon was forged and how it’s been used in the past.",
"level_x": "Level {x}",
"story_x": "Story {x}",
- "player_name_tooltip": "Certain in-game texts use the player's name as part of the dialogue/narration. If you want to see your name in the transcript found on this website, feel free to enter your player's name here. If left empty, '(player)' will be used instead."
+ "player_name_tooltip": "Certain in-game texts use the player's name as part of the dialogue/narration. If you want to see your name in the transcript found on this website, feel free to enter your player's name here. If left empty, '(player)' will be used instead.",
+ "download_scans": "Download scans"
}
},
{
@@ -372,7 +373,8 @@
"weapons_description": "Une liste de toutes les armes présentes dans tous les jeux. Toutes les armes distinguées sont accompagnées d'un \"compte\". Il s'agit d'un document contenant divers détails tels que la façon dont l'arme a été forgée et comment elle a été utilisée dans le passé.",
"level_x": "Niveau {x}",
"story_x": "Histoire {x}",
- "player_name_tooltip": "Certains textes dans les jeux utilisent le nom du joueur dans les dialogue/la narration. Si vous voulez voir votre nom dans les transcriptions se trouvant sur ce site web, n'hésitez pas à entrer votre nom de joueur ici. S'il n'est pas renseigné, '(player)' sera utilisé à la place."
+ "player_name_tooltip": "Certains textes dans les jeux utilisent le nom du joueur dans les dialogue/la narration. Si vous voulez voir votre nom dans les transcriptions se trouvant sur ce site web, n'hésitez pas à entrer votre nom de joueur ici. S'il n'est pas renseigné, '(player)' sera utilisé à la place.",
+ "download_scans": "Télécharger les scans"
}
},
{
@@ -559,7 +561,8 @@
"weapons_description": null,
"level_x": null,
"story_x": null,
- "player_name_tooltip": null
+ "player_name_tooltip": null,
+ "download_scans": null
}
},
{
@@ -746,7 +749,8 @@
"weapons_description": null,
"level_x": null,
"story_x": null,
- "player_name_tooltip": null
+ "player_name_tooltip": null,
+ "download_scans": null
}
},
{
@@ -933,7 +937,8 @@
"weapons_description": null,
"level_x": null,
"story_x": null,
- "player_name_tooltip": null
+ "player_name_tooltip": null,
+ "download_scans": null
}
}
]
diff --git a/src/components/PreviewCard.tsx b/src/components/PreviewCard.tsx
index 11c4242..4fa8b55 100644
--- a/src/components/PreviewCard.tsx
+++ b/src/components/PreviewCard.tsx
@@ -204,7 +204,7 @@ export const PreviewCard = ({
)}
{subtitle &&
{format("empty_folder_message")}
{rangeStart}
-{rangeStart}
{rangeStart}
- {content?.type &&{format("category", { count: content.categories.length })}
+{format("type", { count: 1 })}
+{rangeStart}
+