diff --git a/src/app.tsx b/src/app.tsx index ae21fd0b1..bb375daff 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -28,7 +28,6 @@ import DirectMessageChatView from "./views/messages/chat"; import NostrLinkView from "./views/link"; import UserReportsTab from "./views/user/reports"; import ToolsHomeView from "./views/tools"; -import Nip19ToolsView from "./views/tools/nip19"; import UserAboutTab from "./views/user/about"; import UserLikesTab from "./views/user/likes"; import useSetColorMode from "./hooks/use-set-color-mode"; @@ -116,10 +115,7 @@ const router = createHashRouter([ { path: "profile", element: }, { path: "tools", - children: [ - { path: "", element: }, - { path: "nip19", element: }, - ], + children: [{ path: "", element: }], }, { path: "streams", diff --git a/src/components/layout/index.tsx b/src/components/layout/index.tsx index 7b0a640e4..a269034a4 100644 --- a/src/components/layout/index.tsx +++ b/src/components/layout/index.tsx @@ -7,25 +7,25 @@ import DesktopSideNav from "./desktop-side-nav"; import MobileBottomNav from "./mobile-bottom-nav"; export default function Layout({ children }: { children: React.ReactNode }) { - const showSideNav = useBreakpointValue({ base: true, md: false }); + const isMobile = useBreakpointValue({ base: true, md: false }); return ( <> - {!showSideNav && } + {!isMobile && } {children} - {showSideNav && ( + {isMobile && ( navigate("/map")} leftIcon={} justifyContent="flex-start"> Map + Github diff --git a/src/views/tools/index.tsx b/src/views/tools/index.tsx index c5609fde5..da587f64b 100644 --- a/src/views/tools/index.tsx +++ b/src/views/tools/index.tsx @@ -1,6 +1,7 @@ import { Avatar, Button, Flex, Heading, Image, Link } from "@chakra-ui/react"; import { Link as RouterLink } from "react-router-dom"; import { ToolsIcon } from "../../components/icons"; +import OpenGraphCard from "../../components/open-graph-card"; export default function ToolsHomeView() { return ( @@ -9,6 +10,15 @@ export default function ToolsHomeView() { Tools + - + diff --git a/src/views/tools/nip19.tsx b/src/views/tools/nip19.tsx deleted file mode 100644 index 8c92f854c..000000000 --- a/src/views/tools/nip19.tsx +++ /dev/null @@ -1,133 +0,0 @@ -import { - Button, - Card, - CardBody, - Code, - Flex, - FormControl, - FormErrorMessage, - FormLabel, - Heading, - Input, - useToast, -} from "@chakra-ui/react"; -import { ToolsIcon } from "../../components/icons"; -import { useForm } from "react-hook-form"; -import { RelayUrlInput } from "../../components/relay-url-input"; -import { useState } from "react"; -import { normalizeToHex } from "../../helpers/nip19"; -import { nip19 } from "nostr-tools"; -import { normalizeRelayUrl } from "../../helpers/url"; -import RawValue from "../../components/debug-modals/raw-value"; - -function EncodeForm() { - const toast = useToast(); - const { handleSubmit, register, formState, setValue } = useForm({ - mode: "onBlur", - defaultValues: { - pubkey: "", - relay: "", - }, - }); - - const [output, setOutput] = useState(""); - - const encode = handleSubmit((values) => { - try { - const pubkey = normalizeToHex(values.pubkey); - if (!pubkey) throw new Error("bad pubkey"); - const relay = normalizeRelayUrl(values.relay); - - const nprofile = nip19.nprofileEncode({ - pubkey, - relays: [relay], - }); - - setOutput(nprofile); - } catch (e) { - if (e instanceof Error) toast({ description: e.message, status: "error" }); - } - }); - - return ( - - -
- - Public key - - {formState.errors.pubkey && {formState.errors.pubkey.message}} - - - Relay url - setValue("relay", v)} - placeholder="wss://relay.example.com" - /> - {formState.errors.pubkey && {formState.errors.pubkey.message}} - - -
- {output && } -
-
- ); -} - -function DecodeForm() { - const toast = useToast(); - const { handleSubmit, register, formState, setValue } = useForm({ - mode: "onBlur", - defaultValues: { - input: "", - }, - }); - - const [output, setOutput] = useState(); - - const decode = handleSubmit((values) => { - try { - setOutput(nip19.decode(values.input)); - } catch (e) { - if (e instanceof Error) toast({ description: e.message, status: "error" }); - } - }); - - return ( - - -
- - Encoded id - - {formState.errors.input && {formState.errors.input.message}} - - -
- {output && ( - - {JSON.stringify(output, null, 2)} - - )} -
-
- ); -} - -export default function Nip19ToolsView() { - return ( - - - Nip-19 Tools - - Encode - - Decode - - - ); -}