Refactor: Improve desktop layout and fix release lock

This commit is contained in:
gpt-engineer-app[bot]
2025-10-15 15:02:30 +00:00
parent 415aa45f4c
commit 9904a0c36b
3 changed files with 19 additions and 6 deletions

View File

@@ -231,6 +231,7 @@ export const useModerationQueue = (config?: UseModerationQueueConfig) => {
const releaseLock = useCallback(async (submissionId: string): Promise<boolean> => {
if (!user?.id) return false;
setIsLoading(true);
try {
const { data, error } = await supabase.rpc('release_submission_lock', {
submission_id: submissionId,
@@ -250,6 +251,11 @@ export const useModerationQueue = (config?: UseModerationQueueConfig) => {
fetchStats();
toast({
title: 'Lock Released',
description: 'You can now claim another submission',
});
// Trigger refresh callback
if (onLockStateChange) {
onLockStateChange();
@@ -261,9 +267,16 @@ export const useModerationQueue = (config?: UseModerationQueueConfig) => {
return false;
} catch (error: any) {
console.error('Error releasing lock:', error);
toast({
title: 'Error',
description: error.message || 'Failed to release lock',
variant: 'destructive',
});
return false;
} finally {
setIsLoading(false);
}
}, [user, fetchStats]);
}, [user, fetchStats, toast, onLockStateChange]);
// Get time remaining on current lock
const getTimeRemaining = useCallback((): number | null => {