import Sheet from "@/components/ui/Sheet"; import useModal from "@/hooks/useModal"; 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 = { modal: ReturnType>; }; const ViewSheet = ({ modal }: Props) => { const id = modal.data; const { data, isLoading, isError } = useQuery({ queryKey: ["artwork", id], queryFn: () => pb.collection("artworks").getOne(id || ""), enabled: !!id, }); return ( {isLoading ? (

Please wait a moment...

) : isError || !data ? (

An error occured.

Cannot load item

) : (
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;