import { useSetRecoilState, useResetRecoilState } from 'recoil'; import type { Artifact } from '~/common'; import FilePreview from '~/components/Chat/Input/Files/FilePreview'; import { useLocalize } from '~/hooks'; import { getFileType } from '~/utils'; import store from '~/store'; const ArtifactButton = ({ artifact }: { artifact: Artifact | null }) => { const localize = useLocalize(); const setVisible = useSetRecoilState(store.artifactsVisible); const setCurrentArtifactId = useSetRecoilState(store.currentArtifactId); const resetCurrentArtifactId = useResetRecoilState(store.currentArtifactId); if (artifact === null || artifact === undefined) { return null; } const fileType = getFileType('artifact'); return (