Talk to wren nodes from the chat's Control tab, opened from Home

This commit is contained in:
2026-10-05 20:59:11 +02:00
parent 14d3208a5d
commit afe0c94a24
11 changed files with 417 additions and 42 deletions
+11 -2
View File
@@ -1,5 +1,11 @@
import { createFileRoute, Outlet, redirect } from "@tanstack/react-router"
import {
createFileRoute,
Outlet,
redirect,
useRouterState,
} from "@tanstack/react-router"
import { ControlTrigger } from "@/components/Chat/ChatPanel"
import { ConnectionNotice } from "@/components/Common/ConnectionNotice"
import ErrorComponent from "@/components/Common/ErrorComponent"
import { Footer } from "@/components/Common/Footer"
@@ -31,6 +37,7 @@ function Layout() {
// Dashboards live in this shell and read live values, so the socket belongs
// here rather than only inside the editor.
useFlowSocket()
const home = useRouterState({ select: (s) => s.location.pathname === "/" })
return (
<SidebarProvider className="bg-card">
@@ -40,9 +47,11 @@ function Layout() {
served through a portal: it raises the offline notification. */}
<ConnectionNotice />
{/* The sidebar carries its own collapse control; a phone has no
sidebar on screen to carry it. */}
sidebar on screen to carry it. Home's chat sits opposite, where
the brain view has it on a wider screen. */}
<header className="sticky top-0 z-10 flex h-16 shrink-0 items-center gap-2 px-4 md:hidden">
<SidebarTrigger className="-ml-1 text-muted-foreground" />
{home ? <ControlTrigger className="-mr-1 ml-auto" /> : null}
</header>
<main className="flex-1 p-4 sm:p-6 md:p-8">
<div className="mx-auto max-w-7xl">
+8 -1
View File
@@ -2,6 +2,7 @@ import { useQuery } from "@tanstack/react-query"
import { createFileRoute } from "@tanstack/react-router"
import { useState } from "react"
import { ControlTrigger } from "@/components/Chat/ChatPanel"
import { byRecency, DashboardMosaic } from "@/components/Common/DashboardMosaic"
import { DEFAULT_RANGE } from "@/components/Common/RangePicker"
import { dashboardsQueryOptions } from "@/components/Dashboard/queries"
@@ -62,7 +63,13 @@ function Home() {
{/* Nothing wired up yet means nothing to draw, and the band would still
hold a screenful of empty space above the flows table. Node count
rather than flow count: a flow made a minute ago has none. */}
{flows.some((flow) => (flow.node_count ?? 0) > 0) ? <BrainView /> : null}
{flows.some((flow) => (flow.node_count ?? 0) > 0) ? (
<div className="relative">
<BrainView />
{/* A phone has it in the header instead, opposite the sidebar's. */}
<ControlTrigger className="absolute top-0 right-0 hidden md:inline-flex" />
</div>
) : null}
{/* One row across the full width rather than a column beside the flows:
a dashboard tile is a picture, and a picture wants to be wide. Past