mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-09-19 12:00:32 +02:00
add simplex chat embed
This commit is contained in:
@@ -8,3 +8,5 @@ export * from "./emoji";
|
|||||||
export * from "./image";
|
export * from "./image";
|
||||||
export * from "./cashu";
|
export * from "./cashu";
|
||||||
export * from "./video";
|
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,
|
embedCashuTokens,
|
||||||
renderStemstrUrl,
|
renderStemstrUrl,
|
||||||
renderSoundCloudUrl,
|
renderSoundCloudUrl,
|
||||||
|
renderSimpleXLink,
|
||||||
|
renderRedditUrl,
|
||||||
} from "../embed-types";
|
} from "../embed-types";
|
||||||
import { LightboxProvider } from "../lightbox-provider";
|
import { LightboxProvider } from "../lightbox-provider";
|
||||||
import { renderRedditUrl } from "../embed-types/reddit";
|
|
||||||
|
|
||||||
function buildContents(event: NostrEvent | DraftNostrEvent, simpleLinks = false) {
|
function buildContents(event: NostrEvent | DraftNostrEvent, simpleLinks = false) {
|
||||||
let content: EmbedableContent = [event.content.trim()];
|
let content: EmbedableContent = [event.content.trim()];
|
||||||
@@ -36,6 +37,7 @@ function buildContents(event: NostrEvent | DraftNostrEvent, simpleLinks = false)
|
|||||||
|
|
||||||
// common
|
// common
|
||||||
content = embedUrls(content, [
|
content = embedUrls(content, [
|
||||||
|
renderSimpleXLink,
|
||||||
renderYoutubeUrl,
|
renderYoutubeUrl,
|
||||||
renderTwitterUrl,
|
renderTwitterUrl,
|
||||||
renderRedditUrl,
|
renderRedditUrl,
|
||||||
|
Reference in New Issue
Block a user