add page titles

This commit is contained in:
mrjvs 2023-11-29 18:49:04 +01:00
parent 9772711a2f
commit a2c114d93f
7 changed files with 39 additions and 2 deletions

View File

@ -56,7 +56,15 @@
"goHome": "Back to home" "goHome": "Back to home"
}, },
"global": { "global": {
"name": "movie-web" "name": "movie-web",
"pages": {
"pagetitle": "{{title}} - movie-web",
"dmca": "DMCA",
"settings": "Settings",
"about": "About",
"login": "Login",
"register": "Register"
}
}, },
"media": { "media": {
"types": { "types": {

View File

@ -3,6 +3,7 @@ import { useTranslation } from "react-i18next";
import { ThinContainer } from "@/components/layout/ThinContainer"; import { ThinContainer } from "@/components/layout/ThinContainer";
import { Ol } from "@/components/utils/Ol"; import { Ol } from "@/components/utils/Ol";
import { Heading1, Heading2, Paragraph } from "@/components/utils/Text"; import { Heading1, Heading2, Paragraph } from "@/components/utils/Text";
import { PageTitle } from "@/pages/parts/util/PageTitle";
import { SubPageLayout } from "./layouts/SubPageLayout"; import { SubPageLayout } from "./layouts/SubPageLayout";
@ -19,6 +20,7 @@ export function AboutPage() {
const { t } = useTranslation(); const { t } = useTranslation();
return ( return (
<SubPageLayout> <SubPageLayout>
<PageTitle subpage k="global.pages.about" />
<ThinContainer> <ThinContainer>
<Heading1>{t("faq.title")}</Heading1> <Heading1>{t("faq.title")}</Heading1>
<Ol <Ol

View File

@ -1,9 +1,9 @@
/* eslint-disable react/no-unescaped-entities */
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { Icon, Icons } from "@/components/Icon"; import { Icon, Icons } from "@/components/Icon";
import { ThinContainer } from "@/components/layout/ThinContainer"; import { ThinContainer } from "@/components/layout/ThinContainer";
import { Heading1, Paragraph } from "@/components/utils/Text"; import { Heading1, Paragraph } from "@/components/utils/Text";
import { PageTitle } from "@/pages/parts/util/PageTitle";
import { SubPageLayout } from "./layouts/SubPageLayout"; import { SubPageLayout } from "./layouts/SubPageLayout";
@ -13,6 +13,7 @@ export function DmcaPage() {
return ( return (
<SubPageLayout> <SubPageLayout>
<PageTitle subpage k="global.pages.dmca" />
<ThinContainer> <ThinContainer>
<Heading1>{t("screens.dmca.title")}</Heading1> <Heading1>{t("screens.dmca.title")}</Heading1>
<Paragraph>{t("screens.dmca.text")}</Paragraph> <Paragraph>{t("screens.dmca.text")}</Paragraph>

View File

@ -2,12 +2,14 @@ import { useHistory } from "react-router-dom";
import { SubPageLayout } from "@/pages/layouts/SubPageLayout"; import { SubPageLayout } from "@/pages/layouts/SubPageLayout";
import { LoginFormPart } from "@/pages/parts/auth/LoginFormPart"; import { LoginFormPart } from "@/pages/parts/auth/LoginFormPart";
import { PageTitle } from "@/pages/parts/util/PageTitle";
export function LoginPage() { export function LoginPage() {
const history = useHistory(); const history = useHistory();
return ( return (
<SubPageLayout> <SubPageLayout>
<PageTitle subpage k="global.pages.login" />
<LoginFormPart <LoginFormPart
onLogin={() => { onLogin={() => {
history.push("/"); history.push("/");

View File

@ -11,6 +11,7 @@ import {
import { PassphraseGeneratePart } from "@/pages/parts/auth/PassphraseGeneratePart"; import { PassphraseGeneratePart } from "@/pages/parts/auth/PassphraseGeneratePart";
import { TrustBackendPart } from "@/pages/parts/auth/TrustBackendPart"; import { TrustBackendPart } from "@/pages/parts/auth/TrustBackendPart";
import { VerifyPassphrase } from "@/pages/parts/auth/VerifyPassphrasePart"; import { VerifyPassphrase } from "@/pages/parts/auth/VerifyPassphrasePart";
import { PageTitle } from "@/pages/parts/util/PageTitle";
function CaptchaProvider(props: { function CaptchaProvider(props: {
siteKey: string | null; siteKey: string | null;
@ -34,6 +35,7 @@ export function RegisterPage() {
return ( return (
<CaptchaProvider siteKey={siteKey}> <CaptchaProvider siteKey={siteKey}>
<SubPageLayout> <SubPageLayout>
<PageTitle subpage k="global.pages.register" />
{step === 0 ? ( {step === 0 ? (
<TrustBackendPart <TrustBackendPart
onNext={(meta: MetaResponse) => { onNext={(meta: MetaResponse) => {

View File

@ -28,6 +28,7 @@ import { DeviceListPart } from "@/pages/parts/settings/DeviceListPart";
import { RegisterCalloutPart } from "@/pages/parts/settings/RegisterCalloutPart"; import { RegisterCalloutPart } from "@/pages/parts/settings/RegisterCalloutPart";
import { SidebarPart } from "@/pages/parts/settings/SidebarPart"; import { SidebarPart } from "@/pages/parts/settings/SidebarPart";
import { ThemePart } from "@/pages/parts/settings/ThemePart"; import { ThemePart } from "@/pages/parts/settings/ThemePart";
import { PageTitle } from "@/pages/parts/util/PageTitle";
import { AccountWithToken, useAuthStore } from "@/stores/auth"; import { AccountWithToken, useAuthStore } from "@/stores/auth";
import { useLanguageStore } from "@/stores/language"; import { useLanguageStore } from "@/stores/language";
import { useSubtitleStore } from "@/stores/subtitles"; import { useSubtitleStore } from "@/stores/subtitles";
@ -191,6 +192,7 @@ export function SettingsPage() {
]); ]);
return ( return (
<SubPageLayout> <SubPageLayout>
<PageTitle subpage k="global.pages.settings" />
<SettingsLayout> <SettingsLayout>
<div id="settings-account"> <div id="settings-account">
<Heading1 border className="!mb-0"> <Heading1 border className="!mb-0">

View File

@ -0,0 +1,20 @@
import { Helmet } from "react-helmet-async";
import { useTranslation } from "react-i18next";
export interface PageTitleProps {
k: string;
subpage?: boolean;
}
export function PageTitle(props: PageTitleProps) {
const { t } = useTranslation();
const title = t(props.k);
const subPageTitle = t("global.pages.pagetitle", { title });
return (
<Helmet>
<title>{props.subpage ? subPageTitle : title}</title>
</Helmet>
);
}