import { useEffect } from "react"; import { useNavigate, useParams } from "react-router-dom"; import { useQueryClient } from "@tanstack/react-query"; import { Lock } from "lucide-react"; import { useLiveParticle } from "@/hooks/use-particle"; import { particlePath } from "@/lib/particle-path"; import { Button } from "@/components/ui/button"; import { StreamView } from "@/features/particles/stream-view"; import { FolderView } from "@/features/particles/folder-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(); if (!networkId) throw new Error("ParticleViewResolver requires a :networkId route param"); 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...
{particle.type} particle: {particle.id}
This particle isn't available
It may have been deleted, or your access was removed.