Commit d45d5e7b by luoqi

fix(web): 空工作台 header 补回用户信息 + 退出

空态(无计划)header 缺用户信息/退出入口,补上(useAuthStore.clear())。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
parent 97fb782f
......@@ -2,11 +2,13 @@
import { useEffect, useState } from 'react';
import { useRouter } from 'next/navigation';
import { Inbox, RefreshCw } from 'lucide-react';
import { Inbox, LogOut, RefreshCw } from 'lucide-react';
import { Permission } from '@pac/types';
import { Can } from '@/components/can';
import { plansApi } from '@/components/plans/plans-api';
import { PatientPickerRail } from '@/components/plans/patient-picker-rail';
import { useAuthStore } from '@/stores/auth-store';
import { userDisplayName, roleNameZh } from '@/lib/utils';
/**
* /plans — 工作台入口解析器(原列表页已弃用,组件保留在 plans-list-app.tsx 未挂载)。
......@@ -28,6 +30,7 @@ export default function PlansEntryPage() {
function EntryResolver() {
const router = useRouter();
const [phase, setPhase] = useState<'resolving' | 'empty'>('resolving');
const user = useAuthStore((s) => s.user);
useEffect(() => {
let cancelled = false;
......@@ -74,6 +77,27 @@ function EntryResolver() {
PAC
</span>
<h1 className="text-[14px] font-semibold text-slate-900">召回工作台</h1>
{/* 用户信息 + 退出 —— 空态也必须有(否则落到这里的用户无法登出)。与详情 TopBar 一致。 */}
<div className="ml-auto flex items-center gap-2">
<div className="hidden text-right text-[11.5px] leading-tight text-slate-500 md:block">
<div className="font-medium text-slate-700">{userDisplayName(user)}</div>
<div className="nums">
{user?.clinicIds?.length ?? 0} 个诊所 · {roleNameZh(user?.role)}
</div>
</div>
<span className="inline-flex h-8 w-8 flex-none items-center justify-center rounded-full bg-gradient-to-br from-teal-400 to-teal-600 text-[12px] font-bold text-white">
{userDisplayName(user).charAt(0).toUpperCase()}
</span>
<button
type="button"
title="退出登录"
aria-label="退出登录"
onClick={() => useAuthStore.getState().clear()}
className="inline-flex h-8 w-8 flex-none items-center justify-center rounded-md text-slate-400 transition-colors hover:bg-rose-50 hover:text-rose-600"
>
<LogOut className="h-4 w-4" />
</button>
</div>
</header>
<div className="flex min-h-0 flex-1">
<PatientPickerRail currentPlanId="" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment