[重构] 前端改造v1

This commit is contained in:
ryan
2026-03-11 12:47:08 +08:00
parent 052e3e98f8
commit 6eea676f8f
71 changed files with 3619 additions and 8791 deletions
@@ -0,0 +1,23 @@
import { FeaturePlaceholder } from '@/components/feedback/feature-placeholder';
interface PublicRoutePlaceholderProps {
title: string;
description: string;
}
export function PublicRoutePlaceholder({
title,
description,
}: PublicRoutePlaceholderProps) {
return (
<FeaturePlaceholder
title={title}
description={description}
milestones={[
'认证页路由入口已建立,便于阶段 2 接入真实表单。',
'公共布局已统一,可复用品牌区、说明区与回跳入口。',
'后续将在此处补齐表单校验、Session 兼容与 OAuth 回调处理。',
]}
/>
);
}
@@ -0,0 +1,73 @@
import Link from 'next/link';
import { AppCard } from '@/components/ui/app-card';
import { StatusBadge } from '@/components/ui/status-badge';
import { dashboardNavigation } from '@/lib/constants/navigation';
const readinessItems = [
{
title: '工程底座',
description: 'Next.js App Router、TypeScript strict、Tailwind CSS 与静态导出链路已建立。',
},
{
title: '质量工具',
description: 'ESLint、Prettier、Vitest、Playwright 配置已就位,可继续补充模块测试。',
},
{
title: '目录分层',
description: '已拆分 app、components、features、lib、store、tests 等基础结构。',
},
];
export function DashboardOverview() {
return (
<div className='space-y-6'>
<AppCard
title='阶段 1 已启动'
description='当前已完成新版管理端基础工程初始化,可继续推进认证迁移与框架层骨架。'
action={<StatusBadge label='可继续阶段 2' variant='success' />}
>
<div className='grid gap-4 lg:grid-cols-3'>
{readinessItems.map((item) => (
<div
key={item.title}
className='rounded-2xl border border-[var(--border-default)] bg-white/5 p-4'
>
<p className='text-base font-semibold text-white'>{item.title}</p>
<p className='mt-2 text-sm leading-6 text-[var(--foreground-secondary)]'>
{item.description}
</p>
</div>
))}
</div>
</AppCard>
<div className='grid gap-6 xl:grid-cols-[1.3fr_0.9fr]'>
<AppCard title='模块入口' description='各业务页面已建立路由占位,后续按阶段逐步接入真实数据与交互。'>
<div className='grid gap-3 md:grid-cols-2'>
{dashboardNavigation.slice(1).map((item) => (
<Link
key={item.href}
href={item.href}
className='rounded-2xl border border-[var(--border-default)] bg-white/5 p-4 transition hover:border-sky-300/30 hover:bg-sky-400/10'
>
<p className='text-sm font-semibold text-white'>{item.label}</p>
<p className='mt-2 text-sm leading-6 text-[var(--foreground-secondary)]'>
{item.description}
</p>
</Link>
))}
</div>
</AppCard>
<AppCard title='下一步建议' description='按前端改造计划,后续优先进入认证与框架层迁移。'>
<ol className='space-y-3 text-sm leading-6 text-[var(--foreground-secondary)]'>
<li>1. 接入登录、注册、重置密码与 OAuth 回调页面。</li>
<li>2. 增加统一鉴权守卫、未登录跳转与消息反馈容器。</li>
<li>3. 在业务模块中逐步接入 Query 与 API 资源层。</li>
</ol>
</AppCard>
</div>
</div>
);
}
@@ -0,0 +1,37 @@
import { EmptyState } from '@/components/feedback/empty-state';
import { ErrorState } from '@/components/feedback/error-state';
import { FeaturePlaceholder } from '@/components/feedback/feature-placeholder';
import { LoadingState } from '@/components/feedback/loading-state';
import { PageHeader } from '@/components/layout/page-header';
interface ModulePageSkeletonProps {
title: string;
description: string;
}
export function ModulePageSkeleton({
title,
description,
}: ModulePageSkeletonProps) {
return (
<div className='space-y-6'>
<PageHeader title={title} description={description} />
<FeaturePlaceholder
title={`${title} 页面骨架`}
description='当前阶段先完成页面入口、统一头部和反馈组件接线,真实列表、表单与联动能力将在后续业务迁移阶段接入。'
milestones={[
'路由入口已创建,可纳入统一导航。',
'页面标题区、说明区与内容容器已统一。',
'加载态、空态、错误态组件已建立,可在真实查询接入后直接复用。',
]}
/>
<div className='grid gap-4 xl:grid-cols-3'>
<LoadingState />
<EmptyState title='空态骨架' description='后续接入查询后,可将资源为空时的提示统一沉淀为此组件。' />
<ErrorState title='错误态骨架' description='后续请求失败、鉴权失效与重试提示可在此基础上扩展。' />
</div>
</div>
);
}