2023-10-14 18:57:37 -04:00
|
|
|
import Container from "./components/Container";
|
|
|
|
import { CardTitle, CardDescription } from "@/components/ui/card";
|
|
|
|
import { type Event } from "nostr-tools";
|
2023-10-15 10:58:44 -04:00
|
|
|
import { RenderText } from "../TextRendering";
|
|
|
|
import { getTagsValues } from "@/lib/nostr/utils";
|
|
|
|
import LinkCard from "@/components/LinkCard";
|
2023-10-15 11:44:15 -04:00
|
|
|
import { copyText } from "@/lib/utils";
|
|
|
|
import { nip19 } from "nostr-tools";
|
|
|
|
import { toast } from "sonner";
|
|
|
|
|
|
|
|
export default function Kind1(props: Event) {
|
|
|
|
const { content, pubkey, tags } = props;
|
2023-10-15 10:58:44 -04:00
|
|
|
const r = getTagsValues("r", tags);
|
2023-10-15 11:44:15 -04:00
|
|
|
const npub = nip19.npubEncode(pubkey);
|
|
|
|
|
2023-10-14 18:57:37 -04:00
|
|
|
return (
|
2023-10-15 11:44:15 -04:00
|
|
|
<Container
|
|
|
|
pubkey={pubkey}
|
|
|
|
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-15 10:58:44 -04:00
|
|
|
<CardDescription className="text-base text-foreground">
|
|
|
|
<RenderText text={content} />
|
2023-10-14 18:57:37 -04:00
|
|
|
</CardDescription>
|
2023-10-15 10:58:44 -04:00
|
|
|
{!!r.length && (
|
|
|
|
<div className="mt-1.5 flex flex-wrap">
|
2023-10-15 12:11:39 -04:00
|
|
|
{r.map((url, idx) => (
|
|
|
|
<LinkCard key={idx} url={url} className="max-w-[250px]" />
|
2023-10-15 10:58:44 -04:00
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
)}
|
2023-10-14 18:57:37 -04:00
|
|
|
</Container>
|
|
|
|
);
|
|
|
|
}
|