import { useParams } from "react-router-dom"; import { useLiveParticle } from "@/hooks/use-particle"; import { particlePath } from "@/lib/particle-path"; import { isContainerType } from "@/api/types"; import { StreamView } from "@/features/particles/stream-view"; import { FolderView } from "@/features/particles/folder-view"; import { ParticleListView } from "@/features/particles/particle-list-view"; /** * Route-level component for /:networkId/*. * Reads params from the router, resolves the particle, and renders * the appropriate view based on particle type. */ export default function ParticleViewResolver() { const { networkId, "*": rest } = useParams(); const segments = (rest ?? "").split("/").filter(Boolean); const path = particlePath(networkId!, segments); // path of current container particle const { particle, isLoading, error } = useLiveParticle(path); if (isLoading) { return (
Loading...
Failed to load particle
Particle: {segments.join(" / ")}
{particle.type} particle: {particle.id}