build ok,

This commit is contained in:
louiscklaw
2025-04-14 09:26:24 +08:00
commit 6c931c1fe8
770 changed files with 63959 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
import * as React from 'react';
import { AuthStrategy } from '@/lib/auth/strategy';
import { StrategyGuard } from '@/components/auth/strategy-guard';
// We are not adding the auth check because there might be individual pages that require the user to be authenticated.
// Another reason is that layouts get cached and loaded only once for all children.
interface LayoutProps {
children: React.ReactNode;
}
export default function Layout({ children }: LayoutProps): React.JSX.Element {
return <StrategyGuard expected={AuthStrategy.COGNITO}>{children}</StrategyGuard>;
}

View File

@@ -0,0 +1,19 @@
import * as React from 'react';
import type { Metadata } from 'next';
import { config } from '@/config';
import { NewPasswordRequiredForm } from '@/components/auth/cognito/new-password-required-form';
import { GuestGuard } from '@/components/auth/guest-guard';
import { SplitLayout } from '@/components/auth/split-layout';
export const metadata: Metadata = { title: `New password required | Cognito | Auth | ${config.site.name}` };
export default function Page(): React.JSX.Element {
return (
<GuestGuard>
<SplitLayout>
<NewPasswordRequiredForm />
</SplitLayout>
</GuestGuard>
);
}

View File

@@ -0,0 +1,19 @@
import * as React from 'react';
import type { Metadata } from 'next';
import { config } from '@/config';
import { ResetPasswordForm } from '@/components/auth/cognito/reset-password-form';
import { GuestGuard } from '@/components/auth/guest-guard';
import { SplitLayout } from '@/components/auth/split-layout';
export const metadata: Metadata = { title: `Reset password | Cognito | Auth | ${config.site.name}` };
export default function Page(): React.JSX.Element {
return (
<GuestGuard>
<SplitLayout>
<ResetPasswordForm />
</SplitLayout>
</GuestGuard>
);
}

View File

@@ -0,0 +1,19 @@
import * as React from 'react';
import type { Metadata } from 'next';
import { config } from '@/config';
import { SignInForm } from '@/components/auth/cognito/sign-in-form';
import { GuestGuard } from '@/components/auth/guest-guard';
import { SplitLayout } from '@/components/auth/split-layout';
export const metadata: Metadata = { title: `Sign in | Cognito | Auth | ${config.site.name}` };
export default function Page(): React.JSX.Element {
return (
<GuestGuard>
<SplitLayout>
<SignInForm />
</SplitLayout>
</GuestGuard>
);
}

View File

@@ -0,0 +1,35 @@
import * as React from 'react';
import type { Metadata } from 'next';
import Alert from '@mui/material/Alert';
import Box from '@mui/material/Box';
import { config } from '@/config';
import { SignUpConfirmForm } from '@/components/auth/cognito/sign-up-confirm-form';
import { GuestGuard } from '@/components/auth/guest-guard';
import { SplitLayout } from '@/components/auth/split-layout';
export const metadata: Metadata = { title: `Sign up confirm | Cognito | Auth | ${config.site.name}` };
interface PageProps {
searchParams: { email?: string };
}
export default function Page({ searchParams }: PageProps): React.JSX.Element {
const { email } = searchParams;
if (!email) {
return (
<Box sx={{ p: 3 }}>
<Alert color="error">Email is required</Alert>
</Box>
);
}
return (
<GuestGuard>
<SplitLayout>
<SignUpConfirmForm email={email} />
</SplitLayout>
</GuestGuard>
);
}

View File

@@ -0,0 +1,19 @@
import * as React from 'react';
import type { Metadata } from 'next';
import { config } from '@/config';
import { SignUpForm } from '@/components/auth/cognito/sign-up-form';
import { GuestGuard } from '@/components/auth/guest-guard';
import { SplitLayout } from '@/components/auth/split-layout';
export const metadata: Metadata = { title: `Sign up | Cognito | Auth | ${config.site.name}` };
export default function Page(): React.JSX.Element {
return (
<GuestGuard>
<SplitLayout>
<SignUpForm />
</SplitLayout>
</GuestGuard>
);
}

View File

@@ -0,0 +1,35 @@
import * as React from 'react';
import type { Metadata } from 'next';
import Alert from '@mui/material/Alert';
import Box from '@mui/material/Box';
import { config } from '@/config';
import { UpdatePasswordForm } from '@/components/auth/cognito/update-password-form';
import { GuestGuard } from '@/components/auth/guest-guard';
import { SplitLayout } from '@/components/auth/split-layout';
export const metadata: Metadata = { title: `Update password | Cognito | Auth | ${config.site.name}` };
interface PageProps {
searchParams: { email?: string };
}
export default function Page({ searchParams }: PageProps): React.JSX.Element {
const { email } = searchParams;
if (!email) {
return (
<Box sx={{ p: 3 }}>
<Alert color="error">Email is required</Alert>
</Box>
);
}
return (
<GuestGuard>
<SplitLayout>
<UpdatePasswordForm email={email} />
</SplitLayout>
</GuestGuard>
);
}