Added messages to more pages
This commit is contained in:
parent
54940260e7
commit
3089f2b6fd
|
@ -1,4 +1,5 @@
|
|||
import AppLayout from "components/AppLayout";
|
||||
import LanguageSwitcher from "components/LanguageSwitcher";
|
||||
import Markdawn from "components/Markdown/Markdawn";
|
||||
import TOC from "components/Markdown/TOC";
|
||||
import ReturnButton, {
|
||||
|
@ -6,7 +7,7 @@ import ReturnButton, {
|
|||
} from "components/PanelComponents/ReturnButton";
|
||||
import ContentPanel from "components/Panels/ContentPanel";
|
||||
import SubPanel from "components/Panels/SubPanel";
|
||||
import { getPost } from "graphql/operations";
|
||||
import { getPost, getPostLanguages } from "graphql/operations";
|
||||
import { GetPostQuery } from "graphql/operations-types";
|
||||
import { GetStaticProps } from "next";
|
||||
import { useRouter } from "next/router";
|
||||
|
@ -15,12 +16,13 @@ import { prettySlug } from "queries/helpers";
|
|||
|
||||
interface AccordsHandbookProps extends AppStaticProps {
|
||||
post: GetPostQuery["posts"]["data"][number]["attributes"];
|
||||
locales: string[];
|
||||
}
|
||||
|
||||
export default function AccordsHandbook(
|
||||
props: AccordsHandbookProps
|
||||
): JSX.Element {
|
||||
const { langui, post } = props;
|
||||
const { langui, post, locales } = props;
|
||||
const router = useRouter();
|
||||
|
||||
const subPanel = (
|
||||
|
@ -51,8 +53,15 @@ export default function AccordsHandbook(
|
|||
title={langui.about_us}
|
||||
className="mb-10"
|
||||
/>
|
||||
{post.translations.length > 0 && (
|
||||
{locales.includes(router.locale || "en") ? (
|
||||
<Markdawn router={router} text={post.translations[0].body} />
|
||||
) : (
|
||||
<LanguageSwitcher
|
||||
locales={locales}
|
||||
router={router}
|
||||
languages={props.languages}
|
||||
langui={props.langui}
|
||||
/>
|
||||
)}
|
||||
</ContentPanel>
|
||||
);
|
||||
|
@ -72,14 +81,20 @@ export default function AccordsHandbook(
|
|||
}
|
||||
|
||||
export const getStaticProps: GetStaticProps = async (context) => {
|
||||
const slug = "accords-handbook";
|
||||
const props: AccordsHandbookProps = {
|
||||
...(await getAppStaticProps(context)),
|
||||
post: (
|
||||
await getPost({
|
||||
slug: "accords-handbook",
|
||||
slug: slug,
|
||||
language_code: context.locale || "en",
|
||||
})
|
||||
).posts.data[0].attributes,
|
||||
locales: (
|
||||
await getPostLanguages({ slug: slug })
|
||||
).posts.data[0].attributes.translations.map((translation) => {
|
||||
return translation.language.data.attributes.code;
|
||||
}),
|
||||
};
|
||||
return {
|
||||
props: props,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import AppLayout from "components/AppLayout";
|
||||
import LanguageSwitcher from "components/LanguageSwitcher";
|
||||
import Markdawn from "components/Markdown/Markdawn";
|
||||
import TOC from "components/Markdown/TOC";
|
||||
import ReturnButton, {
|
||||
|
@ -6,7 +7,7 @@ import ReturnButton, {
|
|||
} from "components/PanelComponents/ReturnButton";
|
||||
import ContentPanel from "components/Panels/ContentPanel";
|
||||
import SubPanel from "components/Panels/SubPanel";
|
||||
import { getPost } from "graphql/operations";
|
||||
import { getPost, getPostLanguages } from "graphql/operations";
|
||||
import { GetPostQuery } from "graphql/operations-types";
|
||||
import { GetStaticProps } from "next";
|
||||
import { useRouter } from "next/router";
|
||||
|
@ -15,10 +16,11 @@ import { prettySlug } from "queries/helpers";
|
|||
|
||||
interface SiteInfoProps extends AppStaticProps {
|
||||
post: GetPostQuery["posts"]["data"][number]["attributes"];
|
||||
locales: string[];
|
||||
}
|
||||
|
||||
export default function SiteInformation(props: SiteInfoProps): JSX.Element {
|
||||
const { langui, post } = props;
|
||||
const { langui, post, locales } = props;
|
||||
const router = useRouter();
|
||||
|
||||
const subPanel = (
|
||||
|
@ -49,8 +51,15 @@ export default function SiteInformation(props: SiteInfoProps): JSX.Element {
|
|||
title={langui.about_us}
|
||||
className="mb-10"
|
||||
/>
|
||||
{post.translations.length > 0 && (
|
||||
{locales.includes(router.locale || "en") ? (
|
||||
<Markdawn router={router} text={post.translations[0].body} />
|
||||
) : (
|
||||
<LanguageSwitcher
|
||||
locales={locales}
|
||||
router={router}
|
||||
languages={props.languages}
|
||||
langui={props.langui}
|
||||
/>
|
||||
)}
|
||||
</ContentPanel>
|
||||
);
|
||||
|
@ -70,14 +79,20 @@ export default function SiteInformation(props: SiteInfoProps): JSX.Element {
|
|||
}
|
||||
|
||||
export const getStaticProps: GetStaticProps = async (context) => {
|
||||
const slug = "legality";
|
||||
const props: SiteInfoProps = {
|
||||
...(await getAppStaticProps(context)),
|
||||
post: (
|
||||
await getPost({
|
||||
slug: "legality",
|
||||
slug: slug,
|
||||
language_code: context.locale || "en",
|
||||
})
|
||||
).posts.data[0].attributes,
|
||||
locales: (
|
||||
await getPostLanguages({ slug: slug })
|
||||
).posts.data[0].attributes.translations.map((translation) => {
|
||||
return translation.language.data.attributes.code;
|
||||
}),
|
||||
};
|
||||
return {
|
||||
props: props,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import AppLayout from "components/AppLayout";
|
||||
import LanguageSwitcher from "components/LanguageSwitcher";
|
||||
import Markdawn from "components/Markdown/Markdawn";
|
||||
import TOC from "components/Markdown/TOC";
|
||||
import ReturnButton, {
|
||||
|
@ -6,7 +7,7 @@ import ReturnButton, {
|
|||
} from "components/PanelComponents/ReturnButton";
|
||||
import ContentPanel from "components/Panels/ContentPanel";
|
||||
import SubPanel from "components/Panels/SubPanel";
|
||||
import { getPost } from "graphql/operations";
|
||||
import { getPost, getPostLanguages } from "graphql/operations";
|
||||
import { GetPostQuery } from "graphql/operations-types";
|
||||
import { GetStaticProps } from "next";
|
||||
import { useRouter } from "next/router";
|
||||
|
@ -15,10 +16,11 @@ import { prettySlug } from "queries/helpers";
|
|||
|
||||
interface SharingPolicyProps extends AppStaticProps {
|
||||
post: GetPostQuery["posts"]["data"][number]["attributes"];
|
||||
locales: string[];
|
||||
}
|
||||
|
||||
export default function SharingPolicy(props: SharingPolicyProps): JSX.Element {
|
||||
const { langui, post } = props;
|
||||
const { langui, post, locales } = props;
|
||||
const router = useRouter();
|
||||
|
||||
const subPanel = (
|
||||
|
@ -49,8 +51,15 @@ export default function SharingPolicy(props: SharingPolicyProps): JSX.Element {
|
|||
title={langui.about_us}
|
||||
className="mb-10"
|
||||
/>
|
||||
{post.translations.length > 0 && (
|
||||
{locales.includes(router.locale || "en") ? (
|
||||
<Markdawn router={router} text={post.translations[0].body} />
|
||||
) : (
|
||||
<LanguageSwitcher
|
||||
locales={locales}
|
||||
router={router}
|
||||
languages={props.languages}
|
||||
langui={props.langui}
|
||||
/>
|
||||
)}
|
||||
</ContentPanel>
|
||||
);
|
||||
|
@ -70,6 +79,7 @@ export default function SharingPolicy(props: SharingPolicyProps): JSX.Element {
|
|||
}
|
||||
|
||||
export const getStaticProps: GetStaticProps = async (context) => {
|
||||
const slug = "sharing-policy";
|
||||
const props: SharingPolicyProps = {
|
||||
...(await getAppStaticProps(context)),
|
||||
post: (
|
||||
|
@ -78,6 +88,11 @@ export const getStaticProps: GetStaticProps = async (context) => {
|
|||
language_code: context.locale || "en",
|
||||
})
|
||||
).posts.data[0].attributes,
|
||||
locales: (
|
||||
await getPostLanguages({ slug: slug })
|
||||
).posts.data[0].attributes.translations.map((translation) => {
|
||||
return translation.language.data.attributes.code;
|
||||
}),
|
||||
};
|
||||
return {
|
||||
props: props,
|
||||
|
|
Loading…
Reference in New Issue