"use client" import { Archive, Edit, EllipsisIcon, UsersIcon } from "lucide-react" import { useState } from "react" import { cn } from "../../lib/utils" import type { AuthLocalization } from "../../localization/auth-localization" import type { Team } from "../../types/auth-hooks" import type { Refetch } from "../../types/refetch" import type { SettingsCardClassNames } from "../settings/shared/settings-card" import { Button } from "../ui/button" import { Card } from "../ui/card" import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "../ui/dropdown-menu" import { DeleteTeamDialog } from "./delete-team-dialog" import { UpdateTeamDialog } from "./update-team-dialog" export interface TeamCellProps { className?: string classNames?: SettingsCardClassNames team: Team localization?: Partial canDelete: boolean canUpdate: boolean refetch?: Refetch } /** * Render a single-row team cell with a color-coded circular avatar, the team name, and a localized "Team" label. * * @param classNames - Optional class name overrides for component parts * @param team - Team data object containing at least `id` and `name` * @param localization - Localization strings providing `TEAM` label * @returns The rendered team cell element */ export function TeamCell({ className, classNames, team, localization, canDelete, canUpdate, refetch }: TeamCellProps) { /* const { teams } = useContext(AuthUIContext); const colorCount = Math.max(1, teams?.colors.count || 5); const getTeamColor = (index: number) => { const colorIndex = (index % colorCount) + 1; return `hsl(var(--team-${colorIndex}))`; }; // Stable color hash based on team ID (sum of char codes) const teamIndex = team.id.split("").reduce((sum, char) => sum + char.charCodeAt(0), 0) % colorCount; */ const [showDeleteDialog, setShowDeleteDialog] = useState(false) const [showUpdateDialog, setShowUpdateDialog] = useState(false) return ( <>
{team.name}
{localization?.TEAM}
e.preventDefault()} > setShowUpdateDialog(true)} > {localization?.UPDATE_TEAM} setShowDeleteDialog(true)} variant="destructive" > {localization?.DELETE_TEAM}
) }