"use client" import { Shield, Crown, CheckCircle, Mail } from "lucide-react" import { motion } from "motion/react" interface ProfileHeaderProps { name: string email?: string role: string | null verified: boolean createdAt: string image?: string | null } const roleConfig: Record = { admin: { label: "Admin", color: "bg-yellow-500/20 text-yellow-400 border-yellow-500/30", icon: Crown }, contributor: { label: "Contributor", color: "bg-blue-500/20 text-blue-400 border-blue-500/30", icon: Shield }, user: { label: "Member", color: "bg-text/10 text-text/60 border-text/20", icon: Shield }, } function isR2Avatar(url: string): boolean { return url.includes(".r2.dev") } function getInitials(name: string): string { return name.charAt(0).toUpperCase() } export function ProfileHeader({ name, email, role, verified, createdAt, image }: ProfileHeaderProps) { const config = roleConfig[role || "user"] || roleConfig.user const RoleIcon = config.icon const joinDate = new Date(createdAt).toLocaleDateString("en-US", { month: "long", year: "numeric", }) return (
{image ? (
{/* eslint-disable-next-line @next/next/no-img-element */} {`${name}'s
) : (
{getInitials(name)}
)}

{name}

{config.label} {verified && ( Verified )}
Member since {joinDate} {email && ( <> · {email} )}
) }