mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-04-01 00:19:45 +02:00
add simplex chat embed
This commit is contained in:
parent
e15c2a9ce8
commit
72790e94d5
@ -8,3 +8,5 @@ export * from "./emoji";
|
||||
export * from "./image";
|
||||
export * from "./cashu";
|
||||
export * from "./video";
|
||||
export * from "./simplex";
|
||||
export * from "./reddit";
|
||||
|
21
src/components/embed-types/simplex.tsx
Normal file
21
src/components/embed-types/simplex.tsx
Normal 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>
|
||||
);
|
||||
}
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user