Merge branch 't3/claude-chat-panel'
# Conflicts: # .agents/mind/gotchas.md # packages/core/src/protocol.ts
This commit is contained in:
@@ -34,6 +34,7 @@ import type { Api } from "./api";
|
||||
import { emptySession, eventReducer, stepKey } from "./events";
|
||||
import { ParamsForm } from "./ParamsForm";
|
||||
import { StepCard } from "./StepCard";
|
||||
import { ChatPanel } from "./ChatPanel";
|
||||
const TerminalSlot = lazy(() =>
|
||||
import("./TerminalSlot").then((module) => ({ default: module.TerminalSlot })),
|
||||
);
|
||||
@@ -61,6 +62,7 @@ export function App({ api }: { api: Api }) {
|
||||
const [values, setValues] = useState<ParamValues>({});
|
||||
const [edit, setEdit] = useState(false);
|
||||
const [terminal, setTerminal] = useState(false);
|
||||
const [chat, setChat] = useState(false);
|
||||
const [terminalOpened, setTerminalOpened] = useState(false);
|
||||
const [conflict, setConflict] = useState(false);
|
||||
const [error, setError] = useState("");
|
||||
@@ -338,7 +340,7 @@ export function App({ api }: { api: Api }) {
|
||||
</main>
|
||||
);
|
||||
return (
|
||||
<div className={`app ${terminal ? "with-terminal" : ""}`}>
|
||||
<div className={`app ${terminal || chat ? "with-terminal" : ""}`}>
|
||||
<aside className="sidebar">
|
||||
<h1>
|
||||
ShellBook<span>RUNBOOKS</span>
|
||||
@@ -378,6 +380,7 @@ export function App({ api }: { api: Api }) {
|
||||
{page === "Hosts" && <p>Host management will appear here.</p>}
|
||||
<div hidden={page !== "Notebooks"}>
|
||||
<div className="toolbar">
|
||||
<button aria-expanded={chat} onClick={() => { setChat(!chat); setTerminal(false); }}>Chat</button>
|
||||
<span>{doc?.notebook.title ?? "Loading workspace…"}</span>
|
||||
<button onClick={() => setEdit(!edit)}>
|
||||
{edit ? "Close editor" : "Edit Markdown"}
|
||||
@@ -386,6 +389,7 @@ export function App({ api }: { api: Api }) {
|
||||
aria-expanded={terminal}
|
||||
onClick={() => {
|
||||
setTerminalOpened(true);
|
||||
setChat(false);
|
||||
setTerminal(!terminal);
|
||||
}}
|
||||
>
|
||||
@@ -500,6 +504,9 @@ export function App({ api }: { api: Api }) {
|
||||
)}
|
||||
</div>
|
||||
</main>
|
||||
{chat && <ChatPanel notebookPath={doc?.path} openNotebook={path => {
|
||||
if (!dirty || window.confirm("Discard unsaved edits?")) void load(path);
|
||||
}} openTerminal={() => { setChat(false); setTerminalOpened(true); setTerminal(true); }} />}
|
||||
{terminalOpened && (
|
||||
<Suspense fallback={<p>Loading terminal...</p>}>
|
||||
<TerminalSlot collapsed={!terminal} />
|
||||
|
||||
Reference in New Issue
Block a user