styling improvements on course header and course tab

This commit is contained in:
austinkelsay 2025-04-13 17:04:31 -05:00
parent a924cc9436
commit 0279140011
No known key found for this signature in database
GPG Key ID: 5A763922E5BA08EE
4 changed files with 29 additions and 47 deletions

View File

@ -202,7 +202,7 @@ export default function CourseDetails({
} }
return ( return (
<div className="w-full"> <div className="w-full bg-gray-800 p-4 rounded-lg">
<Toast ref={toastRef} /> <Toast ref={toastRef} />
<WelcomeModal /> <WelcomeModal />

View File

@ -1,14 +1,11 @@
import React from 'react'; import React from 'react';
import { Tag } from 'primereact/tag';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import GenericButton from '@/components/buttons/GenericButton'; import GenericButton from '@/components/buttons/GenericButton';
import Image from 'next/image';
import 'primeicons/primeicons.css'; import 'primeicons/primeicons.css';
const CourseHeader = ({ const CourseHeader = ({
course, course,
isMobileView, isMobileView,
isCompleted,
navbarHeight, navbarHeight,
isNavbarMode = false isNavbarMode = false
}) => { }) => {
@ -42,30 +39,16 @@ const CourseHeader = ({
e.stopPropagation(); e.stopPropagation();
router.push('/'); router.push('/');
}} }}
className="mr-2 pl-0 p-button-rounded p-button-text text-gray-300 hover:text-white" className="mr-2 p-button-rounded p-button-text text-gray-300 hover:text-white"
rounded={true} rounded={true}
text={true} text={true}
aria-label="Go back to home" aria-label="Go back to home"
/> />
{course.image && ( <div className="flex items-center pb-1">
<div className="relative h-8 w-8 mr-3 rounded-md overflow-hidden flex-shrink-0 border border-gray-700/50"> <h2 className={`text-white font-semibold truncate ${isMobileView ? 'text-base max-w-[160px]' : 'text-lg max-w-[300px]'}`}>
<img
src={course.image}
alt={course.name}
className="object-cover w-full h-full"
/>
</div>
)}
<div className="flex items-center">
<h1 className={`text-white font-semibold truncate ${isMobileView ? 'text-base max-w-[120px]' : 'text-lg max-w-[240px]'}`}>
{course.name} {course.name}
</h1> </h2>
{isCompleted && !isMobileView && (
<Tag severity="success" value="Completed" size="small" className="ml-2 py-0.5 text-xs" />
)}
</div> </div>
</div> </div>
); );
@ -74,10 +57,10 @@ const CourseHeader = ({
// Standard mode - for course page content // Standard mode - for course page content
return ( return (
<div <div
className="bg-transparent backdrop-blur-sm mb-0 p-3 px-4 sticky z-20 flex items-center justify-between" className="bg-transparent backdrop-blur-sm mb-0 p-3 px-4 sticky z-20 flex items-center"
style={{ top: `${navbarHeight}px` }} style={{ top: `${navbarHeight}px` }}
> >
<div className="flex items-center max-w-[80%]"> <div className="flex items-center max-w-[90%]">
<GenericButton <GenericButton
icon="pi pi-arrow-left" icon="pi pi-arrow-left"
onClick={handleBackNavigation} onClick={handleBackNavigation}
@ -88,23 +71,9 @@ const CourseHeader = ({
text={true} text={true}
aria-label="Go back" aria-label="Go back"
/> />
{!isMobileView && course.image && ( <h2 className={`font-medium text-gray-100 ${isMobileView ? 'text-sm' : 'text-base'} truncate`}>
<div className="relative w-8 h-8 mr-3 rounded-md overflow-hidden flex-shrink-0 border border-gray-700/50">
<img
src={course.image}
alt={course.name}
className="object-cover w-full h-full"
/>
</div>
)}
<h1 className={`font-medium text-gray-100 ${isMobileView ? 'text-sm' : 'text-base'} truncate`}>
{course.name} {course.name}
</h1> </h2>
</div>
<div className="flex items-center">
{isCompleted && (
<Tag severity="success" value="Completed" size="small" className="ml-2 py-1 text-xs" />
)}
</div> </div>
</div> </div>
); );

View File

@ -42,6 +42,7 @@ export default function MenuTab({ items, activeIndex, onTabChange, sidebarVisibl
tooltip={sidebarVisible ? "Hide lessons" : "Show lessons"} tooltip={sidebarVisible ? "Hide lessons" : "Show lessons"}
tooltipOptions={{ position: 'bottom' }} tooltipOptions={{ position: 'bottom' }}
aria-label="Toggle course lessons" aria-label="Toggle course lessons"
size="small"
/> />
</div> </div>
)} )}

View File

@ -388,13 +388,25 @@ const Course = () => {
// Render the QA section (empty for now) // Render the QA section (empty for now)
const renderQASection = () => { const renderQASection = () => {
return ( return (
<div className="rounded-lg border p-8 mt-4"> <div className="rounded-lg p-8 mt-4 bg-gray-800">
<h2 className="text-xl font-bold mb-4">Comments</h2> <h2 className="text-xl font-bold mb-4">Comments</h2>
<ZapThreadsWrapper {nAddress !== null ? (
anchor={course?.d} <ZapThreadsWrapper
user={session?.user?.pubkey ? nip19.npubEncode(session?.user?.pubkey) : null} anchor={nAddress}
relays="wss://nos.lol/, wss://relay.damus.io/, wss://relay.snort.social/, wss://relay.nostr.band/, wss://relay.primal.net/, wss://nostrue.com/, wss://purplerelay.com/, wss://relay.devs.tools/" user={session?.user?.pubkey ? nip19.npubEncode(session?.user?.pubkey) : null}
/> relays="wss://nos.lol/, wss://relay.damus.io/, wss://relay.snort.social/, wss://relay.nostr.band/, wss://relay.primal.net/, wss://nostrue.com/, wss://purplerelay.com/, wss://relay.devs.tools/"
disable="zaps"
/>
) : course?.d ? (
<ZapThreadsWrapper
anchor={course.d}
user={session?.user?.pubkey ? nip19.npubEncode(session?.user?.pubkey) : null}
relays="wss://nos.lol/, wss://relay.damus.io/, wss://relay.snort.social/, wss://relay.nostr.band/, wss://relay.primal.net/, wss://nostrue.com/, wss://purplerelay.com/, wss://relay.devs.tools/"
disable="zaps"
/>
) : (
<p>Loading comments...</p>
)}
</div> </div>
); );
}; };
@ -404,7 +416,7 @@ const Course = () => {
const isCompleted = completedLessons.length > 0; const isCompleted = completedLessons.length > 0;
return ( return (
<div className={`bg-gray-900 rounded-lg border border-gray-800 shadow-md ${isMobileView ? 'p-4' : 'p-6'}`}> <div className={`bg-gray-800 rounded-lg border border-gray-800 shadow-md ${isMobileView ? 'p-4' : 'p-6'}`}>
{isMobileView && course && ( {isMobileView && course && (
<div className="mb-2"> <div className="mb-2">
{/* Completed tag above image in mobile view */} {/* Completed tag above image in mobile view */}