Files
thbd-portal/src/app/(admin)/profile/page.tsx
T
ogrechkoandClaude Sonnet 5 579528edf7 Initial commit: thbd-portal, duplicated from elmi-portal
Rebranded for Thunderbird Portal (THBD): numbering prefix EL->TH, all
"ELMI"/"ЭЛМИ" UI strings genericized, ELMI's real contract templates and
company legal/bank details removed (not applicable to this company), fresh
VAPID keypair and encryption key, fresh single-migration schema history.
Same architecture as elmi-portal: Web Push notifications, unread-chat app
badge, cookie-session auth.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gh2UXUQUVBWroWEnn1FLFG
2026-08-31 16:33:30 +00:00

46 lines
1.6 KiB
TypeScript

import { redirect } from "next/navigation";
import { getCurrentSession } from "@/lib/auth/session";
import { AvatarUploader } from "./avatar-uploader";
const ROLE_LABEL: Record<string, string> = { admin: "Администратор", manager: "Менеджер", accountant: "Бухгалтер" };
export default async function ProfilePage() {
const session = await getCurrentSession();
if (!session) redirect("/login");
const { user } = session;
return (
<div className="mx-auto max-w-lg">
<h1 className="mb-5 font-display text-xl font-bold tracking-tight">Профиль</h1>
<div className="card mb-5 p-4">
<AvatarUploader userId={user.id} name={user.name} hasAvatar={Boolean(user.avatarPath)} />
</div>
<div className="card p-4">
<dl className="flex flex-col gap-2 text-sm">
<div className="flex justify-between">
<dt className="text-text-muted">Имя</dt>
<dd>{user.name}</dd>
</div>
<div className="flex justify-between">
<dt className="text-text-muted">Email</dt>
<dd>{user.email}</dd>
</div>
<div className="flex justify-between">
<dt className="text-text-muted">Роль</dt>
<dd>{ROLE_LABEL[user.role]}</dd>
</div>
{user.managerNumber != null && (
<div className="flex justify-between">
<dt className="text-text-muted">Номер менеджера</dt>
<dd>{user.managerNumber}</dd>
</div>
)}
</dl>
</div>
</div>
);
}