From a10dca89010c9ff655af6959dd424670749024b6 Mon Sep 17 00:00:00 2001 From: nuelo Date: Wed, 29 Apr 2026 09:58:07 +0100 Subject: [PATCH] feat: build course video player UI with play button, side controls, and completed state --- src/app/dashboard/courses/[id]/page.tsx | 73 +++++++++++++++--- .../dashboard/CourseVideoPlayer.tsx | 76 +++++++++++++++++++ 2 files changed, 137 insertions(+), 12 deletions(-) create mode 100644 src/components/dashboard/CourseVideoPlayer.tsx diff --git a/src/app/dashboard/courses/[id]/page.tsx b/src/app/dashboard/courses/[id]/page.tsx index dba0e59..c44be50 100644 --- a/src/app/dashboard/courses/[id]/page.tsx +++ b/src/app/dashboard/courses/[id]/page.tsx @@ -6,10 +6,22 @@ import SummaryTabContent from "@/components/dashboard/SummaryTabContent"; import ResourcesTabContent from "@/components/dashboard/ResourcesTabContent"; import TaskTabContent from "@/components/dashboard/TaskTabContent"; import CourseContentTrackerSidebar from "@/components/dashboard/CourseContentTrackerSidebar"; +import CourseVideoPlayer from "@/components/dashboard/CourseVideoPlayer"; +import { Checkbox } from "@/components/ui/Checkbox"; import image1 from "../../../../../public/Image (1).png"; type TabId = "overview" | "resources" | "tasks" | "summary"; +const LESSONS = [ + { id: 1, title: "Lesson 1: Intro to Digital Technology", duration: "5 min" }, + { id: 2, title: "Lesson 2: Blockchain Basics", duration: "5 min" }, + { id: 3, title: "Lesson 3: Smart Contracts", duration: "5 min" }, + { id: 4, title: "Lesson 4: DeFi Fundamentals", duration: "5 min" }, + { id: 5, title: "Lesson 5: Web3 Wallets", duration: "5 min" }, + { id: 6, title: "Lesson 6: dApp Development", duration: "5 min" }, + { id: 7, title: "Lesson 7: Token Standards", duration: "5 min" }, +]; + interface Params { id: string; } @@ -102,6 +114,8 @@ const COURSE_DATA: Record< export default function CourseDetailsPage({ params }: { params: Params }) { const courseData = COURSE_DATA[params.id]; const [activeTab, setActiveTab] = useState("overview"); + const [currentLesson, setCurrentLesson] = useState(0); + const [completed, setCompleted] = useState(false); if (!courseData) { return ( @@ -111,26 +125,49 @@ export default function CourseDetailsPage({ params }: { params: Params }) { ); } + const handlePrevious = () => + setCurrentLesson((prev) => Math.max(0, prev - 1)); + const handleNext = () => + setCurrentLesson((prev) => Math.min(LESSONS.length - 1, prev + 1)); + return (
-
-
- {courseData.title} -
-

{courseData.title}

+ {/* Breadcrumb */} +
+ {courseData.title} + | + + {LESSONS[currentLesson].title} +
-
+ {/* Left: video + tabs */} +
+ + + {/* Completed checkbox */} + + + {/* Tabs */}
{[ { id: "overview" as const, label: "Overview" }, { id: "resources" as const, label: "Resources" }, - { id: "tasks" as const, label: "Tasks" }, + { id: "tasks" as const, label: "Task" }, { id: "summary" as const, label: "Summary" }, ].map((tab) => (
+ {/* Right: tutor + content tracker */}
- + ({ + id: l.id, + title: l.title, + duration: l.duration, + }))} + tutorInfo={{ + name: "Satoshi Nakamoto", + role: "Front-End Developer", + avatar: "/avatarPlaceholder1.jpg", + }} + />
diff --git a/src/components/dashboard/CourseVideoPlayer.tsx b/src/components/dashboard/CourseVideoPlayer.tsx new file mode 100644 index 0000000..17ca118 --- /dev/null +++ b/src/components/dashboard/CourseVideoPlayer.tsx @@ -0,0 +1,76 @@ +"use client"; + +import React, { useState } from "react"; +import { Play, SkipBack, SkipForward } from "lucide-react"; + +interface CourseVideoPlayerProps { + thumbnailSrc: string; + thumbnailAlt?: string; + onPrevious?: () => void; + onNext?: () => void; + onPlay?: () => void; +} + +export default function CourseVideoPlayer({ + thumbnailSrc, + thumbnailAlt = "Course video thumbnail", + onPrevious, + onNext, + onPlay, +}: CourseVideoPlayerProps) { + const [isPlayHovered, setIsPlayHovered] = useState(false); + + return ( +
+ {/* Thumbnail */} + {thumbnailAlt} + + {/* Dark overlay */} +
+ + {/* Side nav: Previous */} + + + {/* Center play button */} + + + {/* Side nav: Next */} + +
+ ); +}