FODASSE QUE BORRAÇO

This commit is contained in:
Afonso Clerigo Mendes de Sousa 2025-10-26 00:25:13 +01:00
parent ede5003530
commit 76586c0df2
5 changed files with 28 additions and 15 deletions

View File

@ -9,6 +9,8 @@ export async function POST(request: Request) {
const body = await request.json();
const { eventId, steamId, carModel, carSkin, teamName } = body;
console.log('Received registration data:', body);
// Validate required fields
if (!eventId || !steamId || !carModel) {
return NextResponse.json(
@ -17,8 +19,18 @@ export async function POST(request: Request) {
);
}
// Convert steamId to number (BIGINT)
const driverGuid = parseInt(steamId);
// Validate steamId format to prevent SQL injection
const steamId = inputSteamId.trim(); // just in case
if (!/^[0-9]{15,20}$/.test(steamId)) {
return NextResponse.json(
{ success: false, error: "Invalid Steam ID format" },
{ status: 400 }
);
}
const driverGuid = steamId;
console.log('Parsed driver GUID:', driverGuid);
if (isNaN(driverGuid)) {
return NextResponse.json(
{ success: false, error: 'Invalid Steam ID format' },
@ -28,7 +40,7 @@ export async function POST(request: Request) {
// Check if user exists in database
const userCheck = await queryOne(
'SELECT driver_guid FROM users WHERE driver_guid = $1',
'SELECT driver_guid FROM users WHERE driver_guid = $1;',
[driverGuid]
);

View File

@ -4,7 +4,7 @@
import { query } from '@/lib/db';
import { Event, EventRegistration } from '@/types/racing';
import { notFound } from 'next/navigation';
import { TrophyIcon, MapPinIcon, UsersIcon } from '@/components/ui/icons';
import { TrophyIcon, MapPinIcon, UsersIcon, ClockIcon, CalendarIcon } from '@/components/ui/icons';
import EventRegistrationForm from '@/components/events/EventRegistrationForm';
async function getEvent(eventId: number): Promise<Event | null> {
@ -51,8 +51,9 @@ export default async function EventDetailPage({
}: {
params: Promise<{ id: string }>;
}) {
const { id } = await params;
const eventId = parseInt(id);
const { event_id } = await params;
const eventId = parseInt(event_id, 10);
const event: any = await getEvent(eventId);
if (!event) {
@ -87,8 +88,8 @@ export default async function EventDetailPage({
{/* Event Info Cards */}
<div className="grid grid-cols-1 md:grid-cols-4 gap-4 mt-12">
<InfoCard label="TRACK" value={event.event_track} icon={<MapPinIcon className="w-6 h-6" />} />
<InfoCard label="DATE" value={formatDate(event.event_date)} icon="📅" />
<InfoCard label="DURATION" value={`${event.event_duration || 'TBD'} min`} icon="⏱️" />
<InfoCard label="DATE" value={formatDate(event.event_date)} icon={<CalendarIcon className="w-6 h-6"/>} />
<InfoCard label="DURATION" value={`${event.event_duration || 'TBD'} min`} icon={<ClockIcon className="w-6 h-6" />} />
<InfoCard
label="PARTICIPANTS"
value={`${event.registrations_count}/${event.max_participants}`}

View File

@ -13,6 +13,11 @@ h1, h2, h3, h4, h5, h6 {
letter-spacing: -0.02em;
}
span p a{
letter-spacing: +0.08em;
}
/* Topographic line pattern */
.topo-lines {
background-image:

View File

@ -51,11 +51,6 @@ function Footer() {
<div className="max-w-7xl mx-auto px-6 py-8">
<div className="flex items-center justify-between text-sm">
<div className="flex items-center space-x-3">
<img
src="https://openwheels.racing/files/img/Openwheels_small.svg"
alt="OW"
className="h-6 w-6 brightness-0 invert opacity-50"
/>
<span className="text-white/40 tracking-wider">
© 2025 OPENWHEELS.RACING
</span>

View File

@ -178,7 +178,7 @@ export default async function RankingsPage({
)}
</td>
<td className="px-6 py-4">
<span className="font-semibold tracking-tight text-base">
<span className="font-semibold tracking-tight text-base" style={{ letterSpacing: "0.1em" }}>
{driver.driver_name}
</span>
</td>
@ -188,7 +188,7 @@ export default async function RankingsPage({
</span>
</td>
<td className="px-6 py-4">
<span className={`inline-block px-3 py-1 border border-white/20 text-xs font-bold tracking-wider bg-black ${driverClass.color}`}>
<span className={`inline-block px-3 py-1 border border-white/20 text-xs font-bold tracking-wider bg-black ${driverClass.color}`}>
{driverClass.name}
</span>
</td>