import { useState } from "react"; import { Link, useNavigate, useParams } from "react-router-dom"; import { ArrowLeft, Clock, FileVideo, Check } from "lucide-react"; import { Button } from "../../components/ui/button"; import { Stepper } from "../../components/ui/stepper"; import successIcon from "../../assets/success.svg"; import { AttachPracticeStep1 } from "./components/practice-steps/AttachPracticeStep1"; import { AttachPracticeReviewStep } from "./components/practice-steps/AttachPracticeReviewStep"; export function AttachPracticeFlow() { const navigate = useNavigate(); const { programType, courseId, unitId, moduleId } = useParams<{ programType: string; courseId: string; unitId: string; moduleId: string; }>(); const backPath = `/new-content/courses/${programType}/${courseId}/${unitId}/${moduleId}`; const [currentStep, setCurrentStep] = useState(1); const [isPublished, setIsPublished] = useState(false); const [formData, setFormData] = useState({ program: programType === "skill" ? "Skill-Based Courses" : "English Proficiency Exams", module: "Module 4: Interactive Speaking", video: "Intro to Interactive Speaking", questionType: "speaking", version: "v1", }); const steps = ["Set Video", "Review & Publish"]; const nextStep = () => setCurrentStep((prev) => Math.min(prev + 1, steps.length)); const prevStep = () => setCurrentStep((prev) => Math.max(prev - 1, 1)); if (isPublished) { return (
{/* Scalloped Success Icon */}
Success

Practice Attached Successfully!

The practice has been successfully linked to a video{" "} “{formData.video}”

{/* Video Info Card */}
Video Thumbnail

Intro to IELTS Speaking Part 1

10:42 mins
MP4
{/* Action Buttons */}
); } const renderStep = () => { switch (currentStep) { case 1: return ( navigate(backPath)} /> ); case 2: return ( setIsPublished(true)} /> ); default: return null; } }; const title = currentStep === 1 ? "Attach Practice to a Video" : "Review & Publish"; const description = currentStep === 1 ? "Create a new immersive practice session for a video." : "Verify practice details before publishing it."; return (
{/* Navigation Breadcrumb */}
Back to Videos
{/* Stepper Area */}
{/* Page Title & Header Actions */}

{title}

{description}

{/* Form Content */}
{renderStep()}
); }