"use client"
import { Suspense } from "react"
import type { Tweet } from "react-tweet/api"
import { TweetBody, enrichTweet, TweetSkeleton } from "react-tweet"
import { cn } from "@lib/utils"
import { dmSansClassName } from "@/lib/fonts"
import { PlayCircle } from "lucide-react"
function VerifiedBadge({ className }: { className?: string }) {
return (
)
}
function XLogo({ className }: { className?: string }) {
return (
)
}
function CustomTweetHeader({
tweet,
}: {
tweet: ReturnType
}) {
const user = tweet.user
const isVerified = user.verified || user.is_blue_verified
return (
{user.name}
{isVerified &&
}
@{user.screen_name}
)
}
function CustomTweetMedia({
tweet,
}: {
tweet: ReturnType
}) {
const media = tweet.mediaDetails?.[0]
if (!media) return null
const isVideo = media.type === "video" || media.type === "animated_gif"
const previewUrl = media.media_url_https
return (

{isVideo && (
)}
)
}
export function TweetPreview({
data,
noBgColor,
}: {
data: Tweet
noBgColor?: boolean
}) {
const parsedTweet = typeof data === "string" ? JSON.parse(data) : data
const tweet = enrichTweet(parsedTweet)
return (
)
}