mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 19:51:13 -05:00
Fix critical 'any' types in components
This commit is contained in:
@@ -8,6 +8,20 @@ import { Alert, AlertDescription } from '@/components/ui/alert';
|
||||
import { EditHistoryEntry } from './EditHistoryEntry';
|
||||
import { History, Loader2, AlertCircle } from 'lucide-react';
|
||||
|
||||
interface EditHistoryRecord {
|
||||
id: string;
|
||||
item_id: string;
|
||||
edited_at: string;
|
||||
previous_data: Record<string, unknown>;
|
||||
new_data: Record<string, unknown>;
|
||||
edit_reason: string | null;
|
||||
changed_fields: string[];
|
||||
profiles?: {
|
||||
username: string;
|
||||
avatar_url?: string | null;
|
||||
} | null;
|
||||
}
|
||||
|
||||
interface EditHistoryAccordionProps {
|
||||
submissionId: string;
|
||||
}
|
||||
@@ -30,7 +44,6 @@ export function EditHistoryAccordion({ submissionId }: EditHistoryAccordionProps
|
||||
id,
|
||||
item_id,
|
||||
edited_at,
|
||||
edited_by,
|
||||
previous_data,
|
||||
new_data,
|
||||
edit_reason,
|
||||
@@ -45,7 +58,7 @@ export function EditHistoryAccordion({ submissionId }: EditHistoryAccordionProps
|
||||
.limit(limit);
|
||||
|
||||
if (error) throw error;
|
||||
return data || [];
|
||||
return (data || []) as unknown as EditHistoryRecord[];
|
||||
},
|
||||
staleTime: 5 * 60 * 1000, // 5 minutes
|
||||
});
|
||||
@@ -98,15 +111,15 @@ export function EditHistoryAccordion({ submissionId }: EditHistoryAccordionProps
|
||||
<div className="space-y-4">
|
||||
<ScrollArea className="h-[400px] pr-4">
|
||||
<div className="space-y-3">
|
||||
{editHistory.map((entry: any) => (
|
||||
{editHistory.map((entry: EditHistoryRecord) => (
|
||||
<EditHistoryEntry
|
||||
key={entry.id}
|
||||
editId={entry.id}
|
||||
editorName={entry.profiles?.username || 'Unknown User'}
|
||||
editorAvatar={entry.profiles?.avatar_url}
|
||||
editorAvatar={entry.profiles?.avatar_url || undefined}
|
||||
timestamp={entry.edited_at}
|
||||
changedFields={entry.changed_fields || []}
|
||||
editReason={entry.edit_reason}
|
||||
editReason={entry.edit_reason || undefined}
|
||||
beforeData={entry.previous_data}
|
||||
afterData={entry.new_data}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user