Accept pubkey for chat popup

This commit is contained in:
2023-07-26 14:38:51 +01:00
parent 648ae65059
commit 602782118d
4 changed files with 57 additions and 10 deletions

View File

@ -1,20 +1,22 @@
import "./chat-popout.css";
import { LiveChat } from "element/live-chat";
import { useParams } from "react-router-dom";
import { parseNostrLink } from "@snort/system";
import useEventFeed from "../hooks/event-feed";
import { NostrPrefix, encodeTLV, parseNostrLink } from "@snort/system";
import { useCurrentStreamFeed } from "hooks/current-stream-feed";
import { findTag } from "utils";
export function ChatPopout() {
const params = useParams();
const link = parseNostrLink(params.id!);
const { data: ev } = useEventFeed(link, true);
const ev = useCurrentStreamFeed(link, true);
const lnk = parseNostrLink(encodeTLV(NostrPrefix.Address, findTag(ev, "d") ?? "", undefined, ev?.kind, ev?.pubkey));
const chat = Boolean(new URL(window.location.href).searchParams.get("chat"));
return (
<div className={`popout-chat${chat ? "" : " embed"}`}>
<LiveChat
ev={ev}
link={link}
link={lnk}
options={{
canWrite: chat,
showHeader: false,