"use client"; import { useRef } from "react"; import { Dialog, DialogContent, DialogOverlay, DialogTitle, } from "@/components/ui/dialog"; import * as VisuallyHidden from "@radix-ui/react-visually-hidden"; import { useQuery } from "@tanstack/react-query"; import { Loader2, X } from "lucide-react"; import { useTRPC } from "@karakeep/shared-react/trpc"; import { ShareButton } from "./ShareButton"; import { WrappedContent } from "./WrappedContent"; interface WrappedModalProps { open: boolean; onClose: () => void; } export function WrappedModal({ open, onClose }: WrappedModalProps) { const api = useTRPC(); const contentRef = useRef(null); const { data: stats, isLoading } = useQuery( api.users.wrapped.queryOptions(undefined, { enabled: open, }), ); const { data: whoami } = useQuery( api.users.whoami.queryOptions(undefined, { enabled: open, }), ); return ( Your 2025 Wrapped
{/* Share button overlay */} {stats && !isLoading && } {/* Close button overlay */}
{/* Content */} {isLoading ? (

Loading your Wrapped...

) : stats ? ( ) : (

Failed to load your Wrapped stats

)}
); }