mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 20:11:12 -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 */}
|
{/* 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"
|
||||||
|
|||||||
@@ -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({
|
||||||
|
|||||||
Reference in New Issue
Block a user