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

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