diff --git a/src/components/AppLayout.tsx b/src/components/AppLayout.tsx index 0bf9264..6510034 100644 --- a/src/components/AppLayout.tsx +++ b/src/components/AppLayout.tsx @@ -325,6 +325,12 @@ export function AppLayout(props: Immutable): JSX.Element { ]) ) } + insertLabels={ + new Map([ + [0, langui.primary_language], + [1, langui.secondary_language], + ]) + } onChange={(items) => { const preferredLanguages = [...items].map( ([code]) => code diff --git a/src/components/Inputs/OrderableList.tsx b/src/components/Inputs/OrderableList.tsx index 9292f77..e013d50 100644 --- a/src/components/Inputs/OrderableList.tsx +++ b/src/components/Inputs/OrderableList.tsx @@ -5,6 +5,7 @@ import { useEffect, useState } from "react"; interface Props { className?: string; items: Map; + insertLabels?: Map; onChange?: (items: Map) => void; } @@ -25,12 +26,8 @@ export function OrderableList(props: Immutable): JSX.Element {
{[...items].map(([key, value], index) => ( <> - {index === 0 ? ( -

Primary language

- ) : index === 1 ? ( -

Secondary languages

- ) : ( - "" + {props.insertLabels?.get(index) && ( +

{props.insertLabels.get(index)}

)}
{ diff --git a/src/components/Library/ScanSetCover.tsx b/src/components/Library/ScanSetCover.tsx index 2c99825..f6b85b3 100644 --- a/src/components/Library/ScanSetCover.tsx +++ b/src/components/Library/ScanSetCover.tsx @@ -31,7 +31,7 @@ export function ScanSetCover(props: Immutable): JSX.Element { const [selectedScan, LanguageSwitcher] = useSmartLanguage({ items: images, languages: languages, - languageExtractor: (item) => item?.language?.data?.attributes?.code, + languageExtractor: (item) => item.language?.data?.attributes?.code, }); const coverImages: UploadImageFragment[] = []; diff --git a/src/graphql/operations/getWebsiteInterface.graphql b/src/graphql/operations/getWebsiteInterface.graphql index 2b66963..8051f7d 100644 --- a/src/graphql/operations/getWebsiteInterface.graphql +++ b/src/graphql/operations/getWebsiteInterface.graphql @@ -132,6 +132,19 @@ query getWebsiteInterface($language_code: String) { response_invalid_code response_invalid_email response_email_success + always_show_info + item_not_available + primary_language + secondary_language + combine_related_contents + previous_content + followup_content + videos + view_on + channel + subscribers + description + available_at } } } diff --git a/src/pages/archives/videos/c/[uid].tsx b/src/pages/archives/videos/c/[uid].tsx index 0d18307..430989b 100644 --- a/src/pages/archives/videos/c/[uid].tsx +++ b/src/pages/archives/videos/c/[uid].tsx @@ -36,7 +36,7 @@ export default function Channel(props: Props): JSX.Element {
-

{"Always show info"}:

+

{langui.always_show_info}:

diff --git a/src/pages/archives/videos/index.tsx b/src/pages/archives/videos/index.tsx index 2b3201d..273e5c5 100644 --- a/src/pages/archives/videos/index.tsx +++ b/src/pages/archives/videos/index.tsx @@ -67,7 +67,7 @@ export default function Videos(props: Props): JSX.Element { />
-

{"Always show info"}:

+

{langui.always_show_info}:

diff --git a/src/pages/archives/videos/v/[uid].tsx b/src/pages/archives/videos/v/[uid].tsx index 3b7efe0..19b685c 100644 --- a/src/pages/archives/videos/v/[uid].tsx +++ b/src/pages/archives/videos/v/[uid].tsx @@ -39,7 +39,7 @@ export default function Video(props: Props): JSX.Element { appLayout.setSubPanelOpen(false)} /> appLayout.setSubPanelOpen(false)} @@ -135,7 +135,7 @@ export default function Video(props: Props): JSX.Element { target="_blank" rel="noreferrer" > - +
@@ -144,7 +144,7 @@ export default function Video(props: Props): JSX.Element { {video.channel?.data?.attributes && (
-

{"Channel"}

+

{langui.channel}

@@ -163,7 +162,7 @@ export default function Video(props: Props): JSX.Element {
-

{"Description"}

+

{langui.description}

{video.description}

diff --git a/src/pages/contents/[slug]/index.tsx b/src/pages/contents/[slug]/index.tsx index 60504b8..7d7479d 100644 --- a/src/pages/contents/[slug]/index.tsx +++ b/src/pages/contents/[slug]/index.tsx @@ -208,110 +208,107 @@ export default function Content(props: Immutable): JSX.Element { className="mb-10" /> - {content && ( -
- } - /> +
+ } + /> - {previousContent?.attributes && ( -
-

Previous content

- category.attributes?.short ?? "" - ) - } - /> -
- )} + {previousContent?.attributes && ( +
+

+ {langui.previous_content} +

+ category.attributes?.short ?? "" + ) + } + /> +
+ )} - + - + - {nextContent?.attributes && ( - <> - -

Follow-up content

- category.attributes?.short ?? "" - ) - } - /> - - )} -
- )} + {nextContent?.attributes && ( + <> + +

+ {langui.followup_content} +

+ category.attributes?.short ?? "" + ) + } + /> + + )} +
); diff --git a/src/pages/contents/index.tsx b/src/pages/contents/index.tsx index daaf74c..b727caf 100644 --- a/src/pages/contents/index.tsx +++ b/src/pages/contents/index.tsx @@ -67,7 +67,7 @@ export default function Contents(props: Immutable): JSX.Element {
-

{"Combine related contents"}:

+

{langui.combine_related_contents}:

): JSX.Element {
-

{"Always show info"}:

+

{langui.always_show_info}:

@@ -122,7 +122,7 @@ export default function Contents(props: Immutable): JSX.Element { stackNumber={ combineRelatedContent && item.attributes.group?.data?.attributes?.combine - ? item.attributes.group?.data?.attributes.contents + ? item.attributes.group.data.attributes.contents ?.data.length : 0 } @@ -268,7 +268,7 @@ function filterContents( (content) => !content.attributes?.group?.data?.attributes || !content.attributes.group.data.attributes.combine || - content.attributes.group.data.attributes.contents?.data?.[0].id === + content.attributes.group.data.attributes.contents?.data[0].id === content.id ); } diff --git a/src/pages/dev/checkup/contents.tsx b/src/pages/dev/checkup/contents.tsx index 9ed7222..431569e 100644 --- a/src/pages/dev/checkup/contents.tsx +++ b/src/pages/dev/checkup/contents.tsx @@ -163,23 +163,6 @@ function testingContent(contents: Immutable): Report { }); } - if ( - content.attributes.next_recommended?.data?.id === content.id || - content.attributes.previous_recommended?.data?.id === content.id - ) { - report.lines.push({ - subitems: [content.attributes.slug], - name: "Self Recommendation", - type: "Error", - severity: "Very High", - description: - "The Content is referring to itself as a Next or Previous Recommended.", - recommandation: "", - backendUrl: backendUrl, - frontendUrl: frontendUrl, - }); - } - if (!content.attributes.thumbnail?.data?.id) { report.lines.push({ subitems: [content.attributes.slug], @@ -270,172 +253,171 @@ function testingContent(contents: Immutable): Report { frontendUrl: frontendUrl, }); } else { - const textSetLanguages: string[] = []; - /* - if (content.attributes && textSet) { - if (textSet.language?.data?.id) { - if (textSet.language.data.id in textSetLanguages) { - report.lines.push({ - subitems: [ - content.attributes.slug, - `TextSet ${textSetIndex.toString()}`, - ], - name: "Duplicate Language", - type: "Error", - severity: "High", - description: "", - recommandation: "", - backendUrl: backendUrl, - frontendUrl: frontendUrl, - }); - } else { - textSetLanguages.push(textSet.language.data.id); - } - } else { - report.lines.push({ - subitems: [ - content.attributes.slug, - `TextSet ${textSetIndex.toString()}`, - ], - name: "No Language", - type: "Error", - severity: "Very High", - description: "", - recommandation: "", - backendUrl: backendUrl, - frontendUrl: frontendUrl, - }); - } - - if (!textSet.source_language?.data?.id) { - report.lines.push({ - subitems: [ - content.attributes.slug, - `TextSet ${textSetIndex.toString()}`, - ], - name: "No Source Language", - type: "Error", - severity: "High", - description: "", - recommandation: "", - backendUrl: backendUrl, - frontendUrl: frontendUrl, - }); - } - - if (textSet.status !== Enum_Componentsetstextset_Status.Done) { - report.lines.push({ - subitems: [ - content.attributes.slug, - `TextSet ${textSetIndex.toString()}`, - ], - name: "Not Done Status", - type: "Improvement", - severity: "Low", - description: "", - recommandation: "", - backendUrl: backendUrl, - frontendUrl: frontendUrl, - }); - } - - if (!textSet.text || textSet.text.length < 10) { - report.lines.push({ - subitems: [ - content.attributes.slug, - `TextSet ${textSetIndex.toString()}`, - ], - name: "No Text", - type: "Missing", - severity: "Medium", - description: "", - recommandation: "", - backendUrl: backendUrl, - frontendUrl: frontendUrl, - }); - } - - if ( - textSet.source_language?.data?.id === - textSet.language?.data?.id - ) { - if (textSet.transcribers?.data.length === 0) { - report.lines.push({ - subitems: [ - content.attributes.slug, - `TextSet ${textSetIndex.toString()}`, - ], - name: "No Transcribers", - type: "Missing", - severity: "High", - description: - "The Content is a Transcription but doesn't credit any Transcribers.", - recommandation: "Add the appropriate Transcribers.", - backendUrl: backendUrl, - frontendUrl: frontendUrl, - }); - } - if ( - textSet.translators?.data && - textSet.translators.data.length > 0 - ) { - report.lines.push({ - subitems: [ - content.attributes.slug, - `TextSet ${textSetIndex.toString()}`, - ], - name: "Credited Translators", - type: "Error", - severity: "High", - description: - "The Content is a Transcription but credits one or more Translators.", - recommandation: - "If appropriate, create a Translation Text Set with the Translator credited there.", - backendUrl: backendUrl, - frontendUrl: frontendUrl, - }); - } - } else { - if (textSet.translators?.data.length === 0) { - report.lines.push({ - subitems: [ - content.attributes.slug, - `TextSet ${textSetIndex.toString()}`, - ], - name: "No Translators", - type: "Missing", - severity: "High", - description: - "The Content is a Transcription but doesn't credit any Translators.", - recommandation: "Add the appropriate Translators.", - backendUrl: backendUrl, - frontendUrl: frontendUrl, - }); - } - if ( - textSet.transcribers?.data && - textSet.transcribers.data.length > 0 - ) { - report.lines.push({ - subitems: [ - content.attributes.slug, - `TextSet ${textSetIndex.toString()}`, - ], - name: "Credited Transcribers", - type: "Error", - severity: "High", - description: - "The Content is a Translation but credits one or more Transcribers.", - recommandation: - "If appropriate, create a Transcription Text Set with the Transcribers credited there.", - backendUrl: backendUrl, - frontendUrl: frontendUrl, - }); - } - } - } - */ + *const textSetLanguages: string[] = []; + *if (content.attributes && textSet) { + * if (textSet.language?.data?.id) { + * if (textSet.language.data.id in textSetLanguages) { + * report.lines.push({ + * subitems: [ + * content.attributes.slug, + * `TextSet ${textSetIndex.toString()}`, + * ], + * name: "Duplicate Language", + * type: "Error", + * severity: "High", + * description: "", + * recommandation: "", + * backendUrl: backendUrl, + * frontendUrl: frontendUrl, + * }); + * } else { + * textSetLanguages.push(textSet.language.data.id); + * } + * } else { + * report.lines.push({ + * subitems: [ + * content.attributes.slug, + * `TextSet ${textSetIndex.toString()}`, + * ], + * name: "No Language", + * type: "Error", + * severity: "Very High", + * description: "", + * recommandation: "", + * backendUrl: backendUrl, + * frontendUrl: frontendUrl, + * }); + * } + * + * if (!textSet.source_language?.data?.id) { + * report.lines.push({ + * subitems: [ + * content.attributes.slug, + * `TextSet ${textSetIndex.toString()}`, + * ], + * name: "No Source Language", + * type: "Error", + * severity: "High", + * description: "", + * recommandation: "", + * backendUrl: backendUrl, + * frontendUrl: frontendUrl, + * }); + * } + * + * if (textSet.status !== Enum_Componentsetstextset_Status.Done) { + * report.lines.push({ + * subitems: [ + * content.attributes.slug, + * `TextSet ${textSetIndex.toString()}`, + * ], + * name: "Not Done Status", + * type: "Improvement", + * severity: "Low", + * description: "", + * recommandation: "", + * backendUrl: backendUrl, + * frontendUrl: frontendUrl, + * }); + * } + * + * if (!textSet.text || textSet.text.length < 10) { + * report.lines.push({ + * subitems: [ + * content.attributes.slug, + * `TextSet ${textSetIndex.toString()}`, + * ], + * name: "No Text", + * type: "Missing", + * severity: "Medium", + * description: "", + * recommandation: "", + * backendUrl: backendUrl, + * frontendUrl: frontendUrl, + * }); + * } + * + * if ( + * textSet.source_language?.data?.id === + * textSet.language?.data?.id + * ) { + * if (textSet.transcribers?.data.length === 0) { + * report.lines.push({ + * subitems: [ + * content.attributes.slug, + * `TextSet ${textSetIndex.toString()}`, + * ], + * name: "No Transcribers", + * type: "Missing", + * severity: "High", + * description: + * "The Content is a Transcription but doesn't credit any Transcribers.", + * recommandation: "Add the appropriate Transcribers.", + * backendUrl: backendUrl, + * frontendUrl: frontendUrl, + * }); + * } + * if ( + * textSet.translators?.data && + * textSet.translators.data.length > 0 + * ) { + * report.lines.push({ + * subitems: [ + * content.attributes.slug, + * `TextSet ${textSetIndex.toString()}`, + * ], + * name: "Credited Translators", + * type: "Error", + * severity: "High", + * description: + * "The Content is a Transcription but credits one or more Translators.", + * recommandation: + * "If appropriate, create a Translation Text Set with the Translator credited there.", + * backendUrl: backendUrl, + * frontendUrl: frontendUrl, + * }); + * } + * } else { + * if (textSet.translators?.data.length === 0) { + * report.lines.push({ + * subitems: [ + * content.attributes.slug, + * `TextSet ${textSetIndex.toString()}`, + * ], + * name: "No Translators", + * type: "Missing", + * severity: "High", + * description: + * "The Content is a Transcription but doesn't credit any Translators.", + * recommandation: "Add the appropriate Translators.", + * backendUrl: backendUrl, + * frontendUrl: frontendUrl, + * }); + * } + * if ( + * textSet.transcribers?.data && + * textSet.transcribers.data.length > 0 + * ) { + * report.lines.push({ + * subitems: [ + * content.attributes.slug, + * `TextSet ${textSetIndex.toString()}`, + * ], + * name: "Credited Transcribers", + * type: "Error", + * severity: "High", + * description: + * "The Content is a Translation but credits one or more Transcribers.", + * recommandation: + * "If appropriate, create a Transcription Text Set with the Transcribers credited there.", + * backendUrl: backendUrl, + * frontendUrl: frontendUrl, + * }); + * } + * } + *} + */ } report.lines.push({ diff --git a/src/pages/library/[slug]/index.tsx b/src/pages/library/[slug]/index.tsx index 7886f0f..9b20761 100644 --- a/src/pages/library/[slug]/index.tsx +++ b/src/pages/library/[slug]/index.tsx @@ -202,7 +202,7 @@ export default function LibrarySlug(props: Immutable): JSX.Element { <> {item?.urls && item.urls.length ? (
-

Available at

+

{langui.available_at}

{item.urls.map((url) => ( <> {url?.url && ( @@ -218,7 +218,7 @@ export default function LibrarySlug(props: Immutable): JSX.Element { ))}
) : ( -

This item is not for sale or is no longer available

+

{langui.item_not_available}

)} )} @@ -415,7 +415,7 @@ export default function LibrarySlug(props: Immutable): JSX.Element {
-

{"Always show info"}:

+

{langui.always_show_info}:

): JSX.Element {
-

{"Always show info"}:

+

{langui.always_show_info}:

diff --git a/src/pages/news/index.tsx b/src/pages/news/index.tsx index e1b51ad..6890ebc 100644 --- a/src/pages/news/index.tsx +++ b/src/pages/news/index.tsx @@ -34,7 +34,7 @@ export default function News(props: Immutable): JSX.Element { />
-

{"Always show info"}:

+

{langui.always_show_info}: