From 8a29ccf3d42e324c5eb19e35be4f5cf44e2bad09 Mon Sep 17 00:00:00 2001 From: zmeyer44 Date: Fri, 27 Oct 2023 17:48:49 -0400 Subject: [PATCH] changign routes --- app/(app)/_layout/BottomNav.tsx | 12 +-- app/(app)/_layout/Header.tsx | 2 +- app/(app)/_layout/Keystone.tsx | 4 +- app/(app)/_layout/Sidebar.tsx | 17 ++-- app/(app)/app/page.tsx | 37 -------- app/(app)/article/[key]/@30311/layout.tsx | 2 +- app/(app)/article/[key]/@event/layout.tsx | 2 +- app/(app)/article/[key]/layout.tsx | 10 +- .../_components/CalendarSection.tsx | 0 app/(app)/events/page.tsx | 70 ++++++++++++++ .../_components/NewEventButton.tsx | 0 .../_sections/BecomeACreator.tsx | 0 .../_sections/ExploreCreators.tsx | 0 .../_sections/FeaturedLists.tsx | 0 .../_sections/LiveStreaming.tsx | 0 .../_sections/LongFormContent.tsx | 0 .../_sections/UpcomingEvents.tsx | 0 app/(app)/explore/page.tsx | 95 ++++++------------- app/(landing)/_layout/Header.tsx | 10 +- app/(landing)/_page.tsx | 6 +- app/(landing)/page.tsx | 2 +- containers/Article/Editor.tsx | 2 +- containers/Article/index.tsx | 2 +- public/manifest.json | 2 +- public/manifest.webmanifest | 60 ++++++------ 25 files changed, 168 insertions(+), 167 deletions(-) delete mode 100644 app/(app)/app/page.tsx rename app/(app)/{explore => events}/_components/CalendarSection.tsx (100%) create mode 100644 app/(app)/events/page.tsx rename app/(app)/{app => explore}/_components/NewEventButton.tsx (100%) rename app/(app)/{app => explore}/_sections/BecomeACreator.tsx (100%) rename app/(app)/{app => explore}/_sections/ExploreCreators.tsx (100%) rename app/(app)/{app => explore}/_sections/FeaturedLists.tsx (100%) rename app/(app)/{app => explore}/_sections/LiveStreaming.tsx (100%) rename app/(app)/{app => explore}/_sections/LongFormContent.tsx (100%) rename app/(app)/{app => explore}/_sections/UpcomingEvents.tsx (100%) diff --git a/app/(app)/_layout/BottomNav.tsx b/app/(app)/_layout/BottomNav.tsx index b0403d7..528ccc0 100644 --- a/app/(app)/_layout/BottomNav.tsx +++ b/app/(app)/_layout/BottomNav.tsx @@ -1,7 +1,7 @@ "use client"; import Link from "next/link"; import { - RiHome6Fill, + RiCalendarEventFill, RiCompass3Fill, RiQuestionAnswerFill, } from "react-icons/ri"; @@ -11,16 +11,16 @@ import { usePathname } from "next/navigation"; export default function BottomNav() { const pathname = usePathname(); const navigationItems = [ - { - href: "/app", - name: "home", - icon: RiHome6Fill, - }, { href: "/explore", name: "explore", icon: RiCompass3Fill, }, + { + href: "/events", + name: "events", + icon: RiCalendarEventFill, + }, { href: "", name: "messages", diff --git a/app/(app)/_layout/Header.tsx b/app/(app)/_layout/Header.tsx index ff3dc25..00666cf 100644 --- a/app/(app)/_layout/Header.tsx +++ b/app/(app)/_layout/Header.tsx @@ -12,7 +12,7 @@ export default function Header() {
diff --git a/app/(app)/_layout/Keystone.tsx b/app/(app)/_layout/Keystone.tsx index 1cf41bb..7ed4c75 100644 --- a/app/(app)/_layout/Keystone.tsx +++ b/app/(app)/_layout/Keystone.tsx @@ -4,11 +4,11 @@ export default function Keystone() { return (
-
+
Flockstr
diff --git a/app/(app)/_layout/Sidebar.tsx b/app/(app)/_layout/Sidebar.tsx index d2e25db..b7c8f2f 100644 --- a/app/(app)/_layout/Sidebar.tsx +++ b/app/(app)/_layout/Sidebar.tsx @@ -8,6 +8,7 @@ import { RiQuestionAnswerLine, RiAddFill, RiSettings4Fill, + RiCalendarEventFill, RiSettings4Line, } from "react-icons/ri"; import { HiOutlineLightningBolt } from "react-icons/hi"; @@ -64,14 +65,6 @@ export default function Sidebar() { const pathname = usePathname(); const navigation: NavigationElement[] = [ - { - href: "/app", - name: "home", - label: "Home", - icon: RiHome6Fill, - type: "link", - active: true, - }, { href: "/explore", name: "explore", @@ -80,6 +73,14 @@ export default function Sidebar() { type: "link", active: true, }, + { + href: "/events", + name: "events", + label: "Events", + icon: RiCalendarEventFill, + type: "link", + active: true, + }, { href: "", name: "messages", diff --git a/app/(app)/app/page.tsx b/app/(app)/app/page.tsx deleted file mode 100644 index 970cbfe..0000000 --- a/app/(app)/app/page.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import dynamic from "next/dynamic"; -import ExploreCreators from "./_sections/ExploreCreators"; -import UpcomingEvents from "./_sections/UpcomingEvents"; -import LongFormContentSection from "./_sections/LongFormContent"; -import BecomeACreator from "./_sections/BecomeACreator"; - -const LiveStreamingSection = dynamic( - () => import("./_sections/LiveStreaming"), - { - ssr: false, - }, -); -const FeaturedListsSection = dynamic( - () => import("./_sections/FeaturedLists"), - { - ssr: false, - }, -); -const NewEventButton = dynamic(() => import("./_components/NewEventButton"), { - ssr: false, -}); - -export default function Page() { - return ( -
- - - - - - -
- -
-
- ); -} diff --git a/app/(app)/article/[key]/@30311/layout.tsx b/app/(app)/article/[key]/@30311/layout.tsx index 04a9f4a..206e719 100644 --- a/app/(app)/article/[key]/@30311/layout.tsx +++ b/app/(app)/article/[key]/@30311/layout.tsx @@ -37,7 +37,7 @@ export default function Layout(props: { if (sessionStorage.getItem("RichHistory")) { void router.back(); } else { - void router.push("/app"); + void router.push("/explore"); } }} size="icon" diff --git a/app/(app)/article/[key]/@event/layout.tsx b/app/(app)/article/[key]/@event/layout.tsx index 5bee456..54c7bad 100644 --- a/app/(app)/article/[key]/@event/layout.tsx +++ b/app/(app)/article/[key]/@event/layout.tsx @@ -37,7 +37,7 @@ export default function Layout(props: { if (sessionStorage.getItem("RichHistory")) { void router.back(); } else { - void router.push("/app"); + void router.push("/explore"); } }} size="icon" diff --git a/app/(app)/article/[key]/layout.tsx b/app/(app)/article/[key]/layout.tsx index 7e14f22..80ce656 100644 --- a/app/(app)/article/[key]/layout.tsx +++ b/app/(app)/article/[key]/layout.tsx @@ -17,31 +17,31 @@ export default function ModalLayout(props: { const kind = data.kind; if (kind === 30023) { return ( -
+
{props[30023]}
); } else if (kind === 30311) { return ( -
+
{props[30311]}
); } } else if (type === "note") { return ( -
+
{props[1]}
); } else if (type === "nevent") { return ( -
+
{props.event}
); } else if (type === "npub") { return redirect(`/${key}`); } - return redirect(`/app`); + return redirect(`/explore`); } diff --git a/app/(app)/explore/_components/CalendarSection.tsx b/app/(app)/events/_components/CalendarSection.tsx similarity index 100% rename from app/(app)/explore/_components/CalendarSection.tsx rename to app/(app)/events/_components/CalendarSection.tsx diff --git a/app/(app)/events/page.tsx b/app/(app)/events/page.tsx new file mode 100644 index 0000000..9e948cb --- /dev/null +++ b/app/(app)/events/page.tsx @@ -0,0 +1,70 @@ +"use client"; +import { NDKEvent, type NDKKind } from "@nostr-dev-kit/ndk"; +import CalendarSection, { + CalendarSectionLoading, +} from "./_components/CalendarSection"; +import useEvents from "@/lib/hooks/useEvents"; +import { getTagValues } from "@/lib/nostr/utils"; +import { fromUnix, daysOffset } from "@/lib/utils/dates"; +export default function Page() { + const { events, isLoading } = useEvents({ + filter: { + kinds: [31923 as NDKKind], + limit: 100, + }, + }); + const eventsByDay = groupEventsByDay(events); + + if (isLoading && !eventsByDay.length) { + return ( +
+
+ +
+
+ ); + } + + return ( +
+
+ {eventsByDay.map((e) => ( + + ))} +
+
+ ); +} + +function groupEventsByDay(events: NDKEvent[]) { + const eventDays: Record = {}; + for (const event of events) { + const eventStartTime = getTagValues("start", event.tags); + if (!eventStartTime) continue; + const startDate = fromUnix(parseInt(eventStartTime)); + const daysAway = daysOffset(startDate); + if (daysAway < 1) continue; + if (eventDays[`${daysAway}`]) { + eventDays[`${daysAway}`]!.push(event); + } else { + eventDays[`${daysAway}`] = [event]; + } + } + const groupedArray = Object.entries(eventDays) + .sort(([aKey], [bKey, test]) => { + console.log("test", test); + const aDay = parseInt(aKey); + + const bDay = parseInt(bKey); + if (aDay > bDay) { + return 1; + } else if (aDay < bDay) { + return -1; + } + return 0; + }) + .map(([_, events]) => events); + console.log("object", eventDays); + console.log("returing", groupedArray); + return groupedArray; +} diff --git a/app/(app)/app/_components/NewEventButton.tsx b/app/(app)/explore/_components/NewEventButton.tsx similarity index 100% rename from app/(app)/app/_components/NewEventButton.tsx rename to app/(app)/explore/_components/NewEventButton.tsx diff --git a/app/(app)/app/_sections/BecomeACreator.tsx b/app/(app)/explore/_sections/BecomeACreator.tsx similarity index 100% rename from app/(app)/app/_sections/BecomeACreator.tsx rename to app/(app)/explore/_sections/BecomeACreator.tsx diff --git a/app/(app)/app/_sections/ExploreCreators.tsx b/app/(app)/explore/_sections/ExploreCreators.tsx similarity index 100% rename from app/(app)/app/_sections/ExploreCreators.tsx rename to app/(app)/explore/_sections/ExploreCreators.tsx diff --git a/app/(app)/app/_sections/FeaturedLists.tsx b/app/(app)/explore/_sections/FeaturedLists.tsx similarity index 100% rename from app/(app)/app/_sections/FeaturedLists.tsx rename to app/(app)/explore/_sections/FeaturedLists.tsx diff --git a/app/(app)/app/_sections/LiveStreaming.tsx b/app/(app)/explore/_sections/LiveStreaming.tsx similarity index 100% rename from app/(app)/app/_sections/LiveStreaming.tsx rename to app/(app)/explore/_sections/LiveStreaming.tsx diff --git a/app/(app)/app/_sections/LongFormContent.tsx b/app/(app)/explore/_sections/LongFormContent.tsx similarity index 100% rename from app/(app)/app/_sections/LongFormContent.tsx rename to app/(app)/explore/_sections/LongFormContent.tsx diff --git a/app/(app)/app/_sections/UpcomingEvents.tsx b/app/(app)/explore/_sections/UpcomingEvents.tsx similarity index 100% rename from app/(app)/app/_sections/UpcomingEvents.tsx rename to app/(app)/explore/_sections/UpcomingEvents.tsx diff --git a/app/(app)/explore/page.tsx b/app/(app)/explore/page.tsx index 9e948cb..970cbfe 100644 --- a/app/(app)/explore/page.tsx +++ b/app/(app)/explore/page.tsx @@ -1,70 +1,37 @@ -"use client"; -import { NDKEvent, type NDKKind } from "@nostr-dev-kit/ndk"; -import CalendarSection, { - CalendarSectionLoading, -} from "./_components/CalendarSection"; -import useEvents from "@/lib/hooks/useEvents"; -import { getTagValues } from "@/lib/nostr/utils"; -import { fromUnix, daysOffset } from "@/lib/utils/dates"; +import dynamic from "next/dynamic"; +import ExploreCreators from "./_sections/ExploreCreators"; +import UpcomingEvents from "./_sections/UpcomingEvents"; +import LongFormContentSection from "./_sections/LongFormContent"; +import BecomeACreator from "./_sections/BecomeACreator"; + +const LiveStreamingSection = dynamic( + () => import("./_sections/LiveStreaming"), + { + ssr: false, + }, +); +const FeaturedListsSection = dynamic( + () => import("./_sections/FeaturedLists"), + { + ssr: false, + }, +); +const NewEventButton = dynamic(() => import("./_components/NewEventButton"), { + ssr: false, +}); + export default function Page() { - const { events, isLoading } = useEvents({ - filter: { - kinds: [31923 as NDKKind], - limit: 100, - }, - }); - const eventsByDay = groupEventsByDay(events); - - if (isLoading && !eventsByDay.length) { - return ( -
-
- -
-
- ); - } - return ( -
-
- {eventsByDay.map((e) => ( - - ))} +
+ + + + + + +
+
); } - -function groupEventsByDay(events: NDKEvent[]) { - const eventDays: Record = {}; - for (const event of events) { - const eventStartTime = getTagValues("start", event.tags); - if (!eventStartTime) continue; - const startDate = fromUnix(parseInt(eventStartTime)); - const daysAway = daysOffset(startDate); - if (daysAway < 1) continue; - if (eventDays[`${daysAway}`]) { - eventDays[`${daysAway}`]!.push(event); - } else { - eventDays[`${daysAway}`] = [event]; - } - } - const groupedArray = Object.entries(eventDays) - .sort(([aKey], [bKey, test]) => { - console.log("test", test); - const aDay = parseInt(aKey); - - const bDay = parseInt(bKey); - if (aDay > bDay) { - return 1; - } else if (aDay < bDay) { - return -1; - } - return 0; - }) - .map(([_, events]) => events); - console.log("object", eventDays); - console.log("returing", groupedArray); - return groupedArray; -} diff --git a/app/(landing)/_layout/Header.tsx b/app/(landing)/_layout/Header.tsx index 8abdef7..bc33236 100644 --- a/app/(landing)/_layout/Header.tsx +++ b/app/(landing)/_layout/Header.tsx @@ -7,10 +7,10 @@ import Logo from "@/assets/Logo"; export default function Header() { const [menuOpen, setMenuOpen] = useState(false); const navigation = [ - { name: "home", label: "Home", href: "/" }, - { name: "explore", label: "Explore", href: "/app" }, - { name: "about", label: "About", href: "/app" }, - { name: "contact", label: "Contact", href: "/app" }, + { name: "explore", label: "Explore", href: "/explore" }, + { name: "home", label: "Events", href: "/events" }, + { name: "about", label: "About", href: "/explore" }, + { name: "contact", label: "Contact", href: "/explore" }, ]; return (
-
    +
      {navigation.slice(0, 2).map((item) => (
    • diff --git a/app/(landing)/_page.tsx b/app/(landing)/_page.tsx index 8604f53..dd6dac7 100644 --- a/app/(landing)/_page.tsx +++ b/app/(landing)/_page.tsx @@ -17,7 +17,7 @@ export default function LandingPage() { again.

      - +
      @@ -27,7 +27,7 @@ export default function LandingPage() { About nostr -
      +

      Nostr is a simple, open protocol for decentralizing how infomration is stored and retreived on the web. @@ -141,7 +141,7 @@ export default function LandingPage() { Let's take a look.

      - + Explore Now diff --git a/app/(landing)/page.tsx b/app/(landing)/page.tsx index 811862f..0a2ee9a 100644 --- a/app/(landing)/page.tsx +++ b/app/(landing)/page.tsx @@ -64,7 +64,7 @@ export default function LandingPage() { your following, no-longer dependent on an external company.

      - + diff --git a/containers/Article/Editor.tsx b/containers/Article/Editor.tsx index 2f2bc5a..133b8fc 100644 --- a/containers/Article/Editor.tsx +++ b/containers/Article/Editor.tsx @@ -44,7 +44,7 @@ export default function EditorPage({ event }: ArticleProps) { if (sessionStorage.getItem("RichHistory")) { void router.back(); } else { - void router.push("/app"); + void router.push("/explore"); } }} size="icon" diff --git a/containers/Article/index.tsx b/containers/Article/index.tsx index 2f5f278..1e06af0 100644 --- a/containers/Article/index.tsx +++ b/containers/Article/index.tsx @@ -55,7 +55,7 @@ export default function ArticlePage({ event }: ArticleProps) { if (sessionStorage.getItem("RichHistory")) { void router.back(); } else { - void router.push("/app"); + void router.push("/explore"); } }} size="icon" diff --git a/public/manifest.json b/public/manifest.json index 5a94611..f313c49 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -3,7 +3,7 @@ "background_color": "#ffffff", "display": "standalone", "scope": "/", - "start_url": "/app", + "start_url": "/explore", "name": "Flockstr", "short_name": "Flockstr", "icons": [ diff --git a/public/manifest.webmanifest b/public/manifest.webmanifest index 8bb7c19..f313c49 100644 --- a/public/manifest.webmanifest +++ b/public/manifest.webmanifest @@ -1,31 +1,31 @@ { - "theme_color": "#ffffff", - "background_color": "#ffffff", - "display": "standalone", - "scope": "/", - "start_url": "/app", - "name": "Flockstr", - "short_name": "Flockstr", - "icons": [ - { - "src": "/icon-192x192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "/icon-256x256.png", - "sizes": "256x256", - "type": "image/png" - }, - { - "src": "/icon-384x384.png", - "sizes": "384x384", - "type": "image/png" - }, - { - "src": "/icon-512x512.png", - "sizes": "512x512", - "type": "image/png" - } - ] -} \ No newline at end of file + "theme_color": "#ffffff", + "background_color": "#ffffff", + "display": "standalone", + "scope": "/", + "start_url": "/explore", + "name": "Flockstr", + "short_name": "Flockstr", + "icons": [ + { + "src": "/icon-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/icon-256x256.png", + "sizes": "256x256", + "type": "image/png" + }, + { + "src": "/icon-384x384.png", + "sizes": "384x384", + "type": "image/png" + }, + { + "src": "/icon-512x512.png", + "sizes": "512x512", + "type": "image/png" + } + ] +}