'use client'; import type { LearningViewProps } from '@contractspec/example.learning-journey-ui-shared'; import { Card, CardContent, CardHeader, CardTitle, } from '@contractspec/lib.ui-kit-web/ui/card'; import { DayCalendar } from '../components/DayCalendar'; export function Timeline({ track, progress }: LearningViewProps) { // Check if this is a quest with day unlocks const hasQuestDays = track.steps.some( (s) => s.availability?.unlockOnDay !== undefined ); if (hasQuestDays) { // Quest-style calendar view const totalDays = Math.max( ...track.steps.map((s) => s.availability?.unlockOnDay ?? 1), 7 ); const completedDays = track.steps .filter((s) => progress.completedStepIds.includes(s.id)) .map((s) => s.availability?.unlockOnDay ?? 1); // Current day is the first incomplete day const currentDay = track.steps.find((s) => !progress.completedStepIds.includes(s.id)) ?.availability?.unlockOnDay ?? 1; return (
Complete each day's challenge to progress
{step.description}
Follow the steps to master this skill
{step.description}