mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 01:31:13 -05:00
feat: Execute production readiness plan
This commit is contained in:
@@ -6,9 +6,8 @@ import { Label } from '@/components/ui/label';
|
||||
import { Alert, AlertDescription } from '@/components/ui/alert';
|
||||
import { AlertCircle } from 'lucide-react';
|
||||
import { type DependencyConflict, type SubmissionItemWithDeps } from '@/lib/submissionItemsService';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import { useAuth } from '@/hooks/useAuth';
|
||||
import { getErrorMessage } from '@/lib/errorHandler';
|
||||
import { handleError, handleSuccess } from '@/lib/errorHandler';
|
||||
|
||||
interface ConflictResolutionDialogProps {
|
||||
open: boolean;
|
||||
@@ -26,7 +25,6 @@ export function ConflictResolutionDialog({
|
||||
onResolve,
|
||||
}: ConflictResolutionDialogProps) {
|
||||
const [resolutions, setResolutions] = useState<Record<string, string>>({});
|
||||
const { toast } = useToast();
|
||||
const { user } = useAuth();
|
||||
|
||||
const handleResolutionChange = (itemId: string, action: string) => {
|
||||
@@ -39,10 +37,9 @@ export function ConflictResolutionDialog({
|
||||
|
||||
const handleApply = async () => {
|
||||
if (!user?.id) {
|
||||
toast({
|
||||
title: 'Authentication Required',
|
||||
description: 'You must be logged in to resolve conflicts',
|
||||
variant: 'destructive',
|
||||
handleError(new Error('Authentication required'), {
|
||||
action: 'Resolve Conflicts',
|
||||
metadata: { conflictCount: conflicts.length }
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -53,27 +50,22 @@ export function ConflictResolutionDialog({
|
||||
const result = await resolveConflicts(conflicts, resolutions, items, user.id);
|
||||
|
||||
if (!result.success) {
|
||||
toast({
|
||||
title: 'Resolution Failed',
|
||||
description: result.error || 'Failed to resolve conflicts',
|
||||
variant: 'destructive',
|
||||
handleError(new Error(result.error || 'Failed to resolve conflicts'), {
|
||||
action: 'Resolve Conflicts',
|
||||
userId: user.id,
|
||||
metadata: { conflictCount: conflicts.length }
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
toast({
|
||||
title: 'Conflicts Resolved',
|
||||
description: 'All conflicts have been resolved successfully',
|
||||
});
|
||||
|
||||
handleSuccess('Conflicts Resolved', 'All conflicts have been resolved successfully');
|
||||
onResolve();
|
||||
onOpenChange(false);
|
||||
} catch (error) {
|
||||
const errorMsg = getErrorMessage(error);
|
||||
toast({
|
||||
title: 'Error',
|
||||
description: errorMsg,
|
||||
variant: 'destructive',
|
||||
} catch (error: unknown) {
|
||||
handleError(error, {
|
||||
action: 'Resolve Conflicts',
|
||||
userId: user.id,
|
||||
metadata: { conflictCount: conflicts.length }
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user