forked from cardosofelipe/fast-next-template
Remove all obsolete authentication, settings, admin, and demo-related components and pages
- Eliminated redundant components, pages, and layouts related to authentication (`login`, `register`, `password-reset`, etc.), user settings, admin, and demos. - Simplified the frontend structure by removing unused dynamic imports, forms, and test code. - Refactored configurations and metadata imports to exclude references to removed features. - Streamlined the project for future development and improved maintainability by discarding legacy and unused code.
This commit is contained in:
10
frontend/src/app/[locale]/(auth)/layout.tsx
Normal file
10
frontend/src/app/[locale]/(auth)/layout.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import type { Metadata } from 'next';
|
||||
import { AuthLayoutClient } from '@/components/auth/AuthLayoutClient';
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'Authentication',
|
||||
};
|
||||
|
||||
export default function AuthLayout({ children }: { children: React.ReactNode }) {
|
||||
return <AuthLayoutClient>{children}</AuthLayoutClient>;
|
||||
}
|
||||
31
frontend/src/app/[locale]/(auth)/login/page.tsx
Normal file
31
frontend/src/app/[locale]/(auth)/login/page.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
import dynamic from 'next/dynamic';
|
||||
|
||||
// Code-split LoginForm - heavy with react-hook-form + validation
|
||||
const LoginForm = dynamic(
|
||||
/* istanbul ignore next - Next.js dynamic import, tested via component */
|
||||
() => import('@/components/auth/LoginForm').then((mod) => ({ default: mod.LoginForm })),
|
||||
{
|
||||
loading: () => (
|
||||
<div className="space-y-4">
|
||||
<div className="animate-pulse h-10 bg-muted rounded" />
|
||||
<div className="animate-pulse h-10 bg-muted rounded" />
|
||||
<div className="animate-pulse h-10 bg-primary/20 rounded" />
|
||||
</div>
|
||||
),
|
||||
}
|
||||
);
|
||||
|
||||
export default function LoginPage() {
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div className="text-center">
|
||||
<h2 className="text-3xl font-bold tracking-tight">Sign in to your account</h2>
|
||||
<p className="mt-2 text-sm text-muted-foreground">
|
||||
Access your dashboard and manage your account
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<LoginForm showRegisterLink showPasswordResetLink />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
/**
|
||||
* Password Reset Confirm Content Component
|
||||
* Wrapped in Suspense boundary to handle useSearchParams()
|
||||
*/
|
||||
|
||||
'use client';
|
||||
|
||||
import { useSearchParams } from 'next/navigation';
|
||||
import { useRouter } from '@/lib/i18n/routing';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import dynamic from 'next/dynamic';
|
||||
import { Alert } from '@/components/ui/alert';
|
||||
import { Link } from '@/lib/i18n/routing';
|
||||
|
||||
// Code-split PasswordResetConfirmForm (319 lines)
|
||||
const PasswordResetConfirmForm = dynamic(
|
||||
/* istanbul ignore next - Next.js dynamic import, tested via component */
|
||||
() =>
|
||||
import('@/components/auth/PasswordResetConfirmForm').then((mod) => ({
|
||||
default: mod.PasswordResetConfirmForm,
|
||||
})),
|
||||
{
|
||||
loading: () => (
|
||||
<div className="space-y-4">
|
||||
<div className="animate-pulse h-10 bg-muted rounded" />
|
||||
<div className="animate-pulse h-10 bg-muted rounded" />
|
||||
</div>
|
||||
),
|
||||
}
|
||||
);
|
||||
|
||||
export default function PasswordResetConfirmContent() {
|
||||
const searchParams = useSearchParams();
|
||||
const router = useRouter();
|
||||
const token = searchParams.get('token');
|
||||
const timeoutRef = useRef<NodeJS.Timeout | null>(null);
|
||||
|
||||
// Cleanup timeout on unmount
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
if (timeoutRef.current) {
|
||||
clearTimeout(timeoutRef.current);
|
||||
}
|
||||
};
|
||||
}, []);
|
||||
|
||||
// Handle successful password reset
|
||||
const handleSuccess = () => {
|
||||
// Wait 3 seconds then redirect to login
|
||||
timeoutRef.current = setTimeout(() => {
|
||||
router.push('/login');
|
||||
}, 3000);
|
||||
};
|
||||
|
||||
// If no token in URL, show error
|
||||
if (!token) {
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div className="text-center">
|
||||
<h2 className="text-3xl font-bold tracking-tight">Invalid Reset Link</h2>
|
||||
</div>
|
||||
|
||||
<Alert variant="destructive">
|
||||
<p className="text-sm">
|
||||
This password reset link is invalid or has expired. Please request a new password reset.
|
||||
</p>
|
||||
</Alert>
|
||||
|
||||
<div className="text-center">
|
||||
<Link
|
||||
href="/password-reset"
|
||||
className="text-sm text-primary underline-offset-4 hover:underline font-medium"
|
||||
>
|
||||
Request new reset link
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div className="text-center">
|
||||
<h2 className="text-3xl font-bold tracking-tight">Set new password</h2>
|
||||
<p className="mt-2 text-sm text-muted-foreground">
|
||||
Choose a strong password for your account
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<PasswordResetConfirmForm token={token} onSuccess={handleSuccess} showLoginLink />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Password Reset Confirm Page
|
||||
* Users set a new password using the token from their email
|
||||
*/
|
||||
|
||||
import { Suspense } from 'react';
|
||||
import PasswordResetConfirmContent from './PasswordResetConfirmContent';
|
||||
|
||||
export default function PasswordResetConfirmPage() {
|
||||
return (
|
||||
<Suspense
|
||||
fallback={
|
||||
<div className="space-y-6">
|
||||
<div className="text-center">
|
||||
<h2 className="text-3xl font-bold tracking-tight">Set new password</h2>
|
||||
<p className="mt-2 text-sm text-muted-foreground">Loading...</p>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<PasswordResetConfirmContent />
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
38
frontend/src/app/[locale]/(auth)/password-reset/page.tsx
Normal file
38
frontend/src/app/[locale]/(auth)/password-reset/page.tsx
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Password Reset Request Page
|
||||
* Users enter their email to receive reset instructions
|
||||
*/
|
||||
|
||||
import dynamic from 'next/dynamic';
|
||||
|
||||
// Code-split PasswordResetRequestForm
|
||||
const PasswordResetRequestForm = dynamic(
|
||||
/* istanbul ignore next - Next.js dynamic import, tested via component */
|
||||
() =>
|
||||
import('@/components/auth/PasswordResetRequestForm').then((mod) => ({
|
||||
default: mod.PasswordResetRequestForm,
|
||||
})),
|
||||
{
|
||||
loading: () => (
|
||||
<div className="space-y-4">
|
||||
<div className="animate-pulse h-10 bg-muted rounded" />
|
||||
<div className="animate-pulse h-10 bg-primary/20 rounded" />
|
||||
</div>
|
||||
),
|
||||
}
|
||||
);
|
||||
|
||||
export default function PasswordResetPage() {
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div className="text-center">
|
||||
<h2 className="text-3xl font-bold tracking-tight">Reset your password</h2>
|
||||
<p className="mt-2 text-muted-foreground">
|
||||
We'll send you an email with instructions to reset your password
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<PasswordResetRequestForm showLoginLink />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
31
frontend/src/app/[locale]/(auth)/register/page.tsx
Normal file
31
frontend/src/app/[locale]/(auth)/register/page.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
import dynamic from 'next/dynamic';
|
||||
|
||||
// Code-split RegisterForm (313 lines)
|
||||
const RegisterForm = dynamic(
|
||||
/* istanbul ignore next - Next.js dynamic import, tested via component */
|
||||
() => import('@/components/auth/RegisterForm').then((mod) => ({ default: mod.RegisterForm })),
|
||||
{
|
||||
loading: () => (
|
||||
<div className="space-y-4">
|
||||
<div className="animate-pulse h-10 bg-muted rounded" />
|
||||
<div className="animate-pulse h-10 bg-muted rounded" />
|
||||
<div className="animate-pulse h-10 bg-muted rounded" />
|
||||
</div>
|
||||
),
|
||||
}
|
||||
);
|
||||
|
||||
export default function RegisterPage() {
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div className="text-center">
|
||||
<h2 className="text-3xl font-bold tracking-tight">Create your account</h2>
|
||||
<p className="mt-2 text-sm text-muted-foreground">
|
||||
Get started with your free account today
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<RegisterForm showLoginLink />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user