diff --git a/src/components/content/carousels/CoursesCarousel.js b/src/components/content/carousels/CoursesCarousel.js index 4da7ce9..4ff6269 100644 --- a/src/components/content/carousels/CoursesCarousel.js +++ b/src/components/content/carousels/CoursesCarousel.js @@ -33,8 +33,13 @@ export default function CoursesCarousel() { try { if (courses && courses.length > 0) { const processedCourses = courses.map(course => parseCourseEvent(course)); + + // Sort courses by created_at in descending order (most recent first) + const sortedCourses = processedCourses.sort((a, b) => b.created_at - a.created_at); - setProcessedCourses(processedCourses); + console.log("Sorted courses:", sortedCourses); + + setProcessedCourses(sortedCourses); } else { console.log('No courses fetched or empty array returned'); } diff --git a/src/components/content/carousels/InteractivePromotionalCarousel.js b/src/components/content/carousels/InteractivePromotionalCarousel.js index 584edb1..bfb8420 100644 --- a/src/components/content/carousels/InteractivePromotionalCarousel.js +++ b/src/components/content/carousels/InteractivePromotionalCarousel.js @@ -65,7 +65,7 @@ const InteractivePromotionalCarousel = () => { const router = useRouter(); return ( -
+
{ {selectedPromotion.title}

{selectedPromotion.description}

-
+
{ (() => { switch (selectedPromotion.category) { case "PLEBDEVS": return ( <> - router.push('/about')} severity="success" icon={} label="Learn More" className="py-2 font-semibold" size="small" outlined /> - router.push('/subscribe')} severity="warning" icon={} label="Subscribe" className="py-2 font-semibold" size="small" outlined /> - router.push('/content?tag=all')} severity="primary" icon={} label="View all content" className="py-2 font-semibold" size="small" outlined /> + router.push('/about')} severity="success" icon={} label="Learn More" className="w-fit py-2 font-semibold" size="small" outlined /> + router.push('/subscribe')} severity="warning" icon={} label="Subscribe" className="w-fit py-2 font-semibold" size="small" outlined /> + router.push('/content?tag=all')} severity="primary" icon={} label="View all content" className="w-fit py-2 font-semibold" size="small" outlined /> ); case "COURSES": return ( - router.push('/content?tag=courses')} icon={} label="View All Courses" className="py-2 font-semibold" size="small" outlined /> + router.push('/content?tag=courses')} icon={} label="View All Courses" className="w-fit py-2 font-semibold" size="small" outlined /> ); case "WORKSHOPS": return ( - router.push('/content?tag=workshops')} icon={} label="View All Workshops" className="py-2 font-semibold" size="small" outlined /> + router.push('/content?tag=workshops')} icon={} label="View All Workshops" className="w-fit py-2 font-semibold" size="small" outlined /> ); case "RESOURCES": return ( - router.push('/content?tag=resources')} icon={} label="View All Resources" className="py-2 font-semibold" size="small" outlined /> + router.push('/content?tag=resources')} icon={} label="View All Resources" className="w-fit py-2 font-semibold" size="small" outlined /> ); case "COMMUNITY": return ( - router.push('/feed?channel=global')} icon={} label="Open Community Feed" className="py-2 font-semibold" size="small" outlined /> + router.push('/feed?channel=global')} icon={} label="Open Community Feed" className="w-fit py-2 font-semibold" size="small" outlined /> ); case "LIGHTNING / NOSTR": return ( - router.push('/subscribe')} severity="warning" icon={} label="Subscribe" className="py-2 font-semibold" size="small" outlined /> + router.push('/subscribe')} severity="warning" icon={} label="Subscribe" className="w-fit py-2 font-semibold" size="small" outlined /> ); default: return null; diff --git a/src/components/content/carousels/ResourcesCarousel.js b/src/components/content/carousels/ResourcesCarousel.js index 5e9beff..40e7bf4 100644 --- a/src/components/content/carousels/ResourcesCarousel.js +++ b/src/components/content/carousels/ResourcesCarousel.js @@ -33,8 +33,15 @@ export default function ResourcesCarousel() { try { if (resources && resources.length > 0) { const processedResources = resources.map(resource => parseEvent(resource)); + + // Sort resources by created_at in descending order (most recent first) + const sortedResources = processedResources.sort((a, b) => b.created_at - a.created_at); - setProcessedResources(processedResources); + console.log("Sorted resources:", sortedResources); + + setProcessedResources(sortedResources); + } else { + console.log('No resources fetched or empty array returned'); } } catch (error) { console.error('Error fetching resources:', error); diff --git a/src/components/content/carousels/WorkshopsCarousel.js b/src/components/content/carousels/WorkshopsCarousel.js index 23d4f44..91193c8 100644 --- a/src/components/content/carousels/WorkshopsCarousel.js +++ b/src/components/content/carousels/WorkshopsCarousel.js @@ -32,10 +32,13 @@ export default function WorkshopsCarousel() { const fetch = async () => { try { if (workshops && workshops.length > 0) { - console.log('workshops', workshops); const processedWorkshops = workshops.map(workshop => parseEvent(workshop)); - console.log('processedWorkshops', processedWorkshops); - setProcessedWorkshops(processedWorkshops); + + // Sort workshops by created_at in descending order (most recent first) + const sortedWorkshops = processedWorkshops.sort((a, b) => b.created_at - a.created_at); + + console.log('Sorted workshops:', sortedWorkshops); + setProcessedWorkshops(sortedWorkshops); } else { console.log('No workshops fetched or empty array returned'); } diff --git a/src/components/profile/UserProfile.js b/src/components/profile/UserProfile.js index 3e11c9a..6ad083a 100644 --- a/src/components/profile/UserProfile.js +++ b/src/components/profile/UserProfile.js @@ -8,9 +8,12 @@ import { ProgressSpinner } from "primereact/progressspinner"; import PurchasedListItem from "@/components/profile/PurchasedListItem"; import { useNDKContext } from "@/context/NDKContext"; import { formatDateTime } from "@/utils/time"; +import { Tooltip } from "primereact/tooltip"; +import { nip19 } from "nostr-tools"; import Image from "next/image"; import SubscribeModal from "@/components/profile/subscription/SubscribeModal"; import useWindowWidth from "@/hooks/useWindowWidth"; +import { useToast } from "@/hooks/useToast"; const UserProfile = () => { const windowWidth = useWindowWidth(); @@ -18,6 +21,7 @@ const UserProfile = () => { const { data: session } = useSession(); const { returnImageProxy } = useImageProxy(); const { ndk, addSigner } = useNDKContext(); + const { showToast } = useToast(); const menu = useRef(null); useEffect(() => { @@ -31,14 +35,14 @@ const UserProfile = () => { label: "Edit", icon: "pi pi-pencil", command: () => { - // Add your edit functionality here + showToast("warn", "Alert", "This feature is not yet implemented"); }, }, { label: "Delete", icon: "pi pi-trash", command: () => { - // Add your delete functionality here + showToast("warn", "Alert", "This feature is not yet implemented"); }, }, ]; @@ -77,7 +81,8 @@ const UserProfile = () => { {user.username || user?.email || "Anon"}

- {user.pubkey} + + {nip19.npubEncode(user.pubkey)}

{user && ( diff --git a/src/components/profile/UserSettings.js b/src/components/profile/UserSettings.js index 3facaaa..4a0fece 100644 --- a/src/components/profile/UserSettings.js +++ b/src/components/profile/UserSettings.js @@ -10,7 +10,9 @@ import useWindowWidth from "@/hooks/useWindowWidth"; import Image from "next/image"; import BitcoinConnectButton from "@/components/bitcoinConnect/BitcoinConnect"; import { Panel } from "primereact/panel"; +import { nip19 } from "nostr-tools"; import { InputText } from "primereact/inputtext"; +import { Tooltip } from "primereact/tooltip"; import { useToast } from "@/hooks/useToast"; const UserSettings = () => { @@ -162,7 +164,8 @@ const UserSettings = () => { {user.username || user?.email || "Anon"}

- {user.pubkey} + + {nip19.npubEncode(user.pubkey)}

Connect Your Lightning Wallet