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