import { useEffect } from 'react'; import { Text, View } from 'react-native'; import { HelpCircle } from 'lucide-react-native'; import type { Particle } from '@/api/types'; import { useNetwork } from '@/hooks/use-networks'; import { resolveHumanDisplay } from '@/lib/humans'; const PLACEHOLDER_DURATION_MS = 5000; interface FallbackParticleViewProps { particle: Particle; networkId: string; paused: boolean; onEnded: () => void; } // Catch-all for particle types this client version doesn't render with a // dedicated view (e.g. a folder slipping into a stream, or a future type a // newer client wrote). Known content types — media, text, task, paper, file — // each have their own view in StreamView's switch. export function FallbackParticleView({ particle, networkId, paused, onEnded, }: FallbackParticleViewProps) { const network = useNetwork(networkId); const creator = resolveHumanDisplay( particle.created_by_human_id, network?.humans, ); const Icon = HelpCircle; const title = particle.type === 'folder' ? particle.properties.name : null; useEffect(() => { if (paused) return; const timeout = setTimeout(onEnded, PLACEHOLDER_DURATION_MS); return () => clearTimeout(timeout); }, [paused, onEnded, particle.id]); return ( {particle.type} {title ? ( {title} ) : null} From {creator.displayName} View on desktop ); }