feat(web): rework layout and quality of life (#12)
- App shell: top bar with connection state and Chat/Terminal toggles, per-column scrolling, sidebar only on the Notebooks page. - Hash routes (#/notebooks/<path>, #/hosts, #/settings) so reloads and links keep the open notebook and page. - Parameters sit beside the notebook on wide screens, collapsible, with missing-count summary and Reset; non-secret values are remembered per notebook in localStorage (secrets and undeclared names never stored). - Sticky notebook header with breadcrumbs, check summary and run-all; Ctrl/Cmd+S saves the Markdown draft. - Step cards show target, one deduplicated hint for missing values and copy feedback. - Shared Dialog, Menu and CopyButton components; notebook and host actions move into menus and modal dialogs. - Hosts page as a compact list; Settings split into cards with sign out for this browser.
This commit is contained in:
@@ -12,8 +12,8 @@ const connectChat = (): ChatSocket => new WebSocket(`${location.protocol === "ht
|
||||
type Message = { role: "user" | "assistant" | "tool"; text: string; path?: string };
|
||||
|
||||
/** notebookPath and openNotebook use app paths (relative to notebooks/); the chat wire uses workspace paths. */
|
||||
export function ChatPanel({ notebookPath, openNotebook, openTerminal, connect = connectChat }: {
|
||||
notebookPath?: string; openNotebook(path: string): void; openTerminal(): void; connect?: () => ChatSocket;
|
||||
export function ChatPanel({ notebookPath, openNotebook, openTerminal, onClose, connect = connectChat }: {
|
||||
notebookPath?: string; openNotebook(path: string): void; openTerminal(): void; onClose?(): void; connect?: () => ChatSocket;
|
||||
}) {
|
||||
const [history, setHistory] = useState<ChatConversation[]>([]);
|
||||
const [selected, setSelected] = useState("");
|
||||
@@ -68,10 +68,15 @@ export function ChatPanel({ notebookPath, openNotebook, openTerminal, connect =
|
||||
setError(""); setLogin(false); setSummary(""); setAllowShell(false);
|
||||
}
|
||||
function send(message: ChatClientMessage) { try { socket.current?.send(JSON.stringify(message)); } catch { setBusy(false); setError("Cannot send chat message. Reconnect to continue."); } }
|
||||
return <aside className="chat-panel" aria-label="Chat panel">
|
||||
<h2>Chat with Claude</h2>
|
||||
<div className="actions"><button disabled={busy} onClick={() => choose("")}>New conversation</button>
|
||||
{!ready && <button onClick={() => setAttempt(n => n + 1)}>Reconnect chat</button>}</div>
|
||||
return <aside className="chat-panel side-panel" aria-label="Chat panel">
|
||||
<header className="panel-header">
|
||||
<h2>Chat with Claude</h2>
|
||||
<span className="spacer" />
|
||||
{!ready && <button onClick={() => setAttempt(n => n + 1)}>Reconnect chat</button>}
|
||||
<button disabled={busy} onClick={() => choose("")}>New conversation</button>
|
||||
{onClose && <button className="icon" aria-label="Close chat" onClick={onClose}>×</button>}
|
||||
</header>
|
||||
{notebookPath && <p className="muted">About: <code>{notebookPath}</code></p>}
|
||||
<label>Conversation history<select aria-label="Conversation history" disabled={busy} value={selected} onChange={e => choose(e.target.value)}>
|
||||
<option value="">New conversation</option>{[...history].reverse().map(c => <option key={c.id} value={c.id}>{c.title}</option>)}
|
||||
</select></label>
|
||||
|
||||
Reference in New Issue
Block a user