diff --git a/src/app/boarding/page.tsx b/src/app/boarding/page.tsx new file mode 100644 index 0000000..323b764 --- /dev/null +++ b/src/app/boarding/page.tsx @@ -0,0 +1,89 @@ +'use client'; + +import { useState, Suspense } from 'react'; +import { useRouter, useSearchParams } from 'next/navigation'; +import { ROUTES } from '@/lib/constants'; +import { saveCurrentVoyage } from '@/lib/store'; +import { Voyage } from '@/types'; + +function BoardingContent() { + const router = useRouter(); + const searchParams = useSearchParams(); + const routeId = searchParams.get('routeId'); + const route = ROUTES.find(r => r.id === routeId) || ROUTES[0]; + + const [mission, setMission] = useState(''); + const [notes, setNotes] = useState(''); + + const handleDocking = () => { + if (!mission.trim()) return; + + const newVoyage: Voyage = { + id: crypto.randomUUID(), + routeId: route.id, + routeName: route.name, + durationMinutes: route.durationMinutes, + startedAt: Date.now(), + status: 'in_progress', + missionText: mission, + notes: notes, + }; + + saveCurrentVoyage(newVoyage); + router.push('/flight'); + }; + + return ( +