mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 13:31:12 -05:00
Fix moderation queue claim logic
This commit is contained in:
@@ -134,6 +134,17 @@ export const ModerationQueue = forwardRef<ModerationQueueRef, ModerationQueuePro
|
||||
};
|
||||
}, [queueManager, toast]);
|
||||
|
||||
// Auto-dismiss lock restored banner after 10 seconds
|
||||
useEffect(() => {
|
||||
if (lockRestored && queueManager.queue.currentLock) {
|
||||
const timer = setTimeout(() => {
|
||||
setLockRestored(false);
|
||||
}, 10000); // Auto-dismiss after 10 seconds
|
||||
|
||||
return () => clearTimeout(timer);
|
||||
}
|
||||
}, [lockRestored, queueManager.queue.currentLock]);
|
||||
|
||||
// Fetch active locks count for superusers
|
||||
const isSuperuserValue = isSuperuser();
|
||||
|
||||
@@ -377,15 +388,43 @@ export const ModerationQueue = forwardRef<ModerationQueueRef, ModerationQueuePro
|
||||
)}
|
||||
|
||||
{/* Lock Restored Alert */}
|
||||
{lockRestored && queueManager.queue.currentLock && (
|
||||
<Alert className="border-blue-500/50 bg-blue-500/5">
|
||||
<Info className="h-4 w-4 text-blue-600" />
|
||||
<AlertTitle>Active Claim Restored</AlertTitle>
|
||||
<AlertDescription>
|
||||
Your previous claim was restored. You still have time to review this submission.
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
)}
|
||||
{lockRestored && queueManager.queue.currentLock && (() => {
|
||||
// Check if restored submission is in current queue
|
||||
const restoredSubmissionInQueue = queueManager.items.some(
|
||||
item => item.id === queueManager.queue.currentLock?.submissionId
|
||||
);
|
||||
|
||||
if (!restoredSubmissionInQueue) return null;
|
||||
|
||||
// Calculate time remaining
|
||||
const timeRemainingMs = queueManager.queue.currentLock.expiresAt.getTime() - Date.now();
|
||||
const timeRemainingSec = Math.max(0, Math.floor(timeRemainingMs / 1000));
|
||||
const isExpiringSoon = timeRemainingSec < 300; // Less than 5 minutes
|
||||
|
||||
return (
|
||||
<Alert className={isExpiringSoon
|
||||
? "border-orange-500/50 bg-orange-500/10"
|
||||
: "border-blue-500/50 bg-blue-500/5"
|
||||
}>
|
||||
<Info className={isExpiringSoon
|
||||
? "h-4 w-4 text-orange-600"
|
||||
: "h-4 w-4 text-blue-600"
|
||||
} />
|
||||
<AlertTitle>
|
||||
{isExpiringSoon
|
||||
? `Lock Expiring Soon (${Math.floor(timeRemainingSec / 60)}m ${timeRemainingSec % 60}s)`
|
||||
: "Active Claim Restored"
|
||||
}
|
||||
</AlertTitle>
|
||||
<AlertDescription>
|
||||
{isExpiringSoon
|
||||
? "Your lock is about to expire. Complete your review or extend the lock."
|
||||
: "Your previous claim was restored. You still have time to review this submission."
|
||||
}
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
);
|
||||
})()}
|
||||
|
||||
{/* Filter Bar */}
|
||||
<QueueFilters
|
||||
|
||||
Reference in New Issue
Block a user