website cleanup
This commit is contained in:
@@ -30,30 +30,32 @@ export default function RaceResultsPage() {
|
||||
const [importSuccess, setImportSuccess] = useState(false);
|
||||
const [showQuickPenaltyModal, setShowQuickPenaltyModal] = useState(false);
|
||||
const [preSelectedDriver, setPreSelectedDriver] = useState<{ id: string; name: string } | undefined>(undefined);
|
||||
const [importError, setImportError] = useState<string | null>(null);
|
||||
|
||||
const raceSOF = sofData?.strengthOfField || null;
|
||||
const isAdmin = membership ? LeagueRoleUtility.isLeagueAdminOrHigherRole(membership.role) : false;
|
||||
|
||||
const handleImportSuccess = async (importedResults: any[]) => {
|
||||
setImporting(true);
|
||||
setError(null);
|
||||
setImportError(null);
|
||||
|
||||
try {
|
||||
await raceResultsService.importRaceResults(raceId, {
|
||||
resultsFileContent: JSON.stringify(importedResults), // Assuming the API expects JSON string
|
||||
});
|
||||
// TODO: Implement race results service
|
||||
// await raceResultsService.importRaceResults(raceId, {
|
||||
// resultsFileContent: JSON.stringify(importedResults), // Assuming the API expects JSON string
|
||||
// });
|
||||
|
||||
setImportSuccess(true);
|
||||
await loadData();
|
||||
// await loadData();
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Failed to import results');
|
||||
setImportError(err instanceof Error ? err.message : 'Failed to import results');
|
||||
} finally {
|
||||
setImporting(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleImportError = (errorMessage: string) => {
|
||||
setError(errorMessage);
|
||||
setImportError(errorMessage);
|
||||
};
|
||||
|
||||
const handlePenaltyClick = (driver: { id: string; name: string }) => {
|
||||
@@ -82,7 +84,7 @@ export default function RaceResultsPage() {
|
||||
<div className="max-w-6xl mx-auto">
|
||||
<Card className="text-center py-12">
|
||||
<div className="text-warning-amber mb-4">
|
||||
{error || 'Race not found'}
|
||||
{error?.message || 'Race not found'}
|
||||
</div>
|
||||
<Button
|
||||
variant="secondary"
|
||||
@@ -147,9 +149,9 @@ export default function RaceResultsPage() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{error && (
|
||||
{importError && (
|
||||
<div className="p-4 bg-warning-amber/10 border border-warning-amber/30 rounded-lg text-warning-amber">
|
||||
<strong>Error:</strong> {error}
|
||||
<strong>Error:</strong> {importError}
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user