import { mapEventToProfile, NostrLink, TaggedNostrEvent } from "@snort/system"; import { FormattedMessage } from "react-intl"; import Icon from "@/Components/Icons/Icon"; import NostrIcon from "@/Components/Icons/Nostrich"; import KindName from "@/Components/kind-name"; import Avatar from "@/Components/User/Avatar"; import DisplayName from "@/Components/User/DisplayName"; import useAppHandler from "@/Hooks/useAppHandler"; export default function NoteAppHandler({ ev }: { ev: TaggedNostrEvent }) { const handlers = useAppHandler(ev.kind); const link = NostrLink.fromEvent(ev); const profiles = handlers.apps .filter(a => a.tags.find(b => b[0] === "web" && b[2] === "nevent")) .map(a => ({ profile: mapEventToProfile(a), event: a })) .filter(a => a.profile) .slice(0, 5); return (
, }} />
{ window.open(`nostr:${link.encode()}`, "_blank"); }}>
{profiles.map(a => (
{ const webHandler = a.event.tags.find(a => a[0] === "web" && a[2] === "nevent")?.[1]; if (webHandler) { window.open(webHandler.replace("", link.encode()), "_blank"); } }}>
))}
); }