Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added static page generation for each locale #337

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/app/[locale]/(private)/about/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Heading1, Heading4 } from '@/components/typography/headers';
import { SubLayout } from '../sub-layout';
import { useTranslations } from 'next-intl';
import { getTranslations } from 'next-intl/server';
import { getTranslations, setRequestLocale } from 'next-intl/server';

const INTL_NAMESPACE = 'private.about';

Expand All @@ -13,7 +13,9 @@ export async function generateMetadata({ params: { locale } }: any) {
};
}

export default function AboutPage() {
export default function AboutPage({ params: { locale } }: { params: { locale: string } }) {
setRequestLocale(locale);

const t = useTranslations(INTL_NAMESPACE);

return (
Expand Down
6 changes: 4 additions & 2 deletions src/app/[locale]/(private)/contacts/complaints/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useTranslations } from 'next-intl';
import { getTranslations } from 'next-intl/server';
import { getTranslations, setRequestLocale } from 'next-intl/server';
import { SubLayout } from '../../sub-layout';
import { Heading1 } from '@/components/typography/headers';
import { Paragraph } from '@/components/typography/paragraph';
Expand All @@ -14,7 +14,9 @@ export async function generateMetadata({ params: { locale } }: any) {
};
}

export default function ComplaintsPage() {
export default function ComplaintsPage({ params: { locale } }: { params: { locale: string } }) {
setRequestLocale(locale);

const t = useTranslations(INTL_NAMESPACE);
const contactsT = useTranslations('private.contacts');

Expand Down
6 changes: 4 additions & 2 deletions src/app/[locale]/(private)/contacts/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Heading1, Heading3 } from '@/components/typography/headers';
import { SubLayout } from '../sub-layout';
import { useTranslations } from 'next-intl';
import { getTranslations } from 'next-intl/server';
import { getTranslations, setRequestLocale } from 'next-intl/server';
import { Link } from '@/i18n/routing';
import { TextButton } from '@/components/ui/text-button';
import { ChatsTeardrop, EnvelopeSimple } from '@/app/images';
Expand All @@ -16,7 +16,9 @@ export async function generateMetadata({ params: { locale } }: any) {
};
}

export default function ContactsPage() {
export default function ContactsPage({ params: { locale } }: { params: { locale: string } }) {
setRequestLocale(locale);

const t = useTranslations(INTL_NAMESPACE);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Heading1, Heading4 } from '@/components/typography/headers';
import { SubLayout } from '../sub-layout';
import { useTranslations } from 'next-intl';
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/ui/accordion';
import { getTranslations } from 'next-intl/server';
import { getTranslations, setRequestLocale } from 'next-intl/server';

const SECTIONS = ['how-to-register', 'how-to-restore-password'];

Expand All @@ -16,7 +16,9 @@ export async function generateMetadata({ params: { locale } }: any) {
};
}

export default function FAQPage() {
export default function FAQPage({ params: { locale } }: { params: { locale: string } }) {
setRequestLocale(locale);

const t = useTranslations(INTL_NAMESPACE);

return (
Expand Down
6 changes: 4 additions & 2 deletions src/app/[locale]/(private)/kpi-documents/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Heading1 } from '@/components/typography/headers';
import { useTranslations } from 'next-intl';
import { SubLayout } from '../sub-layout';
import { getTranslations } from 'next-intl/server';
import { getTranslations, setRequestLocale } from 'next-intl/server';
import { BookBookmark, BookOpen, Roll } from '@/app/images';
import { DocumentCard } from './document-card';

Expand All @@ -15,7 +15,9 @@ export async function generateMetadata({ params: { locale } }: any) {
};
}

export default function KPIDocumentsPage() {
export default function KPIDocumentsPage({ params: { locale } }: { params: { locale: string } }) {
setRequestLocale(locale);

const t = useTranslations(INTL_NAMESPACE);

return (
Expand Down
6 changes: 4 additions & 2 deletions src/app/[locale]/(private)/terms-of-service/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Heading1 } from '@/components/typography/headers';
import { SubLayout } from '../sub-layout';
import { useTranslations } from 'next-intl';
import { getTranslations } from 'next-intl/server';
import { getTranslations, setRequestLocale } from 'next-intl/server';

const INTL_NAMESPACE = 'private.terms-of-service';

Expand All @@ -13,7 +13,9 @@ export async function generateMetadata({ params: { locale } }: any) {
};
}

export default function TermsOfServicePage() {
export default function TermsOfServicePage({ params: { locale } }: { params: { locale: string } }) {
setRequestLocale(locale);

const t = useTranslations(INTL_NAMESPACE);

return (
Expand Down
6 changes: 4 additions & 2 deletions src/app/[locale]/(private)/user-manual/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Heading1 } from '@/components/typography/headers';
import { useTranslations } from 'next-intl';
import { SubLayout } from '../sub-layout';
import { DownloadButton } from './download-button';
import { getTranslations } from 'next-intl/server';
import { getTranslations, setRequestLocale } from 'next-intl/server';

const USER_MANUAL_URL = process.env.NEXT_PUBLIC_USER_MANUAL_URL!;

Expand All @@ -16,7 +16,9 @@ export async function generateMetadata({ params: { locale } }: any) {
};
}

export default function UserManualPage() {
export default function UserManualPage({ params: { locale } }: { params: { locale: string } }) {
setRequestLocale(locale);

const t = useTranslations(INTL_NAMESPACE);

return (
Expand Down
5 changes: 5 additions & 0 deletions src/app/[locale]/(public)/(auth)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import { setRequestLocale } from 'next-intl/server';
import { Footer } from '../footer';
import { Header } from '../header';
import { LoginCarousel } from './login-carousel';

export default function AuthLayout({
children,
params: { locale },
}: Readonly<{
children: React.ReactNode;
params: { locale: string };
}>) {
setRequestLocale(locale);

return (
<div className="flex h-dvh min-h-fit min-w-[344px] gap-[20px] p-[20px]">
<div className="flex min-h-fit grow basis-0 flex-col md:px-[28px] md:py-[16px]">
Expand Down
1 change: 1 addition & 0 deletions src/app/[locale]/(public)/(auth)/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export async function generateMetadata({ params: { locale } }: any) {

export default function LoginPage({ params: { locale } }: { params: { locale: string } }) {
setRequestLocale(locale);

const t = useTranslations('auth.login');

return (
Expand Down
8 changes: 2 additions & 6 deletions src/app/[locale]/(public)/(auth)/password-reset/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,14 @@ import PasswordResetForm from './password-reset-form';
import { AuthNavLayout } from '../../auth-nav-layout';

export async function generateMetadata({ params: { locale } }: any) {
const t = await getTranslations({ locale, namespace: 'auth.passwordReset'});
const t = await getTranslations({ locale, namespace: 'auth.passwordReset' });

return {
title: t('header'),
};
}

export default function PasswordResetPage({
searchParams,
}: {
searchParams: { username: string }
}) {
export default function PasswordResetPage({ searchParams }: { searchParams: { username: string } }) {
const t = useTranslations('auth.passwordReset');
const username = searchParams.username;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const PageContents = () => {
);
};

export default function PasswordRestoreSuccess() {
export default function PasswordRestoreSuccessPage() {
const t = useTranslations('auth.passwordReset.success');

return (
Expand Down
6 changes: 4 additions & 2 deletions src/app/[locale]/(public)/(support)/complaints/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useTranslations } from 'next-intl';
import { SupportNavLayout } from '../support-nav-layout';
import { getTranslations } from 'next-intl/server';
import { getTranslations, setRequestLocale } from 'next-intl/server';

export async function generateMetadata({ params: { locale } }: any) {
const t = await getTranslations({ locale, namespace: 'public.complaints' });
Expand All @@ -10,7 +10,9 @@ export async function generateMetadata({ params: { locale } }: any) {
};
}

export default function ComplaintsPage() {
export default function ComplaintsPage({ params: { locale } }: { params: { locale: string } }) {
setRequestLocale(locale);

const t = useTranslations('public.complaints');

return (
Expand Down
10 changes: 6 additions & 4 deletions src/app/[locale]/(public)/(support)/curator-search/page.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
import { useTranslations } from 'next-intl';
import { SupportNavLayout } from '../support-nav-layout';
import { CuratorSearch } from './curator-search';
import { getTranslations } from 'next-intl/server';
import { getTranslations, setRequestLocale } from 'next-intl/server';

export async function generateMetadata({ params: { locale } }: any) {
const t = await getTranslations({ locale, namespace: 'public.curator-search'});
const t = await getTranslations({ locale, namespace: 'public.curator-search' });

return {
title: t('header'),
};
}

export default function CuratorSearchPage() {
export default function CuratorSearchPage({ params: { locale } }: { params: { locale: string } }) {
setRequestLocale(locale);

const t = useTranslations('public.curator-search');

return (
<SupportNavLayout header={t('header')} description={t('description')} className="flex flex-col w-full grow">
<SupportNavLayout header={t('header')} description={t('description')} className="flex w-full grow flex-col">
<CuratorSearch />
</SupportNavLayout>
);
Expand Down
14 changes: 6 additions & 8 deletions src/app/[locale]/(public)/(support)/faq/page.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
import { useTranslations } from 'next-intl';
import { SupportNavLayout } from '../support-nav-layout';
import { getTranslations } from 'next-intl/server';
import { getTranslations, setRequestLocale } from 'next-intl/server';

export async function generateMetadata({ params: { locale } }: any) {
const t = await getTranslations({ locale, namespace: 'public.faq'});
const t = await getTranslations({ locale, namespace: 'public.faq' });

return {
title: t('header'),
};
}

export default function FAQ() {
export default function FAQ({ params: { locale } }: { params: { locale: string } }) {
setRequestLocale(locale);

const t = useTranslations('public.faq');

return (
<SupportNavLayout header={t('header')}>
{t.rich('content')}
</SupportNavLayout>
);
return <SupportNavLayout header={t('header')}>{t.rich('content')}</SupportNavLayout>;
}
5 changes: 5 additions & 0 deletions src/app/[locale]/(public)/(support)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import { setRequestLocale } from 'next-intl/server';
import { Footer } from '../footer';
import { Header } from '../header';

export default function PublicPagesLayout({
children,
params: { locale },
}: Readonly<{
children: React.ReactNode;
params: { locale: string };
}>) {
setRequestLocale(locale);

return (
<div className="flex h-[100vh] min-h-fit min-w-[344px] gap-[20px] p-[20px]">
<div className="flex min-h-fit grow basis-0 flex-col md:px-[28px] md:py-[16px]">
Expand Down
6 changes: 4 additions & 2 deletions src/app/[locale]/(public)/(support)/support/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Link } from '@/i18n/routing';
import { useTranslations } from 'next-intl';
import { SupportNavLayout } from '../support-nav-layout';
import { getTranslations } from 'next-intl/server';
import { getTranslations, setRequestLocale } from 'next-intl/server';

export async function generateMetadata({ params: { locale } }: any) {
const t = await getTranslations({ locale, namespace: 'public.support' });
Expand All @@ -11,7 +11,9 @@ export async function generateMetadata({ params: { locale } }: any) {
};
}

export default function Support() {
export default function Support({ params: { locale } }: { params: { locale: string } }) {
setRequestLocale(locale);

const t = useTranslations('public.support');

return (
Expand Down