feat: impl accounts and channels

This commit is contained in:
2026-09-06 18:17:42 +08:00
parent aa9999a940
commit 1ccee1414c
70 changed files with 9879 additions and 31 deletions
+209 -15
View File
@@ -1,19 +1,213 @@
import { Button } from "@/components/ui/button"
import { redirect } from "next/navigation";
import Link from "next/link";
import {
ArrowRightIcon,
CreditCardIcon,
DollarSignIcon,
LayersIcon,
PlusIcon,
SlidersHorizontalIcon,
TrendingUpIcon,
WalletIcon,
} from "lucide-react";
import { auth } from "@/lib/auth";
import { AppSidebar } from "@/components/app-sidebar";
import { AppHeader } from "@/components/app-header";
import { Button } from "@/components/ui/button";
import {
Card,
CardContent,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import {
SidebarInset,
SidebarProvider,
} from "@/components/ui/sidebar";
export default async function HomePage() {
const session = await auth();
// 若用户未登录,由于 proxy 会拦截并重定向,作为服务端页面增加双重保障
if (!session?.user) {
redirect("/login");
}
const user = session.user;
const userName = user.name || "Fluxent 用户";
const userEmail = user.email || "";
const userAvatar = user.image || null;
export default function Page() {
return (
<div className="flex min-h-svh p-6">
<div className="flex max-w-md min-w-0 flex-col gap-4 text-sm leading-loose">
<div>
<h1 className="font-medium">Project ready!</h1>
<p>You may now add components and start building.</p>
<p>We&apos;ve already added the button component for you.</p>
<Button className="mt-2">Button</Button>
<SidebarProvider>
<AppSidebar
user={{
name: userName,
email: userEmail,
avatar: userAvatar,
}}
/>
<SidebarInset>
<AppHeader title="控制台" />
{/* Inset Main Dashboard Content */}
<div className="flex flex-1 flex-col gap-6 p-4 md:p-6 lg:p-8">
{/* Welcome greeting banner */}
<div className="relative overflow-hidden rounded-2xl border border-border/80 bg-gradient-to-br from-card via-card to-muted/40 p-6 md:p-8">
<div className="relative z-10 flex flex-col gap-3 md:max-w-2xl">
<h1 className="font-heading text-2xl font-bold tracking-tight text-foreground md:text-3xl">
{userName}
</h1>
<p className="text-sm text-muted-foreground leading-relaxed">
Fluxent
</p>
<div className="mt-2 flex flex-wrap items-center gap-3">
<Button size="sm" className="text-xs">
<PlusIcon data-icon="inline-start" />
</Button>
<Button
variant="outline"
size="sm"
className="text-xs"
render={<Link href="/accounts" />}
nativeButton={false}
>
<LayersIcon data-icon="inline-start" />
</Button>
</div>
</div>
{/* Subtle background decoration */}
<div className="pointer-events-none absolute -right-12 -bottom-12 size-64 rounded-full bg-primary/5 blur-2xl" />
</div>
{/* Quick Metrics & Highlights Cards (3 columns on desktop) */}
<div className="grid gap-4 md:grid-cols-3">
<Card className="border-border/70 bg-card/60 backdrop-blur-xs">
<CardHeader className="flex flex-row items-center justify-between pb-2">
<CardTitle className="text-xs font-medium text-muted-foreground">
(CNY)
</CardTitle>
<DollarSignIcon className="size-4 text-muted-foreground" />
</CardHeader>
<CardContent>
<div className="text-2xl font-bold tracking-tight">¥ 0.00</div>
<p className="mt-1 text-[11px] text-muted-foreground">
</p>
</CardContent>
</Card>
<Card className="border-border/70 bg-card/60 backdrop-blur-xs">
<CardHeader className="flex flex-row items-center justify-between pb-2">
<CardTitle className="text-xs font-medium text-muted-foreground">
</CardTitle>
<WalletIcon className="size-4 text-muted-foreground" />
</CardHeader>
<CardContent>
<div className="text-2xl font-bold tracking-tight">0</div>
<p className="mt-1 text-[11px] text-muted-foreground">
</p>
</CardContent>
</Card>
<Card className="border-border/70 bg-card/60 backdrop-blur-xs">
<CardHeader className="flex flex-row items-center justify-between pb-2">
<CardTitle className="text-xs font-medium text-muted-foreground">
</CardTitle>
<TrendingUpIcon className="size-4 text-muted-foreground" />
</CardHeader>
<CardContent>
<div className="text-2xl font-bold tracking-tight">0</div>
<p className="mt-1 text-[11px] text-muted-foreground">
</p>
</CardContent>
</Card>
</div>
{/* Next Steps / Feature Guide (3 columns) */}
<div className="flex flex-col gap-4">
<h2 className="font-heading text-base font-semibold tracking-tight text-foreground">
</h2>
<div className="grid gap-4 md:grid-cols-3">
<Link
href="/accounts"
className="group flex flex-col justify-between rounded-xl border border-border/80 bg-card p-5 transition-all hover:border-foreground/30 hover:shadow-sm"
>
<div className="flex flex-col gap-2">
<div className="flex size-9 items-center justify-center rounded-lg bg-primary/10 text-primary">
<CreditCardIcon className="size-4.5" />
</div>
<h3 className="font-heading text-sm font-semibold text-foreground">
1.
</h3>
<p className="text-xs text-muted-foreground leading-relaxed">
</p>
</div>
<div className="mt-4 flex items-center gap-1 text-xs font-medium text-primary">
<span></span>
<ArrowRightIcon
data-icon="inline-end"
className="size-3.5 transition-transform group-hover:translate-x-0.5"
/>
</div>
</Link>
<div className="group flex flex-col justify-between rounded-xl border border-border/80 bg-card p-5 transition-all hover:border-foreground/30 hover:shadow-sm">
<div className="flex flex-col gap-2">
<div className="flex size-9 items-center justify-center rounded-lg bg-primary/10 text-primary">
<LayersIcon className="size-4.5" />
</div>
<h3 className="font-heading text-sm font-semibold text-foreground">
2.
</h3>
<p className="text-xs text-muted-foreground leading-relaxed">
</p>
</div>
<div className="mt-4 flex items-center gap-1 text-xs font-medium text-primary">
<span></span>
<ArrowRightIcon
data-icon="inline-end"
className="size-3.5 transition-transform group-hover:translate-x-0.5"
/>
</div>
</div>
<div className="group flex flex-col justify-between rounded-xl border border-border/80 bg-card p-5 transition-all hover:border-foreground/30 hover:shadow-sm">
<div className="flex flex-col gap-2">
<div className="flex size-9 items-center justify-center rounded-lg bg-primary/10 text-primary">
<SlidersHorizontalIcon className="size-4.5" />
</div>
<h3 className="font-heading text-sm font-semibold text-foreground">
3.
</h3>
<p className="text-xs text-muted-foreground leading-relaxed">
</p>
</div>
<div className="mt-4 flex items-center gap-1 text-xs font-medium text-primary">
<span></span>
<ArrowRightIcon
data-icon="inline-end"
className="size-3.5 transition-transform group-hover:translate-x-0.5"
/>
</div>
</div>
</div>
</div>
</div>
<div className="font-mono text-xs text-muted-foreground">
(Press <kbd>d</kbd> to toggle dark mode)
</div>
</div>
</div>
)
</SidebarInset>
</SidebarProvider>
);
}