From d2888e98dda8a3887d1fb0c1f568969639977b84 Mon Sep 17 00:00:00 2001 From: VirtualTests1 Date: Fri, 20 Mar 2026 22:13:30 +0800 Subject: [PATCH] =?UTF-8?q?chore(Kimi-K2.5):=20=E6=96=B0=E5=A2=9E=E6=A0=B9?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E9=A1=B9=E7=9B=AE=E9=A2=84=E8=A7=88=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=20-=20app/page.tsx=20-=20=E6=A0=B9=E8=B7=AF=E7=94=B1?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=EF=BC=88=E6=9C=8D=E5=8A=A1=E7=AB=AF=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 使用 auth.api.getSession() 检测用户登录状态 - 已登录用户自动重定向到 /dashboard - 未登录用户显示预览界面 - components/landing-page.tsx - 预览页组件 - 展示项目名称、定位、核心技术栈 - 四个能力亮点卡片(用户认证、仪表盘、数据表格、主题定制) - 「登录后台」按钮跳转至登录页 - 适配明暗模式,极简居中布局 --- app/page.tsx | 16 +++++- components/landing-page.tsx | 110 ++++++++++++++++++++++++++++++++++++ 2 files changed, 123 insertions(+), 3 deletions(-) create mode 100644 components/landing-page.tsx diff --git a/app/page.tsx b/app/page.tsx index 6be5aae..01e0571 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,6 +1,16 @@ +import { auth } from "@/lib/auth"; +import { headers } from "next/headers"; import { redirect } from "next/navigation"; +import { LandingPage } from "@/components/landing-page"; -// Redirect to dashboard - middleware will handle authentication -export default function Home() { - redirect("/dashboard"); +export default async function Home() { + const session = await auth.api.getSession({ + headers: await headers(), + }); + + if (session) { + redirect("/dashboard"); + } + + return ; } diff --git a/components/landing-page.tsx b/components/landing-page.tsx new file mode 100644 index 0000000..d6f1896 --- /dev/null +++ b/components/landing-page.tsx @@ -0,0 +1,110 @@ +"use client"; + +import { Button } from "@/components/ui/button"; +import { Card, CardContent } from "@/components/ui/card"; +import { + LayoutDashboard, + Shield, + Table2, + Palette, + ArrowRight, +} from "lucide-react"; +import Link from "next/link"; + +const features = [ + { + icon: Shield, + title: "用户认证", + description: "基于 Better-Auth 的完整认证系统,支持邮箱/社交登录", + }, + { + icon: LayoutDashboard, + title: "仪表盘", + description: "丰富的数据可视化组件,支持交互式图表和实时数据展示", + }, + { + icon: Table2, + title: "数据表格", + description: "强大的表格管理功能,支持排序、筛选、分页等操作", + }, + { + icon: Palette, + title: "主题定制", + description: "内置明暗模式切换,支持自定义主题色彩和字体配置", + }, +]; + +const techStack = [ + "Next.js 16", + "React 19", + "TypeScript", + "Tailwind CSS", + "Shadcn UI", + "Better-Auth", + "Drizzle ORM", + "PostgreSQL", +]; + +export function LandingPage() { + return ( +
+
+
+
+
+ SA +
+
+ +

+ Shadcn Admin +

+ +

+ 基于 Next.js 和 Shadcn UI 的现代化后台管理系统 +

+ +
+ {techStack.map((tech) => ( + + {tech} + + ))} +
+ + + + +
+ +
+ {features.map((feature) => ( + + +
+ +
+

{feature.title}

+

+ {feature.description} +

+
+
+ ))} +
+
+ + +
+ ); +}