import { useParticle } from "@/hooks/use-particle"; import { StreamView } from "./stream-view"; import { FolderView } from "./folder-view"; import { ParticleListView } from "./particle-list-view"; import { isContainerType } from "@/api/types"; interface ParticleViewResolverProps { networkId: string; particleSegments: string[]; } /** * Resolves a particle by its path segments and renders the appropriate view * based on particle type. This is the extensibility point for future particle types. */ export function ParticleViewResolver({ networkId, particleSegments }: ParticleViewResolverProps) { const { particle, isLoading, error } = useParticle(networkId, particleSegments); if (isLoading) { return (

Loading...

); } if (error) { return (

Failed to load particle

); } // While the hook is stubbed, particle will be null — show a placeholder if (!particle) { return (

Particle: {particleSegments.join(" / ")}

); } switch (particle.type) { case "stream": return ; case "folder": return ; default: // For container types we haven't built a view for, fall back to list if (isContainerType(particle.type)) { return ; } // Leaf particle — placeholder return (

{particle.type} particle: {particle.id}

); } }