cleanup routing

upgrade to react router v7
This commit is contained in:
hzrd149 2025-01-16 14:39:54 -06:00
parent 6356a291ba
commit ae8f3a4d22
249 changed files with 1257 additions and 1118 deletions

View File

@ -2,6 +2,7 @@
"name": "nostrudel",
"version": "0.42.0",
"private": true,
"type": "module",
"license": "MIT",
"repository": {
"type": "git",
@ -94,10 +95,10 @@
"nostr-wasm": "^0.1.0",
"nuka-carousel": "^8.1.1",
"prettier": "^3.4.2",
"react": "^18.3.1",
"react": "^19.0.0",
"react-chartjs-2": "^5.3.0",
"react-diff-viewer-continued": "^3.4.0",
"react-dom": "^18.3.1",
"react-dom": "^19.0.0",
"react-error-boundary": "^4.1.2",
"react-force-graph-2d": "^1.26.2",
"react-force-graph-3d": "^1.25.2",
@ -106,7 +107,7 @@
"react-mosaic-component": "^6.1.1",
"react-photo-album": "^2.4.1",
"react-qr-barcode-scanner": "^2.0.0",
"react-router-dom": "^6.28.1",
"react-router": "^7.1.2",
"react-simplemde-editor": "^5.2.0",
"react-singleton-hook": "^4.0.1",
"react-use": "^17.6.0",
@ -152,8 +153,8 @@
"@types/leaflet.locatecontrol": "^0.74.6",
"@types/lodash.throttle": "^4.1.9",
"@types/ngeohash": "^0.6.8",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"@types/react": "^19.0.7",
"@types/react-dom": "^19.0.3",
"@types/react-window": "^1.8.8",
"@types/three": "^0.160.0",
"@types/webscopeio__react-textarea-autocomplete": "^4.7.5",
@ -164,6 +165,7 @@
"typescript": "^5.7.3",
"vite": "^5.4.11",
"vite-plugin-pwa": "^0.21.1",
"vite-tsconfig-paths": "^5.1.4",
"workbox-build": "^7.3.0",
"workbox-window": "^7.3.0"
},

570
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -1,176 +1,27 @@
import { lazy, Suspense } from "react";
import { createBrowserRouter, Outlet, RouterProvider, ScrollRestoration } from "react-router-dom";
import { Spinner } from "@chakra-ui/react";
import { createBrowserRouter, Outlet, RouterProvider, ScrollRestoration } from "react-router";
import GlobalStyles from "./styles";
import { ErrorBoundary } from "./components/error-boundary";
import AppLayout from "./components/layout";
import DrawerSubViewProvider from "./providers/drawer-sub-view-provider";
import useSetColorMode from "./hooks/use-set-color-mode";
import { RouteProviders } from "./providers/route";
import RequireCurrentAccount from "./components/router/require-current-account";
import RequireBakery from "./components/router/require-bakery";
import useSetColorMode from "./hooks/use-set-color-mode";
import HomeView from "./views/home/index";
const DiscoveryHomeView = lazy(() => import("./views/discovery/index"));
const DVMFeedView = lazy(() => import("./views/discovery/dvm-feed/feed"));
const BlindspotHomeView = lazy(() => import("./views/discovery/blindspot"));
const BlindspotFeedView = lazy(() => import("./views/discovery/blindspot/feed"));
const RelayDiscoveryView = lazy(() => import("./views/discovery/relays/index"));
const MediaFeedView = lazy(() => import("./views/media/index"));
const MediaPostView = lazy(() => import("./views/media/media-post"));
import NostrLinkView from "./views/link";
import ProfileView from "./views/profile";
const HashTagView = lazy(() => import("./views/hashtag"));
import ThreadView from "./views/thread";
import NotificationsView from "./views/notifications";
import ThreadsNotificationsView from "./views/notifications/threads";
const DirectMessagesView = lazy(() => import("./views/dms"));
const DirectMessageChatView = lazy(() => import("./views/dms/chat"));
import SigninView from "./views/signin";
import SignupView from "./views/signup";
import LoginStartView from "./views/signin/start";
import LoginNpubView from "./views/signin/pubkey";
import LoginNsecView from "./views/signin/nsec";
import LoginNostrConnectView from "./views/signin/nostr-connect";
import LoginNostrAddressView from "./views/signin/address";
import LoginNostrAddressCreate from "./views/signin/address/create";
import UserView from "./views/user";
import UserNotesTab from "./views/user/notes";
import UserFollowersTab from "./views/user/followers";
import UserRelaysTab from "./views/user/relays";
import UserFollowingTab from "./views/user/following";
import UserZapsTab from "./views/user/zaps";
import UserReportsTab from "./views/user/reports";
import UserAboutTab from "./views/user/about";
import UserReactionsTab from "./views/user/reactions";
import UserListsTab from "./views/user/lists";
import UserGoalsTab from "./views/user/goals";
import MutedByView from "./views/user/muted-by";
import UserArticlesTab from "./views/user/articles";
import UserMessagesTab from "./views/user/messages";
const UserTorrentsTab = lazy(() => import("./views/user/torrents"));
import ListsHomeView from "./views/lists";
import ListView from "./views/lists/list";
import BrowseListView from "./views/lists/browse";
const EmojiPacksBrowseView = lazy(() => import("./views/emoji-packs/browse"));
const EmojiPackView = lazy(() => import("./views/emoji-packs/emoji-pack"));
const UserEmojiPacksTab = lazy(() => import("./views/user/emoji-packs"));
const EmojiPacksView = lazy(() => import("./views/emoji-packs"));
const GoalsView = lazy(() => import("./views/goals"));
const GoalsBrowseView = lazy(() => import("./views/goals/browse"));
const GoalDetailsView = lazy(() => import("./views/goals/goal-details"));
const BadgesView = lazy(() => import("./views/badges"));
const BadgesBrowseView = lazy(() => import("./views/badges/browse"));
const BadgeDetailsView = lazy(() => import("./views/badges/badge-details"));
import RelaysView from "./views/relays";
import RelayView from "./views/relays/relay";
import BrowseRelaySetsView from "./views/relays/browse-sets";
import CacheRelayView from "./views/relays/cache";
import RelaySetView from "./views/relays/relay-set";
import AppRelaysView from "./views/relays/app";
import MailboxesView from "./views/relays/mailboxes";
import NIP05RelaysView from "./views/relays/nip05";
import DatabaseView from "./views/relays/cache/database";
import ContactListRelaysView from "./views/relays/contact-list";
const WebRtcRelaysView = lazy(() => import("./views/relays/webrtc"));
const WebRtcConnectView = lazy(() => import("./views/relays/webrtc/connect"));
const WebRtcPairView = lazy(() => import("./views/relays/webrtc/pair"));
import OtherStuffView from "./views/other-stuff";
import LaunchpadView from "./views/launchpad";
const VideosView = lazy(() => import("./views/videos"));
const VideoDetailsView = lazy(() => import("./views/videos/video"));
import BookmarksView from "./views/bookmarks";
import TaskManagerProvider from "./views/task-manager/provider";
import SearchRelaysView from "./views/relays/search";
import ArticlesHomeView from "./views/articles";
import ArticleView from "./views/articles/article";
import WalletView from "./views/wallet";
import SupportView from "./views/support";
import UserMediaPostsTab from "./views/user/media-posts";
import NewView from "./views/new";
import NewNoteView from "./views/new/note";
import NewMediaPostView from "./views/new/media";
const TracksView = lazy(() => import("./views/tracks"));
const UserTracksTab = lazy(() => import("./views/user/tracks"));
const UserVideosTab = lazy(() => import("./views/user/videos"));
const UserFilesTab = lazy(() => import("./views/user/files"));
const ToolsHomeView = lazy(() => import("./views/tools"));
const NetworkMuteGraphView = lazy(() => import("./views/tools/network-mute-graph"));
const NetworkDMGraphView = lazy(() => import("./views/tools/network-dm-graph"));
const UnknownTimelineView = lazy(() => import("./views/tools/unknown-event-feed"));
const EventConsoleView = lazy(() => import("./views/tools/event-console"));
const EventPublisherView = lazy(() => import("./views/tools/event-publisher"));
const DMTimelineView = lazy(() => import("./views/tools/dm-timeline"));
const TransformNoteView = lazy(() => import("./views/tools/transform-note"));
const CorrectionsFeedView = lazy(() => import("./views/tools/corrections"));
const NoStrudelUsersView = lazy(() => import("./views/tools/nostrudel-users/index"));
const UserStreamsTab = lazy(() => import("./views/user/streams"));
const StreamsView = lazy(() => import("./views/streams"));
const StreamView = lazy(() => import("./views/streams/stream"));
const StreamModerationView = lazy(() => import("./views/streams/dashboard"));
const SearchView = lazy(() => import("./views/search"));
const MapView = lazy(() => import("./views/map"));
const ChannelsHomeView = lazy(() => import("./views/channels"));
const ChannelView = lazy(() => import("./views/channels/channel"));
const TorrentsView = lazy(() => import("./views/torrents"));
const TorrentDetailsView = lazy(() => import("./views/torrents/torrent"));
const NewTorrentView = lazy(() => import("./views/torrents/new"));
const WikiHomeView = lazy(() => import("./views/wiki"));
const WikiPageView = lazy(() => import("./views/wiki/page"));
const WikiTopicView = lazy(() => import("./views/wiki/topic"));
const WikiSearchView = lazy(() => import("./views/wiki/search"));
const WikiCompareView = lazy(() => import("./views/wiki/compare"));
const CreateWikiPageView = lazy(() => import("./views/wiki/create"));
const EditWikiPageView = lazy(() => import("./views/wiki/edit"));
const FilesHomeView = lazy(() => import("./views/files"));
const FileDetailsView = lazy(() => import("./views/files/file"));
const PodcastsHomeView = lazy(() => import("./views/podcasts"));
const PodcastView = lazy(() => import("./views/podcasts/podcast"));
const EpisodeView = lazy(() => import("./views/podcasts/podcast/episode"));
const BakerySetupView = lazy(() => import("./views/settings/bakery/setup"));
const RequireBakeryAuth = lazy(() => import("./components/router/require-bakery-auth"));
// setting views
import SettingsView from "./views/settings";
import DisplaySettings from "./views/settings/display";
import LightningSettings from "./views/settings/lightning";
import PerformanceSettings from "./views/settings/performance";
import PrivacySettings from "./views/settings/privacy";
import PostSettings from "./views/settings/post";
import AccountSettings from "./views/settings/accounts";
import MediaServersView from "./views/settings/media-servers";
const BakeryConnectView = lazy(() => import("./views/settings/bakery/connect"));
const BakeryAuthView = lazy(() => import("./views/settings/bakery/connect/auth"));
const NotificationSettingsView = lazy(() => import("./views/settings/bakery/notifications"));
const BakeryGeneralSettingsView = lazy(() => import("./views/settings/bakery/general-settings"));
const BakeryNetworkSettingsView = lazy(() => import("./views/settings/bakery/network"));
const BakeryServiceLogsView = lazy(() => import("./views/settings/bakery/service-logs"));
/*
TODO: update scroll restoration to use a different key then location.key
the location.key changes when location.state changes, but that should not change the scroll position
*/
const RootPage = () => {
useSetColorMode();
return (
<RouteProviders>
<ScrollRestoration />
<AppLayout />
</RouteProviders>
);
@ -186,392 +37,101 @@ const NoLayoutPage = () => {
);
};
// one off views
import NostrLinkView from "./views/link";
const HomeView = lazy(() => import("./views/home"));
const ProfileView = lazy(() => import("./views/profile"));
const MapView = lazy(() => import("./views/map"));
const LaunchpadView = lazy(() => import("./views/launchpad"));
const OtherStuffView = lazy(() => import("./views/other-stuff"));
const ThreadView = lazy(() => import("./views/thread"));
const NotificationsView = lazy(() => import("./views/notifications"));
const RelayView = lazy(() => import("./views/relays/relay"));
const SearchView = lazy(() => import("./views/search"));
const SupportView = lazy(() => import("./views/support"));
const TracksView = lazy(() => import("./views/tracks"));
const HashTagView = lazy(() => import("./views/hashtag"));
// routes
import signinRoutes from "./views/signin/routes";
import signupRoutes from "./views/signup/routes";
import userRoutes from "./views/user/routes";
import newRoutes from "./views/new/routes";
import settingsRoutes from "./views/settings/routes";
import relaysRoutes from "./views/relays/routes";
import videosRoutes from "./views/videos/routes";
import mediaRoutes from "./views/media/routes";
import streamsRoutes from "./views/streams/routes";
import toolsRoutes from "./views/tools/routes";
import discoveryRoutes from "./views/discovery/routes";
import wikiRoutes from "./views/wiki/routes";
import filesRoutes from "./views/files/routes";
import messagesRoutes from "./views/messages/routes";
import listsRoutes from "./views/lists/routes";
import bookmarksRoutes from "./views/bookmarks/routes";
import articlesRoutes from "./views/articles/routes";
import torrentsRoutes from "./views/torrents/routes";
import channelsRoutes from "./views/channels/routes";
import goalsRoutes from "./views/goals/routes";
import badgesRoutes from "./views/badges/routes";
import emojisRoutes from "./views/emojis/routes";
import walletRoutes from "./views/wallet/routes";
import podcastsRoutes from "./views/podcasts/routes";
const router = createBrowserRouter([
{
path: "signin",
element: <SigninView />,
children: [
{ path: "", element: <LoginStartView /> },
{ path: "npub", element: <LoginNpubView /> },
{ path: "nsec", element: <LoginNsecView /> },
{
path: "address",
children: [
{ path: "", element: <LoginNostrAddressView /> },
{ path: "create", element: <LoginNostrAddressCreate /> },
],
},
{ path: "nostr-connect", element: <LoginNostrConnectView /> },
],
Component: NoLayoutPage,
children: signinRoutes,
},
{
path: "signup",
element: <NoLayoutPage />,
children: [
{
path: "",
element: <SignupView />,
},
{
path: ":step",
element: <SignupView />,
},
],
Component: NoLayoutPage,
children: signupRoutes,
},
{
path: "/",
element: <RootPage />,
Component: RootPage,
children: [
{
path: "new",
element: (
<RequireCurrentAccount>
<Outlet />
</RequireCurrentAccount>
),
children: [
{ path: "", element: <NewView /> },
{ path: "note", element: <NewNoteView /> },
{ path: "media", element: <NewMediaPostView /> },
],
},
{
path: "launchpad",
element: <LaunchpadView />,
},
{
path: "map",
element: <MapView />,
},
{
path: "/u/:pubkey",
element: <UserView />,
children: [
{ path: "", element: <UserAboutTab /> },
{ path: "about", element: <UserAboutTab /> },
{ path: "notes", element: <UserNotesTab /> },
{ path: "articles", element: <UserArticlesTab /> },
{ path: "media", element: <UserMediaPostsTab /> },
{ path: "streams", element: <UserStreamsTab /> },
{ path: "tracks", element: <UserTracksTab /> },
{ path: "videos", element: <UserVideosTab /> },
{ path: "files", element: <UserFilesTab /> },
{ path: "zaps", element: <UserZapsTab /> },
{ path: "reactions", element: <UserReactionsTab /> },
{ path: "lists", element: <UserListsTab /> },
{ path: "followers", element: <UserFollowersTab /> },
{ path: "following", element: <UserFollowingTab /> },
{ path: "goals", element: <UserGoalsTab /> },
{ path: "emojis", element: <UserEmojiPacksTab /> },
{ path: "relays", element: <UserRelaysTab /> },
{ path: "reports", element: <UserReportsTab /> },
{ path: "muted-by", element: <MutedByView /> },
{ path: "dms", element: <UserMessagesTab /> },
{ path: "torrents", element: <UserTorrentsTab /> },
],
},
{
path: "/n/:id",
element: <ThreadView />,
},
{ path: "other-stuff", element: <OtherStuffView /> },
{
path: "settings",
element: <SettingsView />,
children: [
{ path: "", element: <DisplaySettings /> },
{
path: "accounts",
element: (
<RequireCurrentAccount>
<AccountSettings />
</RequireCurrentAccount>
),
},
{ path: "mailboxes", element: <MailboxesView /> },
{ path: "media-servers", element: <MediaServersView /> },
{ path: "search-relays", element: <SearchRelaysView /> },
{ index: true, Component: HomeView },
{ path: "notes", Component: HomeView },
{ path: "new", children: newRoutes },
{ path: "launchpad", Component: LaunchpadView },
{ path: "profile", Component: ProfileView },
{ path: "messages", children: messagesRoutes },
{ path: "user/:pubkey", children: userRoutes },
{ path: "u/:pubkey", children: userRoutes },
{ path: "note/:id", Component: ThreadView },
{ path: "n/:id", Component: ThreadView },
{ path: "search", Component: SearchView },
{ path: "other-stuff", Component: OtherStuffView },
{ path: "settings", children: settingsRoutes },
{ path: "relays", children: relaysRoutes },
{ path: "r/:relay", Component: RelayView },
{ path: "notifications", Component: NotificationsView },
{ path: "media", children: mediaRoutes },
{ path: "streams", children: streamsRoutes },
{ path: "tools", children: toolsRoutes },
{ path: "discovery", children: discoveryRoutes },
{ path: "wiki", children: wikiRoutes },
{ path: "support", Component: SupportView },
{ path: "l/:link", Component: NostrLinkView },
{ path: "t/:hashtag", Component: HashTagView },
{ path: "relays", element: <AppRelaysView /> },
{ path: "cache", element: <CacheRelayView /> },
{ path: "display", element: <DisplaySettings /> },
{ path: "post", element: <PostSettings /> },
{ path: "privacy", element: <PrivacySettings /> },
{ path: "lightning", element: <LightningSettings /> },
{ path: "performance", element: <PerformanceSettings /> },
{ path: "bakery/connect", element: <BakeryConnectView /> },
{
path: "bakery",
element: (
<RequireBakery>
<Outlet />
</RequireBakery>
),
children: [
{ path: "", element: <BakeryGeneralSettingsView /> },
{
path: "auth",
element: <BakeryAuthView />,
},
{ path: "notifications", element: <NotificationSettingsView /> },
{
path: "network",
element: (
<RequireBakeryAuth>
<BakeryNetworkSettingsView />
</RequireBakeryAuth>
),
},
{ path: "logs", element: <BakeryServiceLogsView /> },
],
},
],
},
{
path: "relays",
element: <RelaysView />,
children: [
{ path: "", element: <AppRelaysView /> },
{ path: "app", element: <AppRelaysView /> },
{
path: "cache",
children: [
{ path: "database", element: <DatabaseView /> },
{ path: "", element: <CacheRelayView /> },
],
},
{ path: "mailboxes", element: <MailboxesView /> },
{ path: "search", element: <SearchRelaysView /> },
{ path: "media-servers", element: <MediaServersView /> },
{ path: "nip05", element: <NIP05RelaysView /> },
{ path: "contacts", element: <ContactListRelaysView /> },
{
path: "webrtc",
children: [
{ path: "connect", element: <WebRtcConnectView /> },
{ path: "pair", element: <WebRtcPairView /> },
{ path: "", element: <WebRtcRelaysView /> },
],
},
{ path: "sets", element: <BrowseRelaySetsView /> },
{ path: ":id", element: <RelaySetView /> },
],
},
{ path: "r/:relay", element: <RelayView /> },
{
path: "notifications",
children: [
{ path: "threads", element: <ThreadsNotificationsView /> },
{ path: "", element: <NotificationsView /> },
],
},
{
path: "wallet",
children: [
{
path: "",
element: (
<RequireCurrentAccount>
<WalletView />
</RequireCurrentAccount>
),
},
],
},
{
path: "podcasts",
element: (
<RequireCurrentAccount>
<Outlet />
</RequireCurrentAccount>
),
children: [
{ path: "", element: <PodcastsHomeView /> },
{ path: ":guid", element: <PodcastView /> },
{ path: ":guid/:episode", element: <EpisodeView /> },
],
},
{
path: "videos",
children: [
{
path: ":naddr",
element: <VideoDetailsView />,
},
{
path: "",
element: <VideosView />,
},
],
},
{
path: "media",
children: [
{ path: "", element: <MediaFeedView /> },
{ path: ":pointer", element: <MediaPostView /> },
],
},
{
path: "streams/moderation",
element: <StreamModerationView />,
},
{
path: "streams/:naddr",
element: <StreamView />,
},
{
path: "files",
children: [
{
path: "",
element: <FilesHomeView />,
},
{
path: ":nevent",
element: <FileDetailsView />,
},
],
},
{
path: "wiki",
children: [
{ path: "search", element: <WikiSearchView /> },
{ path: "topic/:topic", element: <WikiTopicView /> },
{ path: "page/:naddr", element: <WikiPageView /> },
{ path: "edit/:topic", element: <EditWikiPageView /> },
{ path: "compare/:topic/:a/:b", element: <WikiCompareView /> },
{ path: "create", element: <CreateWikiPageView /> },
{ path: "", element: <WikiHomeView /> },
],
},
{
path: "discovery",
children: [
{ path: "", element: <DiscoveryHomeView /> },
{ path: "dvm/:addr", element: <DVMFeedView /> },
{
path: "blindspot",
element: (
<RequireCurrentAccount>
<Outlet />
</RequireCurrentAccount>
),
children: [
{ path: "", element: <BlindspotHomeView /> },
{ path: ":pubkey", element: <BlindspotFeedView /> },
],
},
],
},
{ path: "search", element: <SearchView /> },
{
path: "messages",
element: <DirectMessagesView />,
children: [{ path: ":pubkey", element: <DirectMessageChatView /> }],
},
{ path: "profile", element: <ProfileView /> },
{
path: "tools",
children: [
{ path: "", element: <ToolsHomeView /> },
{ path: "network-mute-graph", element: <NetworkMuteGraphView /> },
{ path: "network-dm-graph", element: <NetworkDMGraphView /> },
{ path: "dm-timeline", element: <DMTimelineView /> },
{ path: "transform/:id", element: <TransformNoteView /> },
{ path: "unknown", element: <UnknownTimelineView /> },
{ path: "console", element: <EventConsoleView /> },
{ path: "corrections", element: <CorrectionsFeedView /> },
{ path: "nostrudel-users", element: <NoStrudelUsersView /> },
{
path: "publisher",
element: <EventPublisherView />,
},
],
},
{
path: "/discovery/relays",
element: <RelayDiscoveryView />,
},
{
path: "lists",
children: [
{ path: "", element: <ListsHomeView /> },
{ path: "browse", element: <BrowseListView /> },
{ path: ":addr", element: <ListView /> },
],
},
{
path: "bookmarks",
children: [
{ path: ":pubkey", element: <BookmarksView /> },
{ path: "", element: <BookmarksView /> },
],
},
{
path: "articles",
children: [
{ path: "", element: <ArticlesHomeView /> },
{ path: ":naddr", element: <ArticleView /> },
],
},
{
path: "torrents",
children: [
{ path: "", element: <TorrentsView /> },
{ path: "new", element: <NewTorrentView /> },
{ path: ":id", element: <TorrentDetailsView /> },
],
},
{
path: "channels",
children: [
{ path: "", element: <ChannelsHomeView /> },
{ path: ":id", element: <ChannelView /> },
],
},
{
path: "goals",
children: [
{ path: "", element: <GoalsView /> },
{ path: "browse", element: <GoalsBrowseView /> },
{ path: ":id", element: <GoalDetailsView /> },
],
},
{
path: "badges",
children: [
{ path: "", element: <BadgesView /> },
{ path: "browse", element: <BadgesBrowseView /> },
{ path: ":naddr", element: <BadgeDetailsView /> },
],
},
{
path: "emojis",
children: [
{ path: "", element: <EmojiPacksView /> },
{ path: "browse", element: <EmojiPacksBrowseView /> },
{ path: ":addr", element: <EmojiPackView /> },
],
},
{
path: "streams",
element: <StreamsView />,
},
{
path: "support",
children: [{ path: "", element: <SupportView /> }],
},
{
path: "tracks",
element: <TracksView />,
},
{ path: "l/:link", element: <NostrLinkView /> },
{ path: "t/:hashtag", element: <HashTagView /> },
{
path: "",
element: <HomeView />,
},
// other stuff
{ path: "articles", children: articlesRoutes },
{ path: "bookmarks", children: bookmarksRoutes },
{ path: "lists", children: listsRoutes },
{ path: "files", children: filesRoutes },
{ path: "tracks", Component: TracksView },
{ path: "map", Component: MapView },
{ path: "videos", children: videosRoutes },
{ path: "torrents", children: torrentsRoutes },
{ path: "channels", children: channelsRoutes },
{ path: "goals", children: goalsRoutes },
{ path: "badges", children: badgesRoutes },
{ path: "emojis", children: emojisRoutes },
{ path: "wallet", children: walletRoutes },
{ path: "podcasts", children: podcastsRoutes },
],
},
]);

View File

@ -1,5 +1,5 @@
import { Alert, AlertDescription, AlertTitle, Button, Flex, Text } from "@chakra-ui/react";
import { Link as RouterLink, useLocation } from "react-router-dom";
import { Link as RouterLink, useLocation } from "react-router";
import { useObservable } from "applesauce-react/hooks";
import WifiOff from "../icons/wifi-off";

View File

@ -1,6 +1,6 @@
import { lazy } from "react";
import { Link, Text } from "@chakra-ui/react";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { ComponentMap } from "applesauce-react/hooks";
import Mention from "./components/mention";

View File

@ -1,7 +1,7 @@
import { MouseEventHandler, useCallback } from "react";
import { Box, Button, Flex, Link, Text, useDisclosure } from "@chakra-ui/react";
import { NostrEvent, nip19 } from "nostr-tools";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { getAddressPointerFromATag, getEventPointerFromETag } from "applesauce-core/helpers";
import { Tag, isATag, isETag, isPTag } from "../../types/nostr-event";

View File

@ -1,6 +1,6 @@
import { Button, ButtonGroup, Code } from "@chakra-ui/react";
import { NostrEvent } from "nostr-tools";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { EditIcon } from "../../icons";
import { CopyButton } from "../../copy-icon-button";

View File

@ -1,5 +1,5 @@
import { Box, Card, CardBody, CardProps, Flex, Heading, Image, LinkBox, Text, useToast } from "@chakra-ui/react";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import {
getArticleImage,

View File

@ -1,5 +1,5 @@
import { useMemo } from "react";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import {
Card,
CardBody,

View File

@ -1,4 +1,4 @@
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { Box, Card, CardBody, CardFooter, CardHeader, CardProps, Flex, Heading, LinkBox, Text } from "@chakra-ui/react";
import { nip19 } from "nostr-tools";

View File

@ -5,10 +5,10 @@ import { TrustProvider } from "../../../providers/local/trust-provider";
import UserAvatarLink from "../../user/user-avatar-link";
import UserLink from "../../user/user-link";
import Timestamp from "../../timestamp";
import DecryptPlaceholder from "../../../views/dms/components/decrypt-placeholder";
import DecryptPlaceholder from "../../../views/messages/components/decrypt-placeholder";
import useCurrentAccount from "../../../hooks/use-current-account";
import { getDMRecipient, getDMSender } from "../../../helpers/nostr/dms";
import DirectMessageContent from "../../../views/dms/components/direct-message-content";
import DirectMessageContent from "../../../views/messages/components/direct-message-content";
import DebugEventButton from "../../debug-modal/debug-event-button";
export default function EmbeddedDM({ dm, ...props }: Omit<CardProps, "children"> & { dm: NostrEvent }) {

View File

@ -11,13 +11,13 @@ import {
Link,
Text,
} from "@chakra-ui/react";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { getEmojis, getPackName } from "applesauce-core/helpers/emoji";
import UserAvatarLink from "../../user/user-avatar-link";
import UserLink from "../../user/user-link";
import EmojiPackFavoriteButton from "../../../views/emoji-packs/components/emoji-pack-favorite-button";
import EmojiPackMenu from "../../../views/emoji-packs/components/emoji-pack-menu";
import EmojiPackFavoriteButton from "../../../views/emojis/components/emoji-pack-favorite-button";
import EmojiPackMenu from "../../../views/emojis/components/emoji-pack-menu";
import { NostrEvent } from "../../../types/nostr-event";
import Timestamp from "../../timestamp";
import { getSharableEventAddress } from "../../../services/relay-hints";

View File

@ -1,5 +1,5 @@
import { Box, Card, CardBody, CardProps, Flex, Heading, Image, LinkBox, Text } from "@chakra-ui/react";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { getTagValue } from "applesauce-core/helpers";
import { getArticlePublishDate } from "../../../helpers/nostr/long-form";

View File

@ -1,6 +1,6 @@
import { useMemo } from "react";
import { Card, CardBody, CardProps, Flex, Heading, Image, Link, Text } from "@chakra-ui/react";
import { Link as RouterLink, useNavigate } from "react-router-dom";
import { Link as RouterLink, useNavigate } from "react-router";
import { NostrEvent } from "../../../types/nostr-event";
import UserLink from "../../user/user-link";

View File

@ -1,5 +1,5 @@
import { Card, CardBody, CardHeader, CardProps, Flex, Heading, Link, Text } from "@chakra-ui/react";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { useMemo } from "react";
import { NostrEvent } from "../../../types/nostr-event";

View File

@ -1,5 +1,5 @@
import { Card, CardBody, CardHeader, CardProps, Flex, Heading, Link, Text } from "@chakra-ui/react";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { getReplaceableUID } from "applesauce-core/helpers";
import { NostrEvent } from "../../../types/nostr-event";

View File

@ -1,6 +1,6 @@
import { MouseEventHandler, useCallback } from "react";
import { Card, CardProps, Flex, LinkBox, Spacer } from "@chakra-ui/react";
import { Link as RouterLink, useNavigate } from "react-router-dom";
import { Link as RouterLink, useNavigate } from "react-router";
import { useObservable } from "applesauce-react/hooks";
import { NostrEvent } from "../../../types/nostr-event";

View File

@ -1,5 +1,5 @@
import { Card, CardProps, Divider, Flex, Link } from "@chakra-ui/react";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { NostrEvent } from "nostr-tools";
import { isATag } from "applesauce-core/helpers";

View File

@ -1,5 +1,5 @@
import { Card, CardBody, CardProps, Flex, Heading, Image, Link, Tag, Text } from "@chakra-ui/react";
import { Link as RouterLink, useNavigate } from "react-router-dom";
import { Link as RouterLink, useNavigate } from "react-router";
import { NostrEvent } from "nostr-tools";
import StreamStatusBadge from "../../../views/streams/components/status-badge";

View File

@ -1,5 +1,5 @@
import { Card, CardProps, Flex, LinkBox, Spacer, Text } from "@chakra-ui/react";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { NostrEvent } from "../../../types/nostr-event";
import UserAvatarLink from "../../user/user-avatar-link";

View File

@ -14,7 +14,7 @@ import {
Tag,
Text,
} from "@chakra-ui/react";
import { Link as RouterLink, useNavigate } from "react-router-dom";
import { Link as RouterLink, useNavigate } from "react-router";
import { useObservable } from "applesauce-react/hooks";
import UserAvatarLink from "../../user/user-avatar-link";

View File

@ -11,7 +11,7 @@ import {
Text,
} from "@chakra-ui/react";
import { useMemo } from "react";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { nip19 } from "nostr-tools";
import { NostrEvent } from "../../../types/nostr-event";

View File

@ -1,6 +1,6 @@
import { Suspense } from "react";
import { Spinner } from "@chakra-ui/react";
import { Outlet } from "react-router-dom";
import { Outlet } from "react-router";
import DesktopSideNav from "./side-nav";
import { ErrorBoundary } from "../../error-boundary";

View File

@ -1,5 +1,5 @@
import { Avatar, Flex, IconButton, useDisclosure } from "@chakra-ui/react";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { DirectMessagesIcon, NotesIcon, NotificationsIcon, PlusCircleIcon, SearchIcon } from "../../icons";
import useRootPadding from "../../../hooks/use-root-padding";

View File

@ -12,7 +12,7 @@ import {
Spacer,
Text,
} from "@chakra-ui/react";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { IconButton } from "@chakra-ui/react";
import { useObservable } from "applesauce-react/hooks";

View File

@ -1,4 +1,4 @@
import { Outlet } from "react-router-dom";
import { Outlet } from "react-router";
import MobileBottomNav from "./bottom-nav";
import { ErrorBoundary } from "../../error-boundary";

View File

@ -1,5 +1,5 @@
import { CloseIcon } from "@chakra-ui/icons";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import {
Box,
Button,
@ -30,6 +30,9 @@ import UserDnsIdentity from "../../user/user-dns-identity";
import NavItem from "./nav-item";
import LogIn01 from "../../icons/log-in-01";
import { CollapsedContext } from "../context";
import Users02 from "../../icons/users-02";
import UserAvatarLink from "../../user/user-avatar-link";
import UserLink from "../../user/user-link";
function AccountItem({ account, onClick }: { account: Account; onClick?: () => void }) {
const pubkey = account.pubkey;
@ -80,23 +83,24 @@ export default function AccountSwitcher() {
return (
<>
{account ? (
<Flex
as="button"
gap="2"
alignItems="center"
onClick={modal.onToggle}
flexShrink={0}
overflow="hidden"
outline="none"
>
<UserAvatar pubkey={account.pubkey} noProxy size="md" />
<Flex gap="2" alignItems="center" flexShrink={0} overflow="hidden">
<UserAvatarLink pubkey={account.pubkey} noProxy size="md" />
{!collapsed && (
<Flex overflow="hidden" direction="column" w="Full" alignItems="flex-start">
<Text whiteSpace="nowrap" fontWeight="bold" fontSize="lg" isTruncated>
{getDisplayName(metadata, account.pubkey)}
</Text>
<UserDnsIdentity pubkey={account.pubkey} />
</Flex>
<>
<Flex overflow="hidden" direction="column" w="Full" alignItems="flex-start">
<UserLink pubkey={account.pubkey} fontWeight="bold" isTruncated whiteSpace="nowrap" />
<UserDnsIdentity pubkey={account.pubkey} />
</Flex>
<IconButton
ms="auto"
aria-label="Switch account"
onClick={modal.onToggle}
flexShrink={0}
size="md"
variant="ghost"
icon={<Users02 boxSize={5} />}
/>
</>
)}
</Flex>
) : (

View File

@ -1,6 +1,6 @@
import { useMemo } from "react";
import { Spacer } from "@chakra-ui/react";
import { useLocation } from "react-router-dom";
import { useLocation } from "react-router";
import { nip19 } from "nostr-tools";
import {
@ -50,7 +50,7 @@ export default function NavItems() {
return (
<>
{account && account.readonly !== false && (
{account && !account.readonly && (
<NavItem icon={Plus} label="Create new" colorScheme="primary" to="/new" variant="solid" />
)}
<NavItem to="/launchpad" icon={Rocket02} label="Launchpad" />

View File

@ -1,6 +1,6 @@
import { useContext } from "react";
import { Button, ComponentWithAs, IconButton, IconButtonProps, IconProps } from "@chakra-ui/react";
import { Link as RouterLink, useLocation } from "react-router-dom";
import { Link as RouterLink, useLocation } from "react-router";
import { CollapsedContext } from "../context";

View File

@ -1,7 +1,9 @@
import { ReactNode } from "react";
import { Flex, FlexProps, Heading } from "@chakra-ui/react";
import { BackIconButton } from "../../router/back-button";
export default function SimpleHeader({ children, title, ...props }: FlexProps) {
export default function SimpleHeader({ children, title, ...props }: Omit<FlexProps, "title"> & { title?: ReactNode }) {
return (
<Flex
p="2"
@ -13,7 +15,7 @@ export default function SimpleHeader({ children, title, ...props }: FlexProps) {
top="var(--safe-top)"
mt="var(--safe-top)"
backgroundColor="var(--chakra-colors-chakra-body-bg)"
zIndex={1}
zIndex="popover"
{...props}
>
<BackIconButton hideFrom="lg" />

View File

@ -1,5 +1,5 @@
import { Button, ButtonProps } from "@chakra-ui/react";
import { useMatch, Link as RouterLink } from "react-router-dom";
import { useMatch, Link as RouterLink } from "react-router";
export default function SimpleNavItem({
children,

View File

@ -1,5 +1,5 @@
import { PropsWithChildren, Suspense } from "react";
import { Outlet, useMatch } from "react-router-dom";
import { Outlet, useMatch } from "react-router";
import { Box, Flex, Spinner } from "@chakra-ui/react";
import { useBreakpointValue } from "../../../providers/global/breakpoint-provider";

View File

@ -11,8 +11,9 @@ export default function SimpleView({
flush,
gap,
maxW,
center,
...props
}: FlexProps & { flush?: boolean; actions?: ReactNode }) {
}: Omit<FlexProps, "title"> & { flush?: boolean; actions?: ReactNode; title?: ReactNode; center?: boolean }) {
return (
<Flex as={as} flex={1} direction="column" pr="var(--safe-right)" pl="var(--safe-left)" {...props}>
<SimpleHeader title={title}>{actions}</SimpleHeader>
@ -28,6 +29,7 @@ export default function SimpleView({
flexGrow={1}
maxW={maxW}
w={maxW ? "full" : "initial"}
mx={center ? "auto" : undefined}
>
{children}
</Flex>

View File

@ -1,6 +1,6 @@
import { Code, Flex, FlexProps, LinkBox, Text } from "@chakra-ui/react";
import { NostrEvent, kinds, nip19, nip25 } from "nostr-tools";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { useReadRelays } from "../../../hooks/use-client-relays";
import useCurrentAccount from "../../../hooks/use-current-account";

View File

@ -12,7 +12,7 @@ import {
} from "react";
import { Button, Flex, FlexProps, Spacer, useDisclosure } from "@chakra-ui/react";
import { useUnmount } from "react-use";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import styled from "@emotion/styled";
import Lightbox, { RenderSlideContainerProps, Slide } from "yet-another-react-lightbox";

View File

@ -17,7 +17,7 @@ import {
import { NostrEvent } from "nostr-tools";
import { ExtraProps } from "react-markdown";
import { getEventUID } from "nostr-idb";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { useObservable } from "applesauce-react/hooks";
import { useReadRelays } from "../../hooks/use-client-relays";

View File

@ -1,6 +1,6 @@
import { Box, ButtonGroup, Card, CardBody, CardFooter, CardHeader, IconButton } from "@chakra-ui/react";
import { NostrEvent } from "nostr-tools";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import UserAvatarLink from "../user/user-avatar-link";
import UserLink from "../user/user-link";

View File

@ -1,5 +1,5 @@
import { Button, IconButton, IconButtonProps } from "@chakra-ui/react";
import { useLocation, useNavigate } from "react-router-dom";
import { useLocation, useNavigate } from "react-router";
import { NostrEvent } from "nostr-tools";
import UserAvatar from "../user/user-avatar";

View File

@ -1,6 +1,6 @@
import { useMemo } from "react";
import { Link, LinkProps } from "@chakra-ui/react";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { nip19 } from "nostr-tools";
import { truncatedId } from "../../helpers/nostr/event";

View File

@ -1,6 +1,6 @@
import { useCallback, useMemo } from "react";
import { MenuItem, useDisclosure } from "@chakra-ui/react";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { BroadcastEventIcon } from "../icons";
import { NostrEvent } from "../../types/nostr-event";

View File

@ -1,6 +1,6 @@
import { MouseEventHandler, useCallback } from "react";
import { IconButton, IconButtonProps } from "@chakra-ui/react";
import { To } from "react-router-dom";
import { To } from "react-router";
import { DrawerIcon } from "../icons";
import { useNavigateInDrawer } from "../../providers/drawer-sub-view-provider";

View File

@ -1,6 +1,6 @@
import { NostrEvent, nip19 } from "nostr-tools";
import { Flex, Link, Text } from "@chakra-ui/react";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { getThreadReferences, truncatedId } from "../../../../helpers/nostr/event";
import UserLink from "../../../user/user-link";

View File

@ -15,7 +15,7 @@ import {
} from "@chakra-ui/react";
import { NostrEvent } from "../../../types/nostr-event";
import UserAvatarLink from "../../user/user-avatar-link";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { useObservable } from "applesauce-react/hooks";
import NoteMenu from "../note-menu";

View File

@ -12,7 +12,7 @@ import {
Text,
useDisclosure,
} from "@chakra-ui/react";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { RelayFavicon } from "./relay-favicon";
import relayScoreboardService from "../services/relay-scoreboard";

View File

@ -15,7 +15,7 @@ import {
useDisclosure,
} from "@chakra-ui/react";
import { CloseIcon } from "@chakra-ui/icons";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { useObservable } from "applesauce-react/hooks";
import { NostrEvent } from "nostr-tools";

View File

@ -1,5 +1,5 @@
import { IconButton, IconButtonProps } from "@chakra-ui/react";
import { useNavigate } from "react-router-dom";
import { useNavigate } from "react-router";
import { ChevronLeftIcon } from "../icons";

View File

@ -1,6 +1,6 @@
import { PropsWithChildren, useEffect, useRef } from "react";
import { Button, Flex, Heading, Spinner } from "@chakra-ui/react";
import { To, useLocation, Link as RouterLink, useNavigate } from "react-router-dom";
import { To, useLocation, Link as RouterLink, useNavigate } from "react-router";
import { useObservable } from "applesauce-react/hooks";
import { useSigningContext } from "../../providers/global/signing-provider";

View File

@ -1,7 +1,7 @@
import { PropsWithChildren } from "react";
import { Button, Code, Flex, Heading, Spinner, Text } from "@chakra-ui/react";
import { Navigate, To, useLocation } from "react-router-dom";
import { Link as RouterLink } from "react-router-dom";
import { Navigate, To, useLocation } from "react-router";
import { Link as RouterLink } from "react-router";
import { useObservable } from "applesauce-react/hooks";
import useReconnectAction from "../../hooks/use-reconnect-action";

View File

@ -1,5 +1,5 @@
import { Button, Flex, Heading, Spinner, Text } from "@chakra-ui/react";
import { Link, useLocation } from "react-router-dom";
import { Link, useLocation } from "react-router";
import { useObservable } from "applesauce-react/hooks";
import accountService from "../../services/account";

View File

@ -1,6 +1,6 @@
import { Flex, Input, Modal, ModalContent, ModalOverlay, ModalProps, Text } from "@chakra-ui/react";
import { useRef, useState } from "react";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { useAsync, useThrottle } from "react-use";
import { matchSorter } from "match-sorter";
import { useObservable } from "applesauce-react/hooks";

View File

@ -12,7 +12,7 @@ import {
LinkOverlay,
Text,
} from "@chakra-ui/react";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { NostrEvent } from "nostr-tools";
import useShareableEventAddress from "../../../hooks/use-shareable-event-address";

View File

@ -1,6 +1,6 @@
import { useCallback } from "react";
import { Flex, FlexProps } from "@chakra-ui/react";
import { useSearchParams } from "react-router-dom";
import { useSearchParams } from "react-router";
import IntersectionObserverProvider from "../../providers/local/intersection-observer";
import GenericNoteTimeline from "./generic-note-timeline";

View File

@ -1,5 +1,5 @@
import { forwardRef, memo } from "react";
import { Link } from "react-router-dom";
import { Link } from "react-router";
import { nip19 } from "nostr-tools";
import { UserAvatar, UserAvatarProps } from "./user-avatar";

View File

@ -1,5 +1,5 @@
import { Link, LinkProps } from "@chakra-ui/react";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { nip19 } from "nostr-tools";
import { getDisplayName } from "../../helpers/nostr/profile";

View File

@ -1,6 +1,6 @@
import { useCallback, useEffect, useMemo, useRef } from "react";
import { FieldValues, UseFormGetValues, UseFormReset, UseFormStateReturn } from "react-hook-form";
import { useBeforeUnload } from "react-router-dom";
import { useBeforeUnload } from "react-router";
import { logger } from "../helpers/debug";

View File

@ -1,4 +1,4 @@
import { useParams } from "react-router-dom";
import { useParams } from "react-router";
import { nip19 } from "nostr-tools";
import type { AddressPointer } from "nostr-tools/nip19";

View File

@ -1,4 +1,4 @@
import { useParams } from "react-router-dom";
import { useParams } from "react-router";
import { nip19 } from "nostr-tools";
import type { EventPointer } from "nostr-tools/nip19";

View File

@ -1,4 +1,4 @@
import { useParams } from "react-router-dom";
import { useParams } from "react-router";
import { nip19 } from "nostr-tools";
import type { ProfilePointer } from "nostr-tools/nip19";
import { isHexKey } from "../helpers/nip19";

View File

@ -1,5 +1,5 @@
import { useCallback, useRef } from "react";
import { useLocation, useSearchParams } from "react-router-dom";
import { useLocation, useSearchParams } from "react-router";
type Actions = {
setValue: (v: string | null | ((v: string | null) => string | null), replace?: boolean) => void;

View File

@ -1,5 +1,5 @@
import { useCallback, useRef } from "react";
import { useLocation, useNavigate } from "react-router-dom";
import { useLocation, useNavigate } from "react-router";
type Actions<T> = {
setValue: (v: T | ((v: T | undefined) => T), replace?: boolean) => void;

View File

@ -1,5 +1,5 @@
import { useCallback, useEffect, useMemo, useRef } from "react";
import { createMemoryRouter } from "react-router-dom";
import { createMemoryRouter } from "react-router";
type Router = ReturnType<typeof createMemoryRouter>;

View File

@ -1,5 +1,5 @@
import { useColorMode } from "@chakra-ui/react";
import { useSearchParams } from "react-router-dom";
import { useSearchParams } from "react-router";
import { useEffect } from "react";
import useAppSettings from "./use-user-app-settings";

View File

@ -1,11 +1,6 @@
import "./polyfill";
import { createRoot } from "react-dom/client";
import { App } from "./app";
import { GlobalProviders } from "./providers/global";
import { registerServiceWorker } from "./services/worker";
import funding from "virtual:funding";
console.log("Funding", funding);
import "./services/user-event-sync";
import "./services/username-search";
@ -30,9 +25,10 @@ window.addEventListener("unload", () => {
// setup dayjs
import dayjs from "dayjs";
import relativeTimePlugin from "dayjs/plugin/relativeTime";
dayjs.extend(relativeTimePlugin);
import localizedFormat from "dayjs/plugin/localizedFormat";
import { CAP_IS_WEB } from "./env";
import { App } from "./app";
dayjs.extend(relativeTimePlugin);
dayjs.extend(localizedFormat);
// register nostr: protocol handler
@ -45,12 +41,14 @@ if (import.meta.env.PROD) {
}
}
if (CAP_IS_WEB) registerServiceWorker();
// if web, register service worker
if (CAP_IS_WEB) {
const { registerServiceWorker } = await import("./services/worker");
registerServiceWorker();
}
const element = document.getElementById("root");
if (!element) throw new Error("missing mount point");
const root = createRoot(element);
root.render(
const root = document.getElementById("root")!;
createRoot(root).render(
<GlobalProviders>
<App />
</GlobalProviders>,

View File

@ -23,7 +23,7 @@ import {
IconButton,
Spinner,
} from "@chakra-ui/react";
import { Location, RouteObject, RouterProvider, To, createMemoryRouter, useNavigate } from "react-router-dom";
import { Location, RouteObject, RouterProvider, To, createMemoryRouter, useNavigate } from "react-router";
import { ErrorBoundary } from "../components/error-boundary";
import ThreadView from "../views/thread";

View File

@ -3,7 +3,7 @@ import { PropsWithChildren, createContext, useCallback, useContext, useMemo, use
import EventDebugModal from "../../components/debug-modal/event-debug-modal";
import useRouteStateValue from "../../hooks/use-route-state-value";
import { UNSAFE_DataRouterContext } from "react-router-dom";
import { UNSAFE_DataRouterContext } from "react-router";
import useRouterMarker from "../../hooks/use-router-marker";
export const DebugModalContext = createContext({

View File

@ -1,8 +1,8 @@
import { PropsWithChildren } from "react";
import { Alert, AlertIcon, Button, Link, Spacer, Text } from "@chakra-ui/react";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { useObservable } from "applesauce-react/hooks";
import { useLocation } from "react-router-dom";
import { useLocation } from "react-router";
import { useReadRelays } from "../../hooks/use-client-relays";
import { offlineMode } from "../../services/offline-mode";

View File

@ -1,7 +1,7 @@
import { memo } from "react";
import { Box, Card, Flex, Heading, LinkBox, Spacer, Text } from "@chakra-ui/react";
import { NostrEvent } from "nostr-tools";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import {
getArticleImage,

View File

@ -1,6 +1,6 @@
import { useCallback } from "react";
import { MenuItem } from "@chakra-ui/react";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { NostrEvent } from "nostr-tools";
import useShareableEventAddress from "../../../hooks/use-shareable-event-address";

View File

@ -42,7 +42,7 @@ function ArticlesHomePage() {
const callback = useTimelineCurserIntersectionCallback(loader);
return (
<VerticalPageLayout>
<VerticalPageLayout maxW="6xl" mx="auto">
<Flex gap="2">
<Heading>Articles</Heading>
<PeopleListSelection />

View File

@ -0,0 +1,10 @@
import { lazy } from "react";
import { RouteObject } from "react-router";
const ArticlesHomeView = lazy(() => import("."));
const ArticleView = lazy(() => import("./article"));
export default [
{ index: true, Component: ArticlesHomeView },
{ path: ":naddr", Component: ArticleView },
] satisfies RouteObject[];

View File

@ -1,4 +1,4 @@
import { useNavigate } from "react-router-dom";
import { useNavigate } from "react-router";
import { kinds } from "nostr-tools";
import { useObservable } from "applesauce-react/hooks";
import {

View File

@ -1,6 +1,6 @@
import { memo } from "react";
import { Button, Card, Flex, Image, Link, LinkBox, Text, useDisclosure } from "@chakra-ui/react";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { getBadgeAwardBadge, getBadgeAwardPubkeys, getBadgeImage, getBadgeName } from "../../../helpers/nostr/badges";
import useReplaceableEvent from "../../../hooks/use-replaceable-event";

View File

@ -1,5 +1,5 @@
import { memo } from "react";
import { Link as RouterLink, useNavigate } from "react-router-dom";
import { Link as RouterLink, useNavigate } from "react-router";
import { ButtonGroup, Card, CardBody, CardHeader, CardProps, Flex, Heading, Image, Link, Text } from "@chakra-ui/react";
import { kinds } from "nostr-tools";

View File

@ -1,6 +1,6 @@
import { useCallback } from "react";
import { Button, Flex, Heading, Image, Link, Spacer } from "@chakra-ui/react";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { kinds } from "nostr-tools";
import { ExternalLinkIcon } from "../../components/icons";
@ -70,9 +70,7 @@ function BadgesPage() {
);
}
export default function BadgesView() {
// const account = useCurrentAccount();
// return account ? <BadgesPage /> : <Navigate to="/lists/browse" />;
export default function BadgesHomeView() {
return (
<PeopleListProvider>
<BadgesPage />

View File

@ -0,0 +1,12 @@
import { lazy } from "react";
import { RouteObject } from "react-router";
const BadgesHomeView = lazy(() => import("."));
const BadgesBrowseView = lazy(() => import("./browse"));
const BadgeDetailsView = lazy(() => import("./badge-details"));
export default [
{ index: true, Component: BadgesHomeView },
{ path: "browse", Component: BadgesBrowseView },
{ path: ":naddr", Component: BadgeDetailsView },
] satisfies RouteObject[];

View File

@ -1,6 +1,6 @@
import { AddressPointer, EventPointer } from "nostr-tools/nip19";
import { Button, ButtonGroup, Flex, Heading, SimpleGrid, SkeletonText, Spinner } from "@chakra-ui/react";
import { useParams } from "react-router-dom";
import { useParams } from "react-router";
import VerticalPageLayout from "../../components/vertical-page-layout";
import useCurrentAccount from "../../hooks/use-current-account";
@ -16,6 +16,7 @@ import useParamsProfilePointer from "../../hooks/use-params-pubkey-pointer";
import useReplaceableEvent from "../../hooks/use-replaceable-event";
import { EmbedEvent } from "../../components/embed-event";
import { aTagToAddressPointer, eTagToEventPointer } from "../../helpers/nostr/event";
import SimpleView from "../../components/layout/presets/simple-view";
function RemoveBookmarkButton({ event }: { event: NostrEvent }) {
const { isLoading, removeBookmark } = useEventBookmarkActions(event);
@ -60,30 +61,33 @@ function BookmarksPage({ pubkey }: { pubkey: string }) {
if (!list) return <Spinner />;
return (
<VerticalPageLayout>
<Flex gap="2" alignItems="center" mb="4">
<UserAvatarLink pubkey={pubkey} />
<Heading size="md">
<UserName pubkey={list.pubkey} />
's Bookmarks
</Heading>
<ListMenu ml="auto" size="sm" list={list} aria-label="More options" />
</Flex>
<Flex gap="2" direction="column" maxW="4xl" mx="auto" overflow="hidden" w="full">
{Array.from(list.tags)
.reverse()
.map((tag) => {
if (isETag(tag)) {
const pointer = eTagToEventPointer(tag);
return <BookmarkEventItem key={pointer.id} pointer={pointer} />;
} else if (isATag(tag)) {
const pointer = aTagToAddressPointer(tag);
return <BookmarkAddressItem key={tag[1]} pointer={pointer} />;
}
return null;
})}
</Flex>
</VerticalPageLayout>
<SimpleView
title={
<Flex gap="2" alignItems="center">
<UserAvatarLink pubkey={pubkey} size="sm" />
<Heading size="md">
<UserName pubkey={list.pubkey} />
's Bookmarks
</Heading>
</Flex>
}
actions={<ListMenu ml="auto" size="sm" list={list} aria-label="More options" />}
maxW="4xl"
center
>
{Array.from(list.tags)
.reverse()
.map((tag) => {
if (isETag(tag)) {
const pointer = eTagToEventPointer(tag);
return <BookmarkEventItem key={pointer.id} pointer={pointer} />;
} else if (isATag(tag)) {
const pointer = aTagToAddressPointer(tag);
return <BookmarkAddressItem key={tag[1]} pointer={pointer} />;
}
return null;
})}
</SimpleView>
);
}

View File

@ -0,0 +1,9 @@
import { lazy } from "react";
import { RouteObject } from "react-router";
const BookmarksView = lazy(() => import("."));
export default [
{ index: true, element: <BookmarksView /> },
{ path: ":pubkey", element: <BookmarksView /> },
] satisfies RouteObject[];

View File

@ -1,5 +1,5 @@
import { memo, useCallback, useMemo } from "react";
import { useNavigate } from "react-router-dom";
import { useNavigate } from "react-router";
import { Button, Flex, Heading, Spacer, Spinner, useDisclosure } from "@chakra-ui/react";
import { kinds } from "nostr-tools";
import { ChannelHiddenQuery, ChannelMessagesQuery, ChannelMutedQuery } from "applesauce-channel/queries";

View File

@ -1,4 +1,4 @@
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { nip19 } from "nostr-tools";
import { EventPointer } from "nostr-tools/nip19";
import {

View File

@ -0,0 +1,10 @@
import { lazy } from "react";
import { RouteObject } from "react-router";
const ChannelsHomeView = lazy(() => import("."));
const ChannelView = lazy(() => import("./channel"));
export default [
{ index: true, Component: ChannelsHomeView },
{ path: ":id", Component: ChannelView },
] satisfies RouteObject[];

View File

@ -1,6 +1,6 @@
import { useCallback, useMemo } from "react";
import { Flex, Heading, Spacer, Spinner, useDisclosure } from "@chakra-ui/react";
import { Navigate } from "react-router-dom";
import { Navigate } from "react-router";
import { kinds, NostrEvent } from "nostr-tools";
import VerticalPageLayout from "../../../components/vertical-page-layout";

View File

@ -11,7 +11,7 @@ import {
SimpleGrid,
Text,
} from "@chakra-ui/react";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { nip19 } from "nostr-tools";
import useCurrentAccount from "../../../hooks/use-current-account";

View File

@ -1,5 +1,5 @@
import { forwardRef } from "react";
import { Link } from "react-router-dom";
import { Link } from "react-router";
import { nip19 } from "nostr-tools";
import { Box, BoxProps } from "@chakra-ui/react";

View File

@ -1,6 +1,6 @@
import { useMemo } from "react";
import { Card, CardProps, Flex, Heading, LinkBox, LinkOverlayProps, Text } from "@chakra-ui/react";
import { Link as RouterLink, To } from "react-router-dom";
import { Link as RouterLink, To } from "react-router";
import { getAddressPointerForEvent } from "applesauce-core/helpers";
import { AddressPointer } from "nostr-tools/nip19";

View File

@ -1,5 +1,5 @@
import { Link, LinkProps, Text, TextProps } from "@chakra-ui/react";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { nip19 } from "nostr-tools";
import useUserProfile from "../../../../hooks/use-user-profile";

View File

@ -23,7 +23,7 @@ import {
} from "@chakra-ui/react";
import { ChevronLeftIcon } from "@chakra-ui/icons";
import dayjs from "dayjs";
import { useNavigate } from "react-router-dom";
import { useNavigate } from "react-router";
import {
DVM_CONTENT_DISCOVERY_JOB_KIND,

View File

@ -1,6 +1,6 @@
import { useCallback } from "react";
import { Card, Flex, Heading, Link, LinkBox, SimpleGrid, Text } from "@chakra-ui/react";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { getEventUID } from "applesauce-core/helpers";
import { kinds, NostrEvent } from "nostr-tools";

View File

@ -17,7 +17,7 @@ import {
} from "@chakra-ui/react";
import { useContext } from "react";
import { NostrEvent } from "nostr-tools";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { SelectedContext } from "../selected-context";
import { getTagValue } from "../../../../helpers/nostr/event";

View File

@ -0,0 +1,27 @@
import { Outlet, RouteObject } from "react-router";
import RequireCurrentAccount from "../../components/router/require-current-account";
import { lazy } from "react";
const DiscoveryHomeView = lazy(() => import("."));
const DVMFeedView = lazy(() => import("./dvm-feed/feed"));
const BlindspotHomeView = lazy(() => import("./blindspot"));
const BlindspotFeedView = lazy(() => import("./blindspot/feed"));
const RelayDiscoveryView = lazy(() => import("./relays"));
export default [
{ index: true, Component: DiscoveryHomeView },
{ path: "dvm/:addr", Component: DVMFeedView },
{ path: "relays", Component: RelayDiscoveryView },
{
path: "blindspot",
element: (
<RequireCurrentAccount>
<Outlet />
</RequireCurrentAccount>
),
children: [
{ index: true, Component: BlindspotHomeView },
{ path: ":pubkey", Component: BlindspotFeedView },
],
},
] satisfies RouteObject[];

View File

@ -13,7 +13,7 @@ import {
ModalProps,
} from "@chakra-ui/react";
import { useForm } from "react-hook-form";
import { useNavigate } from "react-router-dom";
import { useNavigate } from "react-router";
import { kinds } from "nostr-tools";
import dayjs from "dayjs";

View File

@ -1,4 +1,4 @@
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import {
ButtonGroup,
Card,

View File

@ -1,5 +1,5 @@
import { useState } from "react";
import { useNavigate } from "react-router-dom";
import { useNavigate } from "react-router";
import { useForm } from "react-hook-form";
import { useThrottle } from "react-use";
import dayjs from "dayjs";

View File

@ -1,6 +1,6 @@
import { Button, Flex, Heading, Link, SimpleGrid, useDisclosure } from "@chakra-ui/react";
import { getAddressPointersFromList } from "applesauce-lists/helpers";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { kinds } from "nostr-tools";
import useCurrentAccount from "../../hooks/use-current-account";
@ -66,7 +66,7 @@ function UserEmojiPackMangerPage() {
);
}
export default function EmojiPacksView() {
export default function EmojisHomeView() {
const account = useCurrentAccount();
const createModal = useDisclosure();

View File

@ -0,0 +1,12 @@
import { lazy } from "react";
import { RouteObject } from "react-router";
const EmojisHomeView = lazy(() => import("."));
const EmojiPacksBrowseView = lazy(() => import("./browse"));
const EmojiPackView = lazy(() => import("./emoji-pack"));
export default [
{ index: true, Component: EmojisHomeView },
{ path: "browse", Component: EmojiPacksBrowseView },
{ path: ":addr", Component: EmojiPackView },
] satisfies RouteObject[];

View File

@ -14,7 +14,7 @@ import {
Thead,
Tr,
} from "@chakra-ui/react";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { getTagValue } from "applesauce-core/helpers";
import useTimelineLoader from "../../hooks/use-timeline-loader";

View File

@ -0,0 +1,16 @@
import { lazy } from "react";
import { RouteObject } from "react-router";
const FilesHomeView = lazy(() => import("."));
const FileDetailsView = lazy(() => import("./file"));
export default [
{
index: true,
element: <FilesHomeView />,
},
{
path: ":nevent",
element: <FileDetailsView />,
},
] satisfies RouteObject[];

View File

@ -1,5 +1,5 @@
import { memo } from "react";
import { Link as RouterLink } from "react-router-dom";
import { Link as RouterLink } from "react-router";
import { ButtonGroup, Card, CardBody, CardHeader, CardProps, Flex, Heading, Link, Text } from "@chakra-ui/react";
import UserAvatarLink from "../../../components/user/user-avatar-link";

Some files were not shown because too many files have changed in this diff Show More