+ {/* Connection Status Header */}
+
+
+
Tech Status
+
+ {getConnectionIcon()}
+ {getConnectionText()}
+
+
+
+ {!tvMode && usersWithStatuses.length > 0 && (
+
+
+
+
+ )}
+
+
+ {/* Status Cards */}
+
+ {usersWithStatuses.map((userWithStatus) => {
+ const isSelected = selectedUsers.includes(userWithStatus.user.id)
+ const isNewStatus = newStatusIds.has(userWithStatus.user.id)
+ const isUpdatedByOther = userWithStatus.updated_by && userWithStatus.updated_by.id !== userWithStatus.user.id
+
+ return (
+
+
+
+
+ {!tvMode && (
+
handleCheckboxChange(userWithStatus.user.id)}
+ onClick={(e) => e.stopPropagation()}
+ />
+ )}
+
+
+
+ {userWithStatus.user.full_name ?? "Unknown User"}
+
+ {isUpdatedByOther && (
+
+
+ {userWithStatus.updated_by && (
+
+ Updated by {userWithStatus.updated_by.full_name}
+
+ )}
+
+ )}
+
+
+
+
+
+ {formatTime(userWithStatus.created_at)}
+
+
+
+
+
+
+
+ setSelectedHistoryUser(userWithStatus.user)}
+ >
+
{userWithStatus.status}
+
+
+ {selectedHistoryUser === userWithStatus.user && }
+
+
+
+ )
+ })}
+
+
+ {usersWithStatuses.length === 0 && (
+
+ No status updates yet
+
+ )}
+
+ {/* Status Update Input */}
+ {!tvMode && (
+
+
+
Update Status
+
+ setStatusInput(e.target.value)}
+ onKeyDown={(e) => {
+ if (e.key === "Enter" && !e.shiftKey) {
+ e.preventDefault()
+ updateStatus().catch((error) => {
+ toast.error(`Failed to update status: ${error as Error}`)
+ })
+ }
+ }}
+ />
+
+ {selectedUsers.length > 0 ? `Update ${selectedUsers.length} Users` : "Update Status"}
+
+
+ {selectedUsers.length > 0 && (
+
Updating status for {selectedUsers.length} selected users
+ )}
+
+
+ )}
+
+ {/* Global Status History Drawer */}
+
+
+
+
+
+
+
+
+
+ )
+}
+//'use client';
+
+//import { createClient } from '@/utils/supabase';
+//import { useState, useEffect, useCallback, useRef } from 'react';
+//import { useAuth, useTVMode } from '@/components/context';
+//import {
+ //getRecentUsersWithStatuses,
+ //updateStatuses,
+ //updateUserStatus,
+ //type UserWithStatus,
+//} from '@/lib/hooks';
+//import {
+ //BasedAvatar,
+ //Drawer,
+ //DrawerTrigger,
+ //Loading,
+//} from '@/components/ui';
+//import { SubmitButton } from '@/components/default';
+//import { toast } from 'sonner';
+//import { HistoryDrawer } from '@/components/status';
+//import type { Profile } from '@/utils/supabase';
+//import type { RealtimeChannel } from '@supabase/supabase-js';
+//import { makeConditionalClassName } from '@/lib/utils';
+
+//export const StatusList = (initialStatuses: UserWithStatus[]) => {
+ //const { isAuthenticated } = useAuth();
+ //const { tvMode } = useTVMode();
+ //const [loading, setLoading] = useState(true);
+ //const [selectedUsers, setSelectedUsers] = useState