@@ -56,9 +56,16 @@ const NAV_LINKS = [
5656 path : `/ai-playground/${ t . id } ` ,
5757 } ) ) ,
5858 } ,
59- { label : "Live Classes" , icon : "📹" , path : "/live-classes" } ,
59+ {
60+ label : "Live Classes" ,
61+ icon : "📹" ,
62+ isLiveClass : true // ✅ IMPORTANT FLAG
63+ }
6064] ;
6165
66+
67+
68+
6269function Navbar ( { showBack } ) {
6370 const navigate = useNavigate ( ) ;
6471 const location = useLocation ( ) ;
@@ -172,21 +179,41 @@ function Navbar({ showBack }) {
172179 setThemeName ( next ) ;
173180 } ;
174181
175- const handleLogout = ( ) => {
176- logout ( ) ;
177- navigate ( "/signin" ) ;
178- } ;
182+ const goToLiveClass = async ( ) => {
183+ try {
184+ const res = await fetch ( "/api/live-classes/active" ) ;
185+ const data = await res . json ( ) ;
186+
187+ if ( data ?. id ) {
188+ navigate ( `/live-class/${ data . id } ` ) ;
189+ } else {
190+ alert ( "No live class available" ) ;
191+ }
192+ } catch ( err ) {
193+ console . error ( err ) ;
194+ alert ( "Error fetching live class" ) ;
195+ }
196+ } ;
197+
198+ const handleLogout = ( ) => {
199+ logout ( ) ;
200+ navigate ( "/signin" ) ;
201+ } ;
179202
180203 return (
181204 < nav
182205 data-theme = { themeName }
183206 className = { `sticky top-0 z-50 h-auto sm:h-16 px-4 sm:px-6 py-3 sm:py-0 flex items-center justify-between
184207 text-[var(--text)] transition-all duration-500 ease-out
185- ${
186- scrolled
187- ? "glass-heavy border-b border-[var(--border)]/60 shadow-[0_4px_30px_-8px_rgba(0,0,0,0.25)]"
188- : "bg-transparent border-b border-transparent"
189- } `}
208+ ${
209+ themeName === themeMap . dark
210+ ? scrolled
211+ ? "bg-[#0b0f1a]/80 backdrop-blur-xl border-b border-white/10 shadow-[0_8px_40px_rgba(0,0,0,0.6)]"
212+ : "bg-transparent"
213+ : scrolled
214+ ? "glass-heavy border-b border-[var(--border)]/60 shadow-[0_4px_30px_-8px_rgba(0,0,0,0.25)]"
215+ : "bg-transparent border-b border-transparent"
216+ } `}
190217 >
191218 { /* Left Section - Logo & Brand */ }
192219 < div className = "flex items-center gap-2 sm:gap-5 min-w-0 flex-1" >
@@ -260,13 +287,16 @@ function Navbar({ showBack }) {
260287 < button
261288 type = "button"
262289 onClick = { ( ) => {
263- if ( link . dropdown ) {
264- setNavDropdown ( isOpen ? null : link . label ) ;
265- } else {
266- navigate ( link . path ) ;
267- setNavDropdown ( null ) ;
268- }
269- } }
290+ if ( link . isLiveClass ) {
291+ goToLiveClass ( ) ;
292+ setNavDropdown ( null ) ;
293+ } else if ( link . dropdown ) {
294+ setNavDropdown ( isOpen ? null : link . label ) ;
295+ } else {
296+ navigate ( link . path ) ;
297+ setNavDropdown ( null ) ;
298+ }
299+ } }
270300 className = { `flex items-center gap-1.5 px-3 py-2 rounded-xl text-sm font-semibold transition-all duration-300 active:scale-95 border-none cursor-pointer
271301 ${
272302 active
@@ -415,10 +445,13 @@ function Navbar({ showBack }) {
415445 { /* Notifications Dropdown */ }
416446 { open && (
417447 < div
418- className = "absolute right-0 top-12 w-[360px] sm:w-96 rounded-2xl border border-[var(--border)]/60
419- glass-heavy shadow-[0_20px_60px_-12px_rgba(0,0,0,0.3)] overflow-hidden z-[200]
420- animate-[scale-in_0.3s_cubic-bezier(0.16,1,0.3,1)_both]
421- origin-top-right"
448+ className = { `absolute right-0 top-12 w-[360px] sm:w-96 rounded-2xl border overflow-hidden z-[200]
449+ animate-[scale-in_0.3s_cubic-bezier(0.16,1,0.3,1)_both] origin-top-right
450+ ${
451+ themeName === themeMap . dark
452+ ? "bg-[#0f172a]/90 backdrop-blur-xl border-white/10 shadow-[0_20px_60px_rgba(0,0,0,0.6)]"
453+ : "border-[var(--border)]/60 glass-heavy shadow-[0_20px_60px_-12px_rgba(0,0,0,0.3)]"
454+ } `}
422455 >
423456 < div
424457 className = "flex items-center justify-between px-5 py-4 border-b border-[var(--border)]/40
@@ -549,9 +582,13 @@ function Navbar({ showBack }) {
549582 key = { link . path }
550583 type = "button"
551584 onClick = { ( ) => {
552- navigate ( link . path ) ;
553- setMobileMenuOpen ( false ) ;
554- } }
585+ if ( link . isLiveClass ) {
586+ goToLiveClass ( ) ;
587+ } else {
588+ navigate ( link . path ) ;
589+ }
590+ setMobileMenuOpen ( false ) ;
591+ } }
555592 className = { `w-full text-left px-4 py-2.5 rounded-xl text-sm font-semibold flex items-center gap-2.5
556593 transition-all duration-300 active:scale-95 border-none cursor-pointer
557594 ${
@@ -610,4 +647,4 @@ function Navbar({ showBack }) {
610647 ) ;
611648}
612649
613- export default Navbar ;
650+ export default Navbar ;
0 commit comments