"use client";
import useSWR from "swr";
import { DownloadButton } from "./DownloadButton";
import { getFileDownloadUrl } from "@/server/getFileDownloadUrl";
export function OutputRender(props: {
run_id: string;
filename: string;
}) {
const { data: url } = useSWR(
"run-outputs+" + props.run_id + props.filename,
async () => {
return await getFileDownloadUrl(
`outputs/runs/${props.run_id}/${props.filename}`,
);
},
);
if (!url) return <>>;
if (props.filename.endsWith(".mp4") || props.filename.endsWith(".webm")) {
return (
);
}
if (
props.filename.endsWith(".png") ||
props.filename.endsWith(".gif") ||
props.filename.endsWith(".jpg") ||
props.filename.endsWith(".jpeg")
) {
return
;
} else {
return ;
}
}