From 365b54c498643a91c35c09b5d844ce22b087783e Mon Sep 17 00:00:00 2001 From: austinkelsay Date: Mon, 16 Sep 2024 16:10:28 -0500 Subject: [PATCH] Mobile style fixes --- src/components/BottomBar.js | 6 +++--- .../content/carousels/CoursesCarousel.js | 17 ++++++++++++++--- .../content/carousels/DocumentsCarousel.js | 16 ++++++++++++++-- .../carousels/InteractivePromotionalCarousel.js | 5 ++--- .../content/carousels/VideosCarousel.js | 15 ++++++++++++++- .../content/courses/CourseDetailsNew.js | 6 +++--- .../content/courses/DocumentLesson.js | 2 +- .../content/documents/DocumentDetails.js | 4 ++-- src/components/content/videos/VideoDetails.js | 6 +++--- src/components/feeds/MessageInput.js | 2 +- src/components/menutab/CommunityMenuTab.js | 2 +- src/components/profile/UserSettings.js | 2 +- src/context/NDKContext.js | 1 + src/pages/content/index.js | 2 +- src/pages/course/[slug]/index.js | 4 ++-- src/pages/feed.js | 6 +----- src/styles/globals.css | 1 + 17 files changed, 65 insertions(+), 32 deletions(-) diff --git a/src/components/BottomBar.js b/src/components/BottomBar.js index 16f3594..d77a0aa 100644 --- a/src/components/BottomBar.js +++ b/src/components/BottomBar.js @@ -11,13 +11,13 @@ const BottomBar = () => { return (
-
router.push('/')} className={`hover:bg-gray-700 cursor-pointer px-4 py-3 rounded-lg ${isActive('/') ? 'bg-gray-700' : ''}`}> +
router.push('/')} className={`hover:bg-gray-700 cursor-pointer px-4 py-2 rounded-lg ${isActive('/') ? 'bg-gray-700' : ''}`}>
-
router.push('/content?tag=all')} className={`hover:bg-gray-700 cursor-pointer px-4 py-3 rounded-lg ${isActive('/content') ? 'bg-gray-700' : ''}`}> +
router.push('/content?tag=all')} className={`hover:bg-gray-700 cursor-pointer px-4 py-2 rounded-lg ${isActive('/content') ? 'bg-gray-700' : ''}`}>
-
router.push('/feed?channel=global')} className={`hover:bg-gray-700 cursor-pointer px-4 py-3 rounded-lg ${isActive('/feed') ? 'bg-gray-700' : ''}`}> +
router.push('/feed?channel=global')} className={`hover:bg-gray-700 cursor-pointer px-4 py-2 rounded-lg ${isActive('/feed') ? 'bg-gray-700' : ''}`}>
diff --git a/src/components/content/carousels/CoursesCarousel.js b/src/components/content/carousels/CoursesCarousel.js index 68af421..3a551c7 100644 --- a/src/components/content/carousels/CoursesCarousel.js +++ b/src/components/content/carousels/CoursesCarousel.js @@ -1,11 +1,11 @@ import React, { useState, useEffect, use } from 'react'; import { Carousel } from 'primereact/carousel'; import { parseCourseEvent } from '@/utils/nostr'; -// import CourseTemplate from '@/components/content/carousels/templates/CourseTemplate'; import { CourseTemplate } from '@/components/content/carousels/templates/CourseTemplate'; import TemplateSkeleton from '@/components/content/carousels/skeletons/TemplateSkeleton'; import { useCourses } from '@/hooks/nostr/useCourses'; - +import useWindowWidth from '@/hooks/useWindowWidth'; +import { Divider } from 'primereact/divider'; const responsiveOptions = [ { breakpoint: '3000px', @@ -27,6 +27,8 @@ const responsiveOptions = [ export default function CoursesCarousel() { const [processedCourses, setProcessedCourses] = useState([]); const { courses, coursesLoading, coursesError } = useCourses() + const windowWidth = useWindowWidth(); + const isMobileView = windowWidth <= 450; useEffect(() => { const fetch = async () => { @@ -56,11 +58,20 @@ export default function CoursesCarousel() { return ( <> -

Courses

+

Courses

+
!processedCourses.length ? : diff --git a/src/components/content/carousels/DocumentsCarousel.js b/src/components/content/carousels/DocumentsCarousel.js index 3ca8f5f..6f57599 100644 --- a/src/components/content/carousels/DocumentsCarousel.js +++ b/src/components/content/carousels/DocumentsCarousel.js @@ -4,7 +4,8 @@ import { parseEvent } from '@/utils/nostr'; import { DocumentTemplate } from '@/components/content/carousels/templates/DocumentTemplate'; import TemplateSkeleton from '@/components/content/carousels/skeletons/TemplateSkeleton'; import { useDocuments } from '@/hooks/nostr/useDocuments'; - +import useWindowWidth from '@/hooks/useWindowWidth'; +import { Divider } from 'primereact/divider'; const responsiveOptions = [ { breakpoint: '3000px', @@ -26,6 +27,8 @@ const responsiveOptions = [ export default function DocumentsCarousel() { const [processedDocuments, setProcessedDocuments] = useState([]); const { documents, documentsLoading, documentsError } = useDocuments() + const windowWidth = useWindowWidth(); + const isMobileView = windowWidth <= 450; useEffect(() => { const fetch = async () => { @@ -53,10 +56,19 @@ export default function DocumentsCarousel() { return ( <> -

Documents

+

Documents

+ processedDocuments.length > 0 ? : diff --git a/src/components/content/carousels/InteractivePromotionalCarousel.js b/src/components/content/carousels/InteractivePromotionalCarousel.js index 6972647..131a591 100644 --- a/src/components/content/carousels/InteractivePromotionalCarousel.js +++ b/src/components/content/carousels/InteractivePromotionalCarousel.js @@ -87,11 +87,10 @@ const InteractivePromotionalCarousel = () => { switch (selectedPromotion.category) { case "PLEBDEVS": return ( - <> - 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 ( diff --git a/src/components/content/carousels/VideosCarousel.js b/src/components/content/carousels/VideosCarousel.js index 18b25e9..6f0b5e1 100644 --- a/src/components/content/carousels/VideosCarousel.js +++ b/src/components/content/carousels/VideosCarousel.js @@ -4,6 +4,8 @@ import { parseEvent } from '@/utils/nostr'; import {VideoTemplate} from '@/components/content/carousels/templates/VideoTemplate'; import TemplateSkeleton from '@/components/content/carousels/skeletons/TemplateSkeleton'; import { useVideos } from '@/hooks/nostr/useVideos'; +import useWindowWidth from '@/hooks/useWindowWidth'; +import { Divider } from 'primereact/divider'; const responsiveOptions = [ { @@ -26,6 +28,8 @@ const responsiveOptions = [ export default function VideosCarousel() { const [processedVideos, setProcessedVideos] = useState([]); const { videos, videosLoading, videosError } = useVideos(); + const windowWidth = useWindowWidth(); + const isMobileView = windowWidth <= 450; useEffect(() => { const fetch = async () => { @@ -51,10 +55,19 @@ export default function VideosCarousel() { return ( <> -

Videos

+

Videos

+ !processedVideos.length ? : diff --git a/src/components/content/courses/CourseDetailsNew.js b/src/components/content/courses/CourseDetailsNew.js index 52385ca..373de88 100644 --- a/src/components/content/courses/CourseDetailsNew.js +++ b/src/components/content/courses/CourseDetailsNew.js @@ -122,9 +122,9 @@ export default function CourseDetailsNew({ processedEvent, paidCourse, lessons, />
-
+
router.push('/')} /> -
+

{processedEvent.name}

@@ -135,7 +135,7 @@ export default function CourseDetailsNew({ processedEvent, paidCourse, lessons, )}
-

{processedEvent.description && ( +

{processedEvent.description && (

{processedEvent.description.split('\n').map((line, index) => (

{line}

diff --git a/src/components/content/courses/DocumentLesson.js b/src/components/content/courses/DocumentLesson.js index 4c5b3bd..12b62a4 100644 --- a/src/components/content/courses/DocumentLesson.js +++ b/src/components/content/courses/DocumentLesson.js @@ -79,7 +79,7 @@ const DocumentLesson = ({ lesson, course, decryptionPerformed, isPaid }) => {
-
+

{lesson.title}

diff --git a/src/components/content/documents/DocumentDetails.js b/src/components/content/documents/DocumentDetails.js index 544da0b..ffcbfaf 100644 --- a/src/components/content/documents/DocumentDetails.js +++ b/src/components/content/documents/DocumentDetails.js @@ -124,8 +124,8 @@ const DocumentDetails = ({ processedEvent, topics, title, summary, image, price, />
-
-
+
+

{title}

diff --git a/src/components/content/videos/VideoDetails.js b/src/components/content/videos/VideoDetails.js index f5ad52e..57e3117 100644 --- a/src/components/content/videos/VideoDetails.js +++ b/src/components/content/videos/VideoDetails.js @@ -110,7 +110,7 @@ const VideoDetails = ({ processedEvent, topics, title, summary, image, price, au ); } if (processedEvent?.content) { - return ; + return ; } return null; } @@ -118,7 +118,7 @@ const VideoDetails = ({ processedEvent, topics, title, summary, image, price, au return (
{renderContent()} -
+

{title}

@@ -131,7 +131,7 @@ const VideoDetails = ({ processedEvent, topics, title, summary, image, price, au

{summary && ( -

+
{summary.split('\n').map((line, index) => (

{line}

))} diff --git a/src/components/feeds/MessageInput.js b/src/components/feeds/MessageInput.js index 27af3bc..ac051dc 100644 --- a/src/components/feeds/MessageInput.js +++ b/src/components/feeds/MessageInput.js @@ -8,7 +8,7 @@ import { useToast } from '@/hooks/useToast'; const MessageInput = ({ onMessageSent }) => { const [message, setMessage] = useState(''); - const [collapsed, setCollapsed] = useState(false); + const [collapsed, setCollapsed] = useState(true); const { ndk, addSigner } = useNDKContext(); const { showToast } = useToast(); diff --git a/src/components/menutab/CommunityMenuTab.js b/src/components/menutab/CommunityMenuTab.js index acaf8c3..3d6eee6 100644 --- a/src/components/menutab/CommunityMenuTab.js +++ b/src/components/menutab/CommunityMenuTab.js @@ -56,7 +56,7 @@ const CommunityMenuTab = ({ selectedTopic, onTabChange }) => { activeIndex={allItems.indexOf(selectedTopic)} onTabChange={(e) => onTabChange(allItems[e.index])} pt={{ - menu: { className: 'bg-transparent border-none ml-2 my-4' }, + menu: { className: 'bg-transparent border-none ml-2 my-4 py-1' }, action: ({ context, parent }) => ({ className: 'cursor-pointer select-none flex items-center relative no-underline overflow-hidden border-b-2 p-2 font-bold rounded-t-lg', style: { top: '2px' } diff --git a/src/components/profile/UserSettings.js b/src/components/profile/UserSettings.js index 4a0fece..a8c1097 100644 --- a/src/components/profile/UserSettings.js +++ b/src/components/profile/UserSettings.js @@ -168,7 +168,7 @@ const UserSettings = () => { {nip19.npubEncode(user.pubkey)}
-

Connect Your Lightning Wallet

+

Connect Your Lightning Wallet

diff --git a/src/context/NDKContext.js b/src/context/NDKContext.js index ed94bcd..f2f2da2 100644 --- a/src/context/NDKContext.js +++ b/src/context/NDKContext.js @@ -15,6 +15,7 @@ export const defaultRelayUrls = [ "wss://nostr21.com/", "wss://nostrue.com/", "wss://purplerelay.com/", + // "wss://relay.devs.tools/" ]; export const NDKProvider = ({ children }) => { diff --git a/src/pages/content/index.js b/src/pages/content/index.js index 41eb4b2..4043098 100644 --- a/src/pages/content/index.js +++ b/src/pages/content/index.js @@ -53,7 +53,7 @@ const MenuTab = ({ items, selectedTopic, onTabChange }) => { activeIndex={allItems.indexOf(selectedTopic)} onTabChange={(e) => onTabChange(allItems[e.index])} pt={{ - menu: { className: 'bg-transparent border-none ml-2 my-4' }, + menu: { className: 'bg-transparent border-none ml-2 my-4 py-1' }, action: ({ context, parent }) => ({ className: 'cursor-pointer select-none flex items-center relative no-underline overflow-hidden border-b-2 p-2 font-bold rounded-t-lg', style: { top: '2px' } diff --git a/src/pages/course/[slug]/index.js b/src/pages/course/[slug]/index.js index 111ffa0..46f2b91 100644 --- a/src/pages/course/[slug]/index.js +++ b/src/pages/course/[slug]/index.js @@ -213,7 +213,7 @@ const Course = () => { {uniqueLessons.length > 0 && uniqueLessons.map((lesson, index) => ( { root: { className: 'border-none' }, header: { className: 'border-none' }, headerAction: { className: 'border-none' }, - content: { className: 'border-none' }, + content: { className: 'border-none max-mob:px-0 max-tab:px-0' }, accordiontab: { className: 'border-none' }, }} header={ diff --git a/src/pages/feed.js b/src/pages/feed.js index 8d4e135..5ef33a6 100644 --- a/src/pages/feed.js +++ b/src/pages/feed.js @@ -50,10 +50,6 @@ const Feed = () => { } }; - const handleMessageSent = () => { - setIsMessageInputCollapsed(true); - }; - return (
@@ -84,7 +80,7 @@ const Feed = () => {
diff --git a/src/styles/globals.css b/src/styles/globals.css index 2c8b504..7d2f8c8 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -11,6 +11,7 @@ body { @apply font-blinker; + background-color: #201c24; } h1 {