add simplex chat embed

This commit is contained in:
hzrd149 2023-12-14 19:41:22 -06:00
parent e15c2a9ce8
commit 72790e94d5
3 changed files with 26 additions and 1 deletions

View File

@ -8,3 +8,5 @@ export * from "./emoji";
export * from "./image";
export * from "./cashu";
export * from "./video";
export * from "./simplex";
export * from "./reddit";

View File

@ -0,0 +1,21 @@
import { Button, Image, Link } from "@chakra-ui/react";
import { ExternalLinkIcon } from "../icons";
export function renderSimpleXLink(match: URL) {
if (match.hostname !== "simplex.chat") return null;
if (!match.pathname.startsWith("/contact")) return null;
return (
<Button
as={Link}
isExternal
rightIcon={<ExternalLinkIcon />}
leftIcon={<Image src="https://simplex.chat/img/favicon.ico" w="6" h="6" />}
href={match.toString()}
variant="outline"
colorScheme="blue"
>
SimpleX Invite
</Button>
);
}

View File

@ -24,9 +24,10 @@ import {
embedCashuTokens,
renderStemstrUrl,
renderSoundCloudUrl,
renderSimpleXLink,
renderRedditUrl,
} from "../embed-types";
import { LightboxProvider } from "../lightbox-provider";
import { renderRedditUrl } from "../embed-types/reddit";
function buildContents(event: NostrEvent | DraftNostrEvent, simpleLinks = false) {
let content: EmbedableContent = [event.content.trim()];
@ -36,6 +37,7 @@ function buildContents(event: NostrEvent | DraftNostrEvent, simpleLinks = false)
// common
content = embedUrls(content, [
renderSimpleXLink,
renderYoutubeUrl,
renderTwitterUrl,
renderRedditUrl,