mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 22:11:24 -05:00
Fix: Improve Release Lock button functionality and styling
This commit is contained in:
@@ -102,7 +102,7 @@ export const LockStatusDisplay = ({
|
||||
{/* Release Lock Button */}
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
variant="outline"
|
||||
onClick={() => onReleaseLock(currentLock.submissionId)}
|
||||
disabled={isLoading}
|
||||
className="w-full"
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user