import { View, Text, ScrollView, Pressable, Modal } from 'react-native'; import { SafeAreaView } from 'react-native-safe-area-context'; import { useEffect } from 'react'; export interface Artifact { id: string; type: 'markdown' | 'diff' | 'image' | 'code'; title: string; content: string; isBase64: boolean; } interface ArtifactDrawerProps { artifact: Artifact | null; onClose: () => void; } export function ArtifactDrawer({ artifact, onClose }: ArtifactDrawerProps) { useEffect(() => { if (!artifact) return; console.log('[ArtifactDrawer] Showing artifact:', artifact.id, artifact.type, artifact.title); }, [artifact]); if (!artifact) { return null; } // Decode content if base64 const content = artifact.isBase64 ? atob(artifact.content) : artifact.content; // Type badge colors const typeColors = { markdown: 'bg-blue-600', diff: 'bg-purple-600', image: 'bg-green-600', code: 'bg-orange-600', }; return ( {/* Header */} {artifact.title} {artifact.type} × {/* Content */} {artifact.type === 'image' ? ( Image viewing not yet implemented Base64 image data received ) : ( {content} )} {/* Metadata */} METADATA ID: {artifact.id} Type: {artifact.type} Encoding: {artifact.isBase64 ? 'Base64' : 'Plain text'} Size: {content.length.toLocaleString()} characters ); }