diff --git a/src/components/ZapThreadsWrapper.js b/src/components/ZapThreadsWrapper.js index 9d78ce8..b7cb409 100644 --- a/src/components/ZapThreadsWrapper.js +++ b/src/components/ZapThreadsWrapper.js @@ -51,7 +51,7 @@ const ZapThreadsWrapper = ({ anchor, relays, disable }) => { }, [anchor, relays, disable]); // Render a
element and attach the zapRef to it - return
; + return
; }; export default ZapThreadsWrapper; \ No newline at end of file diff --git a/src/components/content/carousels/newTemplates/CourseTemplate.js b/src/components/content/carousels/newTemplates/CourseTemplate.js index 4b9c78a..770b356 100644 --- a/src/components/content/carousels/newTemplates/CourseTemplate.js +++ b/src/components/content/carousels/newTemplates/CourseTemplate.js @@ -11,6 +11,7 @@ import { useRouter } from "next/router"; import { formatTimestampToHowLongAgo } from "@/utils/time"; import { ProgressSpinner } from "primereact/progressspinner"; import GenericButton from "@/components/buttons/GenericButton"; +import { defaultRelayUrls } from "@/context/NDKContext"; export function CourseTemplate({ course }) { const { zaps, zapsLoading, zapsError } = useZapsSubscription({ event: course }); @@ -40,6 +41,7 @@ export function CourseTemplate({ course }) { pubkey: course.pubkey, kind: course.kind, identifier: course.id, + relayUrls: defaultRelayUrls }); setNAddress(nAddress); } diff --git a/src/components/content/carousels/newTemplates/DocumentTemplate.js b/src/components/content/carousels/newTemplates/DocumentTemplate.js index d1498a2..563c243 100644 --- a/src/components/content/carousels/newTemplates/DocumentTemplate.js +++ b/src/components/content/carousels/newTemplates/DocumentTemplate.js @@ -10,6 +10,7 @@ import { formatTimestampToHowLongAgo } from "@/utils/time"; import { nip19 } from "nostr-tools"; import { Tag } from "primereact/tag"; import GenericButton from "@/components/buttons/GenericButton"; +import { defaultRelayUrls } from "@/context/NDKContext"; export function DocumentTemplate({ document }) { const { zaps, zapsLoading, zapsError } = useZapsSubscription({ event: document }); @@ -24,6 +25,7 @@ export function DocumentTemplate({ document }) { pubkey: document.pubkey, kind: document.kind, identifier: document.id, + relayUrls: defaultRelayUrls }); setNAddress(nAddress); } diff --git a/src/components/content/carousels/newTemplates/VideoTemplate.js b/src/components/content/carousels/newTemplates/VideoTemplate.js index 830eea0..3e9a92a 100644 --- a/src/components/content/carousels/newTemplates/VideoTemplate.js +++ b/src/components/content/carousels/newTemplates/VideoTemplate.js @@ -11,6 +11,7 @@ import { nip19 } from "nostr-tools"; import { formatTimestampToHowLongAgo } from "@/utils/time"; import { Tag } from "primereact/tag"; import GenericButton from "@/components/buttons/GenericButton"; +import { defaultRelayUrls } from "@/context/NDKContext"; export function VideoTemplate({ video }) { const { zaps, zapsLoading, zapsError } = useZapsSubscription({ event: video }); @@ -23,7 +24,8 @@ export function VideoTemplate({ video }) { const addr = nip19.naddrEncode({ pubkey: video.pubkey, kind: video.kind, - identifier: video.id + identifier: video.id, + relayUrls: defaultRelayUrls }) setNAddress(addr); }, [video]); diff --git a/src/components/content/courses/CourseDetails.js b/src/components/content/courses/CourseDetails.js index 46f496d..6b8581b 100644 --- a/src/components/content/courses/CourseDetails.js +++ b/src/components/content/courses/CourseDetails.js @@ -16,6 +16,7 @@ import { findKind0Fields } from '@/utils/nostr'; import 'primeicons/primeicons.css'; import CoursePaymentButton from "@/components/bitcoinConnect/CoursePaymentButton"; import { ProgressSpinner } from 'primereact/progressspinner'; +import { defaultRelayUrls } from "@/context/NDKContext"; const MDDisplay = dynamic( () => import("@uiw/react-markdown-preview"), @@ -65,6 +66,7 @@ export default function CourseDetails({ processedEvent, paidCourse, lessons, dec pubkey: processedEvent.pubkey, kind: processedEvent.kind, identifier: processedEvent.d, + relayUrls: defaultRelayUrls }); setNAddress(naddr); } diff --git a/src/components/content/courses/CourseDetailsNew.js b/src/components/content/courses/CourseDetailsNew.js index e4b7285..b98246c 100644 --- a/src/components/content/courses/CourseDetailsNew.js +++ b/src/components/content/courses/CourseDetailsNew.js @@ -15,6 +15,7 @@ import { useSession } from 'next-auth/react'; import useWindowWidth from "@/hooks/useWindowWidth"; import { useNDKContext } from "@/context/NDKContext"; import { findKind0Fields } from '@/utils/nostr'; +import { defaultRelayUrls } from "@/context/NDKContext"; const lnAddress = process.env.NEXT_PUBLIC_LIGHTNING_ADDRESS; @@ -46,6 +47,7 @@ export default function CourseDetailsNew({ processedEvent, paidCourse, lessons, pubkey: processedEvent.pubkey, kind: processedEvent.kind, identifier: processedEvent.d, + relayUrls: defaultRelayUrls }); setNAddress(naddr); } @@ -157,14 +159,16 @@ export default function CourseDetailsNew({ processedEvent, paidCourse, lessons,
{renderPaymentMessage()} - {processedEvent?.pubkey === session?.user?.pubkey && ( + {processedEvent?.pubkey === session?.user?.pubkey ? (
router.push(`/details/${processedEvent.id}/edit`)} label="Edit" severity='warning' outlined /> + window.open(`https://nostr.band/${nAddress}`, '_blank')} tooltip="View Nostr Event" tooltipOptions={{ position: 'right' }} /> +
+ ) : ( +
+ window.open(`https://nostr.band/${nAddress}`, '_blank')} tooltip="View Nostr Event" tooltipOptions={{ position: paidCourse ? 'left' : 'right' }} />
- )} - {nAddress && ( - window.open(`https://nostr.band/${nAddress}`, '_blank')} tooltip="View Nostr Event" tooltipOptions={{ position: paidCourse ? 'left' : 'right' }} /> )}
diff --git a/src/components/content/courses/DocumentLesson.js b/src/components/content/courses/DocumentLesson.js index 99aaa07..7d8257d 100644 --- a/src/components/content/courses/DocumentLesson.js +++ b/src/components/content/courses/DocumentLesson.js @@ -9,6 +9,7 @@ import { nip19 } from "nostr-tools"; import { Divider } from "primereact/divider"; import { getTotalFromZaps } from "@/utils/lightning"; import dynamic from "next/dynamic"; +import { defaultRelayUrls } from "@/context/NDKContext"; const MDDisplay = dynamic( () => import("@uiw/react-markdown-preview"), @@ -35,6 +36,7 @@ const DocumentLesson = ({ lesson, course, decryptionPerformed, isPaid }) => { pubkey: lesson.pubkey, kind: lesson.kind, identifier: lesson.d, + relayUrls: defaultRelayUrls }) setNAddress(addr); } diff --git a/src/components/content/courses/DraftCourseDetails.js b/src/components/content/courses/DraftCourseDetails.js index 2f47920..fa6e570 100644 --- a/src/components/content/courses/DraftCourseDetails.js +++ b/src/components/content/courses/DraftCourseDetails.js @@ -15,6 +15,7 @@ import { findKind0Fields } from '@/utils/nostr'; import { useToast } from '@/hooks/useToast'; import { formatDateTime } from '@/utils/time'; import { validateEvent } from '@/utils/nostr'; +import { defaultRelayUrls } from "@/context/NDKContext"; import 'primeicons/primeicons.css'; const MDDisplay = dynamic( @@ -109,6 +110,7 @@ export default function DraftCourseDetails({ processedEvent, draftId, lessons }) pubkey: resource.pubkey, kind: resource.kind, identifier: dTag, + relayUrls: defaultRelayUrls }); const userResponse = await axios.get(`/api/users/${user.pubkey}`); diff --git a/src/components/content/courses/VideoLesson.js b/src/components/content/courses/VideoLesson.js index 006416b..e4e2619 100644 --- a/src/components/content/courses/VideoLesson.js +++ b/src/components/content/courses/VideoLesson.js @@ -9,6 +9,7 @@ import { nip19 } from "nostr-tools"; import { getTotalFromZaps } from "@/utils/lightning"; import dynamic from "next/dynamic"; import { Divider } from "primereact/divider"; +import { defaultRelayUrls } from "@/context/NDKContext"; const MDDisplay = dynamic( () => import("@uiw/react-markdown-preview"), @@ -34,6 +35,7 @@ const VideoLesson = ({ lesson, course, decryptionPerformed, isPaid }) => { pubkey: lesson.pubkey, kind: lesson.kind, identifier: lesson.d, + relayUrls: defaultRelayUrls }); setNAddress(addr); }, [lesson]); diff --git a/src/components/content/documents/DocumentDetails.js b/src/components/content/documents/DocumentDetails.js index 6343159..756b7e7 100644 --- a/src/components/content/documents/DocumentDetails.js +++ b/src/components/content/documents/DocumentDetails.js @@ -39,6 +39,10 @@ const DocumentDetails = ({ processedEvent, topics, title, summary, image, price, } }, [zaps, processedEvent]); + useEffect(() => { + console.log("authorView", authorView); + }, [authorView]); + const handleDelete = async () => { try { const response = await axios.delete(`/api/resources/${processedEvent.d}`); @@ -80,7 +84,9 @@ const DocumentDetails = ({ processedEvent, topics, title, summary, image, price, } if (paidResource && !decryptedContent) { return ( -
+
+ +
@@ -94,9 +100,10 @@ const DocumentDetails = ({ processedEvent, topics, title, summary, image, price, onSuccess={handlePaymentSuccess} onError={handlePaymentError} resourceId={processedEvent.d} - /> + />
+
); } if (processedEvent?.content) { @@ -151,30 +158,39 @@ const DocumentDetails = ({ processedEvent, topics, title, summary, image, price, zapsLoading={zapsLoading && zapAmount === 0} />
-
- { - window.open(`https://nostr.com/${nAddress}`, '_blank'); - }} - /> +
+ {renderPaymentMessage()} + {authorView ? ( +
+ router.push(`/details/${processedEvent.id}/edit`)} label="Edit" severity='warning' outlined /> + + { + window.open(`https://nostr.com/${nAddress}`, '_blank'); + }} + /> +
+ ) : ( +
+ { + window.open(`https://nostr.com/${nAddress}`, '_blank'); + }} + /> +
+ )}
{renderContent()} - -
- {renderPaymentMessage()} - {authorView && ( -
- router.push(`/details/${processedEvent.id}/edit`)} label="Edit" severity='warning' outlined /> - -
- )} -
) } diff --git a/src/components/content/videos/VideoDetails.js b/src/components/content/videos/VideoDetails.js index 364b407..5f8e4d2 100644 --- a/src/components/content/videos/VideoDetails.js +++ b/src/components/content/videos/VideoDetails.js @@ -81,7 +81,7 @@ const VideoDetails = ({ processedEvent, topics, title, summary, image, price, au if (paidResource && !decryptedContent) { return (
-
{renderContent()}
-
-
-

{title}

- {topics && topics.length > 0 && ( - topics.map((topic, index) => ( - - )) - ) - } -
-
-

{summary}

- +
+

{title}

+ {topics && topics.length > 0 && ( + topics.map((topic, index) => ( + + )) + ) + } +
+
+

{summary}

+ +
-
-
-
-
- avatar image +
+
+ avatar image -

- Created by{' '} - - {author?.username} - -

-
- { - window.open(`https://nostr.com/${nAddress}`, '_blank'); - }} - /> - {authorView && ( -
- router.push(`/details/${processedEvent.id}/edit`)} label="Edit" severity='warning' outlined /> - +

+ Created by{' '} + + {author?.username} + +

- )} -
-
- {renderPaymentMessage()} + {authorView ? ( +
+ router.push(`/details/${processedEvent.id}/edit`)} label="Edit" severity='warning' outlined /> + + window.open(`https://nostr.band/${nAddress}`, '_blank')} tooltip="View Nostr Event" tooltipOptions={{ position: 'right' }} /> +
+ ) : ( +
+ window.open(`https://nostr.band/${nAddress}`, '_blank')} tooltip="View Nostr Event" tooltipOptions={{ position: 'right' }} /> +
+ )} +
-
) } diff --git a/src/components/feeds/messages/CommunityMessage.js b/src/components/feeds/messages/CommunityMessage.js index a8fe645..7aee020 100644 --- a/src/components/feeds/messages/CommunityMessage.js +++ b/src/components/feeds/messages/CommunityMessage.js @@ -72,7 +72,7 @@ const CommunityMessage = ({ message, searchQuery, windowWidth, platform }) => { }
{ - session?.user?.pubkey && platform === 'nostr' ? ( + platform === 'nostr' ? ( headerTemplate({ onTogglerClick: () => setCollapsed(!collapsed) }, windowWidth, platform, message.id)} toggleable @@ -80,20 +80,21 @@ const CommunityMessage = ({ message, searchQuery, windowWidth, platform }) => { onToggle={(e) => setCollapsed(e.value)} className="w-full" > - - +
+ +
) : (
{platform !== "nostr" ? (

- {new Date(message.timestamp).toLocaleString()} -

+ {new Date(message.timestamp).toLocaleString()} +

) :
} 768 ? `View in ${platform}` : null} diff --git a/src/components/sidebar/Sidebar.js b/src/components/sidebar/Sidebar.js index e4e0e39..a99b649 100644 --- a/src/components/sidebar/Sidebar.js +++ b/src/components/sidebar/Sidebar.js @@ -99,7 +99,6 @@ const Sidebar = ({ course = false }) => {

Home

{lessons.map((lesson, index) => ( - console.log(lesson),
{ diff --git a/src/pages/details/[slug]/index.js b/src/pages/details/[slug]/index.js index 96be807..e06a193 100644 --- a/src/pages/details/[slug]/index.js +++ b/src/pages/details/[slug]/index.js @@ -9,6 +9,7 @@ import { useNDKContext } from '@/context/NDKContext'; import VideoDetails from '@/components/content/videos/VideoDetails'; import DocumentDetails from '@/components/content/documents/DocumentDetails'; import { ProgressSpinner } from 'primereact/progressspinner'; +import { defaultRelayUrls } from '@/context/NDKContext'; import 'primeicons/primeicons.css'; const privkey = process.env.NEXT_PUBLIC_APP_PRIV_KEY; @@ -170,6 +171,7 @@ export default function Details() { pubkey: processedEvent.pubkey, kind: processedEvent.kind, identifier: processedEvent.d, + relayUrls: defaultRelayUrls }); setNAddress(naddr); } diff --git a/src/pages/draft/[slug]/index.js b/src/pages/draft/[slug]/index.js index dd643bd..b7fab53 100644 --- a/src/pages/draft/[slug]/index.js +++ b/src/pages/draft/[slug]/index.js @@ -17,6 +17,7 @@ import useResponsiveImageDimensions from '@/hooks/useResponsiveImageDimensions'; import 'primeicons/primeicons.css'; import dynamic from 'next/dynamic'; import { validateEvent } from '@/utils/nostr'; +import { defaultRelayUrls } from '@/context/NDKContext'; const MDDisplay = dynamic( () => import("@uiw/react-markdown-preview"), @@ -120,6 +121,7 @@ export default function Draft() { pubkey: resource.pubkey, kind: resource.kind, identifier: dTag, + relayUrls: defaultRelayUrls }); const userResponse = await axios.get(`/api/users/${user.pubkey}`);