diff --git a/src/components/content/carousels/GenericCarousel.js b/src/components/content/carousels/GenericCarousel.js index 7de5303..383217e 100644 --- a/src/components/content/carousels/GenericCarousel.js +++ b/src/components/content/carousels/GenericCarousel.js @@ -20,7 +20,7 @@ const responsiveOptions = [ } ]; -export default function GenericCarousel({items, selectedTopic}) { +export default function GenericCarousel({items, selectedTopic, title}) { const [carousels, setCarousels] = useState([]); useEffect(() => { @@ -35,16 +35,9 @@ export default function GenericCarousel({items, selectedTopic}) { itemsPerCarousel = 1; } - const filteredItems = selectedTopic === 'All' - ? items - : items.filter(item => - item.topics && - (item.topics.includes(selectedTopic) || item.type === selectedTopic.toLowerCase()) - ); - const newCarousels = []; - for (let i = 0; i < filteredItems.length; i += itemsPerCarousel) { - newCarousels.push(filteredItems.slice(i, i + itemsPerCarousel)); + for (let i = 0; i < items.length; i += itemsPerCarousel) { + newCarousels.push(items.slice(i, i + itemsPerCarousel)); } setCarousels(newCarousels); }; @@ -55,7 +48,8 @@ export default function GenericCarousel({items, selectedTopic}) { return () => { window.removeEventListener('resize', handleResize); }; - }, [items, selectedTopic]); + }, [items]); + return ( <> {carousels.map((carouselItems, index) => ( diff --git a/src/components/forms/course/CourseForm.js b/src/components/forms/course/CourseForm.js index fd13dd0..fb26571 100644 --- a/src/components/forms/course/CourseForm.js +++ b/src/components/forms/course/CourseForm.js @@ -52,6 +52,10 @@ const CourseForm = ({ draft = null }) => { console.log('allContent', allContent); }, [allContent]); + useEffect(() => { + console.log('fasfsa', workshops) + }, [workshops]) + useEffect(() => { if (!resourcesLoading && !workshopsLoading && !draftsLoading) { let combinedContent = []; @@ -59,6 +63,7 @@ const CourseForm = ({ draft = null }) => { combinedContent = [...combinedContent, ...resources]; } if (workshops) { + console.log('workssdfsdfdsf', workshops) combinedContent = [...combinedContent, ...workshops]; } if (drafts) { diff --git a/src/components/forms/course/LessonSelector.js b/src/components/forms/course/LessonSelector.js index 685fdaa..ae4398d 100644 --- a/src/components/forms/course/LessonSelector.js +++ b/src/components/forms/course/LessonSelector.js @@ -45,6 +45,8 @@ const LessonSelector = ({ isPaidCourse, lessons, setLessons, allContent, onNewRe } }); + console.log('filtered content', filteredContent) + const draftResourceOptions = filteredContent.filter(content => content?.topics.includes('resource') && !content.kind).map(content => ({ label: content.title, value: content @@ -60,7 +62,7 @@ const LessonSelector = ({ isPaidCourse, lessons, setLessons, allContent, onNewRe value: content })); - const workshopOptions = filteredContent.filter(content => content?.topics.includes('workshop') && content.kind).map(content => ({ + const workshopOptions = filteredContent.filter(content => content?.type === "workshop" && content.kind).map(content => ({ label: content.title, value: content })); diff --git a/src/components/sidebar/Sidebar.js b/src/components/sidebar/Sidebar.js index ed9a5f1..5d695cc 100644 --- a/src/components/sidebar/Sidebar.js +++ b/src/components/sidebar/Sidebar.js @@ -10,26 +10,47 @@ const Sidebar = () => { // Helper function to determine if the path matches the current route const isActive = (path) => { - const pathWithQuery = router.pathname + router.asPath.split(router.pathname)[1]; - return pathWithQuery === path; + return router.asPath === path; }; const { data: session } = useSession(); + const header = (text) => { + return router.push('/content')}>{text} + }; + return ( -
Home
-Content
+Home
Courses
+Workshops
+Resources
+Create
+Create
Subscribe
+Subscribe
global
+global
nostr
+nostr
discord
+discord
stackernews
+stackernews
Settings
+Settings
{session ? 'Logout' : 'Login'}
+{session ? 'Logout' : 'Login'}
Logout
+Logout