wip
This commit is contained in:
@@ -3,8 +3,7 @@
|
||||
import { useState } from 'react';
|
||||
import Modal from '@/components/ui/Modal';
|
||||
import Button from '@/components/ui/Button';
|
||||
import { getFileProtestUseCase, getDriverRepository } from '@/lib/di-container';
|
||||
import type { Driver } from '@gridpilot/racing/domain/entities/Driver';
|
||||
import { getFileProtestUseCase } from '@/lib/di-container';
|
||||
import type { ProtestIncident } from '@gridpilot/racing/domain/entities/Protest';
|
||||
import {
|
||||
AlertTriangle,
|
||||
@@ -17,13 +16,18 @@ import {
|
||||
CheckCircle2,
|
||||
} from 'lucide-react';
|
||||
|
||||
type ProtestParticipant = {
|
||||
id: string;
|
||||
name: string;
|
||||
};
|
||||
|
||||
interface FileProtestModalProps {
|
||||
isOpen: boolean;
|
||||
onClose: () => void;
|
||||
raceId: string;
|
||||
leagueId?: string;
|
||||
protestingDriverId: string;
|
||||
participants: Driver[];
|
||||
participants: ProtestParticipant[];
|
||||
}
|
||||
|
||||
export default function FileProtestModal({
|
||||
@@ -70,18 +74,26 @@ export default function FileProtestModal({
|
||||
|
||||
const incident: ProtestIncident = {
|
||||
lap: parseInt(lap, 10),
|
||||
timeInRace: timeInRace ? parseInt(timeInRace, 10) : undefined,
|
||||
description: description.trim(),
|
||||
...(timeInRace
|
||||
? { timeInRace: parseInt(timeInRace, 10) }
|
||||
: {}),
|
||||
};
|
||||
|
||||
await useCase.execute({
|
||||
const command = {
|
||||
raceId,
|
||||
protestingDriverId,
|
||||
accusedDriverId,
|
||||
incident,
|
||||
comment: comment.trim() || undefined,
|
||||
proofVideoUrl: proofVideoUrl.trim() || undefined,
|
||||
});
|
||||
...(comment.trim()
|
||||
? { comment: comment.trim() }
|
||||
: {}),
|
||||
...(proofVideoUrl.trim()
|
||||
? { proofVideoUrl: proofVideoUrl.trim() }
|
||||
: {}),
|
||||
};
|
||||
|
||||
await useCase.execute(command);
|
||||
|
||||
setStep('success');
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user