1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-08-29 12:10:22 +02:00

Improve back button logic

This commit is contained in:
Kamran Ahmed
2025-03-14 02:18:24 +00:00
parent 9532a8ad04
commit 143e27bbdd

View File

@@ -181,6 +181,8 @@ export function AICourseContent(props: AICourseContentProps) {
); );
} }
const isViewingLesson = viewMode === 'module';
return ( return (
<section className="flex h-screen flex-grow flex-col overflow-hidden bg-gray-50"> <section className="flex h-screen flex-grow flex-col overflow-hidden bg-gray-50">
{modals} {modals}
@@ -189,11 +191,17 @@ export function AICourseContent(props: AICourseContentProps) {
<div className="flex items-center justify-between px-4 py-2"> <div className="flex items-center justify-between px-4 py-2">
<a <a
href="/ai-tutor" href="/ai-tutor"
onClick={(e) => {
if (isViewingLesson) {
e.preventDefault();
setViewMode('full');
}
}}
className="flex flex-row items-center gap-1.5 text-sm font-medium text-gray-700 hover:text-gray-900" className="flex flex-row items-center gap-1.5 text-sm font-medium text-gray-700 hover:text-gray-900"
aria-label="Back to generator" aria-label="Back to generator"
> >
<ChevronLeft className="size-4" strokeWidth={2.5} /> <ChevronLeft className="size-4" strokeWidth={2.5} />
Back<span className="hidden lg:inline"> to AI Tutor</span> Back {isViewingLesson ? 'to Outline' : 'to AI Tutor'}
</a> </a>
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<div className="flex flex-row lg:hidden"> <div className="flex flex-row lg:hidden">