import { useEffect, useState } from 'react' import { useParams, useNavigate } from 'react-router-dom' import { PageMeta } from '@/components/common/PageMeta' import { l1Api } from '@/api/l1' import { L1WalkTreeVariant } from '@/components/l1/L1WalkTreeVariant' import { L1WalkAdhocVariant } from '@/components/l1/L1WalkAdhocVariant' import type { WalkSession } from '@/types/l1' export default function L1WalkPage() { const { sessionId } = useParams<{ sessionId: string }>() const navigate = useNavigate() const [session, setSession] = useState(null) const [error, setError] = useState(null) useEffect(() => { if (!sessionId) return l1Api.getSession(sessionId) .then(setSession) .catch((err) => { const msg = err?.response?.data?.detail || err?.message || 'Failed to load session' setError(typeof msg === 'string' ? msg : 'Failed to load session') }) }, [sessionId]) if (error) { return (
{error}
) } if (!session) { return (
Loading…
) } const handleDone = () => navigate('/l1') // Phase 1: adhoc variant handles session_kind='adhoc'. Tree variant handles flow/proposal. if (session.session_kind === 'adhoc') { return ( <> ) } return ( <> ) }