"use client"; import { useState } from "react"; import { type z } from "zod"; import { PageLoader } from "~/components/layout"; import Icon from "~/components/ui/icon"; import useLoading from "~/hooks/useLoading"; import { cn } from "~/lib/utils"; import { type Schema_File } from "~/types/schema"; import { Status } from "../global"; type Props = { file: z.infer; }; export default function PreviewImage({ file }: Props) { const [loaded, setLoaded] = useState(false); const [error, setError] = useState(false); const loading = useLoading(); return (
{loading ? ( ) : error ? ( ) : (
{file.name}
{file.name} setLoaded(true)} onError={(_e) => { setError(true); }} /> {/* {file.name} { console.error(e); toast.error("Failed to load image"); }} /> */}
)}
); }