mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 17:11:13 -05:00
Refactor: Complete type safety migration
This commit is contained in:
@@ -1,6 +1,14 @@
|
||||
import { useEffect, useState, useRef, useCallback } from 'react';
|
||||
import { supabase } from '@/integrations/supabase/client';
|
||||
|
||||
// Type for submission realtime payload
|
||||
interface SubmissionPayload {
|
||||
status?: string;
|
||||
assigned_to?: string | null;
|
||||
locked_until?: string | null;
|
||||
escalated?: boolean;
|
||||
}
|
||||
|
||||
interface ModerationStats {
|
||||
pendingSubmissions: number;
|
||||
openReports: number;
|
||||
@@ -118,12 +126,14 @@ export const useModerationStats = (options: UseModerationStatsOptions = {}) => {
|
||||
schema: 'public',
|
||||
table: 'content_submissions'
|
||||
}, (payload) => {
|
||||
const oldStatus = (payload.old as any)?.status;
|
||||
const newStatus = (payload.new as any)?.status;
|
||||
const oldAssignedTo = (payload.old as any)?.assigned_to;
|
||||
const newAssignedTo = (payload.new as any)?.assigned_to;
|
||||
const oldLockedUntil = (payload.old as any)?.locked_until;
|
||||
const newLockedUntil = (payload.new as any)?.locked_until;
|
||||
const oldData = payload.old as SubmissionPayload;
|
||||
const newData = payload.new as SubmissionPayload;
|
||||
const oldStatus = oldData?.status;
|
||||
const newStatus = newData?.status;
|
||||
const oldAssignedTo = oldData?.assigned_to;
|
||||
const newAssignedTo = newData?.assigned_to;
|
||||
const oldLockedUntil = oldData?.locked_until;
|
||||
const newLockedUntil = newData?.locked_until;
|
||||
|
||||
// Only refresh if change affects pending count or assignments
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user