52 lines
1.5 KiB
TypeScript
Raw Normal View History

2023-10-16 11:32:03 -04:00
"use client";
import Container from "./components/Container";
import { CardTitle, CardDescription } from "@/components/ui/card";
import { nip19 } from "nostr-tools";
import { toast } from "sonner";
import { copyText } from "@/lib/utils";
import { RenderText } from "../TextRendering";
import { getTagValues, getTagsValues } from "@/lib/nostr/utils";
import ReactPlayer from "react-player";
2023-10-20 15:26:55 -04:00
import { type KindCardProps } from "./";
2023-10-16 11:32:03 -04:00
2023-10-20 15:26:55 -04:00
export default function Kind30311(props: KindCardProps) {
const { pubkey, tags } = props;
2023-10-16 11:32:03 -04:00
const streamingUrl =
getTagValues("streaming", tags) ?? getTagValues("recording", tags);
const title = getTagValues("title", tags);
const summary = getTagValues("summary", tags);
const npub = nip19.npubEncode(pubkey);
return (
<Container
event={props}
2023-10-16 11:32:03 -04:00
actionOptions={[
{
label: "View profile",
href: `/${npub}`,
type: "link",
},
{
label: "Copy raw data",
type: "button",
onClick: () => {
void copyText(JSON.stringify(props));
toast.success("Copied Text!");
},
},
]}
>
2023-10-16 13:01:46 -04:00
<ReactPlayer
url={streamingUrl}
playing={true}
muted={false}
controls={true}
/>
2023-10-16 11:32:03 -04:00
<div className="border-t pt-4">
{!!title && <CardTitle className="text-base">{title}</CardTitle>}
{!!summary && <CardDescription>{summary}</CardDescription>}
</div>
</Container>
);
}