import Sheet from "@/components/ui/Sheet"; import pb from "@/utility/api"; import { useQuery } from "react-query"; import loadingIllust from "@/assets/images/l9fsdoa2j7vb1.gif"; import Badge from "@/components/ui/Badge"; import Button from "@/components/ui/Button"; import { ChevronLeft } from "lucide-react"; type Props = { id?: string | null; isOpen?: boolean; onClose: () => void; }; const ViewSheet = ({ id, isOpen, onClose }: Props) => { const { data, isLoading, isError } = useQuery({ queryKey: ["artwork", id], queryFn: () => pb.collection("artworks").getOne(id || ""), enabled: !!id, }); return ( { if (!open) { onClose(); } }} title="View Item" position="bottom" className="md:rounded-t-none h-[90vh] md:h-screen" > {isLoading ? (

Please wait a moment...

) : isError || !data ? (

An error occured.

Cannot load item

) : (
{data.caption?.length > 0 ? (
{data.caption.split("\n").map((text: string, idx: number) => (

{text}

))}
) : null} Artist Name

{data.artistName}

Source {cleanUrl(data.srcUrl)}

Disclaimer:
I do not own this work of art. Please visit the original post to see more from{" "} {data.artistName} .
Let me know if this artwork needs to be removed by emailing{" "} khai@rul.sh

)}
); }; const cleanUrl = (url: string) => { return url.replace("https://", "").replace("http://", "").replace("www.", ""); }; export default ViewSheet;