Skip to content

Commit

Permalink
refactor: added page titles
Browse files Browse the repository at this point in the history
  • Loading branch information
ivopr committed Jan 4, 2024
1 parent cb1f0b7 commit fdba822
Show file tree
Hide file tree
Showing 13 changed files with 111 additions and 8 deletions.
9 changes: 9 additions & 0 deletions client/app/[locale]/(auth)/login/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import { PageLayout } from "@/components/Layouts/PageLayout";
import { getI18n } from "@/locales/server";

import { FormLogin } from "./form";

export async function generateMetadata() {
const t = await getI18n();

return {
title: t("navigation.auth.login")
};
}

export default function Page() {
return (
<PageLayout>
Expand Down
9 changes: 9 additions & 0 deletions client/app/[locale]/(auth)/register/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import { createUser } from "@/app/[locale]/(auth)/register/createUser";
import { FormRegister } from "@/app/[locale]/(auth)/register/form";
import { PageLayout } from "@/components/Layouts/PageLayout";
import { getI18n } from "@/locales/server";

export async function generateMetadata() {
const t = await getI18n();

return {
title: t("navigation.auth.register")
};
}

export default function Page() {
return (
Expand Down
8 changes: 8 additions & 0 deletions client/app/[locale]/(auth)/reset/[resetId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ import { getI18n } from "@/locales/server";
import { ResetPasswordForm } from "./form";
import { resetUserPassword } from "./resetUserPassword";

export async function generateMetadata() {
const t = await getI18n();

return {
title: t("reset.reset-form.password.title")
};
}

export default async function Page({
params
}: {
Expand Down
8 changes: 8 additions & 0 deletions client/app/[locale]/(auth)/reset/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ import { PageLayout } from "@/components/Layouts/PageLayout";
import { H1 } from "@/components/Typography";
import { getI18n } from "@/locales/server";

export async function generateMetadata() {
const t = await getI18n();

return {
title: t("login.lost-password")
};
}

export default async function Page({
searchParams
}: {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ExternalLink } from "lucide-react";
import Link from "next/link";

import { Maintainer } from "@/app/[locale]/about/Maintainer";
import fernandoImg from "@/assets/maintainers/fernando.jpg";
import ivoImg from "@/assets/maintainers/ivo.jpg";
import rafaelImg from "@/assets/maintainers/rafael.jpg";
Expand All @@ -11,6 +10,16 @@ import { H1, H2 } from "@/components/Typography";
import { getI18n } from "@/locales/server";
import logo from "@/public/images/favicon.svg";

import { Maintainer } from "./Maintainer";

export async function generateMetadata() {
const t = await getI18n();

return {
title: t("navigation.system.about")
};
}

const maintainers: Maintainer[] = [
{
name: "Dr. Fernando Berton Zanchi",
Expand Down
9 changes: 9 additions & 0 deletions client/app/[locale]/(content)/tutorials/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import { PageLayout } from "@/components/Layouts/PageLayout";
import { H2 } from "@/components/Typography";
import { getI18n } from "@/locales/server";

export async function generateMetadata() {
const t = await getI18n();

return {
title: t("navigation.system.knowledge")
};
}

const videos = [
{
Expand Down
9 changes: 9 additions & 0 deletions client/app/[locale]/(content)/usage/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
import { PageLayout } from "@/components/Layouts/PageLayout";
import { getI18n } from "@/locales/server";

export async function generateMetadata() {
const t = await getI18n();

return {
title: t("navigation.system.usage")
};
}

export default function Page() {
return (
Expand Down
11 changes: 10 additions & 1 deletion client/app/[locale]/(simulation)/simulations/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ import { SimulationList } from "@/app/[locale]/(simulation)/simulations/Simulati
import { PageLayout } from "@/components/Layouts/PageLayout";
import { authOptions } from "@/lib/auth";
import { queryClient } from "@/lib/queryClient";
import { getI18n } from "@/locales/server";

export async function generateMetadata() {
const t = await getI18n();

return {
title: t("simulations.title")
};
}

export default async function Page() {
const session = await getServerSession(authOptions);
Expand All @@ -15,7 +24,7 @@ export default async function Page() {
redirect("/login?reason=unauthenticated");
}

queryClient.prefetchQuery({
await queryClient.prefetchQuery({
queryFn: () => getSimulations(session.user.username),
queryKey: ["SimulationList", session.user.username]
});
Expand Down
10 changes: 9 additions & 1 deletion client/app/[locale]/admin/settings/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ import { getI18n } from "@/locales/server";
import { AppSettings } from "./AppSettings";
import { MDPSettings } from "./MDPSettings";

export async function generateMetadata() {
const t = await getI18n();

return {
title: t("admin.settings.title")
};
}

export default async function Page() {
const session = await getServerSession(authOptions);
const t = await getI18n();
Expand All @@ -24,7 +32,7 @@ export default async function Page() {
redirect("/simulations?reason=unauthorized");
}

queryClient.prefetchQuery({
await queryClient.prefetchQuery({
queryKey: ["MDPSettings"],
queryFn: () => getMDPSettings()
});
Expand Down
12 changes: 10 additions & 2 deletions client/app/[locale]/admin/simulations/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ import { QueuedSimulationsList } from "./QueuedSimulationsList";
import { RunningSimulationsList } from "./RunningSimulationsList";
import { TriggerRun } from "./TriggerRun";

export async function generateMetadata() {
const t = await getI18n();

return {
title: t("admin.simulations.title")
};
}

export default async function Page() {
const t = await getI18n();
const session = await getServerSession(authOptions);
Expand All @@ -27,12 +35,12 @@ export default async function Page() {
redirect("/simulations?reason=unauthorized");
}

queryClient.prefetchQuery({
await queryClient.prefetchQuery({
queryKey: ["QueuedSimulations"],
queryFn: () => getQueuedSimulations()
});

queryClient.prefetchQuery({
await queryClient.prefetchQuery({
queryKey: ["RunningSimulations"],
queryFn: () => getRunningSimulations()
});
Expand Down
13 changes: 11 additions & 2 deletions client/app/[locale]/admin/user-validation/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ import { getValidationUsers } from "@/app/[locale]/admin/user-validation/Validat
import { PageLayout } from "@/components/Layouts/PageLayout";
import { authOptions } from "@/lib/auth";
import { queryClient } from "@/lib/queryClient";
import { getI18n } from "@/locales/server";

export async function generateMetadata() {
const t = await getI18n();

return {
title: t("admin.validation.title")
};
}

export default async function Page() {
const session = await getServerSession(authOptions);
Expand All @@ -20,12 +29,12 @@ export default async function Page() {
redirect("/simulations?reason=unauthorized");
}

queryClient.prefetchQuery({
await queryClient.prefetchQuery({
queryFn: () => getValidationUsers("rejected"),
queryKey: ["RejectedUsersList"]
});

queryClient.prefetchQuery({
await queryClient.prefetchQuery({
queryFn: () => getValidationUsers(),
queryKey: ["InactiveUsersList"]
});
Expand Down
10 changes: 9 additions & 1 deletion client/app/[locale]/admin/users/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ import { authOptions } from "@/lib/auth";
import { queryClient } from "@/lib/queryClient";
import { getI18n } from "@/locales/server";

export async function generateMetadata() {
const t = await getI18n();

return {
title: t("admin.users.title")
};
}

export default async function Page() {
const session = await getServerSession(authOptions);

Expand All @@ -21,7 +29,7 @@ export default async function Page() {
redirect("/simulations?reason=unauthorized");
}

queryClient.prefetchQuery({
await queryClient.prefetchQuery({
queryKey: ["Users", "", 10, 1],
queryFn: () =>
getUsers({
Expand Down

0 comments on commit fdba822

Please sign in to comment.