From b15f9bc1a8304d2c8bfbc780c233e735a156c725 Mon Sep 17 00:00:00 2001 From: hzrd149 Date: Thu, 1 Feb 2024 12:04:44 +0000 Subject: [PATCH] move mailbox relays to relays view --- src/app.tsx | 10 ++---- src/components/layout/nav-items.tsx | 10 ------ src/views/relays/index.tsx | 22 +++++++++---- src/views/{ => relays}/mailboxes/index.tsx | 38 ++++++++++++---------- src/views/settings/index.tsx | 2 +- 5 files changed, 40 insertions(+), 42 deletions(-) rename src/views/{ => relays}/mailboxes/index.tsx (77%) diff --git a/src/app.tsx b/src/app.tsx index 368bc3ca5..a57980899 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -68,8 +68,6 @@ import CommunityTrendingView from "./views/community/views/trending"; import RelaysView from "./views/relays"; import RelayView from "./views/relays/relay"; -import RelayReviewsView from "./views/relays/reviews"; -import PopularRelaysView from "./views/relays/popular"; import BrowseRelaySetsView from "./views/relays/browse-sets"; import UserDMsTab from "./views/user/dms"; import DMTimelineView from "./views/tools/dm-timeline"; @@ -84,11 +82,10 @@ import LaunchpadView from "./views/launchpad"; import VideosView from "./views/videos"; import VideoDetailsView from "./views/videos/video"; import BookmarksView from "./views/bookmarks"; -import MailboxesView from "./views/mailboxes"; -import RequireReadRelays from "./providers/route/require-read-relays"; import CacheRelayView from "./views/relays/cache"; import RelaySetView from "./views/relays/relay-set"; import AppRelays from "./views/relays/app"; +import MailboxesView from "./views/relays/mailboxes"; const TracksView = lazy(() => import("./views/tracks")); const UserTracksTab = lazy(() => import("./views/user/tracks")); const UserVideosTab = lazy(() => import("./views/user/videos")); @@ -263,6 +260,7 @@ const router = createHashRouter([ { path: "", element: }, { path: "app", element: }, { path: "cache", element: }, + { path: "mailboxes", element: }, { path: "sets", element: }, { path: ":id", element: }, ], @@ -275,10 +273,6 @@ const router = createHashRouter([ { path: "", element: }, ], }, - { - path: "mailboxes", - children: [{ path: "", element: }], - }, { path: "videos", children: [ diff --git a/src/components/layout/nav-items.tsx b/src/components/layout/nav-items.tsx index 01a443cfd..824974034 100644 --- a/src/components/layout/nav-items.tsx +++ b/src/components/layout/nav-items.tsx @@ -54,7 +54,6 @@ export default function NavItems() { else if (location.pathname.startsWith("/lists")) active = "lists"; else if (location.pathname.startsWith("/communities")) active = "communities"; else if (location.pathname.startsWith("/channels")) active = "channels"; - else if (location.pathname.startsWith("/mailboxes")) active = "mailboxes"; else if (location.pathname.startsWith("/c/")) active = "communities"; else if (location.pathname.startsWith("/goals")) active = "goals"; else if (location.pathname.startsWith("/badges")) active = "badges"; @@ -161,15 +160,6 @@ export default function NavItems() { > Relays - Other Stuff diff --git a/src/views/relays/index.tsx b/src/views/relays/index.tsx index c20b0ed32..7602931af 100644 --- a/src/views/relays/index.tsx +++ b/src/views/relays/index.tsx @@ -1,6 +1,5 @@ -import { useState } from "react"; -import { Outlet, Link as RouterLink, useLocation, useMatch } from "react-router-dom"; -import { Button, Divider, Flex, Heading, VStack } from "@chakra-ui/react"; +import { Outlet, Link as RouterLink, useLocation } from "react-router-dom"; +import { Button, Flex, Heading } from "@chakra-ui/react"; import VerticalPageLayout from "../../components/vertical-page-layout"; import useCurrentAccount from "../../hooks/use-current-account"; @@ -8,9 +7,9 @@ import useUserRelaySets from "../../hooks/use-user-relay-sets"; import { getListName } from "../../helpers/nostr/lists"; import { getEventCoordinate } from "../../helpers/nostr/events"; import { useBreakpointValue } from "../../providers/global/breakpoint-provider"; -import BackButton from "../../components/back-button"; import Database01 from "../../components/icons/database-01"; import { RelayIcon } from "../../components/icons"; +import Mail02 from "../../components/icons/mail-02"; export default function RelaysView() { const account = useCurrentAccount(); @@ -31,7 +30,7 @@ export default function RelaysView() { : undefined } to="/relays/app" - leftIcon={} + leftIcon={} > App Relays @@ -40,10 +39,21 @@ export default function RelaysView() { variant="outline" colorScheme={location.pathname === "/relays/cache" ? "primary" : undefined} to="/relays/cache" - leftIcon={} + leftIcon={} > Cache Relay + {account && ( + + )} {account && ( <> diff --git a/src/views/mailboxes/index.tsx b/src/views/relays/mailboxes/index.tsx similarity index 77% rename from src/views/mailboxes/index.tsx rename to src/views/relays/mailboxes/index.tsx index c98ac936b..aa185c6c4 100644 --- a/src/views/mailboxes/index.tsx +++ b/src/views/relays/mailboxes/index.tsx @@ -13,22 +13,23 @@ import { import { CloseIcon } from "@chakra-ui/icons"; import { Link as RouterLink } from "react-router-dom"; -import VerticalPageLayout from "../../components/vertical-page-layout"; -import RequireCurrentAccount from "../../providers/route/require-current-account"; -import useUserMailboxes from "../../hooks/use-user-mailboxes"; -import useCurrentAccount from "../../hooks/use-current-account"; -import { InboxIcon } from "../../components/icons"; -import { RelayUrlInput } from "../../components/relay-url-input"; -import { RelayFavicon } from "../../components/relay-favicon"; -import { RelayMode } from "../../classes/relay"; +import VerticalPageLayout from "../../../components/vertical-page-layout"; +import RequireCurrentAccount from "../../../providers/route/require-current-account"; +import useUserMailboxes from "../../../hooks/use-user-mailboxes"; +import useCurrentAccount from "../../../hooks/use-current-account"; +import { InboxIcon } from "../../../components/icons"; +import { RelayUrlInput } from "../../../components/relay-url-input"; +import { RelayFavicon } from "../../../components/relay-favicon"; +import { RelayMode } from "../../../classes/relay"; import { useCallback } from "react"; -import { NostrEvent } from "../../types/nostr-event"; -import { addRelayModeToMailbox, removeRelayModeFromMailbox } from "../../helpers/nostr/mailbox"; -import useAsyncErrorHandler from "../../hooks/use-async-error-handler"; +import { NostrEvent } from "../../../types/nostr-event"; +import { addRelayModeToMailbox, removeRelayModeFromMailbox } from "../../../helpers/nostr/mailbox"; +import useAsyncErrorHandler from "../../../hooks/use-async-error-handler"; import { useForm } from "react-hook-form"; -import { safeRelayUrl } from "../../helpers/relay"; -import { usePublishEvent } from "../../providers/global/publish-provider"; -import { COMMON_CONTACT_RELAY } from "../../const"; +import { safeRelayUrl } from "../../../helpers/relay"; +import { usePublishEvent } from "../../../providers/global/publish-provider"; +import { COMMON_CONTACT_RELAY } from "../../../const"; +import BackButton from "../../../components/back-button"; function RelayLine({ relay, mode, list }: { relay: string; mode: RelayMode; list?: NostrEvent }) { const publish = usePublishEvent(); @@ -94,8 +95,11 @@ function MailboxesPage() { ); return ( - - Mailboxes + + + + Mailboxes + @@ -126,7 +130,7 @@ function MailboxesPage() { addRelay(r, RelayMode.WRITE)} /> - + ); } diff --git a/src/views/settings/index.tsx b/src/views/settings/index.tsx index cd8eee82f..803d2e0a6 100644 --- a/src/views/settings/index.tsx +++ b/src/views/settings/index.tsx @@ -45,7 +45,7 @@ export default function SettingsView() { - + Github