From 0df71cc85fcac0a0b42f8fe6c731103b202dff96 Mon Sep 17 00:00:00 2001
From: DrMint
Date: Thu, 10 Mar 2022 21:46:55 +0100
Subject: [PATCH 1/6] Updated dependencies
---
package-lock.json | 100 +++++++++++++++++++++++-----------------------
package.json | 12 +++---
2 files changed, 56 insertions(+), 56 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 11e6734..8718301 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -11,7 +11,7 @@
"@fontsource/opendyslexic": "^4.5.2",
"@fontsource/vollkorn": "^4.5.4",
"@fontsource/zen-maru-gothic": "^4.5.5",
- "markdown-to-jsx": "^7.1.6",
+ "markdown-to-jsx": "^7.1.7",
"next": "^12.1.0",
"react": "17.0.2",
"react-dom": "17.0.2",
@@ -21,13 +21,13 @@
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.2",
- "@types/node": "17.0.18",
- "@types/react": "17.0.39",
- "@types/react-dom": "^17.0.11",
- "eslint": "8.9.0",
+ "@types/node": "17.0.21",
+ "@types/react": "17.0.40",
+ "@types/react-dom": "^17.0.13",
+ "eslint": "8.10.0",
"eslint-config-next": "12.1.0",
"tailwindcss": "^3.0.23",
- "typescript": "4.5.5"
+ "typescript": "4.6.2"
}
},
"node_modules/@babel/code-frame": {
@@ -162,9 +162,9 @@
}
},
"node_modules/@eslint/eslintrc": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.1.0.tgz",
- "integrity": "sha512-C1DfL7XX4nPqGd6jcP01W9pVM1HYCuUkFk1432D7F0v3JSlUIeOYn9oCoi3eoLZ+iwBSb29BMFxxny0YrrEZqg==",
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.2.0.tgz",
+ "integrity": "sha512-igm9SjJHNEJRiUnecP/1R5T3wKLEJ7pL6e2P+GUSfCd0dGjPYYZve08uzw8L2J8foVHFz+NGu12JxRcU2gGo6w==",
"dev": true,
"dependencies": {
"ajv": "^6.12.4",
@@ -476,9 +476,9 @@
"dev": true
},
"node_modules/@types/node": {
- "version": "17.0.18",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.18.tgz",
- "integrity": "sha512-eKj4f/BsN/qcculZiRSujogjvp5O/k4lOW5m35NopjZM/QwLOR075a8pJW5hD+Rtdm2DaCVPENS6KtSQnUD6BA==",
+ "version": "17.0.21",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.21.tgz",
+ "integrity": "sha512-DBZCJbhII3r90XbQxI8Y9IjjiiOGlZ0Hr32omXIZvwwZ7p4DMMXGrKXVyPfuoBOri9XNtL0UK69jYIBIsRX3QQ==",
"dev": true
},
"node_modules/@types/parse-json": {
@@ -494,9 +494,9 @@
"dev": true
},
"node_modules/@types/react": {
- "version": "17.0.39",
- "resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.39.tgz",
- "integrity": "sha512-UVavlfAxDd/AgAacMa60Azl7ygyQNRwC/DsHZmKgNvPmRR5p70AJ5Q9EAmL2NWOJmeV+vVUI4IAP7GZrN8h8Ug==",
+ "version": "17.0.40",
+ "resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.40.tgz",
+ "integrity": "sha512-UrXhD/JyLH+W70nNSufXqMZNuUD2cXHu6UjCllC6pmOQgBX4SGXOH8fjRka0O0Ee0HrFxapDD8Bwn81Kmiz6jQ==",
"dev": true,
"dependencies": {
"@types/prop-types": "*",
@@ -505,9 +505,9 @@
}
},
"node_modules/@types/react-dom": {
- "version": "17.0.11",
- "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-17.0.11.tgz",
- "integrity": "sha512-f96K3k+24RaLGVu/Y2Ng3e1EbZ8/cVJvypZWd7cy0ofCBaf2lcM46xNhycMZ2xGwbBjRql7hOlZ+e2WlJ5MH3Q==",
+ "version": "17.0.13",
+ "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-17.0.13.tgz",
+ "integrity": "sha512-wEP+B8hzvy6ORDv1QBhcQia4j6ea4SFIBttHYpXKPFZRviBvknq0FRh3VrIxeXUmsPkwuXVZrVGG7KUVONmXCQ==",
"dev": true,
"dependencies": {
"@types/react": "*"
@@ -1302,12 +1302,12 @@
}
},
"node_modules/eslint": {
- "version": "8.9.0",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.9.0.tgz",
- "integrity": "sha512-PB09IGwv4F4b0/atrbcMFboF/giawbBLVC7fyDamk5Wtey4Jh2K+rYaBhCAbUyEI4QzB1ly09Uglc9iCtFaG2Q==",
+ "version": "8.10.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.10.0.tgz",
+ "integrity": "sha512-tcI1D9lfVec+R4LE1mNDnzoJ/f71Kl/9Cv4nG47jOueCMBrCCKYXr4AUVS7go6mWYGFD4+EoN6+eXSrEbRzXVw==",
"dev": true,
"dependencies": {
- "@eslint/eslintrc": "^1.1.0",
+ "@eslint/eslintrc": "^1.2.0",
"@humanwhocodes/config-array": "^0.9.2",
"ajv": "^6.10.0",
"chalk": "^4.0.0",
@@ -2447,9 +2447,9 @@
}
},
"node_modules/markdown-to-jsx": {
- "version": "7.1.6",
- "resolved": "https://registry.npmjs.org/markdown-to-jsx/-/markdown-to-jsx-7.1.6.tgz",
- "integrity": "sha512-1wrIGZYwIG2gR3yfRmbr4FlQmhaAKoKTpRo4wur4fp9p0njU1Hi7vR8fj0AUKKIcPduiJmPprzmCB5B/GvlC7g==",
+ "version": "7.1.7",
+ "resolved": "https://registry.npmjs.org/markdown-to-jsx/-/markdown-to-jsx-7.1.7.tgz",
+ "integrity": "sha512-VI3TyyHlGkO8uFle0IOibzpO1c1iJDcXcS/zBrQrXQQvJ2tpdwVzVZ7XdKsyRz1NdRmre4dqQkMZzUHaKIG/1w==",
"engines": {
"node": ">= 10"
},
@@ -3529,9 +3529,9 @@
}
},
"node_modules/typescript": {
- "version": "4.5.5",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz",
- "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==",
+ "version": "4.6.2",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz",
+ "integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
@@ -3772,9 +3772,9 @@
}
},
"@eslint/eslintrc": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.1.0.tgz",
- "integrity": "sha512-C1DfL7XX4nPqGd6jcP01W9pVM1HYCuUkFk1432D7F0v3JSlUIeOYn9oCoi3eoLZ+iwBSb29BMFxxny0YrrEZqg==",
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.2.0.tgz",
+ "integrity": "sha512-igm9SjJHNEJRiUnecP/1R5T3wKLEJ7pL6e2P+GUSfCd0dGjPYYZve08uzw8L2J8foVHFz+NGu12JxRcU2gGo6w==",
"dev": true,
"requires": {
"ajv": "^6.12.4",
@@ -3968,9 +3968,9 @@
"dev": true
},
"@types/node": {
- "version": "17.0.18",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.18.tgz",
- "integrity": "sha512-eKj4f/BsN/qcculZiRSujogjvp5O/k4lOW5m35NopjZM/QwLOR075a8pJW5hD+Rtdm2DaCVPENS6KtSQnUD6BA==",
+ "version": "17.0.21",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.21.tgz",
+ "integrity": "sha512-DBZCJbhII3r90XbQxI8Y9IjjiiOGlZ0Hr32omXIZvwwZ7p4DMMXGrKXVyPfuoBOri9XNtL0UK69jYIBIsRX3QQ==",
"dev": true
},
"@types/parse-json": {
@@ -3986,9 +3986,9 @@
"dev": true
},
"@types/react": {
- "version": "17.0.39",
- "resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.39.tgz",
- "integrity": "sha512-UVavlfAxDd/AgAacMa60Azl7ygyQNRwC/DsHZmKgNvPmRR5p70AJ5Q9EAmL2NWOJmeV+vVUI4IAP7GZrN8h8Ug==",
+ "version": "17.0.40",
+ "resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.40.tgz",
+ "integrity": "sha512-UrXhD/JyLH+W70nNSufXqMZNuUD2cXHu6UjCllC6pmOQgBX4SGXOH8fjRka0O0Ee0HrFxapDD8Bwn81Kmiz6jQ==",
"dev": true,
"requires": {
"@types/prop-types": "*",
@@ -3997,9 +3997,9 @@
}
},
"@types/react-dom": {
- "version": "17.0.11",
- "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-17.0.11.tgz",
- "integrity": "sha512-f96K3k+24RaLGVu/Y2Ng3e1EbZ8/cVJvypZWd7cy0ofCBaf2lcM46xNhycMZ2xGwbBjRql7hOlZ+e2WlJ5MH3Q==",
+ "version": "17.0.13",
+ "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-17.0.13.tgz",
+ "integrity": "sha512-wEP+B8hzvy6ORDv1QBhcQia4j6ea4SFIBttHYpXKPFZRviBvknq0FRh3VrIxeXUmsPkwuXVZrVGG7KUVONmXCQ==",
"dev": true,
"requires": {
"@types/react": "*"
@@ -4564,12 +4564,12 @@
"dev": true
},
"eslint": {
- "version": "8.9.0",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.9.0.tgz",
- "integrity": "sha512-PB09IGwv4F4b0/atrbcMFboF/giawbBLVC7fyDamk5Wtey4Jh2K+rYaBhCAbUyEI4QzB1ly09Uglc9iCtFaG2Q==",
+ "version": "8.10.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.10.0.tgz",
+ "integrity": "sha512-tcI1D9lfVec+R4LE1mNDnzoJ/f71Kl/9Cv4nG47jOueCMBrCCKYXr4AUVS7go6mWYGFD4+EoN6+eXSrEbRzXVw==",
"dev": true,
"requires": {
- "@eslint/eslintrc": "^1.1.0",
+ "@eslint/eslintrc": "^1.2.0",
"@humanwhocodes/config-array": "^0.9.2",
"ajv": "^6.10.0",
"chalk": "^4.0.0",
@@ -5430,9 +5430,9 @@
}
},
"markdown-to-jsx": {
- "version": "7.1.6",
- "resolved": "https://registry.npmjs.org/markdown-to-jsx/-/markdown-to-jsx-7.1.6.tgz",
- "integrity": "sha512-1wrIGZYwIG2gR3yfRmbr4FlQmhaAKoKTpRo4wur4fp9p0njU1Hi7vR8fj0AUKKIcPduiJmPprzmCB5B/GvlC7g==",
+ "version": "7.1.7",
+ "resolved": "https://registry.npmjs.org/markdown-to-jsx/-/markdown-to-jsx-7.1.7.tgz",
+ "integrity": "sha512-VI3TyyHlGkO8uFle0IOibzpO1c1iJDcXcS/zBrQrXQQvJ2tpdwVzVZ7XdKsyRz1NdRmre4dqQkMZzUHaKIG/1w==",
"requires": {}
},
"merge2": {
@@ -6153,9 +6153,9 @@
"dev": true
},
"typescript": {
- "version": "4.5.5",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz",
- "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==",
+ "version": "4.6.2",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz",
+ "integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==",
"dev": true
},
"unbox-primitive": {
diff --git a/package.json b/package.json
index ce9877c..20c6682 100644
--- a/package.json
+++ b/package.json
@@ -13,7 +13,7 @@
"@fontsource/opendyslexic": "^4.5.2",
"@fontsource/vollkorn": "^4.5.4",
"@fontsource/zen-maru-gothic": "^4.5.5",
- "markdown-to-jsx": "^7.1.6",
+ "markdown-to-jsx": "^7.1.7",
"next": "^12.1.0",
"react": "17.0.2",
"react-dom": "17.0.2",
@@ -23,12 +23,12 @@
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.2",
- "@types/node": "17.0.18",
- "@types/react": "17.0.39",
- "@types/react-dom": "^17.0.11",
- "eslint": "8.9.0",
+ "@types/node": "17.0.21",
+ "@types/react": "17.0.40",
+ "@types/react-dom": "^17.0.13",
+ "eslint": "8.10.0",
"eslint-config-next": "12.1.0",
"tailwindcss": "^3.0.23",
- "typescript": "4.5.5"
+ "typescript": "4.6.2"
}
}
From 6c0b0a0083c09171a8dc8362e972821896d77e1f Mon Sep 17 00:00:00 2001
From: DrMint
Date: Thu, 10 Mar 2022 23:39:13 +0100
Subject: [PATCH 2/6] Library items can now be grouped by categories
---
.../Library/LibraryItemsPreview.tsx | 10 ++++++
src/graphql/operation.graphql | 11 ++++++
src/graphql/operations-types.ts | 19 ++++++++++-
src/pages/library/index.tsx | 34 +++++++++++++++++--
4 files changed, 71 insertions(+), 3 deletions(-)
diff --git a/src/components/Library/LibraryItemsPreview.tsx b/src/components/Library/LibraryItemsPreview.tsx
index 718a625..a8cc035 100644
--- a/src/components/Library/LibraryItemsPreview.tsx
+++ b/src/components/Library/LibraryItemsPreview.tsx
@@ -16,6 +16,7 @@ export type LibraryItemsPreviewProps = {
title: GetLibraryItemsPreviewQuery["libraryItems"]["data"][number]["attributes"]["title"];
subtitle: GetLibraryItemsPreviewQuery["libraryItems"]["data"][number]["attributes"]["subtitle"];
price?: GetLibraryItemsPreviewQuery["libraryItems"]["data"][number]["attributes"]["price"];
+ categories: GetLibraryItemsPreviewQuery["libraryItems"]["data"][number]["attributes"]["categories"];
release_date?: GetLibraryItemsPreviewQuery["libraryItems"]["data"][number]["attributes"]["release_date"];
metadata?: GetLibraryItemsPreviewQuery["libraryItems"]["data"][number]["attributes"]["metadata"];
};
@@ -55,6 +56,15 @@ export default function LibraryItemsPreview(
{item.title}
{item.subtitle}
+
+
+ {item.categories.data.map((category) => (
+
+ {category.attributes.short}
+
+ ))}
+
+
{item.release_date || item.price ? (
{item.release_date ? (
diff --git a/src/graphql/operation.graphql b/src/graphql/operation.graphql
index a671a29..5ec508c 100644
--- a/src/graphql/operation.graphql
+++ b/src/graphql/operation.graphql
@@ -205,6 +205,15 @@ query getLibraryItemsPreview($language_code: String) {
}
}
}
+ categories {
+ data {
+ id
+ attributes {
+ name
+ short
+ }
+ }
+ }
metadata {
__typename
... on ComponentMetadataBooks {
@@ -666,6 +675,7 @@ query getLibraryItem($slug: String, $language_code: String) {
data {
id
attributes {
+ name
short
}
}
@@ -736,6 +746,7 @@ query getContents($language_code: String) {
data {
id
attributes {
+ name
short
}
}
diff --git a/src/graphql/operations-types.ts b/src/graphql/operations-types.ts
index ea1f9ae..c9d8ee3 100644
--- a/src/graphql/operations-types.ts
+++ b/src/graphql/operations-types.ts
@@ -317,6 +317,18 @@ export type GetLibraryItemsPreviewQuery = {
};
};
};
+ categories: {
+ __typename: "CategoryRelationResponseCollection";
+ data: Array<{
+ __typename: "CategoryEntity";
+ id: string;
+ attributes: {
+ __typename: "Category";
+ name: string;
+ short: string;
+ };
+ }>;
+ };
metadata: Array<
| {
__typename: "ComponentMetadataAudio";
@@ -897,6 +909,7 @@ export type GetLibraryItemQuery = {
id: string;
attributes: {
__typename: "Category";
+ name: string;
short: string;
};
}>;
@@ -982,7 +995,11 @@ export type GetContentsQuery = {
data: Array<{
__typename: "CategoryEntity";
id: string;
- attributes: { __typename: "Category"; short: string };
+ attributes: {
+ __typename: "Category";
+ name: string;
+ short: string;
+ };
}>;
};
type: {
diff --git a/src/pages/library/index.tsx b/src/pages/library/index.tsx
index cba6882..5300af0 100644
--- a/src/pages/library/index.tsx
+++ b/src/pages/library/index.tsx
@@ -56,7 +56,7 @@ export default function Library(props: LibraryProps): JSX.Element {
useEffect(() => {
setSortedItem(sortBy(sortingMethod, filteredItems, currencies));
- }, [filteredItems, sortingMethod]);
+ }, [currencies, filteredItems, sortingMethod]);
useEffect(() => {
setGroups(getGroups(langui, groupingMethod, sortedItems));
@@ -163,7 +163,37 @@ function getGroups(
): GroupLibraryItems {
switch (groupByType) {
case 0:
- return new Map();
+ const typeGroup = new Map();
+ typeGroup.set("Drakengard 1", []);
+ typeGroup.set("Drakengard 1.3", []);
+ typeGroup.set("Drakengard 2", []);
+ typeGroup.set("Drakengard 3", []);
+ typeGroup.set("Drakengard 4", []);
+ typeGroup.set("NieR Gestalt", []);
+ typeGroup.set("NieR Replicant", []);
+ typeGroup.set("NieR Replicant ver.1.22474487139...", []);
+ typeGroup.set("NieR:Automata", []);
+ typeGroup.set("NieR Re[in]carnation", []);
+ typeGroup.set("SINoALICE", []);
+ typeGroup.set("Voice of Cards", []);
+ typeGroup.set("Final Fantasy XIV", []);
+ typeGroup.set("Thou Shalt Not Die", []);
+ typeGroup.set("Bakuken", []);
+ typeGroup.set("YoRHa", []);
+ typeGroup.set("YoRHa Boys", []);
+ typeGroup.set("No category", []);
+
+ items.map((item) => {
+ if (item.attributes.categories.data.length === 0) {
+ typeGroup.get("No category")?.push(item);
+ } else {
+ item.attributes.categories.data.map((category) => {
+ typeGroup.get(category.attributes.name)?.push(item);
+ });
+ }
+ });
+
+ return typeGroup;
case 1:
const groupType: GroupLibraryItems = new Map();
From 252a1af799e3e1c2c4a4eb1d7a43a527e2ca05f3 Mon Sep 17 00:00:00 2001
From: DrMint
Date: Fri, 11 Mar 2022 00:13:47 +0100
Subject: [PATCH 3/6] Replaced ternary operations with && when applicable
---
src/components/AppLayout.tsx | 4 +-
.../Chronology/ChronologyItemComponent.tsx | 8 +-
src/components/Content/ThumbnailHeader.tsx | 8 +-
src/components/Library/ContentTOCLine.tsx | 12 +-
.../Library/LibraryContentPreview.tsx | 4 +-
.../Library/LibraryItemsPreview.tsx | 59 +++---
.../PanelComponents/PanelHeader.tsx | 4 +-
src/components/Panels/MainPanel.tsx | 8 +-
src/pages/contents/[slug]/index.tsx | 12 +-
src/pages/contents/[slug]/read.tsx | 8 +-
src/pages/library/[slug].tsx | 170 +++++++-----------
11 files changed, 107 insertions(+), 190 deletions(-)
diff --git a/src/components/AppLayout.tsx b/src/components/AppLayout.tsx
index a295b3f..51eab74 100644
--- a/src/components/AppLayout.tsx
+++ b/src/components/AppLayout.tsx
@@ -199,7 +199,7 @@ export default function AppLayout(props: AppLayoutProps): JSX.Element {
{/* Sub panel */}
- {subPanel ? (
+ {subPanel && (
{subPanel}
- ) : (
- ""
)}
{/* Main panel */}
diff --git a/src/components/Chronology/ChronologyItemComponent.tsx b/src/components/Chronology/ChronologyItemComponent.tsx
index 090fb92..3864c27 100644
--- a/src/components/Chronology/ChronologyItemComponent.tsx
+++ b/src/components/Chronology/ChronologyItemComponent.tsx
@@ -64,15 +64,13 @@ export default function ChronologyItemComponent(
props.item.attributes.day
)}
>
- {props.displayYear ? (
+ {props.displayYear && (
{generateYear(
props.item.attributes.displayed_date,
props.item.attributes.year
)}
- ) : (
- ""
)}
@@ -108,7 +106,7 @@ export default function ChronologyItemComponent(
{translation.title ?
{translation.title}
: ""}
- {translation.description ? (
+ {translation.description && (
1
@@ -118,8 +116,6 @@ export default function ChronologyItemComponent(
>
{translation.description}
- ) : (
- ""
)}
{translation.note ? (
{"Notes: " + translation.note}
diff --git a/src/components/Content/ThumbnailHeader.tsx b/src/components/Content/ThumbnailHeader.tsx
index 2b8ec2a..5ae6da6 100644
--- a/src/components/Content/ThumbnailHeader.tsx
+++ b/src/components/Content/ThumbnailHeader.tsx
@@ -53,7 +53,7 @@ export default function ThumbnailHeader(
- {content.type ? (
+ {content.type && (
{langui.type}
- ) : (
- ""
)}
- {content.categories.data.length > 0 ? (
+ {content.categories.data.length > 0 && (
{langui.categories}
{content.categories.data.map((category) => (
))}
- ) : (
- ""
)}
{content.titles.length > 0 && content.titles[0].description && (
diff --git a/src/components/Library/ContentTOCLine.tsx b/src/components/Library/ContentTOCLine.tsx
index 9001184..4ac55e1 100644
--- a/src/components/Library/ContentTOCLine.tsx
+++ b/src/components/Library/ContentTOCLine.tsx
@@ -54,7 +54,7 @@ export default function ContentTOCLine(
? content.attributes.range[0].starting_page
: ""}
- {content.attributes.content.data ? (
+ {content.attributes.content.data && (
{content.attributes.content.data.attributes.type.data.attributes
.titles.length > 0
@@ -65,8 +65,6 @@ export default function ContentTOCLine(
.attributes.slug
)}
- ) : (
- ""
)}
- {content.attributes.scan_set.length > 0 ? (
+ {content.attributes.scan_set.length > 0 && (
- ) : (
- ""
)}
- {content.attributes.content.data ? (
+ {content.attributes.content.data && (
- ) : (
- ""
)}
{content.attributes.scan_set.length === 0 &&
diff --git a/src/components/Library/LibraryContentPreview.tsx b/src/components/Library/LibraryContentPreview.tsx
index bcebbce..8017528 100644
--- a/src/components/Library/LibraryContentPreview.tsx
+++ b/src/components/Library/LibraryContentPreview.tsx
@@ -33,14 +33,12 @@ export default function LibraryContentPreview(
)}
- {item.type.data ? (
+ {item.type.data && (
{item.type.data.attributes.titles.length > 0
? item.type.data.attributes.titles[0].title
: prettySlug(item.type.data.attributes.slug)}
- ) : (
- ""
)}
diff --git a/src/components/Library/LibraryItemsPreview.tsx b/src/components/Library/LibraryItemsPreview.tsx
index a8cc035..392a3fc 100644
--- a/src/components/Library/LibraryItemsPreview.tsx
+++ b/src/components/Library/LibraryItemsPreview.tsx
@@ -44,12 +44,10 @@ export default function LibraryItemsPreview(
)}
- {item.metadata && item.metadata.length > 0 ? (
+ {item.metadata && item.metadata.length > 0 && (
{prettyItemSubType(item.metadata[0])}
- ) : (
- ""
)}
@@ -65,36 +63,31 @@ export default function LibraryItemsPreview(
))}
- {item.release_date || item.price ? (
-
- {item.release_date ? (
-
-
- event
-
- {prettyDate(item.release_date)}
-
- ) : (
- ""
- )}
- {item.price && props.currencies ? (
-
-
- shopping_cart
-
- {prettyPrice(
- item.price,
- props.currencies,
- appLayout.currency
- )}
-
- ) : (
- ""
- )}
-
- ) : (
- ""
- )}
+ {item.release_date ||
+ (item.price && (
+
+ {item.release_date && (
+
+
+ event
+
+ {prettyDate(item.release_date)}
+
+ )}
+ {item.price && props.currencies && (
+
+
+ shopping_cart
+
+ {prettyPrice(
+ item.price,
+ props.currencies,
+ appLayout.currency
+ )}
+
+ )}
+
+ ))}
diff --git a/src/components/PanelComponents/PanelHeader.tsx b/src/components/PanelComponents/PanelHeader.tsx
index 94e32b3..925d46d 100644
--- a/src/components/PanelComponents/PanelHeader.tsx
+++ b/src/components/PanelComponents/PanelHeader.tsx
@@ -10,10 +10,8 @@ export default function PanelHeader(props: PanelHeaderProps): JSX.Element {
return (
<>
- {props.icon ? (
+ {props.icon && (
{props.icon}
- ) : (
- ""
)}
{props.title}
{props.description ?
{props.description}
: ""}
diff --git a/src/components/Panels/MainPanel.tsx b/src/components/Panels/MainPanel.tsx
index 0390ccf..f1928fa 100644
--- a/src/components/Panels/MainPanel.tsx
+++ b/src/components/Panels/MainPanel.tsx
@@ -192,10 +192,8 @@ export default function MainPanel(props: MainPanelProps): JSX.Element {
}`}
>
- {langui.licensing_notice ? (
+ {langui.licensing_notice && (
{langui.licensing_notice}
- ) : (
- ""
)}
- {langui.copyright_notice ? (
+ {langui.copyright_notice && (
{langui.copyright_notice}
- ) : (
- ""
)}
diff --git a/src/pages/contents/[slug]/index.tsx b/src/pages/contents/[slug]/index.tsx
index 1c9726d..e3799bb 100644
--- a/src/pages/contents/[slug]/index.tsx
+++ b/src/pages/contents/[slug]/index.tsx
@@ -44,28 +44,22 @@ export default function ContentIndex(props: ContentIndexProps): JSX.Element {
- {content.text_set.length > 0 ? (
+ {content.text_set.length > 0 && (
- ) : (
- ""
)}
- {content.audio_set.length > 0 ? (
+ {content.audio_set.length > 0 && (
- ) : (
- ""
)}
- {content.video_set.length > 0 ? (
+ {content.video_set.length > 0 && (
- ) : (
- ""
)}
diff --git a/src/pages/contents/[slug]/read.tsx b/src/pages/contents/[slug]/read.tsx
index 8dc58cb..8a6fc0b 100644
--- a/src/pages/contents/[slug]/read.tsx
+++ b/src/pages/contents/[slug]/read.tsx
@@ -47,7 +47,7 @@ export default function ContentRead(props: ContentReadProps): JSX.Element {
horizontalLine
/>
- {content.text_set.length > 0 ? (
+ {content.text_set.length > 0 && (
{content.text_set[0].source_language.data.attributes.code ===
@@ -140,8 +140,6 @@ export default function ContentRead(props: ContentReadProps): JSX.Element {
)}
- ) : (
- ""
)}
);
@@ -159,10 +157,8 @@ export default function ContentRead(props: ContentReadProps): JSX.Element {
- {content.text_set.length > 0 ? (
+ {content.text_set.length > 0 && (
- ) : (
- ""
)}
diff --git a/src/pages/library/[slug].tsx b/src/pages/library/[slug].tsx
index 7df9fca..f4fdba3 100644
--- a/src/pages/library/[slug].tsx
+++ b/src/pages/library/[slug].tsx
@@ -70,15 +70,13 @@ export default function LibrarySlug(props: LibrarySlugProps): JSX.Element {
onClick={() => appLayout.setSubPanelOpen(false)}
/>
- {item.gallery.data.length > 0 ? (
+ {item.gallery.data.length > 0 && (
appLayout.setSubPanelOpen(false)}
/>
- ) : (
- ""
)}
appLayout.setSubPanelOpen(false)}
/>
- {item.subitems.data.length > 0 ? (
+ {item.subitems.data.length > 0 && (
appLayout.setSubPanelOpen(false)}
/>
- ) : (
- ""
)}
- {item.contents.data.length > 0 ? (
+ {item.contents.data.length > 0 && (
- ) : (
- ""
)}
@@ -134,7 +128,7 @@ export default function LibrarySlug(props: LibrarySlugProps): JSX.Element {
- {item.subitem_of.data.length > 0 ? (
+ {item.subitem_of.data.length > 0 && (
- ) : (
- ""
)}
{item.title}
- {item.subtitle ? (
- {item.subtitle}
- ) : (
- ""
- )}
+ {item.subtitle && {item.subtitle}
}
- {item.descriptions.length > 0 ? (
+ {item.descriptions.length > 0 && (
{item.descriptions[0].description}
- ) : (
- ""
)}
- {item.gallery.data.length > 0 ? (
+ {item.gallery.data.length > 0 && (
{langui.gallery}
@@ -186,15 +172,13 @@ export default function LibrarySlug(props: LibrarySlugProps): JSX.Element {
))}
- ) : (
- ""
)}
{langui.details}
- {item.metadata.length > 0 ? (
+ {item.metadata.length > 0 && (
{langui.type}
@@ -203,20 +187,16 @@ export default function LibrarySlug(props: LibrarySlugProps): JSX.Element {
{prettyItemSubType(item.metadata[0])}
- ) : (
- ""
)}
- {item.release_date ? (
+ {item.release_date && (
{langui.release_date}
{prettyDate(item.release_date)}
- ) : (
- ""
)}
- {item.price ? (
+ {item.price && (
{langui.price}
@@ -234,11 +214,9 @@ export default function LibrarySlug(props: LibrarySlugProps): JSX.Element {
)}
- ) : (
- ""
)}
- {item.size ? (
+ {item.size && (
<>
{langui.size}
@@ -256,7 +234,7 @@ export default function LibrarySlug(props: LibrarySlugProps): JSX.Element {
{convertMmToInch(item.size.height)} in
- {item.size.thickness ? (
+ {item.size.thickness && (
{langui.thickness}:
@@ -264,84 +242,68 @@ export default function LibrarySlug(props: LibrarySlugProps): JSX.Element {
{convertMmToInch(item.size.thickness)} in
- ) : (
- ""
)}
>
- ) : (
- ""
)}
{item.metadata.length > 0 &&
- item.metadata[0].__typename !== "ComponentMetadataGroup" &&
- item.metadata[0].__typename !== "ComponentMetadataOther" ? (
- <>
- {langui.type_information}
-
- {item.metadata[0].__typename === "ComponentMetadataBooks" ? (
- <>
-
-
{langui.pages}:
-
{item.metadata[0].page_count}
-
+ item.metadata[0].__typename !== "ComponentMetadataGroup" &&
+ item.metadata[0].__typename !== "ComponentMetadataOther" && (
+ <>
+
{langui.type_information}
+
+ {item.metadata[0].__typename ===
+ "ComponentMetadataBooks" && (
+ <>
+
+
{langui.pages}:
+
{item.metadata[0].page_count}
+
-
-
{langui.binding}:
-
- {item.metadata[0].binding_type ===
- Enum_Componentmetadatabooks_Binding_Type.Paperback
- ? langui.paperback
- : item.metadata[0].binding_type ===
- Enum_Componentmetadatabooks_Binding_Type.Hardcover
- ? langui.hardcover
- : ""}
-
-
-
-
-
{langui.page_order}:
-
- {item.metadata[0].page_order ===
- Enum_Componentmetadatabooks_Page_Order.LeftToRight
- ? langui.left_to_right
- : item.metadata[0].page_order ===
- Enum_Componentmetadatabooks_Page_Order.RightToLeft
- ? langui.right_to_left
- : ""}
-
-
-
-
-
{langui.languages}:
- {item.metadata[0].languages.data.map((lang) => (
-
- {lang.attributes.name}
+
+
{langui.binding}:
+
+ {item.metadata[0].binding_type ===
+ Enum_Componentmetadatabooks_Binding_Type.Paperback
+ ? langui.paperback
+ : item.metadata[0].binding_type ===
+ Enum_Componentmetadatabooks_Binding_Type.Hardcover
+ ? langui.hardcover
+ : ""}
- ))}
-
- >
- ) : item.metadata[0].__typename ===
- "ComponentMetadataAudio" ? (
- <>>
- ) : item.metadata[0].__typename ===
- "ComponentMetadataVideo" ? (
- <>>
- ) : item.metadata[0].__typename ===
- "ComponentMetadataGame" ? (
- <>>
- ) : (
- ""
- )}
-
- >
- ) : (
- ""
- )}
+
+
+
+
{langui.page_order}:
+
+ {item.metadata[0].page_order ===
+ Enum_Componentmetadatabooks_Page_Order.LeftToRight
+ ? langui.left_to_right
+ : item.metadata[0].page_order ===
+ Enum_Componentmetadatabooks_Page_Order.RightToLeft
+ ? langui.right_to_left
+ : ""}
+
+
+
+
+
{langui.languages}:
+ {item.metadata[0].languages.data.map((lang) => (
+
+ {lang.attributes.name}
+
+ ))}
+
+ >
+ )}
+
+ >
+ )}
- {item.subitems.data.length > 0 ? (
+ {item.subitems.data.length > 0 && (
- ) : (
- ""
)}
- {item.contents.data.length > 0 ? (
+ {item.contents.data.length > 0 && (
{langui.contents}
@@ -376,8 +336,6 @@ export default function LibrarySlug(props: LibrarySlugProps): JSX.Element {
))}
- ) : (
- ""
)}
From 1a9f5ae41b461a127864dc53f349cd6c1263d1ce Mon Sep 17 00:00:00 2001
From: DrMint
Date: Fri, 11 Mar 2022 00:32:36 +0100
Subject: [PATCH 4/6] Display library item's categories on its page
---
.../Library/LibraryItemsPreview.tsx | 49 +++++++++----------
src/graphql/operation.graphql | 18 +++++++
src/graphql/operations-types.ts | 24 +++++++++
src/pages/library/[slug].tsx | 14 ++++++
4 files changed, 80 insertions(+), 25 deletions(-)
diff --git a/src/components/Library/LibraryItemsPreview.tsx b/src/components/Library/LibraryItemsPreview.tsx
index 392a3fc..85afd83 100644
--- a/src/components/Library/LibraryItemsPreview.tsx
+++ b/src/components/Library/LibraryItemsPreview.tsx
@@ -63,31 +63,30 @@ export default function LibraryItemsPreview(
))}
- {item.release_date ||
- (item.price && (
-
- {item.release_date && (
-
-
- event
-
- {prettyDate(item.release_date)}
-
- )}
- {item.price && props.currencies && (
-
-
- shopping_cart
-
- {prettyPrice(
- item.price,
- props.currencies,
- appLayout.currency
- )}
-
- )}
-
- ))}
+ {(item.release_date || item.price) && (
+
+ {item.release_date && (
+
+
+ event
+
+ {prettyDate(item.release_date)}
+
+ )}
+ {item.price && props.currencies && (
+
+
+ shopping_cart
+
+ {prettyPrice(
+ item.price,
+ props.currencies,
+ appLayout.currency
+ )}
+
+ )}
+
+ )}
diff --git a/src/graphql/operation.graphql b/src/graphql/operation.graphql
index 5ec508c..0d7a7be 100644
--- a/src/graphql/operation.graphql
+++ b/src/graphql/operation.graphql
@@ -363,6 +363,15 @@ query getLibraryItem($slug: String, $language_code: String) {
}
}
}
+ categories {
+ data {
+ id
+ attributes {
+ name
+ short
+ }
+ }
+ }
size {
width
height
@@ -532,6 +541,15 @@ query getLibraryItem($slug: String, $language_code: String) {
}
}
}
+ categories {
+ data {
+ id
+ attributes {
+ name
+ short
+ }
+ }
+ }
metadata {
__typename
... on ComponentMetadataBooks {
diff --git a/src/graphql/operations-types.ts b/src/graphql/operations-types.ts
index c9d8ee3..7735c06 100644
--- a/src/graphql/operations-types.ts
+++ b/src/graphql/operations-types.ts
@@ -522,6 +522,18 @@ export type GetLibraryItemQuery = {
};
};
};
+ categories: {
+ __typename: "CategoryRelationResponseCollection";
+ data: Array<{
+ __typename: "CategoryEntity";
+ id: string;
+ attributes: {
+ __typename: "Category";
+ name: string;
+ short: string;
+ };
+ }>;
+ };
size: {
__typename: "ComponentBasicsSize";
width: number;
@@ -738,6 +750,18 @@ export type GetLibraryItemQuery = {
};
};
};
+ categories: {
+ __typename: "CategoryRelationResponseCollection";
+ data: Array<{
+ __typename: "CategoryEntity";
+ id: string;
+ attributes: {
+ __typename: "Category";
+ name: string;
+ short: string;
+ };
+ }>;
+ };
metadata: Array<
| {
__typename: "ComponentMetadataAudio";
diff --git a/src/pages/library/[slug].tsx b/src/pages/library/[slug].tsx
index f4fdba3..d37c98a 100644
--- a/src/pages/library/[slug].tsx
+++ b/src/pages/library/[slug].tsx
@@ -216,6 +216,20 @@ export default function LibrarySlug(props: LibrarySlugProps): JSX.Element {
)}
+
+ {item.categories.data.length > 0 && (
+
+
{langui.categories}
+
+ {item.categories.data.map((category) => (
+
+ {category.attributes.short}
+
+ ))}
+
+
+ )}
+
{item.size && (
<>
{langui.size}
From 0a02534c055ed23c6eb503d46ce857a8d82ce446 Mon Sep 17 00:00:00 2001
From: DrMint
Date: Fri, 11 Mar 2022 00:33:02 +0100
Subject: [PATCH 5/6] Return buttons now use material icon instead of unicode
for the icon
---
src/components/PanelComponents/ReturnButton.tsx | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/components/PanelComponents/ReturnButton.tsx b/src/components/PanelComponents/ReturnButton.tsx
index 35cbc26..c706da2 100644
--- a/src/components/PanelComponents/ReturnButton.tsx
+++ b/src/components/PanelComponents/ReturnButton.tsx
@@ -34,8 +34,10 @@ export default function ReturnButton(props: ReturnButtonProps): JSX.Element {
{props.horizontalLine && }
From 35c889d38943e386fc24bf2e2099e89b6c06a6c3 Mon Sep 17 00:00:00 2001
From: DrMint
Date: Fri, 11 Mar 2022 01:06:20 +0100
Subject: [PATCH 6/6] Added grouping for Contents
---
src/pages/contents/index.tsx | 123 ++++++++++++++++++++++++++++++++---
src/pages/library/index.tsx | 11 +++-
2 files changed, 122 insertions(+), 12 deletions(-)
diff --git a/src/pages/contents/index.tsx b/src/pages/contents/index.tsx
index d899665..be8b767 100644
--- a/src/pages/contents/index.tsx
+++ b/src/pages/contents/index.tsx
@@ -8,15 +8,30 @@ import { getContents } from "graphql/operations";
import PanelHeader from "components/PanelComponents/PanelHeader";
import AppLayout from "components/AppLayout";
import LibraryContentPreview from "components/Library/LibraryContentPreview";
-import { prettyinlineTitle } from "queries/helpers";
+import { prettyinlineTitle, prettySlug } from "queries/helpers";
import { AppStaticProps, getAppStaticProps } from "queries/getAppStaticProps";
+import Select from "components/Select";
+import { useEffect, useState } from "react";
-interface LibraryProps extends AppStaticProps {
+interface ContentsProps extends AppStaticProps {
contents: GetContentsQuery["contents"]["data"];
}
-export default function Library(props: LibraryProps): JSX.Element {
- const { langui } = props;
+type GroupContentItems = Map;
+
+export default function Contents(props: ContentsProps): JSX.Element {
+ const { langui, contents } = props;
+
+ const [groupingMethod, setGroupingMethod] = useState(-1);
+
+ const [groups, setGroups] = useState(
+ getGroups(groupingMethod, contents)
+ );
+
+ useEffect(() => {
+ setGroups(getGroups(groupingMethod, contents));
+ }, [langui, groupingMethod, contents]);
+
const subPanel = (
+
+
);
const contentPanel = (
-
- {props.contents.map((item) => (
-
- ))}
-
+ {[...groups].map(([name, items]) => (
+ <>
+ {items.length > 0 && (
+ <>
+ {name && (
+
+ {name}
+
+ )}
+
+ {items.map((item) => (
+
+ ))}
+
+ >
+ )}
+ >
+ ))}
);
return (
@@ -72,7 +117,7 @@ export const getStaticProps: GetStaticProps = async (context) => {
return titleA.localeCompare(titleB);
});
- const props: LibraryProps = {
+ const props: ContentsProps = {
...(await getAppStaticProps(context)),
contents: contents,
};
@@ -80,3 +125,61 @@ export const getStaticProps: GetStaticProps = async (context) => {
props: props,
};
};
+
+function getGroups(
+ groupByType: number,
+ items: ContentsProps["contents"]
+): GroupContentItems {
+ switch (groupByType) {
+ case 0:
+ const typeGroup = new Map();
+ typeGroup.set("Drakengard 1", []);
+ typeGroup.set("Drakengard 1.3", []);
+ typeGroup.set("Drakengard 2", []);
+ typeGroup.set("Drakengard 3", []);
+ typeGroup.set("Drakengard 4", []);
+ typeGroup.set("NieR Gestalt", []);
+ typeGroup.set("NieR Replicant", []);
+ typeGroup.set("NieR Replicant ver.1.22474487139...", []);
+ typeGroup.set("NieR:Automata", []);
+ typeGroup.set("NieR Re[in]carnation", []);
+ typeGroup.set("SINoALICE", []);
+ typeGroup.set("Voice of Cards", []);
+ typeGroup.set("Final Fantasy XIV", []);
+ typeGroup.set("Thou Shalt Not Die", []);
+ typeGroup.set("Bakuken", []);
+ typeGroup.set("YoRHa", []);
+ typeGroup.set("YoRHa Boys", []);
+ typeGroup.set("No category", []);
+
+ items.map((item) => {
+ if (item.attributes.categories.data.length === 0) {
+ typeGroup.get("No category")?.push(item);
+ } else {
+ item.attributes.categories.data.map((category) => {
+ typeGroup.get(category.attributes.name)?.push(item);
+ });
+ }
+ });
+ return typeGroup;
+
+ case 1:
+ const groupType: GroupContentItems = new Map();
+ items.map((item) => {
+ const type =
+ item.attributes.type.data.attributes.titles.length > 0
+ ? item.attributes.type.data.attributes.titles[0].title
+ : prettySlug(item.attributes.type.data.attributes.slug);
+
+ if (!groupType.has(type)) groupType.set(type, []);
+ groupType.get(type)?.push(item);
+ });
+
+ return groupType;
+
+ default:
+ const groupDefault: GroupContentItems = new Map();
+ groupDefault.set("", items);
+ return groupDefault;
+ }
+}
diff --git a/src/pages/library/index.tsx b/src/pages/library/index.tsx
index 5300af0..ed121d9 100644
--- a/src/pages/library/index.tsx
+++ b/src/pages/library/index.tsx
@@ -113,9 +113,16 @@ export default function Library(props: LibraryProps): JSX.Element {
<>
{items.length > 0 && (
<>
- {name}
+ {name && (
+
+ {name}
+
+ )}
{items.map((item) => (