mirror of
https://github.com/AustinKelsay/plebdevs.git
synced 2025-08-30 00:09:22 +00:00
Merge pull request #84 from AustinKelsay/bugfix/course-lessons-in-sidebar
enforce correct lesson order in course sidebar, improve styling and seperation of course sidebar
This commit is contained in:
commit
4a2e0ec022
@ -91,7 +91,7 @@ const CourseSidebar = ({
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<div className="overflow-y-auto flex-1 pr-2">
|
||||
<div className="flex-1 pr-2">
|
||||
<ul className="space-y-2">
|
||||
{lessons.map((lesson, index) => (
|
||||
<LessonItem key={index} lesson={lesson} index={index} />
|
||||
@ -128,16 +128,14 @@ const CourseSidebar = ({
|
||||
{!isMobileView && sidebarVisible && (
|
||||
<div className="relative flex flex-row-reverse z-[999]">
|
||||
<div
|
||||
className={`transition-all duration-500 ease-in-out flex w-80 opacity-100`}
|
||||
className={`transition-all duration-500 ease-in-out opacity-100`}
|
||||
>
|
||||
<div className="ml-2 w-80 h-[calc(100vh-400px)] sticky overflow-hidden rounded-lg border border-gray-800 shadow-md bg-gray-800"
|
||||
<div className="ml-2 w-80 sticky rounded-lg border border-gray-800 shadow-md bg-gray-800"
|
||||
style={{ top: `${navbarHeight + 70}px` }}> {/* Adjusted to match new header spacing */}
|
||||
<div className="h-full overflow-y-auto">
|
||||
<SidebarContent />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
@ -226,11 +226,10 @@ const Course = () => {
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Main content area with fixed width */}
|
||||
<div className="relative mt-4">
|
||||
<div className={`transition-all duration-500 ease-in-out ${isMobileView ? 'w-full' : 'w-full'}`}
|
||||
style={!isMobileView && sidebarVisible ? {paddingRight: '320px'} : {}}>
|
||||
|
||||
{/* Main content area with flex layout */}
|
||||
<div className={`relative mt-4 ${!isMobileView ? 'flex items-start gap-x-8' : ''}`}>
|
||||
{/* Main Content */}
|
||||
<div className="flex-1 min-w-0">
|
||||
{/* Overview tab content */}
|
||||
<div className={`${activeTab === 'overview' ? 'block' : 'hidden'}`}>
|
||||
<CourseOverview
|
||||
@ -279,56 +278,14 @@ const Course = () => {
|
||||
|
||||
{/* QA tab content */}
|
||||
<div className={`${activeTab === 'qa' ? 'block' : 'hidden'}`}>
|
||||
<CourseQA
|
||||
nAddress={nAddress}
|
||||
isAuthorized={isAuthorized}
|
||||
nsec={nsec}
|
||||
npub={npub}
|
||||
/>
|
||||
</div>
|
||||
<CourseQA nAddress={nAddress} isAuthorized={isAuthorized} nsec={nsec} npub={npub} />
|
||||
</div>
|
||||
|
||||
{/* Course Sidebar - positioned absolutely on desktop when visible */}
|
||||
{!isMobileView ? (
|
||||
<div
|
||||
className={`transition-all duration-500 ease-in-out ${
|
||||
sidebarVisible ? 'opacity-100 translate-x-0 shadow-2xl' : 'opacity-0 translate-x-full pointer-events-none'
|
||||
}`}
|
||||
style={{
|
||||
position: 'absolute',
|
||||
top: '0',
|
||||
right: '0',
|
||||
width: '320px',
|
||||
height: '100%',
|
||||
zIndex: 999,
|
||||
overflow: 'visible',
|
||||
transformOrigin: 'right center',
|
||||
transform: `translateX(${sidebarVisible ? '0' : '10px'}) scale(${sidebarVisible ? '1' : '0.97'})`,
|
||||
transition: 'transform 1000ms cubic-bezier(0.34, 1.56, 0.64, 1), opacity 300ms ease-in-out, box-shadow 1200ms ease'
|
||||
}}
|
||||
>
|
||||
{/* Mobile: Lessons are a tab */}
|
||||
{isMobileView && (
|
||||
<div className={`${activeTab === 'lessons' ? 'block' : 'hidden'}`}>
|
||||
<CourseSidebar
|
||||
lessons={uniqueLessons}
|
||||
activeIndex={activeIndex}
|
||||
onLessonSelect={handleLessonSelect}
|
||||
completedLessons={completedLessons}
|
||||
isMobileView={isMobileView}
|
||||
sidebarVisible={sidebarVisible}
|
||||
setSidebarVisible={setSidebarVisible}
|
||||
hideToggleButton={true}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<div className={`flex-shrink-0 transition-all duration-300 z-[999] ${
|
||||
(isMobileView && activeTab === 'lessons') ? 'ml-0 w-auto opacity-100 scale-100' :
|
||||
'w-0 ml-0 opacity-0 scale-95 overflow-hidden'
|
||||
}`}
|
||||
style={{
|
||||
transformOrigin: 'top center',
|
||||
transition: 'opacity 300ms ease, transform 400ms cubic-bezier(0.34, 1.56, 0.64, 1), width 300ms ease-in-out'
|
||||
}}>
|
||||
<CourseSidebar
|
||||
lessons={uniqueLessons}
|
||||
lessons={[...uniqueLessons].sort((a, b) => a.index - b.index)}
|
||||
activeIndex={activeIndex}
|
||||
onLessonSelect={handleLessonSelect}
|
||||
completedLessons={completedLessons}
|
||||
@ -344,6 +301,32 @@ const Course = () => {
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Desktop: Sidebar */}
|
||||
{!isMobileView && (
|
||||
<div
|
||||
className={`flex-shrink-0 transition-all duration-300 ease-in-out ${
|
||||
sidebarVisible ? 'w-80 opacity-100' : 'w-0 opacity-0'
|
||||
}`}
|
||||
style={{
|
||||
pointerEvents: sidebarVisible ? 'auto' : 'none',
|
||||
}}
|
||||
>
|
||||
{sidebarVisible && (
|
||||
<CourseSidebar
|
||||
lessons={[...uniqueLessons].sort((a, b) => a.index - b.index)}
|
||||
activeIndex={activeIndex}
|
||||
onLessonSelect={handleLessonSelect}
|
||||
completedLessons={completedLessons}
|
||||
isMobileView={isMobileView}
|
||||
sidebarVisible={sidebarVisible}
|
||||
setSidebarVisible={setSidebarVisible}
|
||||
hideToggleButton={true}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user