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" } } 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 718a625..85afd83 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"]; }; @@ -43,31 +44,36 @@ export default function LibraryItemsPreview( )}
- {item.metadata && item.metadata.length > 0 ? ( + {item.metadata && item.metadata.length > 0 && (
{prettyItemSubType(item.metadata[0])}
- ) : ( - "" )}

{item.title}

{item.subtitle}

- {item.release_date || item.price ? ( + +
+ {item.categories.data.map((category) => ( + + {category.attributes.short} + + ))} +
+ + {(item.release_date || item.price) && (
- {item.release_date ? ( + {item.release_date && (

event {prettyDate(item.release_date)}

- ) : ( - "" )} - {item.price && props.currencies ? ( + {item.price && props.currencies && (

shopping_cart @@ -78,12 +84,8 @@ export default function LibraryItemsPreview( 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/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 && }
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/graphql/operation.graphql b/src/graphql/operation.graphql index a671a29..0d7a7be 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 { @@ -354,6 +363,15 @@ query getLibraryItem($slug: String, $language_code: String) { } } } + categories { + data { + id + attributes { + name + short + } + } + } size { width height @@ -523,6 +541,15 @@ query getLibraryItem($slug: String, $language_code: String) { } } } + categories { + data { + id + attributes { + name + short + } + } + } metadata { __typename ... on ComponentMetadataBooks { @@ -666,6 +693,7 @@ query getLibraryItem($slug: String, $language_code: String) { data { id attributes { + name short } } @@ -736,6 +764,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..7735c06 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"; @@ -510,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; @@ -726,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"; @@ -897,6 +933,7 @@ export type GetLibraryItemQuery = { id: string; attributes: { __typename: "Category"; + name: string; short: string; }; }>; @@ -982,7 +1019,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/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/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 = ( + +
+

{langui.group_by}:

+