import { Text, View } from 'react-native'; import * as Clipboard from 'expo-clipboard'; import { Button } from '~/components/ui/button'; import { Card } from '~/components/ui/card'; import { DiffPreview } from './diff-preview'; type Artifact = { _id: string; content: string; contentType: string; kind: string; title: string; }; export const WorkspaceArtifacts = ({ artifacts, mode, }: { artifacts: Artifact[]; mode: 'diffs' | 'artifacts'; }) => { const diffArtifacts = artifacts.filter( (artifact) => artifact.contentType === 'text/x-diff' || artifact.kind === 'diff', ); const visible = mode === 'diffs' ? diffArtifacts : artifacts.filter((artifact) => !diffArtifacts.includes(artifact)); return ( {mode === 'diffs' ? 'Diffs' : 'Artifacts'} {visible.length ? ( visible.map((artifact) => ( {artifact.title} {mode === 'diffs' ? ( ) : ( <> {artifact.content.slice(0, 2_000)} )} )) ) : ( {mode === 'diffs' ? 'Diff artifacts will appear here when the worker records them.' : 'No non-diff artifacts recorded.'} )} ); };