22
33import { useState } from "react" ;
44import { usePathname } from "next/navigation" ;
5- import { Video , X , Youtube , Play , WifiOff , AlertCircle , Loader2 } from "lucide-react" ;
5+ import {
6+ Video ,
7+ X ,
8+ Youtube ,
9+ Play ,
10+ WifiOff ,
11+ AlertCircle ,
12+ Loader2 ,
13+ } from "lucide-react" ;
614import { videoLibrary } from "@/app/_data/videoLibrary" ;
715import { useEffect } from "react" ;
816
@@ -42,7 +50,7 @@ const VideoAcademy = () => {
4250 await fetch ( "https://www.youtube.com/favicon.ico" , {
4351 mode : "no-cors" ,
4452 signal : controller . signal ,
45- cache : ' no-store'
53+ cache : " no-store" ,
4654 } ) ;
4755
4856 clearTimeout ( timeoutId ) ;
@@ -66,7 +74,9 @@ const VideoAcademy = () => {
6674 } ;
6775
6876 const currentCategory = getCategory ( ) ;
69- const videoData = currentCategory ? videoLibrary [ currentCategory ] : videoLibrary . common ;
77+ const videoData = currentCategory
78+ ? videoLibrary [ currentCategory ]
79+ : videoLibrary . common ;
7080
7181 return (
7282 < >
@@ -77,7 +87,10 @@ const VideoAcademy = () => {
7787 id = "video-academy-button"
7888 >
7989 { isChecking ? (
80- < Loader2 size = { 18 } className = "animate-spin text-yellow-400" />
90+ < Loader2
91+ size = { 18 }
92+ className = "animate-spin text-yellow-400"
93+ />
8194 ) : (
8295 < Video size = { 18 } />
8396 ) }
@@ -87,13 +100,13 @@ const VideoAcademy = () => {
87100 </ button >
88101
89102 { isOpen && (
90- < div
103+ < div
91104 className = "fixed inset-0 bg-black/60 backdrop-blur-md z-[60] transition-opacity duration-300"
92105 onClick = { ( ) => setIsOpen ( false ) }
93106 />
94107 ) }
95108
96- < div
109+ < div
97110 className = { `fixed top-0 right-0 h-full w-full sm:w-[450px] bg-white z-[70] shadow-2xl transform transition-transform duration-500 ease-in-out flex flex-col ${ isOpen ? "translate-x-0" : "translate-x-full" } ` }
98111 >
99112 < div className = "p-6 border-b flex items-center justify-between bg-black text-white" >
@@ -102,10 +115,11 @@ const VideoAcademy = () => {
102115 < Video size = { 22 } fill = "currentColor" />
103116 </ div >
104117 < h2 className = "text-xl font-bold font-[family-name:var(--font-geist-mono)] tracking-tight text-white" >
105- < span className = "text-yellow-400" > EVOLVE</ span > Academy
118+ < span className = "text-yellow-400" > EVOLVE</ span > { " " }
119+ Academy
106120 </ h2 >
107121 </ div >
108- < button
122+ < button
109123 onClick = { ( ) => setIsOpen ( false ) }
110124 className = "p-2 hover:bg-white/10 rounded-full transition-colors"
111125 >
@@ -114,27 +128,33 @@ const VideoAcademy = () => {
114128 </ div >
115129
116130 < div className = "flex-1 overflow-y-auto p-6 font-[family-name:var(--font-geist-sans)]" >
117-
118131 < div className = "mb-8" >
119132 < h3 className = "font-bold mb-4 flex items-center gap-2 text-gray-800 uppercase tracking-widest text-xs" >
120133 < span className = "w-1.5 h-1.5 bg-yellow-400 rounded-full" > </ span >
121134 Recommended Intro
122135 </ h3 >
123-
124136
125137 < div className = "rounded-xl overflow-hidden shadow-xl border border-gray-200 bg-black" >
126138 { ! isOnline || connectionError ? (
127139 < div className = "aspect-video w-full bg-gray-900 flex flex-col items-center justify-center p-6 text-center" >
128- < WifiOff size = { 48 } className = "text-gray-600 mb-4" />
129- < h4 className = "text-white font-bold mb-2" > No Internet Access</ h4 >
140+ < WifiOff
141+ size = { 48 }
142+ className = "text-gray-600 mb-4"
143+ />
144+ < h4 className = "text-white font-bold mb-2" >
145+ No Internet Access
146+ </ h4 >
130147 < p className = "text-gray-400 text-xs" >
131- Video tutorials require an active internet connection to load from YouTube.
148+ Video tutorials require an active
149+ internet connection to load from
150+ YouTube.
132151 </ p >
133- < button
152+ < button
134153 onClick = { verifyConnectivity }
135154 className = "mt-4 text-yellow-400 text-xs font-bold hover:underline flex items-center gap-1"
136155 >
137- < AlertCircle size = { 14 } /> Retry connection
156+ < AlertCircle size = { 14 } /> Retry
157+ connection
138158 </ button >
139159 </ div >
140160 ) : (
@@ -150,31 +170,47 @@ const VideoAcademy = () => {
150170 </ div >
151171 ) }
152172 < div className = "p-4 bg-white" >
153- < h4 className = "font-bold text-gray-900 text-sm mb-1" > { videoData . featured . title } </ h4 >
154- < p className = "text-xs text-gray-500 mb-2" > { videoData . featured . channel } </ p >
155- < p className = "text-xs text-gray-600 leading-relaxed" > { videoData . featured . description } </ p >
173+ < h4 className = "font-bold text-gray-900 text-sm mb-1" >
174+ { videoData . featured . title }
175+ </ h4 >
176+ < p className = "text-xs text-gray-500 mb-2" >
177+ { videoData . featured . channel }
178+ </ p >
179+ < p className = "text-xs text-gray-600 leading-relaxed" >
180+ { videoData . featured . description }
181+ </ p >
156182 </ div >
157183 </ div >
158184 </ div >
159185
160186 < div className = "mb-8" >
161- { ( ! isOnline || connectionError ) ? (
187+ { ! isOnline || connectionError ? (
162188 < div className = "p-6 bg-red-50 rounded-xl border border-red-100 text-center" >
163189 < div className = "flex justify-center mb-3" >
164- < AlertCircle className = "text-red-500" size = { 24 } />
190+ < AlertCircle
191+ className = "text-red-500"
192+ size = { 24 }
193+ />
165194 </ div >
166- < h4 className = "font-bold text-gray-900 mb-2" > Offline Mode</ h4 >
195+ < h4 className = "font-bold text-gray-900 mb-2" >
196+ Offline Mode
197+ </ h4 >
167198 < p className = "text-sm text-gray-600" >
168- It seems you're offline or YouTube is unreachable. Please check your connection to explore more tutorials.
199+ It seems you're offline or YouTube is
200+ unreachable. Please check your connection to
201+ explore more tutorials.
169202 </ p >
170203 </ div >
171204 ) : (
172205 < div className = "p-6 bg-gray-50 rounded-xl border border-gray-200 text-center" >
173- < h4 className = "font-bold text-gray-900 mb-2" > Want to learn more?</ h4 >
206+ < h4 className = "font-bold text-gray-900 mb-2" >
207+ Want to learn more?
208+ </ h4 >
174209 < p className = "text-sm text-gray-600 mb-4" >
175- Explore more tutorials and advanced concepts on YouTube.
210+ Explore more tutorials and advanced concepts
211+ on YouTube.
176212 </ p >
177- < a
213+ < a
178214 href = { `https://www.youtube.com/results?search_query=${ encodeURIComponent ( videoData . searchQuery ) } ` }
179215 target = "_blank"
180216 rel = "noopener noreferrer"
@@ -186,7 +222,6 @@ const VideoAcademy = () => {
186222 </ div >
187223 ) }
188224 </ div >
189-
190225 </ div >
191226 </ div >
192227 </ >
0 commit comments