diff --git a/.changeset/fuzzy-fans-sip.md b/.changeset/fuzzy-fans-sip.md new file mode 100644 index 000000000..fe6cb47d3 --- /dev/null +++ b/.changeset/fuzzy-fans-sip.md @@ -0,0 +1,5 @@ +--- +"nostrudel": minor +--- + +Add external link for mostr notes diff --git a/src/components/note/index.tsx b/src/components/note/index.tsx index 9a5b024e9..327611f08 100644 --- a/src/components/note/index.tsx +++ b/src/components/note/index.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { useMemo } from "react"; import { Link as RouterLink } from "react-router-dom"; import moment from "moment"; import { @@ -11,6 +11,7 @@ import { CardProps, Flex, Heading, + IconButton, Link, } from "@chakra-ui/react"; import { NostrEvent } from "../../types/nostr-event"; @@ -36,6 +37,7 @@ import { ReplyButton } from "./buttons/reply-button"; import { RepostButton } from "./buttons/repost-button"; import { QuoteRepostButton } from "./buttons/quote-repost-button"; import { useReadRelayUrls } from "../../hooks/use-client-relays"; +import { ExternalLinkIcon } from "../icons"; export type NoteProps = { event: NostrEvent; @@ -51,6 +53,9 @@ export const Note = React.memo(({ event, maxHeight, variant = "outline" }: NoteP const contacts = useUserContacts(account.pubkey, readRelays); const following = contacts?.contacts || []; + // find mostr external link + const externalLink = useMemo(() => event.tags.find((t) => t[0] === "mostr"), [event]); + return ( @@ -85,6 +90,17 @@ export const Note = React.memo(({ event, maxHeight, variant = "outline" }: NoteP {showReactions && } + {externalLink && ( + } + aria-label="Open External" + href={externalLink[1]} + size="sm" + variant="link" + target="_blank" + /> + )}