feat: optional notice slot under composer + fix starter-suggestion crash
Add an optional `notice` prop (React.ReactNode) to AgentDockProps, rendered as quiet fine-print under the composer. Lets a host app surface a privacy / data-handling notice next to the input without the dock owning the copy. Default undefined — no change for apps that don't pass it. Also fix a latent crash: a "Try saying" starter suggestion called sendMessage(s) with a single argument, but sendMessage(display, wire) immediately does wire.trim() — clicking a suggestion threw on undefined. Pass (s, s) since a suggestion's display and wire text are identical. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -113,6 +113,11 @@ export interface AgentDockProps {
|
|||||||
hidden?: boolean;
|
hidden?: boolean;
|
||||||
/** localStorage namespace for the open/closed state. */
|
/** localStorage namespace for the open/closed state. */
|
||||||
storageKey?: string;
|
storageKey?: string;
|
||||||
|
/** Optional fine-print rendered under the composer — e.g. a privacy /
|
||||||
|
* data-handling notice. App-supplied content (the dock stays generic);
|
||||||
|
* omit for no notice. Kept visually quiet so it doesn't compete with the
|
||||||
|
* input. */
|
||||||
|
notice?: React.ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------ */
|
||||||
@@ -153,6 +158,7 @@ export function AgentDock({
|
|||||||
onExpand,
|
onExpand,
|
||||||
hidden = false,
|
hidden = false,
|
||||||
storageKey = DEFAULT_STORAGE_KEY,
|
storageKey = DEFAULT_STORAGE_KEY,
|
||||||
|
notice,
|
||||||
}: AgentDockProps) {
|
}: AgentDockProps) {
|
||||||
const [open, setOpen] = useState<boolean>(() => {
|
const [open, setOpen] = useState<boolean>(() => {
|
||||||
if (typeof window === "undefined") return false;
|
if (typeof window === "undefined") return false;
|
||||||
@@ -418,7 +424,7 @@ export function AgentDock({
|
|||||||
<li key={s}>
|
<li key={s}>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => void sendMessage(s)}
|
onClick={() => void sendMessage(s, s)}
|
||||||
disabled={sending}
|
disabled={sending}
|
||||||
className="w-full rounded-lg border border-[var(--border)] bg-[var(--chat-assistant-bg)] px-3 py-2 text-left text-sm leading-snug text-[var(--chat-assistant-fg)] transition-colors hover:border-[var(--primary)] disabled:opacity-60"
|
className="w-full rounded-lg border border-[var(--border)] bg-[var(--chat-assistant-bg)] px-3 py-2 text-left text-sm leading-snug text-[var(--chat-assistant-fg)] transition-colors hover:border-[var(--primary)] disabled:opacity-60"
|
||||||
data-action="assistant-dock-starter"
|
data-action="assistant-dock-starter"
|
||||||
@@ -504,6 +510,11 @@ export function AgentDock({
|
|||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
{notice ? (
|
||||||
|
<div className="mt-2 px-0.5 text-[11px] leading-snug text-[var(--foreground)]/50">
|
||||||
|
{notice}
|
||||||
|
</div>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user