diff --git a/src/components/status/List.tsx b/src/components/status/List.tsx index 45a4b57..54db958 100755 --- a/src/components/status/List.tsx +++ b/src/components/status/List.tsx @@ -18,7 +18,7 @@ import { Badge } from '@/components/ui/badge'; import { Checkbox } from '@/components/ui/checkbox'; import { Input } from '@/components/ui/input'; import { Button } from '@/components/ui/button'; -import { RefreshCw, Clock, Wifi, WifiOff } from 'lucide-react'; +import { RefreshCw, Clock, Wifi, WifiOff, Calendar } from 'lucide-react'; import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'; import { QueryErrorCodes } from '@/components/context'; import { createClient } from '@/utils/supabase'; @@ -299,9 +299,14 @@ export const StatusList = ({ initialStatuses = [] }: ListProps) => { hour: 'numeric', minute: 'numeric', }); + return `${time}`; + }; + + const formatDate = (timestamp: string) => { + const date = new Date(timestamp); const day = date.getDate(); const month = date.toLocaleString('default', { month: 'long' }); - return `${time} - ${month} ${day}`; + return `${month} ${day}`; }; if (loading) { @@ -326,27 +331,36 @@ export const StatusList = ({ initialStatuses = [] }: ListProps) => { const containerClassName = makeConditionalClassName({ context: tvMode, - defaultClassName: 'mx-auto space-y-4', + defaultClassName: 'flex flex-col mx-auto space-y-4 items-center', on: 'lg:w-11/12 w-full mt-15', - off: 'w-5/6', + off: 'sm:w-5/6 md:3/4 lg:w-1/2', }); const headerClassName = makeConditionalClassName({ + context: tvMode, + defaultClassName: 'w-full', + on: 'hidden', + off: 'flex mb-4 justify-between', + }); + + const cardContainerClassName = makeConditionalClassName({ context: tvMode, defaultClassName: '', - on: 'none', - off: 'flex items-center justify-between mb-4', - }) + on: '', + off: 'space-y-3 items-center justify-center w-full', + }); const cardClassName = makeConditionalClassName({ context: tvMode, - defaultClassName: 'transition-all duration-300 hover:shadow-md', + defaultClassName: + 'transition-all duration-300 hover:shadow-md hover:bg-muted/50 cursor-pointer', on: 'lg:text-4xl', - off: 'lg:text-base', + off: 'lg:text-base lg:w-full', }); return (
+
{ +
+
{getConnectionIcon()} {getConnectionText()}
+ +
+ {usersWithStatuses.map((userWithStatus) => { + const isSelected = selectedUsers.some((u) => u.user.id === userWithStatus.user.id); + const isNewStatus = newStatuses.has(userWithStatus); + const isUpdatedByOther = userWithStatus.updated_by && + userWithStatus.updated_by.id !== userWithStatus.user.id; + return ( + + +
+
+ {!tvMode && ( + handleCheckboxChange(userWithStatus)} + onClick={(e) => e.stopPropagation()} + /> + )} + +
+

+ {userWithStatus.user.full_name} +

+ {isUpdatedByOther && ( +
+ + + Updated by {userWithStatus.updated_by?.full_name} + +
+ )} +
+
+
+
+ + + {formatTime(userWithStatus.created_at)} + +
+
+ + + {formatDate(userWithStatus.created_at)} + +
+
+
+
+ + + + +
setSelectedHistoryUser(userWithStatus.user)} + > +

{userWithStatus.status}

+
+
+ {selectedHistoryUser === userWithStatus.user && ( + + )} +
+
+
+ ); + })} +
+ + {usersWithStatuses.length === 0 && ( + +

+ No status updates have been made in the past day. +

+
+ )} +
);