Something went wrong fetching this workspace's deliverables.
);
}
function EmptyState() {
return (
No artifacts yet
Artifacts collect the reports, resumes, podcasts, presentations, and images SurfSense
creates for this workspace. Generated deliverables from your chats will appear here.
);
}
export function ArtifactsLibrary({ workspaceId }: { workspaceId: number }) {
const { artifacts, loading, error, refresh } = useLibraryArtifacts(workspaceId);
const openReportPanel = useSetAtom(openReportPanelAtom);
const [selectedMedia, setSelectedMedia] = useState(null);
const grouped = useMemo(() => {
const map = new Map();
for (const artifact of artifacts) {
const bucket = map.get(artifact.kind);
if (bucket) bucket.push(artifact);
else map.set(artifact.kind, [artifact]);
}
return map;
}, [artifacts]);
const handleOpen = (artifact: LibraryArtifact) => {
// Reports/resumes reuse the shared report panel; the rest open in the dialog.
if (artifact.kind === "report" || artifact.kind === "resume") {
openReportPanel({
reportId: artifact.entityId,
title: artifact.title,
contentType: artifact.contentType,
});
return;
}
setSelectedMedia(artifact);
};
return (