import { createSignal, createEffect, For, Show } from "solid-js"; export function HierarchyApp(props) { // props.state contains springs, rivers, streams, trenches, etc. // props.push is the function to push events to LiveView // props.setState can be used for local updates if needed, // but better to just use props.state and fire events. const handleSpringClick = (springId) => { // Optimistic update or just wait for server? // Let's fire event to server to fetch rivers props.push("fetch_rivers", { spring_id: springId }); // We can also update local state to show selection immediately? // But sending `setState` from parent is cleaner. // Wait, the parent hook has `setState`. // We can use a local signal for UI selection state content, // but the data (rivers) must come from server. // Actually, let's just trigger the push. // And ideally we also set activeSpringId in the store. props.setState("activeSpringId", springId); props.setState("activeRiverId", null); props.setState("activeStreamId", null); }; const handleRiverClick = (riverId) => { props.push("fetch_streams", { river_id: riverId }); props.setState("activeRiverId", riverId); // Maybe toggle expansion? }; const handleStreamClick = (streamId) => { props.push("fetch_trenches", { stream_id: streamId }); props.setState("activeStreamId", streamId); }; return (
Select a stream to start chatting
Welcome to the stream!