From cc9bed6667433fb550f3fe7a6b9479a299473c5e Mon Sep 17 00:00:00 2001 From: DrMint Date: Mon, 14 Feb 2022 05:49:43 +0100 Subject: [PATCH] Added more translations + more pages --- next.config.js | 9 ++++ src/components/Content/ThumbnailHeader.tsx | 30 ++++++++---- src/components/Panels/MainPanel.tsx | 8 ++-- src/graphql/operation.graphql | 18 +++++++ src/graphql/operations-types.ts | 18 +++++++ src/pages/about-us/index.tsx | 48 +++++++++++++++++++ src/pages/archives/index.tsx | 48 +++++++++++++++++++ src/pages/chronicles/index.tsx | 48 +++++++++++++++++++ src/pages/content/[slug]/index.tsx | 8 ++-- src/pages/content/[slug]/read.tsx | 8 +++- .../overview.tsx => data/chronology.tsx} | 2 +- src/pages/{chronology => data}/index.tsx | 29 ++++++----- src/pages/hubs/index.tsx | 34 +++++++++++-- src/pages/library/[slug].tsx | 46 +++++++++++++++--- src/pages/merch/index.tsx | 48 +++++++++++++++++++ src/pages/news/index.tsx | 48 +++++++++++++++++++ 16 files changed, 407 insertions(+), 43 deletions(-) create mode 100644 src/pages/about-us/index.tsx create mode 100644 src/pages/archives/index.tsx create mode 100644 src/pages/chronicles/index.tsx rename src/pages/{chronology/overview.tsx => data/chronology.tsx} (94%) rename src/pages/{chronology => data}/index.tsx (61%) create mode 100644 src/pages/merch/index.tsx create mode 100644 src/pages/news/index.tsx diff --git a/next.config.js b/next.config.js index 3748040..8f5d375 100644 --- a/next.config.js +++ b/next.config.js @@ -8,4 +8,13 @@ module.exports = { images: { domains: ['strapi.accords-library.com'], }, + async redirects() { + return [ + { + source: '/discord', + destination: 'https://discord.com/invite/5mcXcRAczj', + permanent: false, + }, + ] + }, } diff --git a/src/components/Content/ThumbnailHeader.tsx b/src/components/Content/ThumbnailHeader.tsx index fa7ec88..e668c76 100644 --- a/src/components/Content/ThumbnailHeader.tsx +++ b/src/components/Content/ThumbnailHeader.tsx @@ -1,21 +1,25 @@ -import { GetContentQuery } from "graphql/operations-types"; +import { + GetContentQuery, + GetWebsiteInterfaceQuery, +} from "graphql/operations-types"; import { getAssetURL, prettySlug } from "queries/helpers"; import Image from "next/image"; import Button from "components/Button"; -export type ThumbnailHeaderProps = { +export type Props = { content: { + slug: GetContentQuery["contents"]["data"][number]["attributes"]["slug"]; thumbnail: GetContentQuery["contents"]["data"][number]["attributes"]["thumbnail"]; titles: GetContentQuery["contents"]["data"][number]["attributes"]["titles"]; type: GetContentQuery["contents"]["data"][number]["attributes"]["type"]; categories: GetContentQuery["contents"]["data"][number]["attributes"]["categories"]; }; + langui: GetWebsiteInterfaceQuery["websiteInterfaces"]["data"][number]["attributes"]; }; -export default function ThumbnailHeader( - props: ThumbnailHeaderProps -): JSX.Element { +export default function ThumbnailHeader(props: Props): JSX.Element { const content = props.content; + const langui = props.langui; return ( <> @@ -34,16 +38,22 @@ export default function ThumbnailHeader( )}
-

{content.titles[0].pre_title}

-

{content.titles[0].title}

-

{content.titles[0].subtitle}

+ {content.titles.length > 0 ? ( + <> +

{content.titles[0].pre_title}

+

{content.titles[0].title}

+

{content.titles[0].subtitle}

+ + ) : ( +

{prettySlug(content.slug)}

+ )}
{content.type ? (
-

Type

+

{langui.global_type}

) : ( @@ -52,7 +62,7 @@ export default function ThumbnailHeader( {content.categories.data.length > 0 ? (
-

Categories

+

{langui.global_categories}

{content.categories.data.map((category) => ( ))} diff --git a/src/components/Panels/MainPanel.tsx b/src/components/Panels/MainPanel.tsx index c30c6f2..fdef626 100644 --- a/src/components/Panels/MainPanel.tsx +++ b/src/components/Panels/MainPanel.tsx @@ -56,10 +56,10 @@ export default function MainPanel(props: Props): JSX.Element { /> @@ -129,7 +129,7 @@ export default function MainPanel(props: Props): JSX.Element { diff --git a/src/graphql/operation.graphql b/src/graphql/operation.graphql index 6c83706..609beff 100644 --- a/src/graphql/operation.graphql +++ b/src/graphql/operation.graphql @@ -46,6 +46,24 @@ query getWebsiteInterface($language_code: String) { chronology_overview_description chronology_walkthrough chronology_walkthrough_description + library_item_front_matter + library_item_back_matter + library_item_type_textual + library_item_type_audio + library_item_type_game + library_item_type_video + library_item_type_other + library_item_open_content + library_item_view_scans + content_read_content + content_watch_content + content_listen_content + global_category + global_categories + global_paperback + global_hardcover + global_left_to_right + global_right_to_left } } } diff --git a/src/graphql/operations-types.ts b/src/graphql/operations-types.ts index 51160b9..e971bd6 100644 --- a/src/graphql/operations-types.ts +++ b/src/graphql/operations-types.ts @@ -120,6 +120,24 @@ export type GetWebsiteInterfaceQuery = { chronology_overview_description: string; chronology_walkthrough: string; chronology_walkthrough_description: string; + library_item_front_matter: string; + library_item_back_matter: string; + library_item_type_textual: string; + library_item_type_audio: string; + library_item_type_game: string; + library_item_type_video: string; + library_item_type_other: string; + library_item_open_content: string; + library_item_view_scans: string; + content_read_content: string; + content_watch_content: string; + content_listen_content: string; + global_category: string; + global_categories: string; + global_paperback: string; + global_hardcover: string; + global_left_to_right: string; + global_right_to_left: string; }; }>; }; diff --git a/src/pages/about-us/index.tsx b/src/pages/about-us/index.tsx new file mode 100644 index 0000000..66092ef --- /dev/null +++ b/src/pages/about-us/index.tsx @@ -0,0 +1,48 @@ +import SubPanel from "components/Panels/SubPanel"; +import { applyCustomAppProps } from "pages/_app"; +import PanelHeader from "components/PanelComponents/PanelHeader"; +import MainPanel from "components/Panels/MainPanel"; +import { GetWebsiteInterfaceQuery } from "graphql/operations-types"; +import { GetStaticProps } from "next"; +import { getWebsiteInterface } from "graphql/operations"; +import ContentPanel from "components/Panels/ContentPanel"; + +applyCustomAppProps(AboutUs, { + useSubPanel: true, + useContentPanel: true, +}); + +type Props = { + langui: GetWebsiteInterfaceQuery; +}; + +export default function AboutUs(props: Props): JSX.Element { + const langui = props.langui.websiteInterfaces.data[0].attributes; + return ( + <> + + + + + Hello + + ); +} + +export const getStaticProps: GetStaticProps = async (context) => { + if (context.locale) { + const props: Props = { + langui: await getWebsiteInterface({ + language_code: context.locale, + }), + }; + return { + props: props, + }; + } + return { props: {} }; +}; diff --git a/src/pages/archives/index.tsx b/src/pages/archives/index.tsx new file mode 100644 index 0000000..08e4c67 --- /dev/null +++ b/src/pages/archives/index.tsx @@ -0,0 +1,48 @@ +import SubPanel from "components/Panels/SubPanel"; +import { applyCustomAppProps } from "pages/_app"; +import PanelHeader from "components/PanelComponents/PanelHeader"; +import MainPanel from "components/Panels/MainPanel"; +import { GetWebsiteInterfaceQuery } from "graphql/operations-types"; +import { GetStaticProps } from "next"; +import { getWebsiteInterface } from "graphql/operations"; +import ContentPanel from "components/Panels/ContentPanel"; + +applyCustomAppProps(Archives, { + useSubPanel: true, + useContentPanel: true, +}); + +type Props = { + langui: GetWebsiteInterfaceQuery; +}; + +export default function Archives(props: Props): JSX.Element { + const langui = props.langui.websiteInterfaces.data[0].attributes; + return ( + <> + + + + + Hello + + ); +} + +export const getStaticProps: GetStaticProps = async (context) => { + if (context.locale) { + const props: Props = { + langui: await getWebsiteInterface({ + language_code: context.locale, + }), + }; + return { + props: props, + }; + } + return { props: {} }; +}; diff --git a/src/pages/chronicles/index.tsx b/src/pages/chronicles/index.tsx new file mode 100644 index 0000000..73c4ef0 --- /dev/null +++ b/src/pages/chronicles/index.tsx @@ -0,0 +1,48 @@ +import SubPanel from "components/Panels/SubPanel"; +import { applyCustomAppProps } from "pages/_app"; +import PanelHeader from "components/PanelComponents/PanelHeader"; +import MainPanel from "components/Panels/MainPanel"; +import { GetWebsiteInterfaceQuery } from "graphql/operations-types"; +import { GetStaticProps } from "next"; +import { getWebsiteInterface } from "graphql/operations"; +import ContentPanel from "components/Panels/ContentPanel"; + +applyCustomAppProps(Chronicles, { + useSubPanel: true, + useContentPanel: true, +}); + +type Props = { + langui: GetWebsiteInterfaceQuery; +}; + +export default function Chronicles(props: Props): JSX.Element { + const langui = props.langui.websiteInterfaces.data[0].attributes; + return ( + <> + + + + + Hello + + ); +} + +export const getStaticProps: GetStaticProps = async (context) => { + if (context.locale) { + const props: Props = { + langui: await getWebsiteInterface({ + language_code: context.locale, + }), + }; + return { + props: props, + }; + } + return { props: {} }; +}; diff --git a/src/pages/content/[slug]/index.tsx b/src/pages/content/[slug]/index.tsx index 9823082..9114db2 100644 --- a/src/pages/content/[slug]/index.tsx +++ b/src/pages/content/[slug]/index.tsx @@ -36,13 +36,13 @@ export default function Library(props: Props): JSX.Element {
- + {content.text_set.length > 0 ? ( ) : ( "" @@ -50,7 +50,7 @@ export default function Library(props: Props): JSX.Element { {content.audio_set.length > 0 ? ( ) : ( "" @@ -58,7 +58,7 @@ export default function Library(props: Props): JSX.Element { {content.video_set.length > 0 ? ( ) : ( "" diff --git a/src/pages/content/[slug]/read.tsx b/src/pages/content/[slug]/read.tsx index e7e94ff..4bda0ef 100644 --- a/src/pages/content/[slug]/read.tsx +++ b/src/pages/content/[slug]/read.tsx @@ -39,11 +39,15 @@ export default function Library(props: Props): JSX.Element { <> - +
- + diff --git a/src/pages/chronology/overview.tsx b/src/pages/data/chronology.tsx similarity index 94% rename from src/pages/chronology/overview.tsx rename to src/pages/data/chronology.tsx index 274d1b4..88d2955 100644 --- a/src/pages/chronology/overview.tsx +++ b/src/pages/data/chronology.tsx @@ -49,7 +49,7 @@ export default function ChronologyOverview(props: Props): JSX.Element { <> - + {props.chronologyEras.chronologyEras.data.map((era) => ( diff --git a/src/pages/chronology/index.tsx b/src/pages/data/index.tsx similarity index 61% rename from src/pages/chronology/index.tsx rename to src/pages/data/index.tsx index c5223ac..d35f5b6 100644 --- a/src/pages/chronology/index.tsx +++ b/src/pages/data/index.tsx @@ -7,7 +7,7 @@ import { GetWebsiteInterfaceQuery } from "graphql/operations-types"; import { GetStaticProps } from "next"; import { getWebsiteInterface } from "graphql/operations"; -applyCustomAppProps(Chronology, { +applyCustomAppProps(Data, { useSubPanel: true, useContentPanel: false, }); @@ -16,36 +16,43 @@ type Props = { langui: GetWebsiteInterfaceQuery; }; -export default function Chronology(props: Props): JSX.Element { +export default function Data(props: Props): JSX.Element { const langui = props.langui.websiteInterfaces.data[0].attributes; return ( <> + + diff --git a/src/pages/hubs/index.tsx b/src/pages/hubs/index.tsx index 4a3de90..4bf50fc 100644 --- a/src/pages/hubs/index.tsx +++ b/src/pages/hubs/index.tsx @@ -1,22 +1,48 @@ import SubPanel from "components/Panels/SubPanel"; import { applyCustomAppProps } from "pages/_app"; import PanelHeader from "components/PanelComponents/PanelHeader"; +import MainPanel from "components/Panels/MainPanel"; +import { GetWebsiteInterfaceQuery } from "graphql/operations-types"; +import { GetStaticProps } from "next"; +import { getWebsiteInterface } from "graphql/operations"; +import ContentPanel from "components/Panels/ContentPanel"; applyCustomAppProps(Hubs, { useSubPanel: true, - useContentPanel: false, + useContentPanel: true, }); -export default function Hubs(): JSX.Element { +type Props = { + langui: GetWebsiteInterfaceQuery; +}; + +export default function Hubs(props: Props): JSX.Element { + const langui = props.langui.websiteInterfaces.data[0].attributes; return ( <> + + Hello ); } + +export const getStaticProps: GetStaticProps = async (context) => { + if (context.locale) { + const props: Props = { + langui: await getWebsiteInterface({ + language_code: context.locale, + }), + }; + return { + props: props, + }; + } + return { props: {} }; +}; diff --git a/src/pages/library/[slug].tsx b/src/pages/library/[slug].tsx index 18ac565..5b7df46 100644 --- a/src/pages/library/[slug].tsx +++ b/src/pages/library/[slug].tsx @@ -10,6 +10,8 @@ import { getWebsiteInterface, } from "graphql/operations"; import { + Enum_Componentmetadatabooks_Binding_Type, + Enum_Componentmetadatabooks_Page_Order, GetLibraryItemQuery, GetWebsiteInterfaceQuery, } from "graphql/operations-types"; @@ -91,6 +93,7 @@ export default function Library(props: Props): JSX.Element { /> {item.subitems.data.length > 0 ? ( + item.metadata.length > 0 && item.metadata[0].__typename === "ComponentMetadataOther" && item.metadata[0].subtype.data.attributes.slug === "variant-set" ? (

{langui.global_type}

) : ( @@ -304,14 +319,30 @@ export default function Library(props: Props): JSX.Element {

{langui.global_binding}:

-

{item.metadata[0].binding_type}

+

+ {item.metadata[0].binding_type === + Enum_Componentmetadatabooks_Binding_Type.Paperback + ? langui.global_paperback + : item.metadata[0].binding_type === + Enum_Componentmetadatabooks_Binding_Type.Hardcover + ? langui.global_hardcover + : ""} +

{langui.global_page_order}:

-

{prettySlug(item.metadata[0].page_order)}

+

+ {item.metadata[0].page_order === + Enum_Componentmetadatabooks_Page_Order.LeftToRight + ? langui.global_left_to_right + : item.metadata[0].page_order === + Enum_Componentmetadatabooks_Page_Order.RightToLeft + ? langui.global_right_to_left + : ""} +

@@ -362,6 +393,7 @@ export default function Library(props: Props): JSX.Element {
{item.subitems.data.length > 0 ? ( + item.metadata.length > 0 && item.metadata[0].__typename === "ComponentMetadataOther" && item.metadata[0].subtype.data.attributes.slug === "variant-set" ? (
- View scans + {langui.library_item_view_scans} ) : ( "" @@ -475,7 +507,7 @@ export default function Library(props: Props): JSX.Element { ) : ( "" diff --git a/src/pages/merch/index.tsx b/src/pages/merch/index.tsx new file mode 100644 index 0000000..24fa29a --- /dev/null +++ b/src/pages/merch/index.tsx @@ -0,0 +1,48 @@ +import SubPanel from "components/Panels/SubPanel"; +import { applyCustomAppProps } from "pages/_app"; +import PanelHeader from "components/PanelComponents/PanelHeader"; +import MainPanel from "components/Panels/MainPanel"; +import { GetWebsiteInterfaceQuery } from "graphql/operations-types"; +import { GetStaticProps } from "next"; +import { getWebsiteInterface } from "graphql/operations"; +import ContentPanel from "components/Panels/ContentPanel"; + +applyCustomAppProps(Merch, { + useSubPanel: true, + useContentPanel: true, +}); + +type Props = { + langui: GetWebsiteInterfaceQuery; +}; + +export default function Merch(props: Props): JSX.Element { + const langui = props.langui.websiteInterfaces.data[0].attributes; + return ( + <> + + + + + Hello + + ); +} + +export const getStaticProps: GetStaticProps = async (context) => { + if (context.locale) { + const props: Props = { + langui: await getWebsiteInterface({ + language_code: context.locale, + }), + }; + return { + props: props, + }; + } + return { props: {} }; +}; diff --git a/src/pages/news/index.tsx b/src/pages/news/index.tsx new file mode 100644 index 0000000..2dfe173 --- /dev/null +++ b/src/pages/news/index.tsx @@ -0,0 +1,48 @@ +import SubPanel from "components/Panels/SubPanel"; +import { applyCustomAppProps } from "pages/_app"; +import PanelHeader from "components/PanelComponents/PanelHeader"; +import MainPanel from "components/Panels/MainPanel"; +import { GetWebsiteInterfaceQuery } from "graphql/operations-types"; +import { GetStaticProps } from "next"; +import { getWebsiteInterface } from "graphql/operations"; +import ContentPanel from "components/Panels/ContentPanel"; + +applyCustomAppProps(News, { + useSubPanel: true, + useContentPanel: true, +}); + +type Props = { + langui: GetWebsiteInterfaceQuery; +}; + +export default function News(props: Props): JSX.Element { + const langui = props.langui.websiteInterfaces.data[0].attributes; + return ( + <> + + + + + Hello + + ); +} + +export const getStaticProps: GetStaticProps = async (context) => { + if (context.locale) { + const props: Props = { + langui: await getWebsiteInterface({ + language_code: context.locale, + }), + }; + return { + props: props, + }; + } + return { props: {} }; +};