/** * @file components/settings/SettingsProfileCard.tsx * @description Card component managing user profile overview, status picker, and color selection. */ "use client"; import { UserAvatar } from "@/components/ui/UserAvatar"; import { UserStatus } from "@/db/schema"; import { MEMBER_STATUS_COLOR_CLASSES, MEMBER_COLOR_OPTIONS, } from "@/lib/constants/member.styles"; import { UserRound, Palette } from "lucide-react"; import { useUser } from "@/lib/context/UserContext"; /** Props for the SettingsProfileCard component. */ interface SettingsProfileCardProps { onUpdate: (fields: Partial<{ status: UserStatus; color: string }>) => void; } const STATUSES: { label: string; value: UserStatus }[] = [ { label: "Online", value: "ONLINE" }, { label: "Offline", value: "OFFLINE" }, { label: "AFK", value: "AFK" }, { label: "DND", value: "DND" }, ]; /** Renders a card for managing user profile details, online status, and theme color preferences. */ export function SettingsProfileCard({ onUpdate }: SettingsProfileCardProps) { const { currentUser } = useUser(); if (!currentUser) return null; return (
{/* User Info Header */}

{currentUser.username}

{currentUser.email}

{/* Status Selection */}

Online Status

{STATUSES.map((status) => { const isSelected = currentUser.status === status.value; return ( ); })}
{/* Color Palette Selection */}

Profile Color

{MEMBER_COLOR_OPTIONS.map((colorClass) => { const isSelected = currentUser.color === colorClass; return (
); }