32 lines
1.8 KiB
TypeScript
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>
|
|
);
|
|
}
|