website cleanup

This commit is contained in:
2025-12-24 14:01:52 +01:00
parent a7aee42409
commit 9b683a59d3
65 changed files with 880 additions and 745 deletions

View File

@@ -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>
)}