diff --git a/src/app.tsx b/src/app.tsx index 22a107038..69a8b18bb 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -1,4 +1,4 @@ -import React, { Suspense } from "react"; +import { lazy, Suspense } from "react"; import { createHashRouter, Outlet, RouterProvider, ScrollRestoration } from "react-router-dom"; import { Spinner } from "@chakra-ui/react"; import { css, Global } from "@emotion/react"; @@ -19,7 +19,8 @@ import NotificationsView from "./views/notifications"; import DirectMessagesView from "./views/messages"; import DirectMessageChatView from "./views/messages/chat"; -import LoginView from "./views/signin"; +import SigninView from "./views/signin"; +import SignupView from "./views/signup"; import LoginStartView from "./views/signin/start"; import LoginNpubView from "./views/signin/npub"; import LoginNip05View from "./views/signin/nip05"; @@ -66,20 +67,19 @@ import RelaysView from "./views/relays"; import RelayView from "./views/relays/relay"; import RelayReviewsView from "./views/relays/reviews"; import PopularRelaysView from "./views/relays/popular"; -import UserTracksTab from "./views/user/tracks"; -import SignupView from "./views/signup"; +const UserTracksTab = lazy(() => import("./views/user/tracks")); -const ToolsHomeView = React.lazy(() => import("./views/tools")); -const NetworkView = React.lazy(() => import("./views/tools/network")); -const StreamModerationView = React.lazy(() => import("./views/tools/stream-moderation")); -const NetworkGraphView = React.lazy(() => import("./views/tools/network-mute-graph")); +const ToolsHomeView = lazy(() => import("./views/tools")); +const NetworkView = lazy(() => import("./views/tools/network")); +const StreamModerationView = lazy(() => import("./views/tools/stream-moderation")); +const NetworkGraphView = lazy(() => import("./views/tools/network-mute-graph")); -const UserStreamsTab = React.lazy(() => import("./views/user/streams")); -const StreamsView = React.lazy(() => import("./views/streams")); -const StreamView = React.lazy(() => import("./views/streams/stream")); +const UserStreamsTab = lazy(() => import("./views/user/streams")); +const StreamsView = lazy(() => import("./views/streams")); +const StreamView = lazy(() => import("./views/streams/stream")); -const SearchView = React.lazy(() => import("./views/search")); -const MapView = React.lazy(() => import("./views/map")); +const SearchView = lazy(() => import("./views/search")); +const MapView = lazy(() => import("./views/map")); const overrideReactTextareaAutocompleteStyles = css` .rta__autocomplete { @@ -124,7 +124,7 @@ const RootPage = () => { const router = createHashRouter([ { path: "signin", - element: , + element: , children: [ { path: "", element: }, { path: "npub", element: }, diff --git a/src/components/embed-event/index.tsx b/src/components/embed-event/index.tsx index b402ed6c9..f52d37303 100644 --- a/src/components/embed-event/index.tsx +++ b/src/components/embed-event/index.tsx @@ -1,30 +1,32 @@ +import { lazy } from "react"; import type { DecodeResult } from "nostr-tools/lib/nip19"; import { CardProps } from "@chakra-ui/react"; +import { Kind, nip19 } from "nostr-tools"; import EmbeddedNote from "./event-types/embedded-note"; import useSingleEvent from "../../hooks/use-single-event"; import { NoteLink } from "../note-link"; import { NostrEvent } from "../../types/nostr-event"; -import { Kind, nip19 } from "nostr-tools"; -import useReplaceableEvent from "../../hooks/use-replaceable-event"; -import RelayCard from "../../views/relays/components/relay-card"; import { STREAM_CHAT_MESSAGE_KIND, STREAM_KIND } from "../../helpers/nostr/stream"; import { GOAL_KIND } from "../../helpers/nostr/goal"; +import { EMOJI_PACK_KIND } from "../../helpers/nostr/emoji-packs"; +import { NOTE_LIST_KIND, PEOPLE_LIST_KIND } from "../../helpers/nostr/lists"; +import { COMMUNITY_DEFINITION_KIND } from "../../helpers/nostr/communities"; +import { STEMSTR_TRACK_KIND } from "../../helpers/nostr/stemstr"; +import useReplaceableEvent from "../../hooks/use-replaceable-event"; import { safeDecode } from "../../helpers/nip19"; + +import RelayCard from "../../views/relays/components/relay-card"; import EmbeddedStream from "./event-types/embedded-stream"; -import { EMOJI_PACK_KIND } from "../../helpers/nostr/emoji-packs"; import EmbeddedEmojiPack from "./event-types/embedded-emoji-pack"; import EmbeddedGoal, { EmbeddedGoalOptions } from "./event-types/embedded-goal"; import EmbeddedUnknown from "./event-types/embedded-unknown"; -import { NOTE_LIST_KIND, PEOPLE_LIST_KIND } from "../../helpers/nostr/lists"; import EmbeddedList from "./event-types/embedded-list"; import EmbeddedArticle from "./event-types/embedded-article"; import EmbeddedBadge from "./event-types/embedded-badge"; import EmbeddedStreamMessage from "./event-types/embedded-stream-message"; -import { COMMUNITY_DEFINITION_KIND } from "../../helpers/nostr/communities"; import EmbeddedCommunity from "./event-types/embedded-community"; -import { STEMSTR_TRACK_KIND } from "../../helpers/nostr/stemstr"; -import EmbeddedStemstrTrack from "./event-types/embedded-stemstr-track"; +const EmbeddedStemstrTrack = lazy(() => import("./event-types/embedded-stemstr-track")); export type EmbedProps = { goalProps?: EmbeddedGoalOptions; diff --git a/src/views/user/index.tsx b/src/views/user/index.tsx index 5e010c4f8..5e91be384 100644 --- a/src/views/user/index.tsx +++ b/src/views/user/index.tsx @@ -1,3 +1,4 @@ +import { Suspense, useState } from "react"; import { Flex, FormControl, @@ -24,26 +25,22 @@ import { Tabs, useDisclosure, } from "@chakra-ui/react"; +import { nip19 } from "nostr-tools"; + import { Outlet, useMatches, useNavigate, useParams } from "react-router-dom"; import { useUserMetadata } from "../../hooks/use-user-metadata"; import { getUserDisplayName } from "../../helpers/user-metadata"; import { isHexKey } from "../../helpers/nip19"; import { useAppTitle } from "../../hooks/use-app-title"; -import { Suspense, useMemo, useState } from "react"; import { useReadRelayUrls } from "../../hooks/use-client-relays"; import relayScoreboardService from "../../services/relay-scoreboard"; import { RelayMode } from "../../classes/relay"; import { AdditionalRelayProvider } from "../../providers/additional-relay-context"; -import { Kind, nip19 } from "nostr-tools"; import { unique } from "../../helpers/array"; import { RelayFavicon } from "../../components/relay-favicon"; import { useUserRelays } from "../../hooks/use-user-relays"; import Header from "./components/header"; import { ErrorBoundary } from "../../components/error-boundary"; -import useUserEventKindCount from "../../hooks/use-user-event-kind-count"; -import { STREAM_KIND } from "../../helpers/nostr/stream"; -import { GOAL_KIND } from "../../helpers/nostr/goal"; -import { useMeasure } from "react-use"; const tabs = [ { label: "About", path: "about" },