fix(chat): empty workspace state and disabled Ask

Show guidance when the user has no workspaces and prevent submitting without a selected workspace.

Made-with: Cursor
This commit is contained in:
Saravana Achu Mac 2026-03-31 13:05:34 -07:00
parent 821d9aee35
commit 32b5e1cd6c

View File

@ -47,13 +47,19 @@ export default function ChatPage() {
<section className="surface-card" style={{ padding: "var(--nl-space-6)", display: "grid", gap: "var(--nl-space-4)", maxWidth: 720 }}> <section className="surface-card" style={{ padding: "var(--nl-space-6)", display: "grid", gap: "var(--nl-space-4)", maxWidth: 720 }}>
<label style={{ display: "grid", gap: 8 }}> <label style={{ display: "grid", gap: 8 }}>
<span style={{ fontWeight: 600 }}>Workspace</span> <span style={{ fontWeight: 600 }}>Workspace</span>
<select className="input-shell" value={workspaceId} onChange={(e) => setWorkspaceId(e.target.value)}> {workspaces.length === 0 ? (
{workspaces.map((w) => ( <p style={{ margin: 0, color: "var(--nl-text-secondary)", fontSize: "var(--nl-fs-sm)" }}>
<option key={w.id} value={w.id}> Create a workspace first (Dashboard seed or Workspaces), then return here.
{w.name} </p>
</option> ) : (
))} <select className="input-shell" value={workspaceId} onChange={(e) => setWorkspaceId(e.target.value)}>
</select> {workspaces.map((w) => (
<option key={w.id} value={w.id}>
{w.name}
</option>
))}
</select>
)}
</label> </label>
<label style={{ display: "grid", gap: 8 }}> <label style={{ display: "grid", gap: 8 }}>
<span style={{ fontWeight: 600 }}>Question</span> <span style={{ fontWeight: 600 }}>Question</span>
@ -65,7 +71,12 @@ export default function ChatPage() {
placeholder="What did we decide about launch?" placeholder="What did we decide about launch?"
/> />
</label> </label>
<button type="button" className="btn btn-primary" disabled={loading} onClick={() => void handleAsk()}> <button
type="button"
className="btn btn-primary"
disabled={loading || !workspaceId.trim() || workspaces.length === 0}
onClick={() => void handleAsk()}
>
{loading ? "Thinking…" : "Ask"} {loading ? "Thinking…" : "Ask"}
</button> </button>
{answer ? ( {answer ? (