diff --git a/lumina/components/KIND20Card.tsx b/lumina/components/KIND20Card.tsx index 5f7d56d..572f094 100644 --- a/lumina/components/KIND20Card.tsx +++ b/lumina/components/KIND20Card.tsx @@ -1,76 +1,65 @@ -import React from 'react'; -import { useProfile } from "nostr-react"; -import { - nip19, -} from "nostr-tools"; -import { - Card, - CardContent, - CardFooter, - CardHeader, - CardTitle, -} from "@/components/ui/card" -import { - Tooltip, - TooltipContent, - TooltipProvider, - TooltipTrigger, -} from "@/components/ui/tooltip" -import { - Carousel, - CarouselContent, - CarouselItem, - CarouselNext, - CarouselPrevious, -} from "@/components/ui/carousel" -import ReactionButton from '@/components/ReactionButton'; -import { Avatar, AvatarImage } from '@/components/ui/avatar'; -import ViewRawButton from '@/components/ViewRawButton'; -import ViewNoteButton from './ViewNoteButton'; -import Link from 'next/link'; -import ViewCopyButton from './ViewCopyButton'; -import { Event as NostrEvent } from "nostr-tools"; -import ZapButton from './ZapButton'; -import Image from 'next/image'; -import { extractDimensions } from '@/utils/utils'; +import type React from "react" +import { useProfile } from "nostr-react" +import { nip19 } from "nostr-tools" +import { Card, CardContent, CardFooter, CardHeader, CardTitle } from "@/components/ui/card" +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip" +import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "@/components/ui/carousel" +import ReactionButton from "@/components/ReactionButton" +import { Avatar, AvatarImage } from "@/components/ui/avatar" +import ViewRawButton from "@/components/ViewRawButton" +import ViewNoteButton from "./ViewNoteButton" +import Link from "next/link" +import ViewCopyButton from "./ViewCopyButton" +import type { Event as NostrEvent } from "nostr-tools" +import ZapButton from "./ZapButton" +import Image from "next/image" interface KIND20CardProps { - pubkey: string; - text: string; - image: string; - eventId: string; - tags: string[][]; - event: NostrEvent; - showViewNoteCardButton: boolean; + pubkey: string + text: string + image: string + eventId: string + tags: string[][] + event: NostrEvent + showViewNoteCardButton: boolean } -const KIND20Card: React.FC = ({ pubkey, text, image, eventId, tags, event, showViewNoteCardButton }) => { +const KIND20Card: React.FC = ({ + pubkey, + text, + image, + eventId, + tags, + event, + showViewNoteCardButton, +}) => { const { data: userData } = useProfile({ pubkey, - }); + }) - const title = userData?.username || userData?.display_name || userData?.name || userData?.npub || nip19.npubEncode(pubkey); - text = text.replaceAll('\n', ' '); - const createdAt = new Date(event.created_at * 1000); - const hrefProfile = `/profile/${nip19.npubEncode(pubkey)}`; - const profileImageSrc = userData?.picture || "https://robohash.org/" + pubkey; - - const { width, height } = extractDimensions(event); + const title = + userData?.username || userData?.display_name || userData?.name || userData?.npub || nip19.npubEncode(pubkey) + text = text.replaceAll("\n", " ") + const createdAt = new Date(event.created_at * 1000) + const hrefProfile = `/profile/${nip19.npubEncode(pubkey)}` + const profileImageSrc = userData?.picture || "https://robohash.org/" + pubkey return ( <> - + -
+
- {title} + + {title} +
@@ -81,35 +70,33 @@ const KIND20Card: React.FC = ({ pubkey, text, image, eventId, t - -
-
+ +
+
{image && ( {text} )}
-
-
- {text} -
-
-
-
- - - {showViewNoteCardButton && } -
-
- - +
+
{text}
+
+
+
+ + + {showViewNoteCardButton && } +
+
+ + +
@@ -118,7 +105,7 @@ const KIND20Card: React.FC = ({ pubkey, text, image, eventId, t - ); + ) } -export default KIND20Card; \ No newline at end of file +export default KIND20Card \ No newline at end of file