@@ -55,9 +55,16 @@ const NAV_LINKS = [
5555 path : `/ai-playground/${ t . id } ` ,
5656 } ) ) ,
5757 } ,
58- { label : "Live Classes" , icon : "📹" , path : "/live-classes" } ,
58+ {
59+ label : "Live Classes" ,
60+ icon : "📹" ,
61+ isLiveClass : true // ✅ IMPORTANT FLAG
62+ }
5963] ;
6064
65+
66+
67+
6168function Navbar ( { showBack } ) {
6269 const navigate = useNavigate ( ) ;
6370 const location = useLocation ( ) ;
@@ -169,21 +176,41 @@ function Navbar({ showBack }) {
169176 setThemeName ( next ) ;
170177 } ;
171178
172- const handleLogout = ( ) => {
173- logout ( ) ;
174- navigate ( "/signin" ) ;
175- } ;
179+ const goToLiveClass = async ( ) => {
180+ try {
181+ const res = await fetch ( "/api/live-classes/active" ) ;
182+ const data = await res . json ( ) ;
183+
184+ if ( data ?. id ) {
185+ navigate ( `/live-class/${ data . id } ` ) ;
186+ } else {
187+ alert ( "No live class available" ) ;
188+ }
189+ } catch ( err ) {
190+ console . error ( err ) ;
191+ alert ( "Error fetching live class" ) ;
192+ }
193+ } ;
194+
195+ const handleLogout = ( ) => {
196+ logout ( ) ;
197+ navigate ( "/signin" ) ;
198+ } ;
176199
177200 return (
178201 < nav
179202 data-theme = { themeName }
180203 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
181204 text-[var(--text)] transition-all duration-500 ease-out
182- ${
183- scrolled
184- ? "glass-heavy border-b border-[var(--border)]/60 shadow-[0_4px_30px_-8px_rgba(0,0,0,0.25)]"
185- : "bg-transparent border-b border-transparent"
186- } `}
205+ ${
206+ themeName === themeMap . dark
207+ ? scrolled
208+ ? "bg-[#0b0f1a]/80 backdrop-blur-xl border-b border-white/10 shadow-[0_8px_40px_rgba(0,0,0,0.6)]"
209+ : "bg-transparent"
210+ : scrolled
211+ ? "glass-heavy border-b border-[var(--border)]/60 shadow-[0_4px_30px_-8px_rgba(0,0,0,0.25)]"
212+ : "bg-transparent border-b border-transparent"
213+ } `}
187214 >
188215 { /* Left Section - Logo & Brand */ }
189216 < div className = "flex items-center gap-2 sm:gap-5 min-w-0 flex-1" >
@@ -257,13 +284,16 @@ function Navbar({ showBack }) {
257284 < button
258285 type = "button"
259286 onClick = { ( ) => {
260- if ( link . dropdown ) {
261- setNavDropdown ( isOpen ? null : link . label ) ;
262- } else {
263- navigate ( link . path ) ;
264- setNavDropdown ( null ) ;
265- }
266- } }
287+ if ( link . isLiveClass ) {
288+ goToLiveClass ( ) ;
289+ setNavDropdown ( null ) ;
290+ } else if ( link . dropdown ) {
291+ setNavDropdown ( isOpen ? null : link . label ) ;
292+ } else {
293+ navigate ( link . path ) ;
294+ setNavDropdown ( null ) ;
295+ }
296+ } }
267297 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
268298 ${
269299 active
@@ -412,10 +442,13 @@ function Navbar({ showBack }) {
412442 { /* Notifications Dropdown */ }
413443 { open && (
414444 < div
415- className = "absolute right-0 top-12 w-[360px] sm:w-96 rounded-2xl border border-[var(--border)]/60
416- glass-heavy shadow-[0_20px_60px_-12px_rgba(0,0,0,0.3)] overflow-hidden z-[200]
417- animate-[scale-in_0.3s_cubic-bezier(0.16,1,0.3,1)_both]
418- origin-top-right"
445+ className = { `absolute right-0 top-12 w-[360px] sm:w-96 rounded-2xl border overflow-hidden z-[200]
446+ animate-[scale-in_0.3s_cubic-bezier(0.16,1,0.3,1)_both] origin-top-right
447+ ${
448+ themeName === themeMap . dark
449+ ? "bg-[#0f172a]/90 backdrop-blur-xl border-white/10 shadow-[0_20px_60px_rgba(0,0,0,0.6)]"
450+ : "border-[var(--border)]/60 glass-heavy shadow-[0_20px_60px_-12px_rgba(0,0,0,0.3)]"
451+ } `}
419452 >
420453 < div
421454 className = "flex items-center justify-between px-5 py-4 border-b border-[var(--border)]/40
@@ -546,9 +579,13 @@ function Navbar({ showBack }) {
546579 key = { link . path }
547580 type = "button"
548581 onClick = { ( ) => {
549- navigate ( link . path ) ;
550- setMobileMenuOpen ( false ) ;
551- } }
582+ if ( link . isLiveClass ) {
583+ goToLiveClass ( ) ;
584+ } else {
585+ navigate ( link . path ) ;
586+ }
587+ setMobileMenuOpen ( false ) ;
588+ } }
552589 className = { `w-full text-left px-4 py-2.5 rounded-xl text-sm font-semibold flex items-center gap-2.5
553590 transition-all duration-300 active:scale-95 border-none cursor-pointer
554591 ${
@@ -607,4 +644,4 @@ function Navbar({ showBack }) {
607644 ) ;
608645}
609646
610- export default Navbar ;
647+ export default Navbar ;
0 commit comments