// `zz work`'s default (non --stdio) view: activity / lanes / ladder / // protocol, built from the same TabView/LaneList/LiveLog/LadderView used // by `zz top`, plus an activity tab fed by the running work loop's // LogBuffer. import React, { useEffect, useState } from "react"; import { TabView } from "./TabView.js"; import { LaneList } from "./LaneList.js"; import { LiveLog } from "./LiveLog.js"; import { ActivityLog } from "./ActivityLog.js"; import { LadderView } from "./LadderView.js"; import { useLaneSnapshots } from "./useLaneSnapshots.js"; import { useLadderTrees } from "./useLadderTrees.js"; import { flattenEvents } from "./types.js"; import { laneListText, liveLogText, ladderText } from "./textExport.js"; import type { LogBuffer } from "./LogBuffer.js"; export function WorkApp({ agent, repos, logBuffer, statusRef, }: { agent: string; repos: { repo: string; repoDir: string; stateDir: string }[]; logBuffer: LogBuffer; statusRef: { current: string }; }) { const snapshots = useLaneSnapshots(repos); const ladders = useLadderTrees(repos); const [, forceTick] = useState(0); useEffect(() => { const id = setInterval(() => forceTick((t) => t + 1), 500); return () => clearInterval(id); }, []); return ( , getFullText: () => logBuffer.all.join("\n"), }, { label: "lanes", content: (maxRows, scrollOffset) => , getFullText: () => laneListText(snapshots) }, { label: "ladder", content: (maxRows, scrollOffset) => , getFullText: () => ladderText(ladders) }, { label: "protocol", content: (maxRows, scrollOffset) => , getFullText: () => liveLogText(flattenEvents(snapshots)), }, ]} /> ); }