diff --git a/src/components/content/courses/CourseDetails.js b/src/components/content/courses/CourseDetails.js index 77117ab..47d7387 100644 --- a/src/components/content/courses/CourseDetails.js +++ b/src/components/content/courses/CourseDetails.js @@ -107,7 +107,7 @@ export default function CourseDetails({ processedEvent, paidCourse, lessons, dec return (
- router.push('/')} /> + router.push('/')} />
@@ -184,7 +184,7 @@ export default function CourseDetails({ processedEvent, paidCourse, lessons, dec )}
{ - processedEvent?.content && + processedEvent?.content && }
diff --git a/src/components/content/courses/CourseLesson.js b/src/components/content/courses/CourseLesson.js index 36da1d3..f6cfc3d 100644 --- a/src/components/content/courses/CourseLesson.js +++ b/src/components/content/courses/CourseLesson.js @@ -92,7 +92,7 @@ const CourseLesson = ({ lesson, course }) => {
{ - lesson?.content && + lesson?.content && }
diff --git a/src/components/content/courses/DraftCourseDetails.js b/src/components/content/courses/DraftCourseDetails.js index 86ed114..ca6af1c 100644 --- a/src/components/content/courses/DraftCourseDetails.js +++ b/src/components/content/courses/DraftCourseDetails.js @@ -413,7 +413,7 @@ export default function DraftCourseDetails({ processedEvent, draftId, lessons })
{ - processedEvent?.content && + processedEvent?.content && }
diff --git a/src/components/content/courses/DraftCourseLesson.js b/src/components/content/courses/DraftCourseLesson.js index d5afd02..2018145 100644 --- a/src/components/content/courses/DraftCourseLesson.js +++ b/src/components/content/courses/DraftCourseLesson.js @@ -116,7 +116,7 @@ const DraftCourseLesson = ({ lesson, course }) => {
{ - lesson?.content && + lesson?.content && }
diff --git a/src/components/content/resources/ResourceDetails.js b/src/components/content/resources/ResourceDetails.js index 1d6bab4..4d2b31d 100644 --- a/src/components/content/resources/ResourceDetails.js +++ b/src/components/content/resources/ResourceDetails.js @@ -28,7 +28,7 @@ const ResourceDetails = ({processedEvent, topics, title, summary, image, price, return (
- router.push('/')} /> + router.push('/')} />
diff --git a/src/components/feeds/MessageInput.js b/src/components/feeds/MessageInput.js index c159b11..cc84e84 100644 --- a/src/components/feeds/MessageInput.js +++ b/src/components/feeds/MessageInput.js @@ -34,6 +34,7 @@ const MessageInput = ({ collapsed, onToggle }) => {
diff --git a/src/components/forms/ResourceForm.js b/src/components/forms/ResourceForm.js index cb5b51a..ce9163b 100644 --- a/src/components/forms/ResourceForm.js +++ b/src/components/forms/ResourceForm.js @@ -1,6 +1,7 @@ import React, { useState, useEffect, useCallback } from "react"; import axios from "axios"; import { InputText } from "primereact/inputtext"; +import { InputTextarea } from "primereact/inputtextarea"; import { InputNumber } from "primereact/inputnumber"; import { InputSwitch } from "primereact/inputswitch"; import { Button } from "primereact/button"; @@ -20,6 +21,7 @@ import 'primeicons/primeicons.css'; import { Tooltip } from 'primereact/tooltip'; import 'primereact/resources/primereact.min.css'; +// todo make the summarry save in a formatted way so we can keep this spaces and line breaks const ResourceForm = ({ draft = null, isPublished = false }) => { const [title, setTitle] = useState(draft?.title || ''); const [summary, setSummary] = useState(draft?.summary || ''); @@ -221,7 +223,7 @@ const ResourceForm = ({ draft = null, isPublished = false }) => { setTitle(e.target.value)} placeholder="Title" />
- setSummary(e.target.value)} placeholder="Summary" /> + setSummary(e.target.value)} placeholder="Summary" />
setCoverImage(e.target.value)} placeholder="Cover Image URL" /> @@ -229,7 +231,7 @@ const ResourceForm = ({ draft = null, isPublished = false }) => {

Paid Resource

- setIsPaidResource(e.value)} /> + setIsPaidResource(e.value)} /> {isPaidResource && (
setPrice(e.value)} placeholder="Price (sats)" /> @@ -284,7 +286,7 @@ const ResourceForm = ({ draft = null, isPublished = false }) => {
-
); diff --git a/src/components/forms/course/CourseForm.js b/src/components/forms/course/CourseForm.js index 25ee373..fd13dd0 100644 --- a/src/components/forms/course/CourseForm.js +++ b/src/components/forms/course/CourseForm.js @@ -49,8 +49,22 @@ const CourseForm = ({ draft = null }) => { }, [draft, resources, workshops, drafts]); useEffect(() => { - if (!resourcesLoading && !workshopsLoading && !draftsLoading && resources && workshops && drafts) { - setAllContent([...resources, ...workshops, ...drafts]); + console.log('allContent', allContent); + }, [allContent]); + + useEffect(() => { + if (!resourcesLoading && !workshopsLoading && !draftsLoading) { + let combinedContent = []; + if (resources) { + combinedContent = [...combinedContent, ...resources]; + } + if (workshops) { + combinedContent = [...combinedContent, ...workshops]; + } + if (drafts) { + combinedContent = [...combinedContent, ...drafts]; + } + setAllContent(combinedContent); } }, [resources, workshops, drafts, resourcesLoading, workshopsLoading, draftsLoading]); diff --git a/src/components/forms/course/LessonSelector.js b/src/components/forms/course/LessonSelector.js index 6d5fe7b..42f0310 100644 --- a/src/components/forms/course/LessonSelector.js +++ b/src/components/forms/course/LessonSelector.js @@ -154,7 +154,7 @@ const LessonSelector = ({ isPaidCourse, lessons, setLessons, allContent, onNewRe handleContentSelect(e.value, index)} - placeholder="Select Existing Lesson" + placeholder={lesson.id ? lesson.title : "Create New Lesson"} optionLabel="label" optionGroupLabel="label" optionGroupChildren="items" diff --git a/src/hooks/nostr/useCourses.js b/src/hooks/nostr/useCourses.js index d0adc5f..18d7b81 100644 --- a/src/hooks/nostr/useCourses.js +++ b/src/hooks/nostr/useCourses.js @@ -8,8 +8,8 @@ export function useCourses() { const [isClient, setIsClient] = useState(false); const [courses, setCourses] = useState(); - const [isLoading, setIsLoading] = useState(false); - const [error, setError] = useState(null); + const [coursesLoading, setCoursesLoading] = useState(false); + const [coursesError, setCoursesError] = useState(null); const { contentIds } = useContentIdsQuery() const {ndk, addSigner} = useNDKContext(); @@ -24,12 +24,12 @@ export function useCourses() { }; const fetchCoursesFromNDK = async () => { - setIsLoading(true); - setError(null); + setCoursesLoading(true); + setCoursesError(null); try { if (!contentIds || contentIds.length === 0) { console.log('No content IDs found'); - setIsLoading(false); + setCoursesLoading(false); return []; // Return early if no content IDs are found } @@ -41,15 +41,15 @@ export function useCourses() { if (events && events.size > 0) { const eventsArray = Array.from(events); const courses = eventsArray.filter(event => hasRequiredProperties(event, contentIds)); - setIsLoading(false); + setCoursesLoading(false); return courses; } - setIsLoading(false); + setCoursesLoading(false); return []; } catch (error) { console.error('Error fetching courses from NDK:', error); - setError(error); - setIsLoading(false); + setCoursesError(error); + setCoursesLoading(false); return []; } }; @@ -64,5 +64,5 @@ export function useCourses() { } }, [isClient, contentIds]); - return { courses, isLoading, error }; + return { courses, coursesLoading, coursesError }; } \ No newline at end of file diff --git a/src/hooks/nostr/useResources.js b/src/hooks/nostr/useResources.js index bf28925..a4ee7db 100644 --- a/src/hooks/nostr/useResources.js +++ b/src/hooks/nostr/useResources.js @@ -8,8 +8,8 @@ export function useResources() { const [isClient, setIsClient] = useState(false); const [resources, setResources] = useState(); // Add new state variables for loading and error - const [isLoading, setIsLoading] = useState(false); - const [error, setError] = useState(null); + const [resourcesLoading, setResourcesLoading] = useState(false); + const [resourcesError, setResourcesError] = useState(null); const { contentIds } = useContentIdsQuery() const {ndk, addSigner} = useNDKContext(); @@ -25,12 +25,12 @@ export function useResources() { }; const fetchResourcesFromNDK = async () => { - setIsLoading(true); - setError(null); + setResourcesLoading(true); + setResourcesError(null); try { if (!contentIds || contentIds.length === 0) { console.log('No content IDs found'); - setIsLoading(false); + setResourcesLoading(false); return []; // Return early if no content IDs are found } @@ -42,15 +42,15 @@ export function useResources() { if (events && events.size > 0) { const eventsArray = Array.from(events); const resources = eventsArray.filter(event => hasRequiredProperties(event, contentIds)); - setIsLoading(false); + setResourcesLoading(false); return resources; } - setIsLoading(false); + setResourcesLoading(false); return []; } catch (error) { console.error('Error fetching resources from NDK:', error); - setError(error); - setIsLoading(false); + setResourcesError(error); + setResourcesLoading(false); return []; } }; @@ -65,5 +65,5 @@ export function useResources() { } }, [isClient, contentIds]); - return { resources, isLoading, error }; + return { resources, resourcesLoading, resourcesError }; } \ No newline at end of file diff --git a/src/hooks/nostr/useWorkshops.js b/src/hooks/nostr/useWorkshops.js index 63065bf..7c8fc38 100644 --- a/src/hooks/nostr/useWorkshops.js +++ b/src/hooks/nostr/useWorkshops.js @@ -8,8 +8,8 @@ export function useWorkshops() { const [isClient, setIsClient] = useState(false); const [workshops, setWorkshops] = useState(); // Add new state variables for loading and error - const [isLoading, setIsLoading] = useState(false); - const [error, setError] = useState(null); + const [workshopsLoading, setWorkshopsLoading] = useState(false); + const [workshopsError, setWorkshopsError] = useState(null); const { contentIds } = useContentIdsQuery() const {ndk, addSigner} = useNDKContext(); @@ -25,12 +25,12 @@ export function useWorkshops() { }; const fetchWorkshopsFromNDK = async () => { - setIsLoading(true); - setError(null); + setWorkshopsLoading(true); + setWorkshopsError(null); try { if (!contentIds || contentIds.length === 0) { console.log('No content IDs found'); - setIsLoading(false); + setWorkshopsLoading(false); return []; // Return early if no content IDs are found } @@ -42,15 +42,15 @@ export function useWorkshops() { if (events && events.size > 0) { const eventsArray = Array.from(events); const workshops = eventsArray.filter(event => hasRequiredProperties(event, contentIds)); - setIsLoading(false); + setWorkshopsLoading(false); return workshops; } - setIsLoading(false); + setWorkshopsLoading(false); return []; } catch (error) { console.error('Error fetching workshops from NDK:', error); - setError(error); - setIsLoading(false); + setWorkshopsError(error); + setWorkshopsLoading(false); return []; } }; @@ -65,5 +65,5 @@ export function useWorkshops() { } }, [isClient, contentIds]); - return { workshops, isLoading, error }; + return { workshops, workshopsLoading, workshopsError }; } \ No newline at end of file diff --git a/src/pages/auth/signin.js b/src/pages/auth/signin.js index 0a2e943..3190323 100644 --- a/src/pages/auth/signin.js +++ b/src/pages/auth/signin.js @@ -45,26 +45,26 @@ export default function SignIn() { } return ( -
+

Sign In