mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 16:31:12 -05:00
feat: Optimize moderation queue desktop layout and fix release lock
This commit is contained in:
@@ -231,6 +231,8 @@ 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 +252,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 +268,16 @@ export const useModerationQueue = (config?: UseModerationQueueConfig) => {
|
||||
return false;
|
||||
} catch (error: any) {
|
||||
console.error('Error releasing lock:', error);
|
||||
toast({
|
||||
title: 'Failed to Release Lock',
|
||||
description: error.message || 'An error occurred',
|
||||
variant: 'destructive',
|
||||
});
|
||||
return false;
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
}, [user, fetchStats]);
|
||||
}, [user, fetchStats, toast, onLockStateChange]);
|
||||
|
||||
// Get time remaining on current lock
|
||||
const getTimeRemaining = useCallback((): number | null => {
|
||||
|
||||
Reference in New Issue
Block a user