|
| 1 | +"use client"; |
| 2 | +import { FEATURE_FLAGS, isFlagEnabled } from "@/utils/flags"; |
| 3 | +import { CheckCircle, CircleCheck, PlayCircle, SquarePlay } from "lucide-react"; |
| 4 | +import { type Session } from "next-auth"; |
| 5 | +import { notFound } from "next/navigation"; |
| 6 | +import { mockContentList, mockVideoSrc } from "../../mock"; |
| 7 | + |
| 8 | +const Content = ({ session }: { session: Session | null }) => { |
| 9 | + const flagEnabled = isFlagEnabled(FEATURE_FLAGS.COURSE_VIDEO); |
| 10 | + |
| 11 | + if (!flagEnabled) { |
| 12 | + notFound(); |
| 13 | + } |
| 14 | + |
| 15 | + return ( |
| 16 | + <div className="flex w-full flex-grow flex-col"> |
| 17 | + <div className="w-full divide-x divide-gray-700 lg:grid lg:grid-cols-12"> |
| 18 | + {/* Video container */} |
| 19 | + <div className="col-span-9"> |
| 20 | + <div className="bg-black"> |
| 21 | + <iframe |
| 22 | + className="aspect-video w-full" |
| 23 | + src="https://www.youtube.com/embed/Q68wOyeG5lc" |
| 24 | + title="YouTube video" |
| 25 | + ></iframe> |
| 26 | + </div> |
| 27 | + </div> |
| 28 | + |
| 29 | + {/* Sidebar */} |
| 30 | + <div className="col-span-3 flex w-full flex-col overflow-auto"> |
| 31 | + <ul className="divide-y divide-gray-700"> |
| 32 | + {mockContentList && mockContentList.length > 0 ? ( |
| 33 | + mockContentList.map((item, index) => ( |
| 34 | + <li |
| 35 | + key={index} |
| 36 | + className="flex flex-row items-center justify-between px-2 py-2 " |
| 37 | + > |
| 38 | + <div className="flex flex-row items-center"> |
| 39 | + <SquarePlay |
| 40 | + className="mr-4 h-5 w-5 text-white group-hover:text-white" |
| 41 | + aria-hidden="true" |
| 42 | + /> |
| 43 | + <p>{item.title}</p> |
| 44 | + </div> |
| 45 | + <CircleCheck |
| 46 | + className={ |
| 47 | + item.watched |
| 48 | + ? "mr-2 h-5 w-5 text-pink-600" |
| 49 | + : "mr-2 h-5 w-5 text-white" |
| 50 | + } |
| 51 | + aria-hidden="true" |
| 52 | + /> |
| 53 | + </li> |
| 54 | + )) |
| 55 | + ) : ( |
| 56 | + <li className="text-center text-gray-500"> |
| 57 | + No content available |
| 58 | + </li> |
| 59 | + )} |
| 60 | + </ul> |
| 61 | + </div> |
| 62 | + </div> |
| 63 | + <div className="flex-none"> |
| 64 | + <div>Video title</div> |
| 65 | + <div>descritpion</div> |
| 66 | + </div> |
| 67 | + </div> |
| 68 | + ); |
| 69 | +}; |
| 70 | + |
| 71 | +export default Content; |
0 commit comments