import { Lock, Clock, Unlock } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Card, CardContent } from '@/components/ui/card'; import { Progress } from '@/components/ui/progress'; interface LockState { submissionId: string; expiresAt: Date; } interface QueueStats { pendingCount: number; assignedToMe: number; avgWaitHours: number; } interface LockStatusDisplayProps { currentLock: LockState | null; queueStats: QueueStats | null; isLoading: boolean; onExtendLock: (submissionId: string) => Promise; onReleaseLock: (submissionId: string) => Promise; getTimeRemaining: () => number | null; getLockProgress: () => number; } /** * LockStatusDisplay Component * * Displays lock timer, progress bar, and lock management controls. * Shows "Claim Next" button when no lock is active, or lock controls when locked. */ export const LockStatusDisplay = ({ currentLock, queueStats, isLoading, onExtendLock, onReleaseLock, getTimeRemaining, getLockProgress, }: LockStatusDisplayProps) => { // Format milliseconds as MM:SS const formatLockTimer = (ms: number): string => { const minutes = Math.floor(ms / 60000); const seconds = Math.floor((ms % 60000) / 1000); return `${minutes}:${seconds.toString().padStart(2, '0')}`; }; const timeRemaining = getTimeRemaining(); const showExtendButton = timeRemaining !== null && timeRemaining < 5 * 60 * 1000; // If no active lock, show simple info message if (!currentLock) { return (
No submission currently claimed. Claim a submission below to start reviewing.
); } // Active lock - show timer and controls return (
{/* Lock Timer */}
Lock: {formatLockTimer(timeRemaining || 0)}
{/* Progress Bar */} {/* Extend Lock Button (show when < 5 min left) */} {showExtendButton && ( )} {/* Release Lock Button */}
); };