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:
parent
821d9aee35
commit
32b5e1cd6c
@ -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 }}>
|
||||
<label style={{ display: "grid", gap: 8 }}>
|
||||
<span style={{ fontWeight: 600 }}>Workspace</span>
|
||||
<select className="input-shell" value={workspaceId} onChange={(e) => setWorkspaceId(e.target.value)}>
|
||||
{workspaces.map((w) => (
|
||||
<option key={w.id} value={w.id}>
|
||||
{w.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{workspaces.length === 0 ? (
|
||||
<p style={{ margin: 0, color: "var(--nl-text-secondary)", fontSize: "var(--nl-fs-sm)" }}>
|
||||
Create a workspace first (Dashboard seed or Workspaces), then return here.
|
||||
</p>
|
||||
) : (
|
||||
<select className="input-shell" value={workspaceId} onChange={(e) => setWorkspaceId(e.target.value)}>
|
||||
{workspaces.map((w) => (
|
||||
<option key={w.id} value={w.id}>
|
||||
{w.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
)}
|
||||
</label>
|
||||
<label style={{ display: "grid", gap: 8 }}>
|
||||
<span style={{ fontWeight: 600 }}>Question</span>
|
||||
@ -65,7 +71,12 @@ export default function ChatPage() {
|
||||
placeholder="What did we decide about launch?"
|
||||
/>
|
||||
</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"}
|
||||
</button>
|
||||
{answer ? (
|
||||
|
||||
Loading…
Reference in New Issue
Block a user