From 426c1c50a0a507368f98cf1558c4747b41c6e88f Mon Sep 17 00:00:00 2001
From: Server Ubunto - HOME
Date: Wed, 24 Jun 2026 11:37:56 +0100
Subject: [PATCH] fix: FINNALY FIXED AND COMPILABLE
---
app/dashboard/page.tsx | 4 +--
app/events/[event_id]/page.tsx | 35 +++++++++++----------
app/events/[event_id]/results/page.tsx | 17 +++++-----
app/events/page.tsx | 8 ++---
app/live/page.tsx | 4 +--
app/music/page.tsx | 18 ++---------
app/page.tsx | 6 ++--
app/rankings/page.tsx | 6 ++--
components/dashboard/DashboardClient.tsx | 8 ++---
components/events/EventRegistrationForm.tsx | 2 +-
components/events/EventResultsClient.tsx | 4 +--
components/live/LiveSessionClient.tsx | 2 +-
types/racing.ts | 4 +++
13 files changed, 56 insertions(+), 62 deletions(-)
diff --git a/app/dashboard/page.tsx b/app/dashboard/page.tsx
index c6ca787..29de394 100644
--- a/app/dashboard/page.tsx
+++ b/app/dashboard/page.tsx
@@ -4,7 +4,7 @@
import { query } from '@/lib/db';
import { LiveDotIcon } from '@/components/ui/icons';
import DashboardClient from '@/components/dashboard/DashboardClient';
-import { Driver, DriverServerRow } from '@/types/racing';
+import { DashboardDriver } from '@/components/dashboard/DashboardClient';
export const dynamic = "force-dynamic";
async function getConnectedDrivers() {
@@ -37,7 +37,7 @@ async function getConnectedDrivers() {
const rows = await query(sql);
- const drivers: Driver[] = rows.map((row: DriverServerRow) => ({
+ const drivers: DashboardDriver[] = rows.map((row: any) => ({
driver_guid: row.driver_guid,
driver_name: row.driver_name,
driver_team: row.driver_team,
diff --git a/app/events/[event_id]/page.tsx b/app/events/[event_id]/page.tsx
index afedb64..a7e5c56 100644
--- a/app/events/[event_id]/page.tsx
+++ b/app/events/[event_id]/page.tsx
@@ -2,15 +2,15 @@
// Event detail page with registration form
import { query } from '@/lib/db';
-import { Event, EventRegistration } from '@/types/racing';
+import { EventWithRegistrations, EventRegistrationWithDriver } from '@/types/racing';
import { notFound } from 'next/navigation';
import { TrophyIcon, MapPinIcon, UsersIcon, ClockIcon, CalendarIcon } from '@/components/ui/icons';
import EventRegistrationForm from '@/components/events/EventRegistrationForm';
-import EventResultClient from '@/components/events/EventResultsClient';
+import EventResultsClient, { TeamStanding } from '@/components/events/EventResultsClient';
export const dynamic = "force-dynamic";
-async function getEventResults(eventId: number) {
+async function getEventResults(eventId: number): Promise<{ event: Event | null; standings: TeamStanding[] }> {
if (eventId == undefined) {
return { event: null, standings: [] };
@@ -27,7 +27,7 @@ async function getEventResults(eventId: number) {
WHERE event_id = $1
`;
const events = await query(eventSql, [String(eventId)]);
- const event = events[0];
+ const event = (events[0] as Event) ?? null;
// Get team standings with driver details
const standingsSql = `
@@ -58,11 +58,11 @@ async function getEventResults(eventId: number) {
const standings = await query(standingsSql, [eventId]);
- return { event, standings };
+ return { event, standings: standings as TeamStanding[] };
}
-async function getEvent(eventId: number): Promise {
+async function getEvent(eventId: number): Promise {
const sql = `
SELECT e.*, COUNT(er.registration_id) as registrations_count
FROM events e
@@ -72,10 +72,10 @@ async function getEvent(eventId: number): Promise {
`;
const rows = await query(sql, [eventId]);
- return rows.length > 0 ? rows[0] as Event : null;
+ return rows.length > 0 ? rows[0] as EventWithRegistrations : null;
}
-async function getEventRegistrations(eventId: number): Promise {
+async function getEventRegistrations(eventId: number): Promise {
const sql = `
SELECT
er.*,
@@ -87,7 +87,7 @@ async function getEventRegistrations(eventId: number): Promise;
+ params: Promise<{ event_id: string }>;
}) {
const { event_id } = await params;
- const event: unknown = await getEvent(event_id);
+ const eventId = parseInt(event_id, 10);
+ const event = await getEvent(eventId);
if (!event) {
notFound();
}
- const registrations = await getEventRegistrations(event_id);
+ const registrations = await getEventRegistrations(eventId);
// Fetch initial event results/standings
- const { standings } = await getEventResults(event_id);
+ const { standings } = await getEventResults(eventId);
const isOpen = event.event_status === 'OPEN';
@@ -176,8 +177,8 @@ export default async function EventDetailPage({
{event.event_status === 'CLOSED' && !isFull && !deadlinePassed && 'Registration is closed for this event.'}
-
@@ -205,11 +206,11 @@ export default async function EventDetailPage({
{registrations.length === 0 ? (
No registrations yet
) : (
- registrations.map((reg: unknown, index: number) => (
+ registrations.map((reg, index) => (
-
+
#{String(index + 1).padStart(2, '0')}
{reg.driver_name}
diff --git a/app/events/[event_id]/results/page.tsx b/app/events/[event_id]/results/page.tsx
index ef62c72..96d5aa3 100644
--- a/app/events/[event_id]/results/page.tsx
+++ b/app/events/[event_id]/results/page.tsx
@@ -4,10 +4,11 @@
import { query } from '@/lib/db';
import Link from 'next/link';
import EventResultsClient from '@/components/events/EventResultsClient';
+import { Event } from '@/types/racing';
export const dynamic = "force-dynamic";
-async function getEventResults(eventId: number) {
+async function getEventResults(eventId: string) {
if (eventId == undefined) {
return { event: null, standings: [] };
@@ -23,8 +24,8 @@ async function getEventResults(eventId: number) {
FROM events
WHERE event_id = $1
`;
- const events = await query(eventSql, [String(eventId)]);
- const event = events[0];
+ const events = await query(eventSql, [eventId]);
+ const event = (events[0] as Event) ?? null;
// Get team standings with driver details
const standingsSql = `
@@ -55,20 +56,20 @@ async function getEventResults(eventId: number) {
const standings = await query(standingsSql, [eventId]);
- return { event, standings };
+ return { event, standings: standings as any[] };
}
export default async function EventResultsPage({
params,
}: {
- params: Promise<{ event_id: number }>;
+ params: Promise<{ event_id: string }>;
}) {
- const { event_id } = await params;
+ const { event_id } = await params;
+ const eventId = parseInt(event_id, 10);
console.log('Fetching results for event ID:', event_id);
const { event, standings } = await getEventResults(event_id);
-
if (!event) {
return (
@@ -110,7 +111,7 @@ export default async function EventResultsPage({
{/* Team Championship Standings */}
diff --git a/app/events/page.tsx b/app/events/page.tsx
index 19b18a2..02c5a9d 100644
--- a/app/events/page.tsx
+++ b/app/events/page.tsx
@@ -2,13 +2,13 @@
// Events listing page
import { query } from '@/lib/db';
-import { Event } from '@/types/racing';
+import { EventWithRegistrations } from '@/types/racing';
import Link from 'next/link';
import Image from "next/image";
import { TrophyIcon, UsersIcon, MapPinIcon, ClockIcon, CalendarIcon } from '@/components/ui/icons';
export const dynamic = "force-dynamic";
-async function getEvents(): Promise
{
+async function getEvents(): Promise {
const sql = `
SELECT
e.*,
@@ -21,7 +21,7 @@ async function getEvents(): Promise {
`;
const rows = await query(sql);
- return rows as Event[];
+ return rows as EventWithRegistrations[];
}
function formatDate(date: Date): string {
@@ -67,7 +67,7 @@ export default async function EventsPage() {
Check back soon for new racing events
) : (
- events.map((event: unknown) => {
+ events.map((event) => {
const isOpen = event.event_status === 'OPEN';
const isFull = event.registrations_count >= event.max_participants;
const deadlinePassed = event.registration_deadline && new Date(event.registration_deadline) < new Date();
diff --git a/app/live/page.tsx b/app/live/page.tsx
index 3d3b342..da9516d 100644
--- a/app/live/page.tsx
+++ b/app/live/page.tsx
@@ -32,7 +32,7 @@ async function getLiveData(): Promise
{
// For each server, get connected cars with their positions
const liveData = await Promise.all(
- servers.map(async (server: unknown) => {
+ servers.map(async (server: any) => {
const carsSql = `
SELECT
u.driver_guid,
@@ -47,7 +47,7 @@ async function getLiveData(): Promise {
const cars = await query(carsSql, [server.server_id]);
// Add mock data for positions (real data will come from telemetry stream)
- const carsWithPositions = cars.map((car: unknown, index: number) => ({
+ const carsWithPositions = cars.map((car: any, index: number) => ({
...car,
carID: index,
position: index + 1,
diff --git a/app/music/page.tsx b/app/music/page.tsx
index 4782402..02522ef 100644
--- a/app/music/page.tsx
+++ b/app/music/page.tsx
@@ -112,19 +112,7 @@ export default function MusicPage() {
};
useEffect(() => {
- let active = true;
-
- const run = async () => {
- const data = await fetchTracks();
- if (!active) return;
- setTracks(data);
- };
-
- void run();
-
- return () => {
- active = false;
- };
+ fetchTracks();
}, [isPlaying]);
// Group tracks by theme
@@ -349,7 +337,7 @@ export default function MusicPage() {
{isVideo ? (