"use client"; import Image from "next/image"; import Link from "next/link"; import { ArrowRight, Check, Flag, RotateCcw, Map as MapIcon } from "lucide-react"; import { TutorialMetaLine } from "@/components/tutorial-card"; import { firstName } from "@/lib/display-name"; import { LEVELS, WEEKLY_TIMES, labelFor } from "@/lib/onboarding"; import { buildRoadmap, type RoadmapPhase, type RoadmapStep } from "@/lib/roadmap"; import { getTrack } from "@/lib/tracks"; import type { TutorialMeta } from "@/lib/tutorial-types"; import { useLearningProfile, useRoadmapProgress } from "@/lib/use-learning-profile"; import { cn } from "@/lib/utils"; const chip = "inline-flex items-center rounded-full border border-border px-3 py-1.5 font-mono text-[11px] uppercase tracking-[0.08em] text-[var(--mist)]"; function StepRow({ step, done, onToggle }: { step: RoadmapStep; done: boolean; onToggle: () => void }) { const t = step.tutorial; const href = `/${t.track}/${t.slug}`; return (
  • {/* Sits above the card's link so ticking it doesn't open the tutorial */}
    {/* The link's ::after covers the whole card, so anywhere on it opens the tutorial */} {t.title}

    For: {step.reason}

  • ); } function Phase({ phase, index, done, onToggle }: { phase: RoadmapPhase; index: number; done: Set; onToggle: (key: string) => void }) { const finished = phase.steps.filter((s) => done.has(s.key)).length; const complete = finished === phase.steps.length; return (
    {/* Node on the timeline */} {complete ? : index + 1}

    Phase {index + 1} · {finished}/{phase.steps.length} done

    {phase.title}

    {phase.summary}

    About {phase.weeks} {phase.weeks === 1 ? "week" : "weeks"} at your pace · {phase.minutes} min of tutorials

      {phase.steps.map((s) => ( onToggle(s.key)} /> ))}

    Milestone {phase.milestone}.

    ); } function Intro() { return (

    My roadmap

    A learning path built around you

    Answer five quick questions about what you want from AI and where you are now. We'll turn the site's tutorials into a step-by-step plan, paced to the time you have, and you can tick things off as you go.

    ); } export function RoadmapView({ tutorials }: { tutorials: TutorialMeta[] }) { const { user, profile } = useLearningProfile(); const { done, toggle } = useRoadmapProgress(); if (profile === undefined || done === null) return
    ; if (!profile) return ; const roadmap = buildRoadmap(profile, tutorials); const finished = roadmap.phases.flatMap((p) => p.steps).filter((s) => done.has(s.key)).length; const pct = roadmap.totalSteps ? Math.round((finished / roadmap.totalSteps) * 100) : 0; return ( <>

    My roadmap

    {user ? `${firstName(user)}, here's your path` : "Here's your path"}

    {labelFor(LEVELS, profile.level)} {roadmap.tracks.map((t) => ( {getTrack(t)?.name} ))} {labelFor(WEEKLY_TIMES, profile.weeklyTime)} Retake the questions
    {finished} of {roadmap.totalSteps} done {pct}%
    {!user && (

    Your roadmap is saved in this browser for now.{" "} Sign in {" "} to keep it and your progress on any device.

    )} {roadmap.phases.length === 0 ? (

    There aren't tutorials for those tools yet. Pick other tools{" "} or browse all tutorials.

    ) : (
    {roadmap.phases.map((phase, i) => ( ))}
    )} ); }