"use client";
/**
* ProfileHeader — Instagram-style centered header used at the top of
* /u/me and /u/[handle]. Avatar, display name, @handle, a single stat
* line, and an optional action slot (Edit profile button on owner view).
*
* Replaces the older ProfileViewHeader (left-aligned avatar + sidebar).
*/
import Image from "next/image";
import Link from "next/link";
export function ProfileHeader({
avatarURL,
name,
handle,
postCount,
joinedAt,
editHref,
}: {
avatarURL: string | null;
name: string;
handle: string;
postCount?: number;
joinedAt?: string;
/** When provided, shows an "Edit profile" CTA below the handle. */
editHref?: string;
}) {
return (
@{handle}
{typeof postCount === "number" ? (
<>
{postCount} post
{postCount === 1 ? "" : "s"}
>
) : null}
{typeof postCount === "number" && joinedAt ? " · " : null}
{joinedAt ? <>Joined {new Date(joinedAt).toLocaleDateString()}> : null}
{name}