diff --git a/components/settings/SettingsView.tsx b/components/settings/SettingsView.tsx index 9e30d7d..b334590 100644 --- a/components/settings/SettingsView.tsx +++ b/components/settings/SettingsView.tsx @@ -8,8 +8,11 @@ import { useState } from "react"; import { UserAvatar } from "@/components/ui/UserAvatar"; import { UserStatus, User } from "@/db/schema"; -import { MEMBER_STATUS_COLOR_CLASSES } from "@/lib/constants/member.styles"; -import { UserRound } from "lucide-react"; +import { + MEMBER_STATUS_COLOR_CLASSES, + MEMBER_COLOR_OPTIONS, +} from "@/lib/constants/member.styles"; +import { UserRound, Palette } from "lucide-react"; /** Props for the SettingsView component. */ interface SettingsViewProps { @@ -17,11 +20,14 @@ interface SettingsViewProps { currentUser: User; } -/** Renders the user settings view for profile management and status selection. */ +/** Renders the user settings view for profile management, status selection, and avatar color customization. */ export function SettingsView({ userId, currentUser }: SettingsViewProps) { const [selectedStatus, setSelectedStatus] = useState( currentUser.status, ); + const [selectedColor, setSelectedColor] = useState( + currentUser.color || MEMBER_COLOR_OPTIONS[0], + ); const statuses: { label: string; value: UserStatus }[] = [ { label: "Online", value: "ONLINE" }, @@ -35,11 +41,17 @@ export function SettingsView({ userId, currentUser }: SettingsViewProps) { setSelectedStatus(newStatus); }; + /** Updates local avatar color state on user selection. */ + const handleColorChange = (newColor: string) => { + setSelectedColor(newColor); + }; + if (!currentUser) return null; const userWithUpdatedSettings = { ...currentUser, status: selectedStatus, + color: selectedColor, }; return ( @@ -94,6 +106,31 @@ export function SettingsView({ userId, currentUser }: SettingsViewProps) { })} + + {/* Color Palette Selection */} +
+

+ Profile Color +

+
+ {MEMBER_COLOR_OPTIONS.map((colorClass) => { + const isSelected = selectedColor === colorClass; + return ( +
+
);