2026-07-11 23:37:48 +08:00

32 lines
1.8 KiB
TypeScript

import { PanelShell } from "@/components/panel-shell";
import { PwaControls } from "@/components/pwa-controls";
import { PushTestPanel } from "@/components/push-test-panel";
import { getCaregiverSettingsOverview } from "@/lib/caregiver-panel";
import { requireCaregiverSession } from "@/lib/page-auth";
import { getCaregiverDisplayName } from "@/lib/session";
export const dynamic = "force-dynamic";
export default async function SettingsPage() {
const caregiver = await requireCaregiverSession("/settings");
const overview = await getCaregiverSettingsOverview(caregiver.id);
const name = getCaregiverDisplayName(caregiver);
return (
<PanelShell currentPath="/settings" title="我的" caregiverLabel={name}>
<section className="card card-pad" style={{ display: "flex", alignItems: "center", gap: 12 }}>
<span className="avatar" style={{ width: 44, height: 44, fontSize: 17 }}>{name.slice(-1)}</span>
<span className="row-main"><strong style={{ display: "block", fontSize: 15 }}>{name}</strong><span className="row-meta"> {overview.deviceCount} · {overview.pushSubscriptionCount} </span></span>
</section>
<div className="settings-controls"><PwaControls /></div>
<div className="settings-controls"><PushTestPanel initialSubscriptionCount={overview.pushSubscriptionCount} deviceCount={overview.deviceCount} /></div>
<form action="/api/account/logout" method="post" className="card">
<button type="submit" className="list-row" style={{ justifyContent: "center", color: "var(--danger)", fontWeight: 500 }}>退</button>
</form>
<p className="muted-note" style={{ textAlign: "center" }}> · AI · v2</p>
</PanelShell>
);
}