Fix: Improve Release Lock button functionality and styling

This commit is contained in:
gpt-engineer-app[bot]
2025-10-15 15:43:29 +00:00
parent adad353e4b
commit fca235269f
2 changed files with 24 additions and 19 deletions

View File

@@ -102,7 +102,7 @@ export const LockStatusDisplay = ({
{/* Release Lock Button */} {/* Release Lock Button */}
<Button <Button
size="sm" size="sm"
variant="ghost" variant="outline"
onClick={() => onReleaseLock(currentLock.submissionId)} onClick={() => onReleaseLock(currentLock.submissionId)}
disabled={isLoading} disabled={isLoading}
className="w-full" className="w-full"

View File

@@ -241,31 +241,36 @@ export const useModerationQueue = (config?: UseModerationQueueConfig) => {
if (error) throw error; if (error) throw error;
if (data) { // Always clear local state and refresh stats if no error
setCurrentLock((prev) => setCurrentLock((prev) =>
prev?.submissionId === submissionId ? null : prev prev?.submissionId === submissionId ? null : prev
); );
if (lockTimerRef.current) { if (lockTimerRef.current) {
clearInterval(lockTimerRef.current); clearInterval(lockTimerRef.current);
} }
fetchStats(); fetchStats();
// Show appropriate toast based on result
if (data === true) {
toast({ toast({
title: 'Lock Released', title: 'Lock Released',
description: 'You can now claim another submission', description: 'You can now claim another submission',
}); });
} else {
// Trigger refresh callback toast({
if (onLockStateChange) { title: 'Lock Already Released',
onLockStateChange(); description: 'This submission was already unlocked',
} });
return true;
} }
return false; // Trigger refresh callback
if (onLockStateChange) {
onLockStateChange();
}
return data;
} catch (error: any) { } catch (error: any) {
console.error('Error releasing lock:', error); console.error('Error releasing lock:', error);
toast({ toast({