Files
2026-06-13 02:24:42 +05:30

51 lines
1.6 KiB
TypeScript

"use client";
/**
* ProfileViewHeader — the read-only header used in view mode on /u/me.
* Mirrors the shape of /u/[handle]'s top block so the owner sees the same
* thing visitors do, plus an action slot for an "Edit profile" button.
*/
import type { User } from "@/lib/auth";
import { UserAvatar } from "@/components/ui/user-avatar";
export function ProfileViewHeader({
user,
postCount,
actionSlot,
}: {
user: User;
postCount: number;
actionSlot?: React.ReactNode;
}) {
return (
<header className="flex flex-col sm:flex-row sm:items-center gap-5 sm:gap-6">
<UserAvatar
src={user.avatar_url}
name={user.name}
className="size-20 sm:size-22"
textClassName="text-2xl"
/>
<div className="flex-1 min-w-0">
<div className="flex items-start justify-between gap-3">
<div className="min-w-0">
<h1 className="font-[family-name:var(--font-title)] font-semibold text-2xl sm:text-3xl text-foreground leading-tight truncate">
{user.name}
</h1>
<p className="text-sm text-muted-foreground mt-0.5">
@{user.handle} ·{" "}
<span className="tabular-nums">{postCount}</span> post
{postCount === 1 ? "" : "s"}
</p>
<p className="text-xs text-muted-foreground mt-1">
Joined {new Date(user.created_at).toLocaleDateString()}
</p>
</div>
{actionSlot ? <div className="shrink-0">{actionSlot}</div> : null}
</div>
</div>
</header>
);
}