Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

feat(notes): continue the note chat in the docked sidebar (#2557)

void8e8102f0834f
diff --git a/CLAUDE.md b/CLAUDE.md
index 67ff65fbe..86b9b5ec7 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -773,9 +773,9 @@ Rows in the `actions` table (built-ins seeded from `src/helpers/builtinActions.j
- **Templates** (`kind: 'template'`) write a note's AI summary (`enhanced_content`) from its notes, meeting context, and transcript, never from the summary they replace. A template is a context (`prompt`) plus ordered `sections` (`{heading, instruction}`); `compileTemplatePrompt` wraps sections in the shared notes rules. A template without sections keeps the request it always had (the generic system prompt, or the material preamble for a standalone key). The note records the template in `enhancement_template_id` (its `client_id`), which syncs with the note, and `enhancement_prompt` the compiled system prompt
- **Actions** (`kind: 'action'`) work from the AI summary when the note has one, and from its notes and transcript otherwise (`buildNoteRunInput`). An `output` of `summary` edits that summary (`requireCompleteOutput`, never split into parts; only `enhanced_content` is written), or with no summary yet writes one from the transcript and applies the action to it, run like a template (split into parts on a local model, the material hash recorded); `chat` runs in the note chat via `SendToAIOptions.requestText` (the chat shows a built-in's call to action where it has one, otherwise the action's name, and the preamble points the model at the summary or the transcript and has it answer in the chat as text in the note's language, using a tool to draft, send or post only when the action's instructions explicitly ask to send, post or file something; the note chat's tools and attendee block otherwise apply as usual, and its transcript context names speakers only on notes known to be the user's own (`ownsNote`), never listing the unfiltered invitees)
-- The default template is the built-in Detailed Notes, shown as "AI Summary" and listed first (launch re-applies the built-in order). Invariant: compiled from its sections, it equals the flat 1.10.2 prompt it replaced, but for the closing rule on material with nothing to summarize (`test/helpers/templatePrompts.test.js`); a built-in's `previousPrompts` only upgrades rows that are still flat
-- For material with nothing substantive (only greetings, filler or recording checks), sectioned templates, Generate Notes and a summary action writing a first summary ask the model to answer `NOTHING_TO_SUMMARIZE`; custom context-only templates and flat built-ins edited before this rule keep their own rules. A reply that is the marker (bare, fenced, emphasised or after a short sentence) outside a thinking block writes nothing; a summary that merely contains it is saved, and the runner shows `notes.actions.errors.nothingToSummarize` as a neutral notice (`notice` on the error event) instead of saving a placeholder summary
-- UI: `TemplatePicker` opens from the chevron in the AI Summary tab, which names the note's template; the "Generate AI Summary" callout (runs the note's template, else the default), `ActionChips` above the ask bar (the first four actions, then All actions), a `/` menu in the note composers (`slashCommands` on `ChatInput`), the sidebar chat's quick-action pills, and `ActionManagerDialog` (Templates | Actions). A new action's output is Auto, Chat or AI summary (a saved one offers only the last two); Auto asks the note model on save (`inferActionOutput`) and stores chat or summary, falling back to chat. A run that writes the summary is undoable for 6 s instead of asking first: the runner queues the fields it overwrote (`appliedEvents`) and `BackgroundActionToastListener` shows the Undo toast
+- The default template is the built-in AI Summary (the generic prompt, stored under the old Generate Notes key `generateNotes`), listed first, then Detailed Notes (launch re-applies the built-in order). Invariant: Detailed Notes, compiled from its sections, equals the flat 1.10.2 prompt it replaced, but for the closing rule on material with nothing to summarize (`test/helpers/templatePrompts.test.js`); a built-in's `previousPrompts` only upgrades rows that are still flat
+- For material with nothing substantive (only greetings, filler or recording checks), sectioned templates, AI Summary and a summary action writing a first summary ask the model to answer `NOTHING_TO_SUMMARIZE`; custom context-only templates and flat built-ins edited before this rule keep their own rules. A reply that is the marker (bare, fenced, emphasised or after a short sentence) outside a thinking block writes nothing; a summary that merely contains it is saved, and the runner shows `notes.actions.errors.nothingToSummarize` as a neutral notice (`notice` on the error event) instead of saving a placeholder summary
+- UI: `TemplatePicker` opens from the chevron in the AI Summary tab, which names the note's template; the "Generate AI Summary" callout (runs the note's template, else the default), `ActionPicker` in the collapsed ask bar (runs the last action picked from it, in place of the send button), `ActionChips` once the in-view chat opens and in the docked chat (the first four actions, each with its action's icon, and All actions; hovering a chip shows its description; the in-view chat pins All actions at the end, and the docked chat shows them as filled pills in one tray with its composer: All actions, Generate summary, then the actions, scrolling together), a `/` menu in the note composers (`slashCommands` on `ChatInput`, each row with its action's icon, or a "/" for an icon this build doesn't know; it fills the chat above the composer until a command runs, the "/" is deleted, nothing matches or the composer loses focus), and `ActionManagerDialog` (Templates | Actions). The notes list and the docked chat widen or narrow from their edge facing the note (`useResizableWidth`, `PanelResizeHandle`), and keep their width across launches (localStorage `notesSidebarWidth`, `noteChatWidth`). Anything the ask bar sends (a message, or a chat action from the picker, a chip or the `/` menu) starts a new conversation in the docked chat, which holds the conversation and its history; the in-view chat is only the chips and the composer. A new action's output is Auto, Chat or AI summary (a saved one offers only the last two); Auto asks the note model on save (`inferActionOutput`) and stores chat or summary, falling back to chat. A run that writes the summary is undoable for 6 s instead of asking first: the runner queues the fields it overwrote (`appliedEvents`) and `BackgroundActionToastListener` shows the Undo toast
## Development Guidelines
@@ -809,7 +809,7 @@ const { t } = useTranslation();
Raster UI assets live in `src/assets/` (onboarding ones are named `onboarding-*`). Vector provider/brand marks live in `src/assets/icons/`.
-UI icons come from `src/components/icons/` (vendored Nucleo core outline components behind lucide-style names, e.g. `import { Check, Loader2 } from "../icons"`). To add one, map a name to a Nucleo label in `src/components/icons/nucleo-map.json` and run `node scripts/sync-nucleo-icons.js`; never import from `lucide-react` or a machine-local Nucleo path. Icons outside that set — the status marks and the note toolbar's formatting glyphs — are drawn by hand in `src/components/icons/primitives.tsx`, which the generated `index.ts` re-exports.
+UI icons come from `src/components/icons/` (vendored Nucleo core outline components behind lucide-style names, e.g. `import { Check, Loader2 } from "../icons"`). To add one, map a name to a Nucleo label in `src/components/icons/nucleo-map.json` and run `node scripts/sync-nucleo-icons.js`; never import from `lucide-react` or a machine-local Nucleo path. Icons outside that set — the status marks, the note toolbar's formatting glyphs, the note chat's rounded copy and "/" glyphs, and the design's action icons (`TextCursorInput`, `ListEnd`, `FolderRounded`) — are drawn by hand in `src/components/icons/primitives.tsx`, which the generated `index.ts` re-exports.
**Typography**: `--font-family-sans` is Yowza (brand, Latin only) falling back to the bundled Noto Sans; `--font-family-display` is Yowza Soft for headings. The font files are licensed and never committed — `src/brandFonts.ts` registers whatever `scripts/download-brand-fonts.js` fetched at build time, and a build without them silently uses Noto Sans.
diff --git a/scripts/sync-nucleo-icons.js b/scripts/sync-nucleo-icons.js
index 25901f3f6..e69b93021 100644
--- a/scripts/sync-nucleo-icons.js
+++ b/scripts/sync-nucleo-icons.js
@@ -90,15 +90,20 @@ export type { IconComponent, IconProps } from "./createIcon";
export {
Bold,
Circle,
+ CopyRounded,
+ FolderRounded,
Heading,
Italic,
List,
ListChecks,
+ ListEnd,
ListOrdered,
Quote,
Square,
+ SquareSlash,
Strikethrough,
Table,
+ TextCursorInput,
} from "./primitives";
${exportLines.join("\n")}
diff --git a/src/components/chat/ChatInput.tsx b/src/components/chat/ChatInput.tsx
index cd4dc5854..f360588d1 100644
--- a/src/components/chat/ChatInput.tsx
+++ b/src/components/chat/ChatInput.tsx
@@ -9,7 +9,6 @@ import { GLASS_SURFACE } from "../ui/glass";
import { useToast } from "../ui/useToast";
import { formatMmSs } from "../../utils/formatDuration";
import { useVoiceDraft } from "./useVoiceDraft";
-import { Popover, PopoverAnchor, PopoverContent } from "../ui/popover";
import SlashCommandMenu from "./SlashCommandMenu";
import { matchSlashCommands, slashOptionId, type SlashCommand } from "./slashCommands";
import type { AgentState } from "./types";
@@ -34,12 +33,15 @@ interface ChatInputProps {
draftText?: string;
onDraftChange?: (text: string) => void;
onFocus?: () => void;
- onEscape?: () => void;
+ /** Shown instead of the send or mic button while idle. */
+ trailingContent?: React.ReactNode;
focusOnIdle?: boolean;
expandOnFocus?: boolean;
expandOnFocusSize?: "standard" | "compact";
/** Offered in a menu while the draft is "/" plus an optional filter. */
slashCommands?: SlashCommand[];
+ /** The menu fills the host above the composer, so the host hides what it would cover. */
+ onSlashMenuOpenChange?: (open: boolean) => void;
}
function RecordingIndicator() {
@@ -84,11 +86,12 @@ export function ChatInput({
draftText,
onDraftChange,
onFocus,
- onEscape,
+ trailingContent,
focusOnIdle = true,
expandOnFocus = false,
expandOnFocusSize = "standard",
slashCommands,
+ onSlashMenuOpenChange,
}: ChatInputProps) {
const { t } = useTranslation();
const { toast } = useToast();
@@ -121,6 +124,12 @@ export function ChatInput({
const isVoiceRecording = voice.status === "recording";
const isVoiceTranscribing = voice.status === "transcribing";
const isCompactNote = variant === "note" && !outlined;
+ // These variants send with a 32px circle; the mic takes the same circle so the two swap in place.
+ const hasRoundSend = variant === "assistant" || variant === "note" || variant === "sidebar";
+ // These composers are 48px tall at rest with bottom-anchored controls, which these margins
+ // center on the first line: the outlined note composer, and the docked one until it expands.
+ const centersFirstLine = outlined || variant === "sidebar";
+ const rowCenter = centersFirstLine && "mb-0.5";
const isIdle = agentState === "idle";
const isListening = agentState === "listening";
@@ -137,6 +146,11 @@ export function ChatInput({
[slashCommands, isFocused, isIdle, inputText]
);
const activeSlashIndex = Math.min(slashIndex, slashMatches.length - 1);
+ const isSlashMenuOpen = slashMatches.length > 0;
+
+ useLayoutEffect(() => {
+ onSlashMenuOpenChange?.(isSlashMenuOpen);
+ }, [isSlashMenuOpen, onSlashMenuOpenChange]);
const runSlashCommand = useCallback(
(command: SlashCommand) => {
@@ -164,7 +178,7 @@ export function ChatInput({
const handleKeyDown = useCallback(
(e: React.KeyboardEvent<HTMLTextAreaElement>) => {
- if (slashMatches.length > 0 && !e.nativeEvent.isComposing) {
+ if (isSlashMenuOpen && !e.nativeEvent.isComposing) {
const step = e.key === "ArrowDown" ? 1 : e.key === "ArrowUp" ? -1 : 0;
if (step !== 0) {
e.preventDefault();
@@ -191,19 +205,12 @@ export function ChatInput({
return;
}
}
- if (e.key === "Escape" && onEscape) {
- e.preventDefault();
- e.stopPropagation();
- e.currentTarget.blur();
- onEscape();
- return;
- }
if (e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing) {
e.preventDefault();
handleSubmit();
}
},
- [handleSubmit, onEscape, slashMatches, activeSlashIndex, runSlashCommand, setInputText]
+ [handleSubmit, isSlashMenuOpen, slashMatches, activeSlashIndex, runSlashCommand, setInputText]
);
useLayoutEffect(() => {
@@ -234,48 +241,44 @@ export function ChatInput({
}, [isIdle, focusOnIdle]);
return (
- <div className={cn("shrink-0", className ?? "px-3 pb-3 pt-1")}>
- {slashCommands && (
- <Popover open={slashMatches.length > 0}>
- <PopoverAnchor virtualRef={composerRef} />
- <PopoverContent
- side="top"
- className="w-72 p-1"
- // Focus stays in the composer, which drives the menu from the keyboard.
- onOpenAutoFocus={(event) => event.preventDefault()}
- onCloseAutoFocus={(event) => event.preventDefault()}
- >
- <SlashCommandMenu
- id={slashMenuId}
- label={t("agentMode.input.commands")}
- commands={slashMatches}
- activeIndex={activeSlashIndex}
- onActiveIndexChange={setSlashIndex}
- onRun={runSlashCommand}
- />
- </PopoverContent>
- </Popover>
+ <div
+ className={cn(
+ isSlashMenuOpen ? "flex min-h-0 flex-1 flex-col" : "shrink-0",
+ className ?? "px-3 pb-3 pt-1"
+ )}
+ >
+ {isSlashMenuOpen && (
+ <SlashCommandMenu
+ id={slashMenuId}
+ label={t("agentMode.input.commands")}
+ commands={slashMatches}
+ activeIndex={activeSlashIndex}
+ onActiveIndexChange={setSlashIndex}
+ onRun={runSlashCommand}
+ />
)}
<div
ref={composerRef}
className={cn(
"flex items-center gap-2 min-h-11",
variant === "sidebar"
- ? "h-14 items-end rounded-3xl bg-background ps-4 pe-2 py-1.5 focus-within:h-40 dark:bg-surface-2"
+ ? "h-12 items-end rounded-2xl bg-background ps-3.5 pe-2 py-1.5 focus-within:h-40 dark:bg-surface-1"
: "rounded-3xl ps-4 pe-1.5 py-1.5",
isCompactNote && "h-12 overflow-hidden",
variant === "assistant"
? "min-h-12 bg-card shadow-sm dark:bg-surface-2"
: variant === "note"
? outlined
- ? "min-h-12 bg-background"
+ ? "min-h-12 bg-white/55 dark:bg-white/[0.035]"
: "min-h-12 bg-transparent"
: variant === "default" && GLASS_SURFACE,
+ // The outlined note composer draws an inset ring, which takes no room and sits where
+ // the bar's outline was, so nothing in it moves as the chat opens.
variant === "sidebar"
- ? "border border-border/80 dark:border-white/14"
+ ? "border border-black/[0.08] dark:border-white/[0.08]"
: variant === "note"
? outlined
- ? "border border-border/70 dark:border-white/14"
+ ? "border-0 ring-1 ring-inset ring-primary/20 focus-within:ring-primary/45 dark:ring-primary/25 dark:focus-within:ring-primary/50"
: "border-0"
: "border border-black/10 dark:border-white/14",
variant === "sidebar"
@@ -287,13 +290,16 @@ export function ChatInput({
? "focus-within:h-[clamp(min(18vh,7rem),var(--composer-fit-height,0px),min(36vh,14rem))]"
: "focus-within:h-[clamp(min(20vh,8rem),var(--composer-fit-height,0px),min(40vh,16rem))]"
)
- : "transition-[border-color,box-shadow] duration-200",
+ : "transition-[border-color,box-shadow,background-color] duration-200",
isIdle &&
(variant === "assistant"
? "focus-within:border-foreground/15 focus-within:ring-2 focus-within:ring-foreground/5"
: variant === "note"
? ""
- : "focus-within:border-black/15 dark:focus-within:border-white/22 focus-within:ring-[3px] focus-within:ring-primary/8")
+ : variant === "sidebar"
+ ? // The tray around it already frames it; a ring would read as a second border.
+ "focus-within:border-black/15 dark:focus-within:border-white/15"
+ : "focus-within:border-black/15 dark:focus-within:border-white/22 focus-within:ring-[3px] focus-within:ring-primary/8")
)}
>
{isListening && (
@@ -393,9 +399,9 @@ export function ChatInput({
}}
onBlur={() => setIsFocused(false)}
aria-autocomplete={slashCommands ? "list" : undefined}
- aria-controls={slashMatches.length > 0 ? slashMenuId : undefined}
+ aria-controls={isSlashMenuOpen ? slashMenuId : undefined}
aria-activedescendant={
- slashMatches.length > 0 ? slashOptionId(slashMenuId, activeSlashIndex) : undefined
+ isSlashMenuOpen ? slashOptionId(slashMenuId, activeSlashIndex) : undefined
}
// Read-only, not disabled: disabling would drop focus for the length of every reply.
readOnly={isBusy}
@@ -406,6 +412,8 @@ export function ChatInput({
variant === "default" ? "text-[13px]" : "text-sm",
"text-foreground placeholder:text-muted-foreground/70",
"min-w-0 min-h-8 max-h-32 resize-none overflow-y-auto border-0 px-0 py-1.5 leading-5",
+ // One line fills the 36px row, as the bare note composer's does.
+ outlined && "min-h-9",
(expandOnFocus || variant === "sidebar" || isCompactNote) && "min-h-0 max-h-none",
isBusy && "text-muted-foreground/70 cursor-not-allowed"
)}
@@ -419,6 +427,8 @@ export function ChatInput({
className={cn(
"flex items-center justify-center w-7 h-7 rounded-full shrink-0",
expandOnFocus && COLLAPSED_ROW_CENTER,
+ // The 28px stop's share of the same centering.
+ centersFirstLine && "mb-1",
"text-muted-foreground/70 hover:text-foreground hover:bg-foreground/8",
"focus:outline-none focus-visible:ring-1 focus-visible:ring-ring/30",
"transition-colors duration-100"
@@ -426,24 +436,29 @@ export function ChatInput({
>
<Square size={12} className="fill-current" />
</button>
+ ) : isIdle && trailingContent ? (
+ trailingContent
) : isIdle && (inputText.trim() || !voiceDraft) ? (
+ // Keyed apart from the mic, so each swap mounts a new button and replays its pop-in.
<button
+ key="send"
onClick={handleSubmit}
disabled={!inputText.trim()}
aria-label={t("agentMode.input.send")}
className={cn(
"rounded-full shrink-0",
+ rowCenter,
voiceDraft && "animate-[scale-in_0.15s_ease-out_backwards]",
"focus:outline-none focus-visible:ring-1 focus-visible:ring-ring/30",
"transition-all duration-100",
inputText.trim()
? "hover:brightness-110 active:scale-95"
- : variant === "assistant" || variant === "note" || variant === "sidebar"
+ : hasRoundSend
? "cursor-default"
: "opacity-30 saturate-0 cursor-default"
)}
>
- {variant === "assistant" || variant === "note" || variant === "sidebar" ? (
+ {hasRoundSend ? (
<span
className={cn(
"flex size-8 items-center justify-center rounded-full",
@@ -458,6 +473,7 @@ export function ChatInput({
</button>
) : isIdle ? (
<button
+ key="mic"
onClick={voice.start}
disabled={voice.streamingOnlyProvider}
aria-label={t("notes.editor.transcribe")}
@@ -467,8 +483,10 @@ export function ChatInput({
: t("notes.editor.transcribe")
}
className={cn(
- "flex items-center justify-center w-7 h-7 rounded-full shrink-0",
- expandOnFocus && COLLAPSED_ROW_CENTER,
+ "flex items-center justify-center rounded-full shrink-0",
+ hasRoundSend ? "size-8" : cn("w-7 h-7", expandOnFocus && COLLAPSED_ROW_CENTER),
+ rowCenter,
+ "animate-[scale-in_0.15s_ease-out_backwards]",
GRADIENT_CIRCLE,
"focus:outline-none focus-visible:ring-1 focus-visible:ring-ring/30",
"transition-all duration-100",
@@ -477,7 +495,7 @@ export function ChatInput({
: "hover:brightness-110 active:scale-95"
)}
>
- <Mic size={14} />
+ <Mic size={hasRoundSend ? 16 : 14} />
</button>
) : null}
</div>
diff --git a/src/components/chat/ChatMessage.tsx b/src/components/chat/ChatMessage.tsx
index fa233b326..5643d7097 100644
--- a/src/components/chat/ChatMessage.tsx
+++ b/src/components/chat/ChatMessage.tsx
@@ -1,6 +1,15 @@
import { memo, useState } from "react";
import { useTranslation } from "react-i18next";
-import { Copy, Check, Search, FileText, ChevronDown, ChevronRight, CircleAlert } from "../icons";
+import {
+ Copy,
+ CopyRounded,
+ Check,
+ Search,
+ FileText,
+ ChevronDown,
+ ChevronRight,
+ CircleAlert,
+} from "../icons";
import { cn } from "../lib/utils";
import { MarkdownRenderer } from "../ui/MarkdownRenderer";
import { TechnicalErrorDetails } from "../ui/TechnicalErrorDetails";
@@ -19,6 +28,7 @@ interface ChatMessageProps {
toolCalls?: ToolCallInfo[];
error?: MessageError;
onOpenNote?: (noteId: number) => void;
+ plain?: boolean;
}
function ToolCallStep({ toolCall }: { toolCall: ToolCallInfo }) {
@@ -187,6 +197,7 @@ export const ChatMessage = memo(function ChatMessage({
toolCalls,
error,
onOpenNote,
+ plain = false,
}: ChatMessageProps) {
const { t } = useTranslation();
const [copied, setCopied] = useState(false);
@@ -210,9 +221,10 @@ export const ChatMessage = memo(function ChatMessage({
<div
data-chat-bubble
className={cn(
- "max-w-[80%] px-3 py-2 rounded-lg rounded-ee-sm",
- "bg-primary/90 text-primary-foreground",
- "text-[13px] leading-relaxed"
+ "max-w-[80%] text-[13px] leading-relaxed",
+ plain
+ ? "rounded-2xl rounded-ee-md bg-foreground/[0.07] px-3.5 py-2 text-foreground shadow-[inset_0_1px_0_rgb(255_255_255/0.5)] dark:bg-white/[0.09] dark:shadow-[inset_0_1px_0_rgb(255_255_255/0.06)]"
+ : "rounded-lg rounded-ee-sm bg-primary/90 px-3 py-2 text-primary-foreground"
)}
>
<span dir="auto" className="whitespace-pre-wrap">
@@ -235,9 +247,10 @@ export const ChatMessage = memo(function ChatMessage({
<div
data-chat-bubble
className={cn(
- "max-w-[85%] px-3 py-2 rounded-lg rounded-es-sm",
- "bg-surface-1 border border-border/70 text-foreground",
- "text-[13px] leading-relaxed"
+ "text-[13px] leading-relaxed text-foreground",
+ plain
+ ? "max-w-full px-1 py-1"
+ : "max-w-[85%] rounded-lg rounded-es-sm border border-border/70 bg-surface-1 px-3 py-2"
)}
>
{hasToolCalls && (
@@ -297,17 +310,27 @@ export const ChatMessage = memo(function ChatMessage({
)}
{hasContent && !isStreaming && (
- <div className="flex justify-start mt-1.5 -mb-0.5">
+ <div className={cn("flex justify-start mt-1.5", !plain && "-mb-0.5")}>
<button
+ type="button"
onClick={handleCopy}
+ aria-label={t(copied ? "common.copied" : "common.copy")}
+ title={t(copied ? "common.copied" : "common.copy")}
className={cn(
- "p-1 rounded-sm",
- "text-muted-foreground/70 hover:text-foreground hover:bg-foreground/8",
- "opacity-0 group-hover/msg:opacity-100 transition-all duration-150",
+ plain
+ ? // Always there in the note chat, not only on hover.
+ "flex size-7 items-center justify-center rounded-full text-foreground/45 hover:bg-foreground/[0.07] hover:text-foreground dark:hover:bg-white/[0.08] transition-colors duration-150"
+ : "p-1 rounded-sm text-muted-foreground/70 hover:text-foreground hover:bg-foreground/8 opacity-0 group-hover/msg:opacity-100 transition-all duration-150",
"focus:outline-none focus-visible:ring-1 focus-visible:ring-ring/30"
)}
>
- {copied ? <Check size={12} className="text-emerald-500" /> : <Copy size={12} />}
+ {copied ? (
+ <Check size={plain ? 15 : 12} className="text-emerald-500" />
+ ) : plain ? (
+ <CopyRounded size={15} />
+ ) : (
+ <Copy size={12} />
+ )}
</button>
</div>
)}
diff --git a/src/components/chat/ChatMessages.tsx b/src/components/chat/ChatMessages.tsx
index 191270d99..7390c6b8e 100644
--- a/src/components/chat/ChatMessages.tsx
+++ b/src/components/chat/ChatMessages.tsx
@@ -10,6 +10,8 @@ interface ChatMessagesProps {
/** Extra classes for the message column (e.g. a page-width cap); the scroll container stays full width. */
contentClassName?: string;
scrollClassName?: string;
+ /** Replies as plain text and the user's messages in a soft pill (the note chat, floating or docked). */
+ plainBubbles?: boolean;
}
export function ChatMessages({
@@ -18,6 +20,7 @@ export function ChatMessages({
onOpenNote,
contentClassName,
scrollClassName,
+ plainBubbles = false,
}: ChatMessagesProps) {
// Follow the stream only while the user is at the bottom; scrolling up to
// re-read must not be yanked back down by the next token.
@@ -67,6 +70,7 @@ export function ChatMessages({
toolCalls={msg.toolCalls}
error={msg.error}
onOpenNote={onOpenNote}
+ plain={plainBubbles}
/>
))}
</div>
diff --git a/src/components/chat/SlashCommandMenu.tsx b/src/components/chat/SlashCommandMenu.tsx
index 0eb3041b9..6c6f3ad8a 100644
--- a/src/components/chat/SlashCommandMenu.tsx
+++ b/src/components/chat/SlashCommandMenu.tsx
@@ -1,3 +1,6 @@
+import { useEffect, useRef } from "react";
+import { useTranslation } from "react-i18next";
+import { ChevronDown, ChevronUp, CornerDownLeft } from "../icons";
import { cn } from "../lib/utils";
import { slashOptionId, type SlashCommand } from "./slashCommands";
@@ -10,6 +13,14 @@ interface SlashCommandMenuProps {
onRun: (command: SlashCommand) => void;
}
+function Key({ children }: { children: React.ReactNode }) {
+ return (
+ <kbd className="inline-flex h-5 min-w-5 items-center justify-center rounded-md bg-foreground/[0.07] px-1 font-sans text-[10px] font-medium text-foreground/65 shadow-[inset_0_-1px_0_rgb(0_0_0/0.08)] dark:bg-white/[0.08]">
+ {children}
+ </kbd>
+ );
+}
+
/** The command list the composer drives from its keyboard while its draft starts with "/". */
export default function SlashCommandMenu({
id,
@@ -19,37 +30,109 @@ export default function SlashCommandMenu({
onActiveIndexChange,
onRun,
}: SlashCommandMenuProps) {
+ const { t } = useTranslation();
+ const activeRef = useRef<HTMLButtonElement>(null);
+
+ // Arrow keys and a narrowing filter can leave the highlighted row out of view.
+ useEffect(() => {
+ activeRef.current?.scrollIntoView({ block: "nearest" });
+ }, [activeIndex, commands]);
+
return (
- <div id={id} role="listbox" aria-label={label} className="flex flex-col">
- {commands.map((command, index) => (
- <button
- key={command.id}
- id={slashOptionId(id, index)}
- type="button"
- role="option"
- aria-selected={index === activeIndex}
- aria-disabled={command.disabled}
- tabIndex={-1}
- // Keep focus in the composer.
- onMouseDown={(event) => event.preventDefault()}
- onClick={() => onRun(command)}
- onMouseEnter={() => onActiveIndexChange(index)}
- className={cn(
- "flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-start text-xs text-foreground/70 transition-colors",
- index === activeIndex && "bg-foreground/5 text-foreground",
- command.disabled ? "cursor-default opacity-40" : "cursor-pointer"
- )}
- >
- <span dir="auto" className="min-w-0 flex-1 truncate font-medium">
- {command.label}
- </span>
- {command.hint && (
- <span className="shrink-0 rounded bg-foreground/5 px-1 py-px text-[10px] font-medium text-muted-foreground/70 dark:bg-white/6">
- {command.hint}
- </span>
- )}
- </button>
- ))}
+ <div
+ // Keep focus in the composer, wherever the press lands.
+ onMouseDown={(event) => event.preventDefault()}
+ // Rows line up with the draft's text.
+ className="flex min-h-0 flex-1 flex-col px-1.5 pt-2.5 animate-[fade-in-up_0.2s_ease-out] motion-reduce:animate-none"
+ >
+ {/* The keys the composer answers to while the menu is open. */}
+ <div
+ aria-hidden="true"
+ className="flex shrink-0 items-center gap-4 px-2.5 pb-2 text-[11px] text-muted-foreground/80"
+ >
+ <span className="flex items-center gap-1.5">
+ <Key>
+ <ChevronUp size={10} />
+ </Key>
+ <Key>
+ <ChevronDown size={10} />
+ </Key>
+ {t("agentMode.input.slashNavigate")}
+ </span>
+ <span className="flex items-center gap-1.5">
+ <Key>
+ <CornerDownLeft size={10} />
+ </Key>
+ {t("agentMode.input.slashSelect")}
+ </span>
+ <span className="ms-auto flex items-center gap-1.5">
+ <Key>esc</Key>
+ {t("agentMode.input.slashClose")}
+ </span>
+ </div>
+ <div
+ id={id}
+ role="listbox"
+ aria-label={label}
+ // A scrolling list is otherwise a tab stop, and Shift+Tab into it would close it.
+ tabIndex={-1}
+ // The end padding leaves room for the highlighted row's nudge.
+ className="flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto pe-1 pb-2"
+ >
+ {commands.map((command, index) => {
+ const isActive = index === activeIndex;
+ return (
+ <button
+ key={command.id}
+ ref={isActive ? activeRef : undefined}
+ id={slashOptionId(id, index)}
+ type="button"
+ role="option"
+ aria-selected={isActive}
+ aria-disabled={command.disabled}
+ tabIndex={-1}
+ onClick={() => onRun(command)}
+ // Move, not enter: rows sliding under a resting pointer as the list filters or
+ // scrolls mustn't change which command Enter runs.
+ onMouseMove={() => onActiveIndexChange(index)}
+ style={{ animationDelay: `${Math.min(index, 8) * 25}ms` }}
+ className={cn(
+ "flex w-full shrink-0 items-center gap-3 rounded-xl px-2.5 py-2 text-start text-xs",
+ "transition-[background-color,color,translate] duration-200 ease-out",
+ "animate-[fade-in-up_0.3s_cubic-bezier(0.22,1,0.36,1)_backwards] motion-reduce:animate-none",
+ isActive
+ ? "translate-x-1 bg-foreground/[0.07] text-foreground rtl:-translate-x-1 dark:bg-white/[0.08]"
+ : "text-foreground/70",
+ command.disabled ? "cursor-default opacity-40" : "cursor-pointer"
+ )}
+ >
+ <span
+ className={cn(
+ "flex size-8 shrink-0 items-center justify-center rounded-lg transition-colors duration-200",
+ isActive ? "bg-foreground/10 dark:bg-white/[0.12]" : "bg-foreground/[0.06]"
+ )}
+ >
+ <command.icon size={15} className="text-primary" />
+ </span>
+ <span className="flex min-w-0 flex-1 flex-col gap-0.5">
+ <span dir="auto" className="truncate text-[13px] font-medium">
+ {command.label}
+ </span>
+ {command.description && (
+ <span dir="auto" className="truncate text-muted-foreground/70">
+ {command.description}
+ </span>
+ )}
+ </span>
+ {command.hint && (
+ <span className="shrink-0 rounded bg-foreground/5 px-1 py-px text-[10px] font-medium text-muted-foreground/70 dark:bg-white/6">
+ {command.hint}
+ </span>
+ )}
+ </button>
+ );
+ })}
+ </div>
</div>
);
}
diff --git a/src/components/chat/slashCommands.ts b/src/components/chat/slashCommands.ts
index 201f16e3f..a9f70a799 100644
--- a/src/components/chat/slashCommands.ts
+++ b/src/components/chat/slashCommands.ts
@@ -1,8 +1,13 @@
+import type { IconComponent } from "../icons";
+
export interface SlashCommand {
id: string;
label: string;
+ /** Drawn in the row's tile. */
+ icon: IconComponent;
/** A short tag after the label, such as where the command's output goes. */
hint?: string;
+ description?: string;
disabled?: boolean;
run: () => void;
}
@@ -11,7 +16,7 @@ export interface SlashCommand {
* The commands a draft of "/" (or the full-width "/" a CJK input method types)
* plus a filter asks for, none when it isn't one.
* Labels with a word starting with the filter come first, so "/s" offers
- * "Shorten" before "Make to-dos"; any other match still counts, since labels
+ * "Shorten" before "Create to-dos"; any other match still counts, since labels
* in languages written without spaces have no words to start.
*/
export function matchSlashCommands(commands: SlashCommand[], draft: string): SlashCommand[] {
diff --git a/src/components/icons/index.ts b/src/components/icons/index.ts
index 01d9cfc3d..8aa6cb463 100644
--- a/src/components/icons/index.ts
+++ b/src/components/icons/index.ts
@@ -6,15 +6,20 @@ export type { IconComponent, IconProps } from "./createIcon";
export {
Bold,
Circle,
+ CopyRounded,
+ FolderRounded,
Heading,
Italic,
List,
ListChecks,
+ ListEnd,
ListOrdered,
Quote,
Square,
+ SquareSlash,
Strikethrough,
Table,
+ TextCursorInput,
} from "./primitives";
export const AlertCircle = createIcon("alert-circle", Nucleo.CircleWarningOutline24);
@@ -114,7 +119,6 @@ export const NotebookPen = createIcon("notebook-pen", Nucleo.NotebookOutline24);
export const PanelLeftClose = createIcon("panel-left-close", Nucleo.LayoutLeftOutline24);
export const PanelLeftOpen = createIcon("panel-left-open", Nucleo.LayoutLeftOutline24);
export const PanelRight = createIcon("panel-right", Nucleo.LayoutRightOutline24);
-export const PanelRightClose = createIcon("panel-right-close", Nucleo.SidebarRightOutline24);
export const Pencil = createIcon("pencil", Nucleo.PencilOutline24);
export const Play = createIcon("play", Nucleo.MediaPlayOutline24);
export const Plus = createIcon("plus", Nucleo.PlusOutline24);
diff --git a/src/components/icons/nucleo-map.json b/src/components/icons/nucleo-map.json
index 4bbd912d1..ffbafb60c 100644
--- a/src/components/icons/nucleo-map.json
+++ b/src/components/icons/nucleo-map.json
@@ -96,7 +96,6 @@
"PanelLeftClose": "layout-left",
"PanelLeftOpen": "layout-left",
"PanelRight": "layout-right",
- "PanelRightClose": "sidebar-right",
"Pencil": "pencil",
"Play": "media-play",
"Plus": "plus",
diff --git a/src/components/icons/nucleo/SidebarRightOutline24.tsx b/src/components/icons/nucleo/SidebarRightOutline24.tsx
deleted file mode 100644
index 77bedf52e..000000000
--- a/src/components/icons/nucleo/SidebarRightOutline24.tsx
+++ /dev/null
@@ -1,46 +0,0 @@
-import type { SVGProps } from "react";
-
-export type SidebarRightOutline24Props = SVGProps<SVGSVGElement> & {
- strokeWidth?: number | string;
- corners?: "round" | "square";
-};
-
-export function SidebarRightOutline24({
- strokeWidth = 2,
- corners = "round",
- ...props
-}: SidebarRightOutline24Props) {
- return (
- <svg xmlns="http://www.w3.org/2000/svg" width={24} height={24} viewBox="0 0 24 24" {...props}>
- <line
- x1="15"
- y1="4"
- x2="15"
- y2="20"
- fill="none"
- stroke="currentColor"
- strokeMiterlimit="10"
- strokeWidth={strokeWidth}
- data-color="color-2"
- data-cap="butt"
- strokeLinejoin={corners === "round" ? "round" : "miter"}
- strokeLinecap={corners === "round" ? "round" : "butt"}
- ></line>
- <rect
- x="4"
- y="2"
- width={16}
- height={20}
- rx="2"
- ry="2"
- transform="translate(24) rotate(90)"
- fill="none"
- stroke="currentColor"
- strokeMiterlimit="10"
- strokeWidth={strokeWidth}
- strokeLinejoin={corners === "round" ? "round" : "miter"}
- strokeLinecap={corners === "round" ? "round" : "square"}
- ></rect>
- </svg>
- );
-}
diff --git a/src/components/icons/nucleo/index.ts b/src/components/icons/nucleo/index.ts
index 449ee45fa..b775ac2d4 100644
--- a/src/components/icons/nucleo/index.ts
+++ b/src/components/icons/nucleo/index.ts
@@ -99,7 +99,6 @@ export { ServerOutline24 } from "./ServerOutline24";
export { ShareRight2Outline24 } from "./ShareRight2Outline24";
export { ShieldCheckOutline24 } from "./ShieldCheckOutline24";
export { ShieldOutline24 } from "./ShieldOutline24";
-export { SidebarRightOutline24 } from "./SidebarRightOutline24";
export { Sliders2Outline24 } from "./Sliders2Outline24";
export { Sliders2VerticalOutline24 } from "./Sliders2VerticalOutline24";
export { SparkleOutline24 } from "./SparkleOutline24";
diff --git a/src/components/icons/primitives.tsx b/src/components/icons/primitives.tsx
index ce49c54db..070b2cb53 100644
--- a/src/components/icons/primitives.tsx
+++ b/src/components/icons/primitives.tsx
@@ -40,8 +40,9 @@ function SquareMark({ strokeWidth = 2, ...props }: MarkProps) {
);
}
-// The note editor's formatting glyphs, drawn to the same 24px grid as the
-// vendored Nucleo outline set (2px stroke, round caps, 3–21 bounds).
+// Glyphs Nucleo lacks (the note editor's formatting marks, a slash command),
+// drawn to the same 24px grid as the vendored Nucleo outline set (2px stroke,
+// round caps, 3–21 bounds).
const glyph = (children: SVGProps<SVGSVGElement>["children"]) =>
function Glyph({ strokeWidth = 2, ...props }: MarkProps) {
return (
@@ -136,6 +137,46 @@ const QuoteMark = glyph(
</>
);
+const SquareSlashMark = glyph(
+ <>
+ <rect x="3" y="3" width="18" height="18" rx="4" />
+ <path d="M14.5 7.5l-5 9" />
+ </>
+);
+
+// Copy, in the same soft-cornered squares as SquareSlash.
+const CopyRoundedMark = glyph(
+ <>
+ <rect x="8.5" y="8.5" width="12.5" height="12.5" rx="3.5" />
+ <path d="M15.5 8.5V6.5A3.5 3.5 0 0 0 12 3H6.5A3.5 3.5 0 0 0 3 6.5V12a3.5 3.5 0 0 0 3.5 3.5h2" />
+ </>
+);
+
+// The docked note chat's pills, drawn from the design's own icons (Lucide's shapes).
+const FolderRoundedMark = glyph(
+ <path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z" />
+);
+
+const ListEndMark = glyph(
+ <>
+ <path d="M16 12H3" />
+ <path d="M16 6H3" />
+ <path d="M10 18H3" />
+ <path d="M21 6v10a2 2 0 0 1-2 2h-5" />
+ <path d="m16 20-2-2 2-2" />
+ </>
+);
+
+const TextCursorInputMark = glyph(
+ <>
+ <path d="M5 4h1a3 3 0 0 1 3 3 3 3 0 0 1 3-3h1" />
+ <path d="M9 7v10" />
+ <path d="M13 20h-1a3 3 0 0 1-3-3 3 3 0 0 1-3 3H5" />
+ <path d="M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1" />
+ <path d="M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7" />
+ </>
+);
+
const TableMark = glyph(
<>
<rect x="3" y="4" width="18" height="16" rx="2" />
@@ -147,12 +188,17 @@ const TableMark = glyph(
export const Circle = createIcon("circle", CircleMark);
export const Square = createIcon("square", SquareMark);
+export const SquareSlash = createIcon("square-slash", SquareSlashMark);
export const Bold = createIcon("bold", BoldMark);
+export const CopyRounded = createIcon("copy-rounded", CopyRoundedMark);
+export const FolderRounded = createIcon("folder-rounded", FolderRoundedMark);
export const Heading = createIcon("heading", HeadingMark);
export const Italic = createIcon("italic", ItalicMark);
export const List = createIcon("list", ListMark);
export const ListChecks = createIcon("list-checks", ListChecksMark);
+export const ListEnd = createIcon("list-end", ListEndMark);
export const ListOrdered = createIcon("list-ordered", ListOrderedMark);
export const Quote = createIcon("quote", QuoteMark);
export const Strikethrough = createIcon("strikethrough", StrikethroughMark);
export const Table = createIcon("table", TableMark);
+export const TextCursorInput = createIcon("text-cursor-input", TextCursorInputMark);
diff --git a/src/components/notes/ActionChips.tsx b/src/components/notes/ActionChips.tsx
index a5c3aae1e..c397917be 100644
--- a/src/components/notes/ActionChips.tsx
+++ b/src/components/notes/ActionChips.tsx
@@ -1,102 +1,166 @@
+import { useState } from "react";
import { useTranslation } from "react-i18next";
-import { Blocks, Settings2, Sparkles, MessageSquareText } from "../icons";
-import {
- DropdownMenu,
- DropdownMenuTrigger,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuSeparator,
-} from "../ui/dropdown-menu";
+import { Blocks, TextCursorInput } from "../icons";
+import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent } from "../ui/dropdown-menu";
+import { cn } from "../lib/utils";
import { getActionName, getActionDescription } from "../../stores/actionStore";
import type { ActionItem } from "../../types/electron";
-import { ASK_PILL_CLASS } from "./shared";
+import ActionMenuItems, { ActionOutputBadge, type ActionMenuItemsProps } from "./ActionMenuItems";
import { getActionIcon } from "./actionIcons";
const VISIBLE_CHIPS = 4;
-interface ActionChipsProps {
- /** Actions only; templates have their own picker. */
- actions: ActionItem[];
- canRun: (action: ActionItem) => boolean;
- onRunAction: (action: ActionItem) => void;
- onManageActions: () => void;
+const CHIP_CLASS = cn(
+ "inline-flex h-7 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-2.5 text-xs text-foreground/60",
+ // A disabled chip still takes the pointer, so moving onto one moves the card to it.
+ "enabled:hover:bg-foreground/[0.07] enabled:hover:text-foreground disabled:cursor-default disabled:text-foreground/30 disabled:[&_svg]:opacity-40 dark:enabled:hover:bg-white/[0.08]",
+ "transition-colors duration-150 focus:outline-none focus-visible:bg-foreground/6 focus-visible:text-foreground",
+ "animate-[fade-in-up_0.32s_cubic-bezier(0.22,1,0.36,1)_backwards] motion-reduce:animate-none"
+);
+
+// The docked chat's tray: filled pills on the tray.
+const DOCKED_CHIP_CLASS = cn(
+ CHIP_CLASS,
+ "bg-background text-foreground/70 dark:bg-surface-1",
+ "enabled:hover:bg-surface-3 focus-visible:bg-surface-3 dark:enabled:hover:bg-surface-2 dark:focus-visible:bg-surface-2"
+);
+
+const CHIP_ICON_CLASS = "shrink-0 text-primary";
+
+const chipEntrance = (index: number) => ({ animationDelay: `${140 + index * 40}ms` });
+
+interface ActionChipsProps extends ActionMenuItemsProps {
+ /** The docked chat's look: filled pills on its tray. */
+ docked?: boolean;
+ /** A first pill that writes the note's AI summary; absent when the note has no template to run. */
+ generateSummary?: { run: () => void; disabled: boolean };
}
-/** The first actions as one-click chips, then every action behind "All actions". */
+/**
+ * The first actions as one-click chips, and every action behind "All actions": at the end of
+ * the row, or at its start in the docked chat.
+ * A hovered or focused chip shows what its action does above the row.
+ */
export default function ActionChips({
actions,
canRun,
onRunAction,
onManageActions,
+ docked = false,
+ generateSummary,
}: ActionChipsProps) {
const { t } = useTranslation();
+ const [previewed, setPreviewed] = useState<ActionItem | null>(null);
+ const description = previewed && getActionDescription(previewed, t);
+ const chipClass = docked ? DOCKED_CHIP_CLASS : CHIP_CLASS;
+ const PreviewedIcon = previewed && getActionIcon(previewed);
+ // Docked, All actions leads the row and scrolls with the chips, opening toward them.
+ const firstChip = (docked ? 1 : 0) + (generateSummary ? 1 : 0);
+ const allActions = (
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <button
+ type="button"
+ onPointerEnter={() => setPreviewed(null)}
+ className={chipClass}
+ style={chipEntrance(docked ? 0 : firstChip + Math.min(actions.length, VISIBLE_CHIPS))}
+ >
+ <Blocks size={14} className={CHIP_ICON_CLASS} />
+ {t("notes.actions.allActions")}
+ </button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent
+ align={docked ? "start" : "end"}
+ side="top"
+ sideOffset={8}
+ // The docked chat sits 24px in from the window's edge; the menu stays inside that too.
+ collisionPadding={docked ? 24 : undefined}
+ className="min-w-48"
+ >
+ <ActionMenuItems
+ actions={actions}
+ canRun={canRun}
+ onRunAction={onRunAction}
+ onManageActions={onManageActions}
+ />
+ </DropdownMenuContent>
+ </DropdownMenu>
+ );
return (
- <div className="scrollbar-hidden flex items-center justify-center-safe gap-1.5 overflow-x-auto">
- {actions.slice(0, VISIBLE_CHIPS).map((action) => {
- const Icon = getActionIcon(action);
- return (
- <button
- key={action.id}
- type="button"
- // Keep focus in the composer, so an open chat can take a follow-up right away.
- onMouseDown={(event) => event.preventDefault()}
- onClick={() => onRunAction(action)}
- disabled={!canRun(action)}
- className={ASK_PILL_CLASS}
- >
- <Icon size={11} className="shrink-0 text-foreground/45" />
- <span dir="auto">{getActionName(action, t)}</span>
- </button>
- );
- })}
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <button type="button" className={ASK_PILL_CLASS}>
- <Blocks size={11} className="shrink-0 text-foreground/45" />
- {t("notes.actions.allActions")}
- </button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="start" side="top" sideOffset={8} className="min-w-48">
- {actions.map((action) => {
- const editsSummary = action.output === "summary";
- const OutputIcon = editsSummary ? Sparkles : MessageSquareText;
+ <div className="relative">
+ {previewed && (
+ <div className="pointer-events-none absolute bottom-full start-0 z-10 mb-2 flex w-full max-w-md items-center gap-3 rounded-2xl border border-black/[0.06] bg-popover p-3 shadow-(--shadow-chat-card) animate-[fade-in-up_0.18s_ease-out] motion-reduce:animate-none dark:border-white/10">
+ <span className="flex size-9 shrink-0 items-center justify-center rounded-lg bg-foreground/6">
+ {PreviewedIcon && <PreviewedIcon size={16} className="text-primary" />}
+ </span>
+ <span className="min-w-0 flex-1">
+ <span dir="auto" className="block truncate text-sm font-medium text-foreground">
+ {getActionName(previewed, t)}
+ </span>
+ {description && (
+ <span dir="auto" className="block truncate text-xs text-muted-foreground">
+ {description}
+ </span>
+ )}
+ </span>
+ <ActionOutputBadge action={previewed} />
+ </div>
+ )}
+ {/* Left as a row, so moving between chips swaps the card instead of replaying it. */}
+ <div onPointerLeave={() => setPreviewed(null)} className="flex items-center gap-1">
+ {/* In the in-view chat only the chips scroll, so All actions at the end stays in reach. */}
+ <div
+ className={cn(
+ "scrollbar-hidden flex min-w-0 flex-1 items-center overflow-x-auto pe-6",
+ docked ? "gap-1.5" : "gap-1",
+ "[mask-image:linear-gradient(to_right,#000_calc(100%_-_1.5rem),transparent)] rtl:[mask-image:linear-gradient(to_left,#000_calc(100%_-_1.5rem),transparent)]"
+ )}
+ >
+ {docked && allActions}
+ {generateSummary && (
+ <button
+ type="button"
+ onMouseDown={(event) => event.preventDefault()}
+ onClick={generateSummary.run}
+ onPointerEnter={() => setPreviewed(null)}
+ disabled={generateSummary.disabled}
+ className={chipClass}
+ style={chipEntrance(docked ? 1 : 0)}
+ >
+ <TextCursorInput size={14} className={CHIP_ICON_CLASS} />
+ {t("embeddedChat.generateSummary")}
+ </button>
+ )}
+ {actions.slice(0, VISIBLE_CHIPS).map((action, index) => {
+ const Icon = getActionIcon(action);
return (
- <DropdownMenuItem
+ <button
key={action.id}
- onClick={() => onRunAction(action)}
+ type="button"
+ // Keep focus in the composer, so an open chat can take a follow-up right away.
+ onMouseDown={(event) => event.preventDefault()}
+ // Running it disables the chips, so the card would otherwise sit over the reply.
+ onClick={() => {
+ setPreviewed(null);
+ onRunAction(action);
+ }}
+ // Pointer, not mouse: React drops mouse events on disabled buttons.
+ onPointerEnter={() => setPreviewed(action)}
+ onFocus={() => setPreviewed(action)}
+ onBlur={() => setPreviewed(null)}
disabled={!canRun(action)}
- className="text-xs gap-2.5 rounded-md px-2.5 py-1.5"
+ className={chipClass}
+ style={chipEntrance(firstChip + index)}
>
- <OutputIcon size={12} className="text-accent/50 shrink-0" />
- <div className="flex-1 min-w-0">
- <div className="flex items-center gap-1.5">
- <span dir="auto" className="font-medium truncate">
- {getActionName(action, t)}
- </span>
- <span className="text-[10px] font-medium px-1 py-px rounded bg-foreground/5 dark:bg-white/6 text-muted-foreground/70 shrink-0">
- {t(
- editsSummary ? "notes.actions.output.summary" : "notes.actions.output.chat"
- )}
- </span>
- </div>
- <div className="text-xs text-muted-foreground/70 truncate">
- {getActionDescription(action, t)}
- </div>
- </div>
- </DropdownMenuItem>
+ <Icon size={14} className={CHIP_ICON_CLASS} />
+ <span dir="auto">{getActionName(action, t)}</span>
+ </button>
);
})}
- <DropdownMenuSeparator />
- <DropdownMenuItem
- onClick={onManageActions}
- className="text-xs gap-2.5 rounded-md px-2.5 py-1.5 text-muted-foreground/70"
- >
- <Settings2 size={12} />
- {t("notes.actions.manage")}
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
+ </div>
+ {!docked && allActions}
+ </div>
</div>
);
}
diff --git a/src/components/notes/ActionManagerDialog.tsx b/src/components/notes/ActionManagerDialog.tsx
index 3e6d0ef2a..56cd1f629 100644
--- a/src/components/notes/ActionManagerDialog.tsx
+++ b/src/components/notes/ActionManagerDialog.tsx
@@ -195,11 +195,11 @@ export default function ActionManagerDialog({
return (
<Dialog open={open} onOpenChange={onOpenChange}>
- <DialogContent className="sm:max-w-3xl p-0 gap-0 overflow-hidden">
+ <DialogContent className="sm:max-w-4xl p-0 gap-0 overflow-hidden">
{/* Hidden accessible title */}
<DialogTitle className="sr-only">{t("notes.templates.managerTitle")}</DialogTitle>
- <div className="flex h-120">
+ <div className="flex h-[min(44rem,85vh)]">
{/* Left panel — template/action list */}
<div
// Auto can take a moment on save; switching away then would drop the new draft.
@@ -216,7 +216,7 @@ export default function ActionManagerDialog({
onValueChange={(value) => showKind(value as ActionKind)}
className="flex-1 min-w-0"
>
- <TabsList className="h-7 w-full p-0.5">
+ <TabsList className="h-7 w-full px-1 py-0.5">
<TabsTrigger value="template" className="flex-1 px-2 py-0.5 text-xs">
{t("notes.templates.tab")}
</TabsTrigger>
@@ -374,7 +374,7 @@ export default function ActionManagerDialog({
</div>
{/* Editor form */}
- <div className="flex-1 overflow-y-auto px-5 py-4 space-y-3">
+ <div className="flex flex-1 flex-col overflow-y-auto px-5 py-4 space-y-3">
<Input
dir="auto"
ref={nameInputRef}
@@ -405,7 +405,7 @@ export default function ActionManagerDialog({
value={output}
onValueChange={(value) => setOutput(value as ActionOutput | "auto")}
>
- <TabsList className="h-8 p-0.5">
+ <TabsList className="h-8 px-1 py-0.5">
{/* A saved action keeps the output it was given, so Auto is for new ones. */}
{editingId === null && (
<TabsTrigger value="auto" className="px-3 py-1 text-xs">
@@ -427,7 +427,7 @@ export default function ActionManagerDialog({
)}
{/* Prompt — a template's context, or what an action does */}
- <div className="flex flex-col flex-1 space-y-1.5 min-h-0">
+ <div className="flex flex-col flex-1 space-y-1.5">
<label className="text-xs font-medium text-foreground/50">
{t(isTemplate ? "notes.templates.contextLabel" : "notes.actions.promptLabel")}
</label>
diff --git a/src/components/notes/ActionMenuItems.tsx b/src/components/notes/ActionMenuItems.tsx
new file mode 100644
index 000000000..f24ad7865
--- /dev/null
+++ b/src/components/notes/ActionMenuItems.tsx
@@ -0,0 +1,73 @@
+import { useTranslation } from "react-i18next";
+import { Settings2 } from "../icons";
+import { DropdownMenuItem, DropdownMenuSeparator } from "../ui/dropdown-menu";
+import { getActionName, getActionDescription } from "../../stores/actionStore";
+import type { ActionItem } from "../../types/electron";
+import { getActionIcon } from "./actionIcons";
+
+export interface ActionMenuItemsProps {
+ /** Actions only; templates have their own picker. */
+ actions: ActionItem[];
+ canRun: (action: ActionItem) => boolean;
+ onRunAction: (action: ActionItem) => void;
+ onManageActions: () => void;
+}
+
+/** Where an action's output goes: the note's chat or its AI summary. */
+export function ActionOutputBadge({ action }: { action: ActionItem }) {
+ const { t } = useTranslation();
+ return (
+ <span className="text-[10px] font-medium px-1 py-px rounded bg-foreground/5 dark:bg-white/6 text-muted-foreground/70 shrink-0">
+ {t(
+ action.output === "summary" ? "notes.actions.output.summary" : "notes.actions.output.chat"
+ )}
+ </span>
+ );
+}
+
+/** Every action with where its output goes, then Manage Actions, as a dropdown's items. */
+export default function ActionMenuItems({
+ actions,
+ canRun,
+ onRunAction,
+ onManageActions,
+}: ActionMenuItemsProps) {
+ const { t } = useTranslation();
+
+ return (
+ <>
+ {actions.map((action) => {
+ const Icon = getActionIcon(action);
+ return (
+ <DropdownMenuItem
+ key={action.id}
+ onClick={() => onRunAction(action)}
+ disabled={!canRun(action)}
+ className="text-xs gap-2.5 rounded-md px-2.5 py-1.5"
+ >
+ <Icon size={14} className="shrink-0 text-primary" />
+ <div className="flex-1 min-w-0">
+ <div className="flex items-center gap-1.5">
+ <span dir="auto" className="font-medium truncate">
+ {getActionName(action, t)}
+ </span>
+ <ActionOutputBadge action={action} />
+ </div>
+ <div className="text-xs text-muted-foreground/70 truncate">
+ {getActionDescription(action, t)}
+ </div>
+ </div>
+ </DropdownMenuItem>
+ );
+ })}
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ onClick={onManageActions}
+ className="text-xs gap-2.5 rounded-md px-2.5 py-1.5 text-muted-foreground/70"
+ >
+ <Settings2 size={12} />
+ {t("notes.actions.manage")}
+ </DropdownMenuItem>
+ </>
+ );
+}
diff --git a/src/components/notes/ActionPicker.tsx b/src/components/notes/ActionPicker.tsx
new file mode 100644
index 000000000..e9fed9b82
--- /dev/null
+++ b/src/components/notes/ActionPicker.tsx
@@ -0,0 +1,80 @@
+import { useState } from "react";
+import { useTranslation } from "react-i18next";
+import { ChevronDown } from "../icons";
+import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from "../ui/dropdown-menu";
+import {
+ SPLIT_BUTTON_DIVIDER_CLASS,
+ SPLIT_BUTTON_GROUP_CLASS,
+ SPLIT_BUTTON_SEGMENT_CLASS,
+} from "../ui/splitButton";
+import { cn } from "../lib/utils";
+import { getActionCta } from "../../stores/actionStore";
+import type { ActionItem } from "../../types/electron";
+import { getActionIcon } from "./actionIcons";
+import ActionMenuItems, { type ActionMenuItemsProps } from "./ActionMenuItems";
+
+// The key the ask bar's picker has always used, so a remembered choice carries over.
+const LAST_ACTION_KEY = "askBarActionId";
+
+/** Runs the action last picked from it (the first action until then), or picks another. */
+export default function ActionPicker({
+ actions,
+ canRun,
+ onRunAction,
+ onManageActions,
+}: ActionMenuItemsProps) {
+ const { t } = useTranslation();
+ const [lastUsedId, setLastUsedId] = useState(() => Number(localStorage.getItem(LAST_ACTION_KEY)));
+ const current = actions.find((action) => action.id === lastUsedId) ?? actions[0];
+
+ const run = (action: ActionItem) => {
+ setLastUsedId(action.id);
+ localStorage.setItem(LAST_ACTION_KEY, String(action.id));
+ onRunAction(action);
+ };
+ const Icon = getActionIcon(current);
+
+ return (
+ <div
+ className={cn(
+ SPLIT_BUTTON_GROUP_CLASS,
+ "h-8 shrink-0 animate-[fade-in-content_0.25s_ease-out_backwards] motion-reduce:animate-none"
+ )}
+ >
+ <button
+ type="button"
+ onClick={() => run(current)}
+ disabled={!canRun(current)}
+ className={cn(
+ SPLIT_BUTTON_SEGMENT_CLASS,
+ "gap-1.5 ps-3 pe-2.5 disabled:pointer-events-none disabled:opacity-40"
+ )}
+ >
+ <Icon size={14} className="shrink-0 text-primary" />
+ <span dir="auto" className="max-w-40 truncate">
+ {getActionCta(current, t)}
+ </span>
+ </button>
+ <span aria-hidden="true" className={SPLIT_BUTTON_DIVIDER_CLASS} />
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <button
+ type="button"
+ aria-label={t("notes.actions.selectAction")}
+ className={cn(SPLIT_BUTTON_SEGMENT_CLASS, "w-8 justify-center")}
+ >
+ <ChevronDown size={13} className="text-foreground/60" />
+ </button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" side="top" sideOffset={8} className="min-w-48">
+ <ActionMenuItems
+ actions={actions}
+ canRun={canRun}
+ onRunAction={run}
+ onManageActions={onManageActions}
+ />
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </div>
+ );
+}
diff --git a/src/components/notes/ConversationPicker.tsx b/src/components/notes/ConversationPicker.tsx
index a457336c3..2e054b444 100644
--- a/src/components/notes/ConversationPicker.tsx
+++ b/src/components/notes/ConversationPicker.tsx
@@ -1,4 +1,4 @@
-import { ChevronDown, Clock, PanelRightClose, Plus } from "../icons";
+import { ChevronDown, Clock, Plus } from "../icons";
import { useTranslation } from "react-i18next";
import { useUiLocale } from "../../hooks/useUiLocale";
import type { ContainerConversationItem } from "../../hooks/useContainerChat";
@@ -19,7 +19,6 @@ interface ConversationPickerProps {
onNewChat?: () => void;
titleClassName?: string;
variant?: "default" | "sidebar";
- onUndock?: () => void;
}
export function ConversationPicker({
@@ -29,7 +28,6 @@ export function ConversationPicker({
onNewChat,
titleClassName,
variant = "default",
- onUndock,
}: ConversationPickerProps) {
const { t } = useTranslation();
const locale = useUiLocale();
@@ -42,12 +40,12 @@ export function ConversationPicker({
className={cn(
"inline-flex items-center rounded-md transition-colors duration-150 outline-none hover:bg-foreground/5",
variant === "sidebar"
- ? "gap-2 px-1 py-1 text-sm text-foreground/65 hover:text-foreground"
+ ? "-ms-1 gap-2.5 px-1 py-1 text-sm text-foreground/65 hover:text-foreground"
: "-ms-1.5 gap-1 px-1.5 py-0.5 text-xs font-medium text-foreground/50 hover:text-foreground/70"
)}
aria-label={t("embeddedChat.conversationSelector")}
>
- {variant === "sidebar" && <Clock size={18} className="shrink-0" />}
+ {variant === "sidebar" && <Clock size={16} className="shrink-0" />}
<span className={cn("truncate max-w-40", titleClassName)}>
{variant === "sidebar"
? t("embeddedChat.history")
@@ -83,15 +81,6 @@ export function ConversationPicker({
))}
</>
)}
- {onUndock && (
- <>
- <DropdownMenuSeparator />
- <DropdownMenuItem onClick={onUndock} className="text-xs gap-2 rounded-md px-2 py-1.5">
- <PanelRightClose size={12} className="text-foreground/45 shrink-0" />
- {t("embeddedChat.undock")}
- </DropdownMenuItem>
- </>
- )}
</DropdownMenuContent>
</DropdownMenu>
);
diff --git a/src/components/notes/EmbeddedChat.tsx b/src/components/notes/EmbeddedChat.tsx
index 52c914996..9af58cc40 100644
--- a/src/components/notes/EmbeddedChat.tsx
+++ b/src/components/notes/EmbeddedChat.tsx
@@ -1,76 +1,47 @@
-import { useEffect, useCallback } from "react";
+import { useCallback, useState } from "react";
import { useTranslation } from "react-i18next";
-import { X, PanelRight, Plus, AlignLeft } from "../icons";
+import { X, Plus } from "../icons";
import { cn } from "../lib/utils";
import { ChatMessages } from "../chat/ChatMessages";
import { ChatInput } from "../chat/ChatInput";
import type { SlashCommand } from "../chat/slashCommands";
import { BrandMarkIcon } from "../dictation/BrandMarkIcon";
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
-} from "../ui/dropdown-menu";
import type { Message, AgentState } from "../chat/types";
import { setActiveNoteId, setActiveFolderId } from "../../stores/noteStore";
-import { getActionName } from "../../stores/actionStore";
-import type { ActionItem } from "../../types/electron";
import type { ContainerConversationItem } from "../../hooks/useContainerChat";
import { ConversationPicker } from "./ConversationPicker";
-import { getActionIcon } from "./actionIcons";
+import { PanelResizeHandle } from "../ui/PanelResizeHandle";
+import { useResizableWidth } from "../../hooks/useResizableWidth";
+/** Closed, the ask bar open over the note (floating), or the chat docked beside it (sidebar). */
export type EmbeddedChatMode = "hidden" | "floating" | "sidebar";
interface EmbeddedChatProps {
- mode: EmbeddedChatMode;
- onModeChange: (mode: EmbeddedChatMode) => void;
+ onClose: () => void;
messages: Message[];
agentState: AgentState;
draftText?: string;
onDraftChange?: (text: string) => void;
onTextSubmit: (text: string) => void;
onCancel: () => void;
- noteConversations?: ContainerConversationItem[];
- activeConversationId?: number | null;
- onSwitchConversation?: (id: number) => void;
- onNewChat?: () => void;
- active?: boolean;
- /** The note's chat actions, offered as quick actions beside the sidebar composer. */
- chatActions?: ActionItem[];
- onRunChatAction?: (action: ActionItem) => void;
- /** Writes the note's AI summary with its template; absent when it can't run now. */
- onGenerateSummary?: () => void;
+ noteConversations: ContainerConversationItem[];
+ activeConversationId: number | null;
+ onSwitchConversation: (id: number) => void;
+ onNewChat: () => void;
+ /** Shown in the tray above the composer. */
+ actionChips?: React.ReactNode;
slashCommands?: SlashCommand[];
}
-function EmptyState({ floating }: { floating: boolean }) {
- const { t } = useTranslation();
- return (
- <div
- className={cn(
- "flex h-full flex-col items-center justify-center gap-3 px-4 text-center select-none",
- floating ? "min-h-48" : "min-h-40"
- )}
- >
- {floating ? (
- <>
- <BrandMarkIcon size={36} className="text-foreground/20 dark:text-muted-foreground/35" />
- <p className="max-w-64 text-sm text-muted-foreground">{t("embeddedChat.emptyState")}</p>
- </>
- ) : (
- <BrandMarkIcon
- size={72}
- className="text-foreground/10 drop-shadow-sm dark:text-foreground/15"
- />
- )}
- </div>
- );
+// The share of the row the CSS lets the chat take: 70%, or half below the `lg` breakpoint.
+function chatMaxWidth(panel: HTMLElement): number {
+ const share = window.matchMedia("(min-width: 1024px)").matches ? 0.7 : 0.5;
+ return Math.floor((panel.parentElement?.clientWidth ?? Infinity) * share);
}
+/** The note's chat, docked beside it: the conversation, its history and a composer. */
export default function EmbeddedChat({
- mode,
- onModeChange,
+ onClose,
messages,
agentState,
draftText,
@@ -81,13 +52,18 @@ export default function EmbeddedChat({
activeConversationId,
onSwitchConversation,
onNewChat,
- active = true,
- chatActions = [],
- onRunChatAction,
- onGenerateSummary,
+ actionChips,
slashCommands,
}: EmbeddedChatProps) {
const { t } = useTranslation();
+ const [slashMenuOpen, setSlashMenuOpen] = useState(false);
+ const resize = useResizableWidth<HTMLDivElement>({
+ storageKey: "noteChatWidth",
+ edge: "start",
+ min: 320,
+ max: 1200,
+ getDragMax: chatMaxWidth,
+ });
const handleOpenNote = useCallback(async (noteId: number) => {
const note = await window.electronAPI.getNote(noteId);
@@ -95,172 +71,81 @@ export default function EmbeddedChat({
setActiveNoteId(noteId);
}, []);
- const handleKeyDown = useCallback(
- (e: KeyboardEvent) => {
- if (e.key === "Escape" && mode === "floating" && active) {
- onModeChange("hidden");
- }
- },
- [mode, onModeChange, active]
- );
-
- useEffect(() => {
- document.addEventListener("keydown", handleKeyDown);
- return () => document.removeEventListener("keydown", handleKeyDown);
- }, [handleKeyDown]);
-
- if (mode === "hidden") return null;
-
- const quickActions = [
- ...(onGenerateSummary
- ? [
- {
- key: "summary",
- label: t("embeddedChat.generateSummary"),
- Icon: AlignLeft,
- run: onGenerateSummary,
- },
- ]
- : []),
- ...chatActions.map((action) => ({
- key: action.client_id,
- label: getActionName(action, t),
- Icon: getActionIcon(action),
- run: () => onRunChatAction?.(action),
- })),
- ];
-
- const hasConversationSelector =
- noteConversations !== undefined && onSwitchConversation !== undefined;
-
- const headerTitle = hasConversationSelector ? (
- <ConversationPicker
- conversations={noteConversations}
- activeConversationId={activeConversationId}
- onSwitchConversation={onSwitchConversation}
- onNewChat={onNewChat}
- titleClassName="max-w-32"
- variant={mode === "sidebar" ? "sidebar" : "default"}
- onUndock={mode === "sidebar" ? () => onModeChange("floating") : undefined}
- />
- ) : (
- <span className="text-xs font-medium text-foreground/50">
- {t(mode === "sidebar" ? "embeddedChat.history" : "embeddedChat.title")}
- </span>
- );
-
- const header = (
+ return (
<div
- className={cn("flex items-center shrink-0", mode === "sidebar" ? "h-16 px-6" : "h-9 px-3")}
+ ref={resize.panelRef}
+ // Half the note view until it's resized; resized, it can take 70%, and the note keeps the rest.
+ // Its minimum is never more than half the row, and in a narrow window (a meeting's side
+ // panel) it takes at most half.
+ className={cn(
+ "relative flex min-h-0 min-w-[min(20rem,50%)] shrink-0 p-3 max-lg:max-w-[50%]",
+ resize.width === null ? "w-1/2 max-w-2xl" : "max-w-[70%]"
+ )}
+ style={resize.width === null ? undefined : { width: resize.width }}
+ data-note-chat-panel
>
- {headerTitle}
- <div className="flex-1" />
- <div className="flex items-center gap-0.5">
- {mode === "floating" ? (
- <button
- onClick={() => onModeChange("sidebar")}
- className="h-6 w-6 flex items-center justify-center rounded-md text-foreground/45 hover:bg-foreground/6 transition-colors"
- aria-label={t("embeddedChat.dock")}
- >
- <PanelRight size={13} className="rtl:scale-x-[-1]" />
- </button>
- ) : null}
- {mode === "sidebar" && onNewChat && (
- <button
- onClick={onNewChat}
- className="flex size-8 items-center justify-center rounded-full text-foreground/65 transition-colors hover:bg-foreground/6 hover:text-foreground"
- aria-label={t("embeddedChat.newChat")}
- >
- <Plus size={18} />
- </button>
- )}
- <button
- onClick={() => onModeChange("hidden")}
- className={cn(
- "flex items-center justify-center text-foreground/45 transition-colors hover:bg-foreground/6 hover:text-foreground",
- mode === "sidebar" ? "size-8 rounded-full" : "h-6 w-6 rounded-md"
- )}
- aria-label={t("embeddedChat.close")}
- >
- <X size={mode === "sidebar" ? 18 : 13} />
- </button>
- </div>
- </div>
- );
-
- const chatBody = (
- <>
- {header}
- <div
- className={cn(
- "flex-1 min-h-0 flex flex-col **:data-chat-bubble:max-w-full",
- mode === "floating" && "min-w-0 max-w-full **:data-chat-bubble:break-words"
- )}
- >
- <ChatMessages
- messages={messages}
- emptyState={<EmptyState floating={mode === "floating"} />}
- onOpenNote={handleOpenNote}
- scrollClassName={
- mode === "floating"
- ? cn(
- "min-w-0 max-w-full overflow-x-hidden",
- messages.length === 0 && "scrollbar-hidden"
- )
- : messages.length === 0
- ? "scrollbar-hidden"
- : undefined
- }
- />
- </div>
- </>
- );
-
- if (mode === "floating") {
- return chatBody;
- }
-
- return (
- <div className="flex min-h-0 w-1/2 min-w-80 max-w-2xl shrink-0 p-4" data-note-chat-panel>
- <div className="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-4xl border border-border/60 bg-surface-1 dark:border-white/10 dark:bg-surface-1">
- {chatBody}
- <div className="mx-3 mb-3 shrink-0">
- <div className="scrollbar-hidden flex items-center gap-1.5 overflow-x-auto px-1 pb-2">
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <button
- type="button"
- disabled={agentState !== "idle"}
- aria-label={t("embeddedChat.quickActions")}
- className="flex size-8 shrink-0 items-center justify-center rounded-full border border-dashed border-foreground/35 bg-background text-foreground/55 transition-colors hover:text-foreground disabled:opacity-40 dark:bg-surface-2"
- >
- <Plus size={14} />
- </button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="start" side="top" sideOffset={8}>
- {quickActions.map(({ key, label, Icon, run }) => (
- <DropdownMenuItem key={key} onClick={run}>
- <Icon size={15} className="text-primary" />
- {label}
- </DropdownMenuItem>
- ))}
- </DropdownMenuContent>
- </DropdownMenu>
- {quickActions.map(({ key, label, Icon, run }) => (
+ <PanelResizeHandle
+ edge="start"
+ isResizing={resize.isResizing}
+ onPointerDown={resize.startResize}
+ // Fills the gutter between the note and the chat.
+ className="w-3"
+ />
+ <div className="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-[20px] border border-border/60 bg-surface-1 dark:border-white/10 dark:bg-surface-1">
+ <div className={cn("flex min-h-0 flex-1 flex-col", slashMenuOpen && "hidden")}>
+ <div className="flex h-14 shrink-0 items-center px-5">
+ <ConversationPicker
+ conversations={noteConversations}
+ activeConversationId={activeConversationId}
+ onSwitchConversation={onSwitchConversation}
+ onNewChat={onNewChat}
+ titleClassName="max-w-32"
+ variant="sidebar"
+ />
+ <div className="flex-1" />
+ {/* The icons sit as far from the right edge as the clock does from the left. */}
+ <div className="-me-2 flex items-center gap-3">
+ <button
+ onClick={onNewChat}
+ className="flex size-8 items-center justify-center rounded-full text-foreground/65 transition-colors hover:bg-foreground/6 hover:text-foreground"
+ aria-label={t("embeddedChat.newChat")}
+ >
+ <Plus size={16} />
+ </button>
<button
- key={key}
- type="button"
- // Keep focus in the composer so it doesn't collapse and slide the pills away.
- onMouseDown={(event) => event.preventDefault()}
- onClick={run}
- disabled={agentState !== "idle"}
- className="inline-flex h-8 shrink-0 items-center gap-1.5 rounded-full border border-border/70 bg-background px-2.5 text-xs text-foreground/65 transition-colors hover:text-foreground disabled:opacity-40 dark:border-white/10 dark:bg-surface-2"
+ onClick={onClose}
+ className="flex size-8 items-center justify-center rounded-full text-foreground/45 transition-colors hover:bg-foreground/6 hover:text-foreground"
+ aria-label={t("embeddedChat.close")}
>
- <Icon size={14} className="text-primary" />
- {label}
+ <X size={16} />
</button>
- ))}
+ </div>
</div>
+ <div className="flex min-h-0 flex-1 flex-col **:data-chat-bubble:max-w-full">
+ <ChatMessages
+ messages={messages}
+ emptyState={
+ <div className="flex h-full min-h-40 select-none items-center justify-center">
+ <BrandMarkIcon
+ size={72}
+ className="text-foreground/10 drop-shadow-sm dark:text-foreground/15"
+ />
+ </div>
+ }
+ onOpenNote={handleOpenNote}
+ plainBubbles
+ scrollClassName={messages.length === 0 ? "scrollbar-hidden" : undefined}
+ />
+ </div>
+ </div>
+ {/* One tray holds the chips and the composer. */}
+ <div
+ className={cn(
+ "mx-3 mb-3 rounded-[18px] border border-black/[0.06] bg-foreground/[0.04] p-0.5 dark:border-white/[0.06] dark:bg-white/[0.05]",
+ slashMenuOpen ? "mt-3 flex min-h-0 flex-1 flex-col" : "shrink-0"
+ )}
+ >
+ {actionChips && !slashMenuOpen && <div className="px-1.5 pt-1 pb-1">{actionChips}</div>}
<ChatInput
className="w-full"
variant="sidebar"
@@ -271,9 +156,12 @@ export default function EmbeddedChat({
onTextSubmit={onTextSubmit}
onCancel={onCancel}
voiceDraft
+ // It opens from a send in the ask bar, and the conversation moves here.
+ autoFocus
focusOnIdle={false}
placeholder={t("embeddedChat.askPlaceholder")}
slashCommands={slashCommands}
+ onSlashMenuOpenChange={setSlashMenuOpen}
/>
</div>
</div>
diff --git a/src/components/notes/MeetingTranscriptChat.tsx b/src/components/notes/MeetingTranscriptChat.tsx
index 9df2cb0b9..21ed45851 100644
--- a/src/components/notes/MeetingTranscriptChat.tsx
+++ b/src/components/notes/MeetingTranscriptChat.tsx
@@ -962,7 +962,7 @@ export function MeetingTranscriptChat({
onTouchStart={handleTouchStart}
onTouchMove={handleTouchMove}
onTouchEnd={handleTouchEnd}
- className="flex-1 min-h-0 overflow-y-auto pt-2 agent-chat-scroll pb-[var(--floating-inset,132px)]"
+ className="flex-1 min-h-0 overflow-y-auto pt-2 agent-chat-scroll pb-[var(--floating-inset,96px)]"
>
<div className={cn("px-4", contentClassName)}>
<div style={{ height: totalSize, width: "100%", position: "relative" }}>
diff --git a/src/components/notes/NoteBottomBar.tsx b/src/components/notes/NoteBottomBar.tsx
index 4e06a4530..118cac829 100644
--- a/src/components/notes/NoteBottomBar.tsx
+++ b/src/components/notes/NoteBottomBar.tsx
@@ -1,12 +1,17 @@
-import { useCallback } from "react";
+import { useCallback, useState } from "react";
import { useTranslation } from "react-i18next";
import { ChatInput } from "../chat/ChatInput";
-import type { AgentState } from "../chat/types";
import type { SlashCommand } from "../chat/slashCommands";
import { cn } from "../lib/utils";
-import { observeFloatingChatSize } from "./floatingChatLayout";
+import { hasLayerAbove } from "../ui/useDismissGuard";
+import { observeFloatingChatMaxHeight } from "./floatingChatLayout";
const RECORDING_SURFACE = "bg-surface-2/95 shadow-(--shadow-glass)";
+// One curve for everything that moves as the chat opens, so it unfolds as one piece:
+// a soft spring that settles just past its mark.
+const UNFOLD =
+ "duration-[480ms] ease-[cubic-bezier(0.25,1.15,0.4,1)] motion-reduce:transition-none";
+const DRAG_START_THRESHOLD_PX = 3;
interface NoteBottomBarProps {
isRecording: boolean;
@@ -15,15 +20,19 @@ interface NoteBottomBarProps {
onAskSubmit: (text: string) => void;
onInputFocus?: () => void;
onInputEscape?: () => void;
+ /**
+ * A click outside the open chat, other than one dismissing a menu or dialog over the page.
+ * Keep it stable: the panel's observers re-attach whenever it changes.
+ */
+ onClickOutside?: () => void;
+ /** Sits in the collapsed composer; the chips take over once the chat opens. */
+ actionPicker?: React.ReactNode;
actionChips?: React.ReactNode;
slashCommands?: SlashCommand[];
callout?: React.ReactNode;
footnote?: React.ReactNode;
hideInput?: boolean;
chatOpen?: boolean;
- chatContent?: React.ReactNode;
- agentState?: AgentState;
- onCancel?: () => void;
floatingPanelRef?: (panel: HTMLDivElement, container: HTMLElement) => void | (() => void);
}
@@ -34,42 +43,73 @@ export default function NoteBottomBar({
onAskSubmit,
onInputFocus,
onInputEscape,
+ onClickOutside,
+ actionPicker,
actionChips,
slashCommands,
callout,
footnote,
hideInput = false,
chatOpen = false,
- chatContent,
- agentState = "idle",
- onCancel,
floatingPanelRef,
}: NoteBottomBarProps) {
const { t } = useTranslation();
+ const [slashMenuOpen, setSlashMenuOpen] = useState(false);
const attachPanel = useCallback(
(panel: HTMLDivElement | null) => {
if (!panel) return;
if (!chatOpen) {
panel.style.height = "48px";
+ panel.style.maxHeight = "";
return;
}
+ // Open, it fits the chips and the composer (or the / menu), within a cap.
+ panel.style.height = "auto";
- const container = panel.parentElement?.parentElement;
- if (!container) return;
+ // Panel → composer slot (with the card) → bar → the note view the bar floats over.
+ const slot = panel.parentElement;
+ const container = slot?.parentElement?.parentElement;
+ if (!slot || !container) return;
- const stopSizing = observeFloatingChatSize({
+ const stopSizing = observeFloatingChatMaxHeight({
panel,
container,
});
const stopLayout = floatingPanelRef?.(panel, container);
+ // Decided on press, while a menu it dismisses is still open, but acted on at click:
+ // closing drops the note's bottom inset, which would move the note under the press.
+ let outsidePress: { x: number; y: number } | null = null;
+ const handlePointerDown = (event: PointerEvent) => {
+ outsidePress =
+ !slot.contains(event.target as Node) && !hasLayerAbove(panel, document)
+ ? { x: event.clientX, y: event.clientY }
+ : null;
+ };
+ // A keyboard click (detail 0) has no press of its own, so a stale one mustn't count for it,
+ // and a drag (selecting text) ends in a click too but isn't one.
+ const handleClick = (event: MouseEvent) => {
+ if (
+ outsidePress &&
+ event.detail > 0 &&
+ Math.abs(event.clientX - outsidePress.x) < DRAG_START_THRESHOLD_PX &&
+ Math.abs(event.clientY - outsidePress.y) < DRAG_START_THRESHOLD_PX
+ ) {
+ onClickOutside?.();
+ }
+ outsidePress = null;
+ };
+ document.addEventListener("pointerdown", handlePointerDown, true);
+ document.addEventListener("click", handleClick, true);
return () => {
stopSizing();
if (typeof stopLayout === "function") stopLayout();
+ document.removeEventListener("pointerdown", handlePointerDown, true);
+ document.removeEventListener("click", handleClick, true);
};
},
- [chatOpen, floatingPanelRef]
+ [chatOpen, floatingPanelRef, onClickOutside]
);
return (
@@ -82,70 +122,101 @@ export default function NoteBottomBar({
<div
aria-hidden="true"
className={cn(
- "pointer-events-none absolute inset-x-0 bottom-0 bg-gradient-to-t from-background from-45% to-transparent transition-opacity duration-200",
- // Taller while the action chips sit above the composer, so text fades out behind them.
- actionChips && !chatOpen && !hideInput ? "h-32" : "h-20",
+ "pointer-events-none absolute inset-x-0 bottom-0 h-20 bg-gradient-to-t from-background from-45% to-transparent transition-opacity duration-200",
chatOpen && "opacity-0"
)}
/>
{callout && !chatOpen && !hideInput && (
<div className="pointer-events-auto relative mb-3 flex justify-center">{callout}</div>
)}
- {actionChips && !chatOpen && !hideInput && (
- <div className="pointer-events-auto relative mx-auto mb-2 w-full min-w-0 max-w-[600px] px-1">
- {actionChips}
- </div>
- )}
+ {/* The composer's slot: the panel always fills it, so the composer never moves. */}
<div
- ref={attachPanel}
- data-note-chat-panel
- aria-hidden={hideInput}
- inert={hideInput}
className={cn(
- "pointer-events-auto relative mx-auto flex w-full min-w-0 max-w-[600px] flex-col rounded-3xl border",
- chatOpen || hideInput ? "overflow-hidden" : "overflow-visible",
- "transition-[height,box-shadow,max-width,opacity] duration-300 [transition-timing-function:cubic-bezier(0.2,0.8,0.2,1)] motion-reduce:transition-none",
- isRecording && !chatOpen ? RECORDING_SURFACE : "bg-background shadow-sm",
- chatOpen
- ? "border-black/10 shadow-elevated dark:border-white/14"
- : "border-black/10 dark:border-white/14",
- "focus-within:border-black/15 focus-within:ring-[3px] focus-within:ring-primary/8 dark:focus-within:border-white/22",
- hideInput && "max-w-0 border-transparent opacity-0 pointer-events-none"
+ "group/chat relative mx-auto w-full min-w-0 transition-[max-width]",
+ UNFOLD,
+ hideInput ? "max-w-0" : "max-w-[600px]"
)}
>
+ {/* The card hugs the composer as the bar, then unfolds around it as the chat opens. */}
+ <div
+ aria-hidden="true"
+ // Pressing the card's margin keeps focus (and the chat) on the composer.
+ onMouseDown={(event) => event.preventDefault()}
+ className={cn(
+ "absolute border transition-[inset,border-radius,box-shadow,background-color,border-color,opacity]",
+ UNFOLD,
+ chatOpen
+ ? "-inset-2 rounded-[32px] bg-background shadow-(--shadow-chat-card)"
+ : cn(
+ "inset-0 rounded-3xl",
+ isRecording ? RECORDING_SURFACE : "bg-background shadow-(--shadow-glass)",
+ "group-hover/chat:border-black/15 dark:group-hover/chat:border-white/22"
+ ),
+ "border-black/[0.08] dark:border-white/12",
+ "group-focus-within/chat:border-black/15 group-focus-within/chat:ring-[3px] group-focus-within/chat:ring-primary/8 dark:group-focus-within/chat:border-white/22",
+ hideInput ? "pointer-events-none opacity-0" : "pointer-events-auto"
+ )}
+ />
<div
- aria-hidden={!chatOpen}
- inert={!chatOpen}
+ ref={attachPanel}
+ data-note-chat-panel
+ aria-hidden={hideInput}
+ inert={hideInput}
+ // From anywhere in the open chat, not just the composer. An Esc that closes a menu
+ // (Radix prevents its default) closes only the menu, and one that closes the chat
+ // stops here, so the note doesn't also clear its transcript selection.
+ onKeyDown={(event) => {
+ if (event.key !== "Escape" || !chatOpen || event.defaultPrevented) return;
+ event.stopPropagation();
+ onInputEscape?.();
+ }}
className={cn(
- "flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden transition-[opacity,transform] duration-300 motion-reduce:transition-none",
- chatOpen ? "translate-y-0 opacity-100 delay-100" : "translate-y-2 opacity-0"
+ // Bottom-anchored: while it grows, what doesn't fit yet overflows the top, not the composer.
+ // Its height animates between the bar's 48px and auto.
+ "pointer-events-auto relative flex min-w-0 flex-col justify-end rounded-3xl transition-[height,opacity] [interpolate-size:allow-keywords]",
+ UNFOLD,
+ // Open, it clips only while it unfolds, so a chip's hover card can show above it.
+ hideInput
+ ? "overflow-hidden"
+ : chatOpen
+ ? "animate-[clip-while-unfolding_480ms] motion-reduce:animate-none"
+ : "overflow-visible",
+ hideInput && "opacity-0 pointer-events-none"
)}
>
- {chatContent}
+ {actionChips && chatOpen && !slashMenuOpen && (
+ // Centered between the card's top edge and the composer.
+ <div className="shrink-0 px-1.5 pt-0.5 pb-2.5">{actionChips}</div>
+ )}
+ {!hideInput && (
+ <ChatInput
+ className="w-full min-w-0"
+ variant="note"
+ outlined={chatOpen}
+ agentState="idle"
+ partialTranscript=""
+ draftText={draftText}
+ onDraftChange={onDraftChange}
+ onTextSubmit={onAskSubmit}
+ onFocus={onInputFocus}
+ focusOnIdle={chatOpen}
+ voiceDraft={chatOpen}
+ placeholder={t("embeddedChat.askPlaceholder")}
+ trailingContent={chatOpen ? undefined : actionPicker}
+ slashCommands={slashCommands}
+ onSlashMenuOpenChange={setSlashMenuOpen}
+ />
+ )}
</div>
- {actionChips && chatOpen && <div className="shrink-0 px-2 pt-2">{actionChips}</div>}
- {!hideInput && (
- <ChatInput
- className={cn("w-full min-w-0", chatOpen && "px-2 py-1")}
- variant="note"
- outlined={chatOpen}
- agentState={agentState}
- partialTranscript=""
- draftText={draftText}
- onDraftChange={onDraftChange}
- onTextSubmit={onAskSubmit}
- onCancel={onCancel}
- onFocus={onInputFocus}
- onEscape={onInputEscape}
- focusOnIdle={chatOpen}
- voiceDraft={chatOpen}
- placeholder={t("embeddedChat.askPlaceholder")}
- slashCommands={slashCommands}
- />
- )}
</div>
{footnote && (
- <div className="relative mt-1.5 flex h-4 select-none items-center justify-center gap-1 text-[10px] text-muted-foreground/70">
+ <div
+ className={cn(
+ "relative mt-1.5 flex h-4 select-none items-center justify-center gap-1 text-[10px] text-muted-foreground/70 transition-opacity duration-200",
+ // The open card reaches over it.
+ chatOpen && "opacity-0"
+ )}
+ >
{footnote}
</div>
)}
diff --git a/src/components/notes/NoteEditor.tsx b/src/components/notes/NoteEditor.tsx
index b77a19103..c55100058 100644
--- a/src/components/notes/NoteEditor.tsx
+++ b/src/components/notes/NoteEditor.tsx
@@ -75,9 +75,12 @@ import { Button } from "../ui/button";
import EmbeddedChat, { type EmbeddedChatMode } from "./EmbeddedChat";
import { useEmbeddedChat } from "../../hooks/useEmbeddedChat";
import ActionChips from "./ActionChips";
+import ActionPicker from "./ActionPicker";
+import { getActionIcon } from "./actionIcons";
import TemplatePicker from "./TemplatePicker";
import {
getActionCta,
+ getActionDescription,
getActionName,
initializeActions,
resolveTemplate,
@@ -278,20 +281,15 @@ export default function NoteEditor({
const viewMode: MeetingViewMode =
selectedViewMode === "enhanced" && !enhancement ? "raw" : selectedViewMode;
const [chatMode, setChatMode] = useState<EmbeddedChatMode>("hidden");
- // The in-view chat mounts on its first open and then stays, so it can fade out as it
- // closes; a note whose chat is never opened doesn't render its conversation at all.
- const [inViewChatMounted, setInViewChatMounted] = useState(false);
- if (chatMode === "floating" && !inViewChatMounted) setInViewChatMounted(true);
const [chatDraft, setChatDraft] = useState("");
- const handleChatModeChange = useCallback((mode: EmbeddedChatMode) => {
+ const closeChat = useCallback(() => {
if (
- mode === "hidden" &&
document.activeElement instanceof HTMLElement &&
document.activeElement.closest("[data-note-chat-panel]")
) {
document.activeElement.blur();
}
- setChatMode(mode);
+ setChatMode("hidden");
}, []);
const [folderSearch, setFolderSearch] = useState("");
const [isCreatingFolder, setIsCreatingFolder] = useState(false);
@@ -438,6 +436,7 @@ export default function NoteEditor({
const segmentScrollRef = useRef<HTMLDivElement>(null);
const segmentContainerRef = useRef<HTMLDivElement>(null);
+ const summaryTabRef = useRef<HTMLDivElement>(null);
const [indicatorStyle, setIndicatorStyle] = useState<React.CSSProperties>({ opacity: 0 });
const scheduleUiUpdate = useCallback((callback: () => void) => {
const frameId = window.requestAnimationFrame(callback);
@@ -461,7 +460,6 @@ export default function NoteEditor({
const templates = useActionsOfKind("template");
const noteActions = useActionsOfKind("action");
- const chatActions = useMemo(() => noteActions.filter((a) => a.output === "chat"), [noteActions]);
// Regenerating keeps the note's template; a first summary uses the default.
const noteTemplate = resolveTemplate(templates, note.enhancement_template_id);
const isActionRunning = actionProcessingState === "processing";
@@ -534,6 +532,7 @@ export default function NoteEditor({
noteOwnedByUser: ownedByUser,
selfEmail: user?.email ?? null,
noteCalendarEventId: note.calendar_event_id,
+ onNewChatUnsent: setChatDraft,
});
const refreshSpeakerProfiles = useCallback(() => {
@@ -866,31 +865,35 @@ export default function NoteEditor({
[enhancement, note.id]
);
+ // Whatever the ask bar sends starts a new conversation, which carries on in the docked chat.
const handleAskSubmit = useCallback(
(text: string) => {
- if (chatMode === "hidden") {
- setChatMode("floating");
- }
+ setChatMode("sidebar");
// The chat is still replying: keep the question as the draft instead of dropping it.
if (embeddedChat.agentState !== "idle") {
setChatDraft(text);
return;
}
- embeddedChat.sendMessage(text);
+ embeddedChat.sendInNewChat(text);
},
- [chatMode, embeddedChat]
+ [embeddedChat]
);
- // The chat shows the action's name while the model gets its prompt.
+ // The chat shows the action's name while the model gets its prompt. Run from the docked
+ // chat, it continues the open conversation; from the ask bar, it starts a new one.
const handleChatAction = useCallback(
(action: ActionItem) => {
if (embeddedChat.agentState !== "idle") return;
- if (chatMode === "hidden") {
- setChatMode("floating");
- }
- void embeddedChat.sendMessage(getActionCta(action, t), {
+ const cta = getActionCta(action, t);
+ const options = {
requestText: compileChatActionPrompt(action, { fromSummary: !!enhancement }),
- });
+ };
+ if (chatMode === "sidebar") {
+ void embeddedChat.sendMessage(cta, options);
+ return;
+ }
+ setChatMode("sidebar");
+ embeddedChat.sendInNewChat(cta, options);
},
[chatMode, embeddedChat, enhancement, t]
);
@@ -902,10 +905,10 @@ export default function NoteEditor({
return;
}
// Uncover the summary the action rewrites; a docked chat already sits beside it.
- if (chatMode === "floating") handleChatModeChange("hidden");
+ if (chatMode === "floating") closeChat();
onRunNoteAction?.(action);
},
- [chatMode, handleChatAction, handleChatModeChange, onRunNoteAction]
+ [chatMode, closeChat, handleChatAction, onRunNoteAction]
);
const offersActions =
!isRecording &&
@@ -920,13 +923,21 @@ export default function NoteEditor({
? noteActions.map((action) => ({
id: action.client_id,
label: getActionName(action, t),
+ icon: getActionIcon(action),
hint: t(
action.output === "summary" ? "notes.actions.output.summary" : "notes.actions.output.chat"
),
+ description: getActionDescription(action, t),
disabled: !canRunAction(action),
run: () => runAction(action),
}))
: undefined;
+ const chipProps = {
+ actions: noteActions,
+ canRun: canRunAction,
+ onRunAction: runAction,
+ onManageActions: () => onManageActions?.("action"),
+ };
const handleChatInputFocus = useCallback(() => {
if (chatMode === "hidden") {
@@ -1219,6 +1230,7 @@ export default function NoteEditor({
</button>
{enhancement && (
<div
+ ref={summaryTabRef}
data-segment-button
data-segment-value="enhanced"
className={cn(
@@ -1248,6 +1260,7 @@ export default function NoteEditor({
onRun={(template) => onRunNoteAction?.(template)}
onManage={() => onManageActions?.("template")}
disabled={isActionRunning}
+ alignTo={summaryTabRef}
>
<button
type="button"
@@ -1454,32 +1467,14 @@ export default function NoteEditor({
onDraftChange={setChatDraft}
onAskSubmit={handleAskSubmit}
onInputFocus={handleChatInputFocus}
- onInputEscape={() => handleChatModeChange("hidden")}
+ onInputEscape={closeChat}
+ onClickOutside={closeChat}
chatOpen={chatMode === "floating"}
- agentState={chatMode === "floating" ? embeddedChat.agentState : "idle"}
- onCancel={embeddedChat.cancelStream}
floatingPanelRef={floatingChatPanelRef}
- chatContent={
- chatMode !== "sidebar" &&
- inViewChatMounted && (
- <EmbeddedChat
- mode="floating"
- active={chatMode === "floating"}
- onModeChange={handleChatModeChange}
- messages={embeddedChat.messages}
- agentState={embeddedChat.agentState}
- onTextSubmit={embeddedChat.sendMessage}
- onCancel={embeddedChat.cancelStream}
- noteConversations={embeddedChat.noteConversations}
- activeConversationId={embeddedChat.activeConversationId}
- onSwitchConversation={embeddedChat.switchConversation}
- onNewChat={embeddedChat.startNewChat}
- />
- )
- }
- actionChips={
- offersActions && (
- <ActionChips
+ actionPicker={
+ offersActions &&
+ noteActions.length > 0 && (
+ <ActionPicker
actions={noteActions}
canRun={canRunAction}
onRunAction={runAction}
@@ -1487,6 +1482,7 @@ export default function NoteEditor({
/>
)
}
+ actionChips={offersActions && <ActionChips {...chipProps} />}
slashCommands={actionCommands}
callout={
showSummaryCallout &&
@@ -1516,8 +1512,7 @@ export default function NoteEditor({
</div>
{chatMode === "sidebar" && (
<EmbeddedChat
- mode="sidebar"
- onModeChange={handleChatModeChange}
+ onClose={closeChat}
messages={embeddedChat.messages}
agentState={embeddedChat.agentState}
draftText={chatDraft}
@@ -1528,14 +1523,20 @@ export default function NoteEditor({
activeConversationId={embeddedChat.activeConversationId}
onSwitchConversation={embeddedChat.switchConversation}
onNewChat={embeddedChat.startNewChat}
- chatActions={chatActions}
- onRunChatAction={handleChatAction}
- slashCommands={actionCommands}
- onGenerateSummary={
- canRunTemplate && noteTemplate && !isActionRunning
- ? () => onRunNoteAction?.(noteTemplate)
- : undefined
+ actionChips={
+ offersActions && (
+ <ActionChips
+ {...chipProps}
+ docked
+ generateSummary={
+ canRunTemplate && noteTemplate
+ ? { run: () => onRunNoteAction?.(noteTemplate), disabled: isActionRunning }
+ : undefined
+ }
+ />
+ )
}
+ slashCommands={actionCommands}
/>
)}
<ShareNoteDialog
diff --git a/src/components/notes/PersonalNotesView.tsx b/src/components/notes/PersonalNotesView.tsx
index d825d3ec7..535d96f0d 100644
--- a/src/components/notes/PersonalNotesView.tsx
+++ b/src/components/notes/PersonalNotesView.tsx
@@ -3,6 +3,7 @@ import { useTranslation } from "react-i18next";
import { useShallow } from "zustand/react/shallow";
import { Plus, Sparkles } from "../icons";
import { useToast } from "../ui/useToast";
+import { PanelResizeHandle } from "../ui/PanelResizeHandle";
import NoteEditor from "./NoteEditor";
import SpacesTree from "./SpacesTree";
import { ContainerOverview } from "./overview/ContainerOverview";
@@ -10,6 +11,7 @@ import NotesStructureIntroDialog from "./NotesStructureIntroDialog";
import ActionManagerDialog from "./ActionManagerDialog";
import AddNotesToFolderDialog from "./AddNotesToFolderDialog";
import { useActionProcessing } from "../../hooks/useActionProcessing";
+import { useResizableWidth } from "../../hooks/useResizableWidth";
import type { NoteMoveTarget } from "../../hooks/useNoteDragAndDrop";
import type { ActionItem, ActionKind, NoteItem } from "../../types/electron";
import { buildNoteRunInput } from "../../helpers/templatePrompts";
@@ -127,6 +129,12 @@ interface PersonalNotesViewProps {
onInvitationEntryHandled?: () => void;
}
+// The list's CSS cap: 30% of the view it shares with the note.
+function notesListMaxWidth(panel: HTMLElement): number {
+ const view = panel.parentElement?.parentElement;
+ return Math.floor((view?.clientWidth ?? Infinity) * 0.3);
+}
+
export default function PersonalNotesView({
onOpenSettings,
meetingRecordingRequest,
@@ -140,6 +148,14 @@ export default function PersonalNotesView({
const notes = useNotes();
const activeNoteId = useActiveNoteId();
const isSidePanelLayout = isMeetingMode || (isNarrowWindow && activeNoteId != null);
+ const notesListResize = useResizableWidth<HTMLDivElement>({
+ storageKey: "notesSidebarWidth",
+ edge: "end",
+ min: 180,
+ max: 420,
+ getDragMax: notesListMaxWidth,
+ });
+ const notesListWidth = notesListResize.width ?? 208;
const activeFolderId = useActiveFolderId();
const [isSaving, setIsSaving] = useState(false);
const [draft, setDraftState] = useState<NoteEditorDraft | null>(null);
@@ -717,10 +733,24 @@ export default function PersonalNotesView({
return (
<div className="flex h-full">
<div
- className="shrink-0 overflow-hidden transition-[width] duration-300 ease-out"
- style={{ width: isSidePanelLayout ? 0 : "13rem" }}
+ className={cn(
+ // A wide list never takes more than 30% of the window, so the note and its chat keep room.
+ "max-w-[30%] shrink-0 overflow-hidden transition-[width] duration-300 ease-out",
+ // Follows the pointer while it's dragged; the transition is for collapsing.
+ notesListResize.isResizing && "transition-none"
+ )}
+ style={{ width: isSidePanelLayout ? 0 : notesListWidth }}
>
- <div className="w-52 shrink-0 border-e border-border dark:border-white/10 flex flex-col h-full">
+ <div
+ ref={notesListResize.panelRef}
+ className="relative max-w-full shrink-0 border-e border-border dark:border-white/10 flex flex-col h-full"
+ style={{ width: notesListWidth }}
+ >
+ <PanelResizeHandle
+ edge="end"
+ isResizing={notesListResize.isResizing}
+ onPointerDown={notesListResize.startResize}
+ />
<div className="px-2 pt-2 pb-1 shrink-0 space-y-0.5">
<button
onClick={() => setManagerKind("template")}
diff --git a/src/components/notes/TemplatePicker.tsx b/src/components/notes/TemplatePicker.tsx
index 39d062665..554259e1d 100644
--- a/src/components/notes/TemplatePicker.tsx
+++ b/src/components/notes/TemplatePicker.tsx
@@ -1,3 +1,4 @@
+import { useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { Check, RefreshCw, Settings2 } from "../icons";
import {
@@ -8,8 +9,9 @@ import {
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "../ui/dropdown-menu";
+import { Tooltip } from "../ui/tooltip";
import { cn } from "../lib/utils";
-import { getActionDescription, getActionName } from "../../stores/actionStore";
+import { getActionName } from "../../stores/actionStore";
import type { ActionItem } from "../../types/electron";
interface TemplatePickerProps {
@@ -19,6 +21,8 @@ interface TemplatePickerProps {
onRun: (template: ActionItem) => void;
onManage: () => void;
disabled?: boolean;
+ /** The menu opens under this element's start edge instead of the trigger's. */
+ alignTo: React.RefObject<HTMLElement | null>;
/** The trigger, rendered as is. */
children: React.ReactNode;
}
@@ -30,16 +34,38 @@ export default function TemplatePicker({
onRun,
onManage,
disabled,
+ alignTo,
children,
}: TemplatePickerProps) {
const { t } = useTranslation();
+ const triggerRef = useRef<HTMLButtonElement>(null);
+ const [alignOffset, setAlignOffset] = useState(0);
+
+ // Radix only aligns a menu with its trigger, so shift it by the distance between the two
+ // start edges (Radix mirrors the offset in right-to-left layouts).
+ const handleOpenChange = (open: boolean) => {
+ const anchor = alignTo.current?.getBoundingClientRect();
+ const trigger = triggerRef.current;
+ if (!open || !anchor || !trigger) return;
+ const bounds = trigger.getBoundingClientRect();
+ setAlignOffset(
+ getComputedStyle(trigger).direction === "rtl"
+ ? bounds.right - anchor.right
+ : anchor.left - bounds.left
+ );
+ };
return (
- <DropdownMenu>
- <DropdownMenuTrigger asChild disabled={disabled}>
+ <DropdownMenu onOpenChange={handleOpenChange}>
+ <DropdownMenuTrigger ref={triggerRef} asChild disabled={disabled}>
{children}
</DropdownMenuTrigger>
- <DropdownMenuContent align="start" sideOffset={6} className="min-w-56">
+ <DropdownMenuContent
+ align="start"
+ alignOffset={alignOffset}
+ sideOffset={6}
+ className="min-w-56"
+ >
<DropdownMenuLabel className="px-2.5 py-1 text-[11px] font-medium text-muted-foreground/70">
{t("notes.templates.tab")}
</DropdownMenuLabel>
@@ -51,15 +77,14 @@ export default function TemplatePicker({
onClick={() => onRun(template)}
className="gap-2.5 rounded-md px-2.5 py-1.5 text-xs"
>
- <div className="min-w-0 flex-1">
- <div className="truncate font-medium">{getActionName(template, t)}</div>
- {template.description && (
- <div className="truncate text-xs text-muted-foreground/70">
- {getActionDescription(template, t)}
- </div>
- )}
- </div>
- {isCurrent && <RefreshCw size={12} className="shrink-0 text-foreground/50" />}
+ <span dir="auto" className="min-w-0 flex-1 truncate font-medium">
+ {getActionName(template, t)}
+ </span>
+ {isCurrent && (
+ <Tooltip content={t("notes.templates.regenerate")}>
+ <RefreshCw size={12} className="shrink-0 text-foreground/50" />
+ </Tooltip>
+ )}
<Check size={12} className={cn("shrink-0 text-accent", !isCurrent && "invisible")} />
</DropdownMenuItem>
);
diff --git a/src/components/notes/actionIcons.ts b/src/components/notes/actionIcons.ts
index da71ae644..558d619b1 100644
--- a/src/components/notes/actionIcons.ts
+++ b/src/components/notes/actionIcons.ts
@@ -1,20 +1,21 @@
import {
- ClipboardCheck,
- FileText,
+ FolderRounded,
+ ListEnd,
Mail,
- MessageSquareText,
Send,
Sparkles,
+ SquareSlash,
type IconComponent,
} from "../icons";
const ACTION_ICONS: Record<string, IconComponent> = {
mail: Mail,
- "clipboard-check": ClipboardCheck,
- "file-text": FileText,
+ "clipboard-check": ListEnd,
+ "file-text": FolderRounded,
send: Send,
sparkles: Sparkles,
};
+// An icon this build doesn't know (say, one synced from a newer client) shows the "/" of a command.
export const getActionIcon = (action: { icon: string }): IconComponent =>
- ACTION_ICONS[action.icon] ?? MessageSquareText;
+ ACTION_ICONS[action.icon] ?? SquareSlash;
diff --git a/src/components/notes/floatingChatLayout.ts b/src/components/notes/floatingChatLayout.ts
index e4ceb15e6..f2d4b35a4 100644
--- a/src/components/notes/floatingChatLayout.ts
+++ b/src/components/notes/floatingChatLayout.ts
@@ -4,7 +4,8 @@ import {
type ScrollMetrics,
} from "../../utils/scrollFollowState";
-const FLOATING_CHAT_INSET_EXTRA_PX = 32;
+// The bar's 28px below the panel, the open card's 8px overhang and a 4px gap.
+const FLOATING_CHAT_INSET_EXTRA_PX = 40;
const FLOATING_CHAT_MIN_VISIBLE_CONTENT_PX = 80;
const SCROLL_BOTTOM_THRESHOLD_PX = 80;
@@ -36,14 +37,15 @@ interface FloatingChatSizeOptions {
container: HTMLElement;
}
-export function observeFloatingChatSize(
+/** The open chat grows to fit its content, up to three-quarters of the note view: room for the default / menu. */
+export function observeFloatingChatMaxHeight(
{ panel, container }: FloatingChatSizeOptions,
createResizeObserver: (callback: () => void) => ResizeObserverHandle = (callback) =>
new ResizeObserver(callback)
): () => void {
const updateHeight = (): void => {
const availableHeight = Math.max(0, container.clientHeight - FLOATING_CHAT_TOP_CLEARANCE_PX);
- panel.style.height = `${Math.min((container.clientHeight * 2) / 3, availableHeight)}px`;
+ panel.style.maxHeight = `${Math.min((container.clientHeight * 3) / 4, availableHeight)}px`;
};
updateHeight();
@@ -71,8 +73,10 @@ export function observeFloatingChatLayout(
const follower = createScrollFollowController({
nearBottomThreshold: SCROLL_BOTTOM_THRESHOLD_PX,
});
+ // The chat opens over the note without scrolling it; the inset only makes room to
+ // scroll the end into view, and a reader who does is followed from then on.
+ follower.leaveBottom();
let frameId: number | null = null;
- let forcePinPending = false;
let touchY: number | null = null;
const pinActiveScroller = (): void => {
@@ -82,24 +86,21 @@ export function observeFloatingChatLayout(
follower.follow();
};
- const schedulePin = (force: boolean): void => {
- forcePinPending ||= force;
- if (!forcePinPending && !follower.isFollowing()) return;
+ const schedulePin = (): void => {
+ if (!follower.isFollowing()) return;
if (frameId !== null) cancelFrame(frameId);
frameId = requestFrame((): void => {
frameId = null;
- const shouldForce = forcePinPending;
- forcePinPending = false;
- if (shouldForce || follower.isFollowing()) pinActiveScroller();
+ if (follower.isFollowing()) pinActiveScroller();
});
};
- const applyInset = (force = false): void => {
+ const applyInset = (): void => {
container.style.setProperty(
"--floating-inset",
`${panel.offsetHeight + FLOATING_CHAT_INSET_EXTRA_PX}px`
);
- schedulePin(force);
+ schedulePin();
};
const updateFollowState = (): void => {
@@ -118,7 +119,6 @@ export function observeFloatingChatLayout(
// no DOM globals; wheel/touch targets are always nodes in the renderer.
if (target == null || !scroller.contains(target as Node)) return;
follower.leaveBottom();
- forcePinPending = false;
if (frameId !== null) {
cancelFrame(frameId);
frameId = null;
@@ -149,7 +149,7 @@ export function observeFloatingChatLayout(
contentRoot.addEventListener("touchstart", handleTouchStart, { capture: true, passive: true });
contentRoot.addEventListener("touchmove", handleTouchMove, { capture: true, passive: true });
contentRoot.addEventListener("touchend", handleTouchEnd, { capture: true, passive: true });
- applyInset(true);
+ applyInset();
const observer = createResizeObserver((): void => applyInset());
observer.observe(panel);
diff --git a/src/components/notes/overview/OverviewAskSection.tsx b/src/components/notes/overview/OverviewAskSection.tsx
index 806bf6773..97f765f39 100644
--- a/src/components/notes/overview/OverviewAskSection.tsx
+++ b/src/components/notes/overview/OverviewAskSection.tsx
@@ -7,12 +7,12 @@ import { observeChatComposerInset } from "../../chat/composerLayout";
import type { Message, AgentState } from "../../chat/types";
import type { ContainerConversationItem } from "../../../hooks/useContainerChat";
import { ConversationPicker } from "../ConversationPicker";
-import { ASK_PILL_CLASS } from "../shared";
+import { cn } from "../../lib/utils";
const PROMPT_CHIP_KEYS = [
"notes.overview.ask.chips.catchUp",
"notes.overview.ask.chips.keyDecisions",
- "notes.overview.ask.chips.inFlight",
+ "notes.overview.ask.chips.openActionItems",
] as const;
interface OverviewAskSectionProps {
@@ -86,7 +86,12 @@ export function OverviewAskSection({
onTextSubmit(t(key));
}}
disabled={agentState !== "idle"}
- className={ASK_PILL_CLASS}
+ className={cn(
+ "inline-flex h-7 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-2.5 text-[11px]",
+ "border border-border/70 bg-card text-foreground/55 shadow-sm dark:border-white/10",
+ "hover:bg-surface-3 hover:text-foreground/80 disabled:pointer-events-none disabled:text-foreground/30",
+ "transition-colors duration-150 focus:outline-none focus-visible:ring-1 focus-visible:ring-ring/30"
+ )}
>
<Sparkles size={10} className="text-foreground/45 shrink-0" />
{t(key)}
diff --git a/src/components/notes/shared.ts b/src/components/notes/shared.ts
index ad4636b6d..a559a027c 100644
--- a/src/components/notes/shared.ts
+++ b/src/components/notes/shared.ts
@@ -113,14 +113,6 @@ export const notesTextareaClass = cn(
"focus:border-primary/30 transition-colors duration-150"
);
-/** Rounded suggestion pill above an ask box: the folder overview's prompts, a note's actions. */
-export const ASK_PILL_CLASS = cn(
- "inline-flex h-7 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-2.5 text-[11px]",
- "border border-border/70 bg-card text-foreground/55 shadow-sm dark:border-white/10",
- "hover:bg-surface-3 hover:text-foreground/80 disabled:pointer-events-none disabled:text-foreground/30",
- "transition-colors duration-150 focus:outline-none focus-visible:ring-1 focus-visible:ring-ring/30"
-);
-
/** Neutral capsule for note header facts (date + attendees, folder, space). */
export const NOTE_META_CHIP_CLASS = cn(
"inline-flex h-[26px] items-center gap-2 rounded-full bg-surface-3 px-2.5 text-xs font-medium text-foreground/70",
diff --git a/src/components/ui/PanelResizeHandle.tsx b/src/components/ui/PanelResizeHandle.tsx
new file mode 100644
index 000000000..0e6d26967
--- /dev/null
+++ b/src/components/ui/PanelResizeHandle.tsx
@@ -0,0 +1,40 @@
+import { useTranslation } from "react-i18next";
+import { cn } from "../lib/utils";
+
+interface PanelResizeHandleProps {
+ /** The panel's edge it sits on, inside the panel. */
+ edge: "start" | "end";
+ isResizing: boolean;
+ onPointerDown: (event: React.PointerEvent<HTMLElement>) => void;
+ className?: string;
+}
+
+/** A strip along a panel's edge that resizes it when dragged; a small grip marks it on hover. */
+export function PanelResizeHandle({
+ edge,
+ isResizing,
+ onPointerDown,
+ className,
+}: PanelResizeHandleProps) {
+ const { t } = useTranslation();
+ return (
+ <div
+ role="separator"
+ aria-orientation="vertical"
+ aria-label={t("common.resizePanel")}
+ onPointerDown={onPointerDown}
+ className={cn(
+ "group/resize absolute inset-y-0 z-10 w-2 cursor-col-resize touch-none",
+ edge === "end" ? "end-0" : "start-0",
+ className
+ )}
+ >
+ <span
+ className={cn(
+ "absolute top-1/2 start-1/2 h-8 w-1 -translate-x-1/2 -translate-y-1/2 rounded-full bg-foreground/20 opacity-0 transition-opacity duration-150 group-hover/resize:opacity-100 rtl:translate-x-1/2",
+ isResizing && "opacity-100"
+ )}
+ />
+ </div>
+ );
+}
diff --git a/src/helpers/builtinActions.js b/src/helpers/builtinActions.js
index f531b1866..a9e1f4242 100644
--- a/src/helpers/builtinActions.js
+++ b/src/helpers/builtinActions.js
@@ -1,9 +1,10 @@
// Built-in note templates and actions. The database seeds any that are missing
// on startup and only rewrites a row whose prompt still equals a previous
// default, so a user's edited prompt is never touched. A template writes the AI
-// summary: Generate Notes wraps its prompt in the generic system prompt, and
-// Detailed Notes is compiled from sections (see templatePrompts.js). An action
-// either edits the summary or answers in the note chat.
+// summary: AI Summary, the default (Generate Notes' key), wraps its prompt in the
+// generic system prompt, and Detailed Notes is compiled from sections (see
+// templatePrompts.js). An action either edits the summary or answers in the note
+// chat.
export const GENERATE_NOTES_KEY = "notes.actions.builtin.generateNotes";
export const DETAILED_NOTES_KEY = "notes.actions.builtin.detailedNotes";
@@ -469,8 +470,8 @@ export const BUILTIN_ACTIONS = [
{
translationKey: DETAILED_NOTES_KEY,
kind: "template",
- // The default template, and the prompt AI summaries always used.
- name: "AI Summary",
+ // The prompt 1.10.2's Generate AI Summary button used.
+ name: "Detailed Notes",
description: "Accurate, comprehensive meeting notes with decisions and action items",
prompt: "",
sections: DETAILED_NOTES_SECTIONS,
@@ -481,12 +482,13 @@ export const BUILTIN_ACTIONS = [
DETAILED_NOTES_PROMPT_1_10_2,
],
icon: "sparkles",
- sortOrder: 0,
+ sortOrder: 1,
},
{
translationKey: GENERATE_NOTES_KEY,
kind: "template",
- name: "Generate Notes",
+ // The default template.
+ name: "AI Summary",
description: "Clean up, structure, and enhance your notes",
prompt: GENERATE_NOTES_PROMPT,
sections: null,
@@ -498,7 +500,7 @@ export const BUILTIN_ACTIONS = [
GENERATE_NOTES_PROMPT_1_10_2,
],
icon: "sparkles",
- sortOrder: 1,
+ sortOrder: 0,
},
{
translationKey: FOLLOW_UP_EMAIL_KEY,
@@ -514,7 +516,7 @@ export const BUILTIN_ACTIONS = [
},
builtinAction({
key: "makeTodos",
- name: "Make to-dos",
+ name: "Create to-dos",
description: "List every to-do and its owner in the chat",
prompt: MAKE_TODOS_PROMPT,
output: "chat",
diff --git a/src/helpers/database.js b/src/helpers/database.js
index c3ee030a9..5823b8eb6 100644
--- a/src/helpers/database.js
+++ b/src/helpers/database.js
@@ -11,12 +11,7 @@ const { parseEventTime } = require("./calendarAvailability");
// keeps the cloud created_at but lets timestamp default to the local pull, so
// a naive value must never outrank created_at when dating a historical row.
const { hasExplicitTimeZone, parseDbTimestamp, toDbTimestamp } = require("./dbTimestamp");
-const {
- BUILTIN_ACTIONS,
- DETAILED_NOTES_KEY,
- GENERATE_NOTES_KEY,
- NOTE_ACTION_LIMITS,
-} = require("./builtinActions");
+const { BUILTIN_ACTIONS, GENERATE_NOTES_KEY, NOTE_ACTION_LIMITS } = require("./builtinActions");
const { normalizeSections } = require("./templatePrompts");
const {
ANALYTICS_COUNTER_VERSION,
@@ -652,13 +647,6 @@ class DatabaseManager {
)
.run(GENERATE_NOTES_KEY, ...builtinKeys);
- // Detailed Notes became the default "AI Summary"; a name the user chose stays.
- this.db
- .prepare(
- "UPDATE actions SET name = 'AI Summary' WHERE is_builtin = 1 AND translation_key = ? AND name = 'Detailed Notes'"
- )
- .run(DETAILED_NOTES_KEY);
-
// Built-ins: insert any that are missing, and roll a new default out to rows
// that are still a previous flat default (never a user edit). A built-in's
// kind is fixed, so it is settled whatever the prompt; its output is only
diff --git a/src/hooks/useEmbeddedChat.ts b/src/hooks/useEmbeddedChat.ts
index 2e1138b1d..b7201a8c2 100644
--- a/src/hooks/useEmbeddedChat.ts
+++ b/src/hooks/useEmbeddedChat.ts
@@ -3,6 +3,7 @@ import { useChatPersistence } from "../components/chat/useChatPersistence";
import { useChatStreaming, type SendToAIOptions } from "../components/chat/useChatStreaming";
import { useChatMessageSender } from "../components/chat/useChatMessageSender";
import type { Message, AgentState } from "../components/chat/types";
+import { deriveConversationTitle } from "../lib/conversationTitle";
import { attendeesForUser } from "../utils/noteAttendees";
import type { CalendarAttendee } from "../types/calendar";
import type { NoteAttendeesRequest } from "../types/connectors";
@@ -26,6 +27,8 @@ interface UseEmbeddedChatOptions {
/** The note's calendar event, whose organizer main adds to the attendees. */
noteCalendarEventId?: string | null;
noteSummary?: string;
+ /** A message `sendInNewChat` could not send, so the caller can put it back as a draft. */
+ onNewChatUnsent?: (text: string) => void;
}
interface NoteConversationItem {
@@ -45,6 +48,8 @@ interface UseEmbeddedChatReturn {
activeConversationId: number | null;
switchConversation: (id: number) => Promise<void>;
startNewChat: () => void;
+ /** Starts a new conversation with this message. */
+ sendInNewChat: (text: string, options?: SendToAIOptions) => void;
}
// Stable, so a note without participants doesn't rebuild noteMeeting on
@@ -62,6 +67,7 @@ export function useEmbeddedChat({
selfEmail = null,
noteCalendarEventId = null,
noteSummary,
+ onNewChatUnsent,
}: UseEmbeddedChatOptions): UseEmbeddedChatReturn {
const [conversationId, setConversationId] = useState<number | null>(null);
const [noteConversations, setNoteConversations] = useState<NoteConversationItem[]>([]);
@@ -134,25 +140,10 @@ export function useEmbeddedChat({
noteIdRef.current = noteId;
if (!noteId) return;
- let stale = false;
- (async () => {
- const conversations = await window.electronAPI?.getConversationsForNote?.(noteId);
- if (stale || noteIdRef.current !== noteId) return;
- setNoteConversations(conversations ?? []);
- if (conversations?.length) {
- const mostRecent = conversations[0];
- await persistence.loadConversation(mostRecent.id);
- if (stale || noteIdRef.current !== noteId) return;
- setConversationId(mostRecent.id);
- } else {
- persistence.handleNewChat();
- setConversationId(null);
- }
- })();
-
- return () => {
- stale = true;
- };
+ // The chat opens on a new conversation (see sendInNewChat); earlier ones are in its history.
+ persistence.handleNewChat();
+ setConversationId(null);
+ void fetchNoteConversations();
}, [noteId]); // eslint-disable-line react-hooks/exhaustive-deps
// useChatStreaming returns a fresh object every render; cancelStream is
@@ -179,7 +170,13 @@ export function useEmbeddedChat({
const createConversation = useCallback(
async (text: string) => {
- const id = await persistence.createConversation(`Note: ${noteTitle || "Untitled"}`, noteId);
+ const noteName = noteTitle || "Untitled";
+ const id = await persistence.createConversation(
+ // The message first, so a note's History entries differ; then the note, so the
+ // Control Panel's chat list still says which note it's from.
+ `${deriveConversationTitle(text, noteName)} · ${noteName}`,
+ noteId
+ );
void fetchNoteConversations();
return id;
},
@@ -200,6 +197,32 @@ export function useEmbeddedChat({
[sendMessageWithResult]
);
+ // The sender reads the conversation of the render it was made in, so a message that
+ // starts a new chat waits for the render that cleared the old one.
+ const [newChatMessage, setNewChatMessage] = useState<{
+ text: string;
+ options?: SendToAIOptions;
+ } | null>(null);
+ const sendInNewChat = useCallback(
+ (text: string, options?: SendToAIOptions) => {
+ startNewChat();
+ setNewChatMessage({ text, options });
+ },
+ [startNewChat]
+ );
+ useEffect(() => {
+ if (!newChatMessage) return;
+ setNewChatMessage(null);
+ const { text, options } = newChatMessage;
+ // A send that never started (lock held, conversation not created) must not eat the question.
+ sendMessageWithResult(text, options).then(
+ (sent) => {
+ if (!sent) onNewChatUnsent?.(text);
+ },
+ () => onNewChatUnsent?.(text)
+ );
+ }, [newChatMessage, onNewChatUnsent, sendMessageWithResult]);
+
return {
messages: persistence.messages,
// As in ChatView: a cancelled send can hold the submission lock until an in-flight
@@ -213,5 +236,6 @@ export function useEmbeddedChat({
activeConversationId: conversationId,
switchConversation,
startNewChat,
+ sendInNewChat,
};
}
diff --git a/src/hooks/useResizableWidth.ts b/src/hooks/useResizableWidth.ts
new file mode 100644
index 000000000..63ae78708
--- /dev/null
+++ b/src/hooks/useResizableWidth.ts
@@ -0,0 +1,106 @@
+import { useCallback, useRef, useState } from "react";
+
+type PanelEdge = "start" | "end";
+
+interface ResizableWidthOptions {
+ storageKey: string;
+ /** The panel's edge its handle sits on, the one facing the note. */
+ edge: PanelEdge;
+ min: number;
+ max: number;
+ /** A tighter cap for this drag, for a panel whose CSS cap depends on its surroundings. */
+ getDragMax?: (panel: HTMLElement) => number;
+}
+
+/** Pointer travel before a press counts as a drag, so a click saves no width. */
+const DRAG_SLOP_PX = 3;
+
+/** The panel's width after the pointer moved `deltaX` pixels from where its drag started. */
+export function resizedWidth(
+ startWidth: number,
+ deltaX: number,
+ { edge, rtl, min, max }: { edge: PanelEdge; rtl: boolean; min: number; max: number }
+): number {
+ // Dragging an end edge toward the inline end widens the panel; a start edge, or a
+ // right-to-left layout, flips which way that is on screen.
+ const sign = (edge === "end" ? 1 : -1) * (rtl ? -1 : 1);
+ return Math.min(max, Math.max(min, Math.round(startWidth + sign * deltaX)));
+}
+
+function readStoredWidth(storageKey: string, min: number, max: number): number | null {
+ try {
+ const stored = Number(localStorage.getItem(storageKey));
+ return stored > 0 ? Math.min(max, Math.max(min, stored)) : null;
+ } catch {
+ return null;
+ }
+}
+
+/**
+ * A panel the user can widen or narrow by dragging a handle on one edge. The width is
+ * remembered across launches; null until the panel has been resized once.
+ */
+export function useResizableWidth<T extends HTMLElement>({
+ storageKey,
+ edge,
+ min,
+ max,
+ getDragMax,
+}: ResizableWidthOptions) {
+ const panelRef = useRef<T>(null);
+ const [width, setWidth] = useState(() => readStoredWidth(storageKey, min, max));
+ const [isResizing, setIsResizing] = useState(false);
+
+ const startResize = useCallback(
+ (event: React.PointerEvent<HTMLElement>) => {
+ const panel = panelRef.current;
+ if (event.button !== 0 || !panel) return;
+ // Keeps the drag from selecting the note's text.
+ event.preventDefault();
+ const handle = event.currentTarget;
+ handle.setPointerCapture(event.pointerId);
+ const startX = event.clientX;
+ const startWidth = panel.getBoundingClientRect().width;
+ // Past the CSS cap the panel stops while the pointer goes on, so the drag is held to it.
+ const dragMax = Math.max(min, Math.min(max, getDragMax?.(panel) ?? max));
+ const options = { edge, rtl: getComputedStyle(panel).direction === "rtl", min, max: dragMax };
+ // A click that never drags saves nothing, so the panel keeps its default width.
+ let next: number | null = null;
+ let ended = false;
+
+ const move = (moveEvent: PointerEvent) => {
+ const deltaX = moveEvent.clientX - startX;
+ if (next === null && Math.abs(deltaX) < DRAG_SLOP_PX) return;
+ next = resizedWidth(startWidth, deltaX, options);
+ setWidth(next);
+ };
+ const end = () => {
+ // pointerup is followed by lostpointercapture, which also ends a drag the browser took away.
+ if (ended) return;
+ ended = true;
+ handle.removeEventListener("pointermove", move);
+ handle.removeEventListener("pointerup", end);
+ handle.removeEventListener("pointercancel", end);
+ handle.removeEventListener("lostpointercapture", end);
+ setIsResizing(false);
+ if (next === null) return;
+ // What the panel shows, which a CSS cap (the docked chat's 70%) can hold below the drag.
+ const settled = Math.round(panel.getBoundingClientRect().width);
+ setWidth(settled);
+ try {
+ localStorage.setItem(storageKey, String(settled));
+ } catch {
+ // The width still applies until the app restarts.
+ }
+ };
+ handle.addEventListener("pointermove", move);
+ handle.addEventListener("pointerup", end);
+ handle.addEventListener("pointercancel", end);
+ handle.addEventListener("lostpointercapture", end);
+ setIsResizing(true);
+ },
+ [edge, getDragMax, max, min, storageKey]
+ );
+
+ return { panelRef, width, isResizing, startResize };
+}
diff --git a/src/hooks/useStickToBottom.ts b/src/hooks/useStickToBottom.ts
index 115a911df..6536c9f06 100644
--- a/src/hooks/useStickToBottom.ts
+++ b/src/hooks/useStickToBottom.ts
@@ -75,8 +75,11 @@ export function useStickToBottom<T extends HTMLElement>(
const ro = new ResizeObserver(() => {
if (followerRef.current?.isFollowing()) pinToBottom(node);
});
- ro.observe(node);
- // Border box, so bottom padding that makes room for an overlay (the chat composer) re-pins too.
+ // The scroller's own border box: a resized viewport re-pins, but padding the scroller
+ // makes for an overlay over the page (the note chat over a transcript) doesn't move it.
+ ro.observe(node, { box: "border-box" });
+ // The content's border box, so bottom padding that makes room for the chat's own
+ // composer re-pins, keeping the last lines above it.
if (content) ro.observe(content, { box: "border-box" });
return () => ro.disconnect();
}, [dep, resetToTop]);
diff --git a/src/index.css b/src/index.css
index ed70bd1d1..a7da6d6db 100644
--- a/src/index.css
+++ b/src/index.css
@@ -102,6 +102,10 @@
--shadow-glass:
inset 0 1px 0 rgba(255, 255, 255, 0.7), inset 0 0 0 1px rgba(255, 255, 255, 0.45),
0 2px 10px rgba(15, 23, 42, 0.06);
+ /* The open note chat: the glass rim over a deep, soft lift. */
+ --shadow-chat-card:
+ inset 0 1px 0 rgba(255, 255, 255, 0.85), inset 0 0 0 1px rgba(255, 255, 255, 0.5),
+ 0 28px 64px -24px rgba(15, 23, 42, 0.3), 0 2px 10px rgba(15, 23, 42, 0.06);
/* Same rim on brand-blue surfaces (mic/send buttons): the app icon's glass.
Softer than --shadow-glass because it sits on colour. */
--shadow-brand-glass:
@@ -186,6 +190,9 @@
--shadow-glass:
inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.05),
0 2px 12px rgba(0, 0, 0, 0.35);
+ --shadow-chat-card:
+ inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 0 0 1px rgba(255, 255, 255, 0.06),
+ 0 32px 72px -24px rgba(0, 0, 0, 0.8), 0 2px 12px rgba(0, 0, 0, 0.35);
--shadow-brand-tile: var(--shadow-brand-glass), 0 10px 24px -8px rgb(0 0 0 / 0.6);
}
@@ -1311,6 +1318,15 @@ a:hover {
}
}
+/* Holds a clip only while it runs, so what overflows during an unfold stays hidden
+ and nothing is clipped at rest. */
+@keyframes clip-while-unfolding {
+ from,
+ to {
+ clip-path: inset(0 round 1.5rem);
+ }
+}
+
@keyframes check-pop {
0% {
transform: scale(0);
@@ -1709,8 +1725,7 @@ a:hover {
.rich-text-editor-content {
outline: none;
unicode-bidi: plaintext;
- /* The bottom clears the note's ask bar and the action chips above it. */
- padding-block: 0.75rem 7.5rem;
+ padding-block: 0.75rem 5rem;
/* Centers the text in the page column (PAGE_CONTENT_WIDTH_CLASS) with padding, not a
max-width, so the editable area spans the pane and a margin click places the caret. */
padding-inline: max(1.25rem, calc((100% - var(--container-5xl)) / 2 + 1.25rem));
diff --git a/src/locales/ar/translation.json b/src/locales/ar/translation.json
index 0ed16a4d6..1443933e4 100644
--- a/src/locales/ar/translation.json
+++ b/src/locales/ar/translation.json
@@ -1710,7 +1710,10 @@
"typeMessage": "اكتب رسالة...",
"send": "إرسال",
"voiceDraftStreamingOnly": "الإدخال الصوتي غير متاح مع مزود التفريغ الخاص بك: فهو يدعم الإملاء المباشر فقط. اختر مزودًا آخر في الإعدادات ← تحويل الكلام إلى نص (Speech to Text).",
- "commands": "الأوامر"
+ "commands": "الأوامر",
+ "slashNavigate": "للتنقل",
+ "slashSelect": "للاختيار",
+ "slashClose": "للإغلاق"
},
"tools": {
"search_notesName": "البحث في الملاحظات",
@@ -2327,6 +2330,7 @@
"chunkProgress": "الجزء {{step}} من {{total}}",
"emptyReply": "أعاد النموذج ردًا فارغًا. حاول مرة أخرى، أو اختر نموذجًا آخر.",
"allActions": "كل الإجراءات",
+ "selectAction": "تحديد إجراء",
"manage": "إدارة الإجراءات...",
"addAction": "إجراء جديد",
"editAction": "تعديل الإجراء",
@@ -2343,7 +2347,7 @@
"emptyEditorDescription": "اختر إجراءً من القائمة أو أنشئ إجراءً جديدًا",
"builtin": {
"generateNotes": {
- "name": "إنشاء ملاحظات",
+ "name": "ملخص بالذكاء الاصطناعي",
"description": "تنظيف وتنظيم وتحسين ملاحظاتك"
},
"followUpEmail": {
@@ -2352,7 +2356,7 @@
"cta": "صياغة بريد متابعة"
},
"detailedNotes": {
- "name": "ملخص بالذكاء الاصطناعي",
+ "name": "ملاحظات مفصلة",
"description": "ملاحظات اجتماع دقيقة وشاملة تتضمن القرارات والمهام"
},
"makeTodos": {
@@ -2419,6 +2423,7 @@
"managerTitle": "القوالب والإجراءات",
"manage": "إدارة القوالب...",
"select": "اختر قالبًا",
+ "regenerate": "إعادة الإنشاء",
"addTemplate": "قالب جديد",
"editTemplate": "تعديل القالب",
"namePlaceholder": "اسم القالب",
@@ -2544,7 +2549,7 @@
"chips": {
"catchUp": "أطلعني على المستجدات",
"keyDecisions": "اذكر القرارات الرئيسية",
- "inFlight": "إظهار المشاريع قيد التنفيذ"
+ "openActionItems": "اذكر بنود العمل المفتوحة"
}
},
"invite": "دعوة",
@@ -4251,7 +4256,8 @@
"logout": "تسجيل الخروج",
"managedConfigLoading": "جارٍ التحقق من الإعداد المُدار لمؤسستك. أعد المحاولة بعد لحظات.",
"managedConfigUnavailable": "الوصول المُدار للمؤسسة غير متاح. سجّل الدخول مرة أخرى أو اتصل بالمسؤول.",
- "managedPolicyConflict": "الوصول المُدار محظور بموجب سياسة مساحة العمل الخاصة بك. اتصل بالمسؤول."
+ "managedPolicyConflict": "الوصول المُدار محظور بموجب سياسة مساحة العمل الخاصة بك. اتصل بالمسؤول.",
+ "resizePanel": "تغيير حجم اللوحة"
},
"streaming": {
"errors": {
@@ -4852,15 +4858,10 @@
},
"embeddedChat": {
"askPlaceholder": "اسأل أي شيء عن ملاحظتك",
- "title": "الدردشة",
- "emptyState": "اسأل سؤالًا حول هذه الملاحظة",
- "dock": "إرساء في الشريط الجانبي",
- "undock": "إلغاء الإرساء من الشريط الجانبي",
"close": "إغلاق الدردشة",
"newChat": "محادثة جديدة",
"conversationSelector": "تبديل المحادثة",
"history": "السجل",
- "quickActions": "إجراءات سريعة",
"generateSummary": "إنشاء ملخص"
},
"transcriptionPreview": {
diff --git a/src/locales/de/translation.json b/src/locales/de/translation.json
index 330e98320..de8613279 100644
--- a/src/locales/de/translation.json
+++ b/src/locales/de/translation.json
@@ -212,7 +212,8 @@
"policyUnresolved": "Die Einstellungen deiner Organisation wurden noch nicht geladen. Versuche es gleich noch einmal.",
"managedConfigLoading": "Die verwaltete Einrichtung Ihrer Organisation wird überprüft. Versuchen Sie es gleich noch einmal.",
"managedConfigUnavailable": "Der verwaltete Unternehmenszugriff ist nicht verfügbar. Melden Sie sich erneut an oder wenden Sie sich an Ihren Administrator.",
- "managedPolicyConflict": "Der verwaltete Zugriff wird durch Ihre Workspace-Richtlinie blockiert. Wenden Sie sich an Ihren Administrator."
+ "managedPolicyConflict": "Der verwaltete Zugriff wird durch Ihre Workspace-Richtlinie blockiert. Wenden Sie sich an Ihren Administrator.",
+ "resizePanel": "Bereichsgröße ändern"
},
"onboarding": {
"rehaul": {
@@ -3552,6 +3553,7 @@
"chunkProgress": "Teil {{step}} von {{total}}",
"emptyReply": "Das Modell hat eine leere Antwort zurückgegeben. Versuchen Sie es erneut oder wählen Sie ein anderes Modell.",
"allActions": "Alle Aktionen",
+ "selectAction": "Aktion auswählen",
"manage": "Aktionen verwalten...",
"addAction": "Neue Aktion",
"editAction": "Aktion bearbeiten",
@@ -3568,7 +3570,7 @@
"emptyEditorDescription": "Wählen Sie eine Aktion aus der Liste oder erstellen Sie eine neue",
"builtin": {
"generateNotes": {
- "name": "Notizen generieren",
+ "name": "KI-Zusammenfassung",
"description": "Notizen bereinigen, strukturieren und verbessern"
},
"followUpEmail": {
@@ -3577,7 +3579,7 @@
"cta": "Follow-up-E-Mail entwerfen"
},
"detailedNotes": {
- "name": "KI-Zusammenfassung",
+ "name": "Ausführliche Notizen",
"description": "Präzise, umfassende Meeting-Notizen mit Entscheidungen und Aufgaben"
},
"makeTodos": {
@@ -3644,6 +3646,7 @@
"managerTitle": "Vorlagen & Aktionen",
"manage": "Vorlagen verwalten...",
"select": "Vorlage auswählen",
+ "regenerate": "Neu generieren",
"addTemplate": "Neue Vorlage",
"editTemplate": "Vorlage bearbeiten",
"namePlaceholder": "Name der Vorlage",
@@ -3761,7 +3764,7 @@
"chips": {
"catchUp": "Bring mich auf den neuesten Stand",
"keyDecisions": "Liste die wichtigsten Entscheidungen auf",
- "inFlight": "Zeig laufende Projekte"
+ "openActionItems": "Liste die offenen Aufgaben auf"
}
},
"invite": "Einladen",
@@ -3973,7 +3976,10 @@
"typeMessage": "Nachricht eingeben...",
"send": "Senden",
"voiceDraftStreamingOnly": "Spracheingabe ist mit Ihrem Transkriptionsanbieter nicht verfügbar: Er unterstützt nur Live-Diktat. Wählen Sie unter Einstellungen → Sprache zu Text einen anderen Anbieter.",
- "commands": "Befehle"
+ "commands": "Befehle",
+ "slashNavigate": "zum Navigieren",
+ "slashSelect": "zum Auswählen",
+ "slashClose": "zum Schließen"
},
"tools": {
"search_notesName": "Notizen durchsuchen",
@@ -4730,15 +4736,10 @@
},
"embeddedChat": {
"askPlaceholder": "Frag etwas zu deiner Notiz",
- "title": "Chat",
- "emptyState": "Stelle eine Frage zu dieser Notiz",
- "dock": "In Seitenleiste andocken",
- "undock": "Von Seitenleiste abdocken",
"close": "Chat schließen",
"newChat": "Neuer Chat",
"conversationSelector": "Unterhaltung wechseln",
"history": "Verlauf",
- "quickActions": "Schnellaktionen",
"generateSummary": "Zusammenfassung erstellen"
},
"transcriptionPreview": {
diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json
index 6fa140e5c..9e627473f 100644
--- a/src/locales/en/translation.json
+++ b/src/locales/en/translation.json
@@ -212,7 +212,8 @@
"policyUnresolved": "Your organization's settings haven't loaded yet. Try again in a moment.",
"managedConfigLoading": "Checking your organization's managed setup. Try again in a moment.",
"managedConfigUnavailable": "Managed enterprise access is unavailable. Sign in again or contact your administrator.",
- "managedPolicyConflict": "Managed access is blocked by your workspace policy. Contact your administrator."
+ "managedPolicyConflict": "Managed access is blocked by your workspace policy. Contact your administrator.",
+ "resizePanel": "Resize panel"
},
"onboarding": {
"rehaul": {
@@ -3552,6 +3553,7 @@
"chunkProgress": "Part {{step}} of {{total}}",
"emptyReply": "The model returned an empty reply. Try again, or pick a different model.",
"allActions": "All actions",
+ "selectAction": "Select action",
"manage": "Manage Actions...",
"addAction": "New Action",
"editAction": "Edit Action",
@@ -3568,7 +3570,7 @@
"emptyEditorDescription": "Choose an action from the list or create a new one",
"builtin": {
"generateNotes": {
- "name": "Generate Notes",
+ "name": "AI Summary",
"description": "Clean up, structure, and enhance your notes"
},
"followUpEmail": {
@@ -3577,11 +3579,11 @@
"cta": "Draft a follow-up email"
},
"detailedNotes": {
- "name": "AI Summary",
+ "name": "Detailed Notes",
"description": "Accurate, comprehensive meeting notes with decisions and action items"
},
"makeTodos": {
- "name": "Make to-dos",
+ "name": "Create to-dos",
"description": "List every to-do and its owner in the chat"
},
"createOutline": {
@@ -3644,6 +3646,7 @@
"managerTitle": "Templates & Actions",
"manage": "Manage Templates...",
"select": "Choose template",
+ "regenerate": "Regenerate",
"addTemplate": "New Template",
"editTemplate": "Edit Template",
"namePlaceholder": "Template name",
@@ -3761,7 +3764,7 @@
"chips": {
"catchUp": "Catch me up",
"keyDecisions": "List key decisions",
- "inFlight": "Show in flight projects"
+ "openActionItems": "List open action items"
}
},
"invite": "Invite",
@@ -3973,7 +3976,10 @@
"typeMessage": "Type a message...",
"send": "Send",
"voiceDraftStreamingOnly": "Voice input isn't available with your transcription provider: it only supports live dictation. Choose another provider in Settings → Speech to Text.",
- "commands": "Commands"
+ "commands": "Commands",
+ "slashNavigate": "to navigate",
+ "slashSelect": "to select",
+ "slashClose": "to close"
},
"tools": {
"search_notesName": "Search notes",
@@ -4730,15 +4736,10 @@
},
"embeddedChat": {
"askPlaceholder": "Ask anything about your note",
- "title": "Chat",
- "emptyState": "Ask a question about this note",
- "dock": "Dock to sidebar",
- "undock": "Undock from sidebar",
"close": "Close chat",
"newChat": "New chat",
"conversationSelector": "Switch conversation",
"history": "History",
- "quickActions": "Quick actions",
"generateSummary": "Generate summary"
},
"transcriptionPreview": {
diff --git a/src/locales/es/translation.json b/src/locales/es/translation.json
index 7c5aff6e1..adcc76646 100644
--- a/src/locales/es/translation.json
+++ b/src/locales/es/translation.json
@@ -212,7 +212,8 @@
"policyUnresolved": "La configuración de tu organización aún no se ha cargado. Inténtalo de nuevo en un momento.",
"managedConfigLoading": "Comprobando la configuración gestionada de tu organización. Inténtalo de nuevo en un momento.",
"managedConfigUnavailable": "El acceso empresarial gestionado no está disponible. Vuelve a iniciar sesión o contacta a tu administrador.",
- "managedPolicyConflict": "El acceso gestionado está bloqueado por la política de tu espacio de trabajo. Contacta a tu administrador."
+ "managedPolicyConflict": "El acceso gestionado está bloqueado por la política de tu espacio de trabajo. Contacta a tu administrador.",
+ "resizePanel": "Cambiar el tamaño del panel"
},
"onboarding": {
"rehaul": {
@@ -3234,6 +3235,7 @@
},
"actions": {
"allActions": "Todas las acciones",
+ "selectAction": "Seleccionar acción",
"manage": "Gestionar acciones...",
"addAction": "Nueva acción",
"editAction": "Editar acción",
@@ -3253,7 +3255,7 @@
"emptyReply": "El modelo devolvió una respuesta vacía. Vuelve a intentarlo o elige otro modelo.",
"builtin": {
"generateNotes": {
- "name": "Generar notas",
+ "name": "Resumen con IA",
"description": "Limpiar, estructurar y mejorar tus notas"
},
"followUpEmail": {
@@ -3262,7 +3264,7 @@
"cta": "Redactar correo de seguimiento"
},
"detailedNotes": {
- "name": "Resumen con IA",
+ "name": "Notas detalladas",
"description": "Notas de reunión precisas y completas con decisiones y tareas"
},
"makeTodos": {
@@ -3329,6 +3331,7 @@
"managerTitle": "Plantillas y acciones",
"manage": "Gestionar plantillas...",
"select": "Elegir plantilla",
+ "regenerate": "Regenerar",
"addTemplate": "Nueva plantilla",
"editTemplate": "Editar plantilla",
"namePlaceholder": "Nombre de la plantilla",
@@ -3462,7 +3465,7 @@
"chips": {
"catchUp": "Ponme al día",
"keyDecisions": "Lista las decisiones clave",
- "inFlight": "Muestra los proyectos en curso"
+ "openActionItems": "Lista las tareas pendientes"
}
},
"invite": "Invitar",
@@ -3855,7 +3858,10 @@
"typeMessage": "Escribe un mensaje...",
"send": "Enviar",
"voiceDraftStreamingOnly": "La entrada de voz no está disponible con tu proveedor de transcripción: solo admite dictado en directo. Elige otro proveedor en Ajustes → Voz a texto.",
- "commands": "Comandos"
+ "commands": "Comandos",
+ "slashNavigate": "para navegar",
+ "slashSelect": "para seleccionar",
+ "slashClose": "para cerrar"
},
"tools": {
"search_notesName": "Buscar notas",
@@ -4654,15 +4660,10 @@
},
"embeddedChat": {
"askPlaceholder": "Pregunta sobre tu nota",
- "title": "Chat",
- "emptyState": "Haz una pregunta sobre esta nota",
- "dock": "Anclar a la barra lateral",
- "undock": "Desanclar de la barra lateral",
"close": "Cerrar chat",
"newChat": "Nuevo chat",
"conversationSelector": "Cambiar conversación",
"history": "Historial",
- "quickActions": "Acciones rápidas",
"generateSummary": "Generar resumen"
},
"transcriptionPreview": {
diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.json
index 139fe0827..f6600aceb 100644
--- a/src/locales/fr/translation.json
+++ b/src/locales/fr/translation.json
@@ -212,7 +212,8 @@
"policyUnresolved": "Les paramètres de votre organisation ne sont pas encore chargés. Réessayez dans un instant.",
"managedConfigLoading": "Vérification de la configuration gérée de votre organisation en cours. Réessayez dans un instant.",
"managedConfigUnavailable": "L'accès d'entreprise géré est indisponible. Reconnectez-vous ou contactez votre administrateur.",
- "managedPolicyConflict": "L'accès géré est bloqué par la politique de votre espace de travail. Contactez votre administrateur."
+ "managedPolicyConflict": "L'accès géré est bloqué par la politique de votre espace de travail. Contactez votre administrateur.",
+ "resizePanel": "Redimensionner le panneau"
},
"onboarding": {
"rehaul": {
@@ -3552,6 +3553,7 @@
"chunkProgress": "Partie {{step}} sur {{total}}",
"emptyReply": "Le modèle a renvoyé une réponse vide. Réessayez ou choisissez un autre modèle.",
"allActions": "Toutes les actions",
+ "selectAction": "Sélectionner l'action",
"manage": "Gérer les actions...",
"addAction": "Nouvelle action",
"editAction": "Modifier l'action",
@@ -3568,7 +3570,7 @@
"emptyEditorDescription": "Choisissez une action dans la liste ou créez-en une nouvelle",
"builtin": {
"generateNotes": {
- "name": "Générer des notes",
+ "name": "Résumé IA",
"description": "Nettoyer, structurer et améliorer vos notes"
},
"followUpEmail": {
@@ -3577,7 +3579,7 @@
"cta": "Rédiger un e-mail de suivi"
},
"detailedNotes": {
- "name": "Résumé IA",
+ "name": "Notes détaillées",
"description": "Des notes de réunion précises et complètes avec décisions et actions"
},
"makeTodos": {
@@ -3644,6 +3646,7 @@
"managerTitle": "Modèles et actions",
"manage": "Gérer les modèles...",
"select": "Choisir un modèle",
+ "regenerate": "Régénérer",
"addTemplate": "Nouveau modèle",
"editTemplate": "Modifier le modèle",
"namePlaceholder": "Nom du modèle",
@@ -3761,7 +3764,7 @@
"chips": {
"catchUp": "Résume-moi les nouveautés",
"keyDecisions": "Liste les décisions clés",
- "inFlight": "Montre les projets en cours"
+ "openActionItems": "Liste les actions à mener"
}
},
"invite": "Inviter",
@@ -3973,7 +3976,10 @@
"typeMessage": "Écrivez un message...",
"send": "Envoyer",
"voiceDraftStreamingOnly": "La saisie vocale n'est pas disponible avec votre fournisseur de transcription : il ne prend en charge que la dictée en direct. Choisissez un autre fournisseur dans Réglages → Parole en texte.",
- "commands": "Commandes"
+ "commands": "Commandes",
+ "slashNavigate": "pour naviguer",
+ "slashSelect": "pour sélectionner",
+ "slashClose": "pour fermer"
},
"tools": {
"search_notesName": "Rechercher des notes",
@@ -4730,15 +4736,10 @@
},
"embeddedChat": {
"askPlaceholder": "Posez une question sur votre note",
- "title": "Chat",
- "emptyState": "Posez une question sur cette note",
- "dock": "Ancrer dans la barre latérale",
- "undock": "Détacher de la barre latérale",
"close": "Fermer le chat",
"newChat": "Nouvelle discussion",
"conversationSelector": "Changer de conversation",
"history": "Historique",
- "quickActions": "Actions rapides",
"generateSummary": "Générer un résumé"
},
"transcriptionPreview": {
diff --git a/src/locales/it/translation.json b/src/locales/it/translation.json
index f4dc7250b..fc225e59e 100644
--- a/src/locales/it/translation.json
+++ b/src/locales/it/translation.json
@@ -212,7 +212,8 @@
"policyUnresolved": "Le impostazioni della tua organizzazione non sono ancora state caricate. Riprova tra un momento.",
"managedConfigLoading": "Verifica della configurazione gestita della tua organizzazione in corso. Riprova tra un momento.",
"managedConfigUnavailable": "L'accesso aziendale gestito non è disponibile. Accedi di nuovo o contatta l'amministratore.",
- "managedPolicyConflict": "L'accesso gestito è bloccato dai criteri del tuo spazio di lavoro. Contatta l'amministratore."
+ "managedPolicyConflict": "L'accesso gestito è bloccato dai criteri del tuo spazio di lavoro. Contatta l'amministratore.",
+ "resizePanel": "Ridimensiona il pannello"
},
"onboarding": {
"rehaul": {
@@ -3181,6 +3182,7 @@
},
"actions": {
"allActions": "Tutte le azioni",
+ "selectAction": "Seleziona azione",
"manage": "Gestisci azioni...",
"addAction": "Nuova azione",
"editAction": "Modifica azione",
@@ -3200,7 +3202,7 @@
"emptyReply": "Il modello ha restituito una risposta vuota. Riprova o scegli un altro modello.",
"builtin": {
"generateNotes": {
- "name": "Genera note",
+ "name": "Riepilogo AI",
"description": "Pulire, strutturare e migliorare le note"
},
"followUpEmail": {
@@ -3209,7 +3211,7 @@
"cta": "Scrivi un'email di follow-up"
},
"detailedNotes": {
- "name": "Riepilogo AI",
+ "name": "Note dettagliate",
"description": "Note di riunione accurate e complete con decisioni e azioni"
},
"makeTodos": {
@@ -3276,6 +3278,7 @@
"managerTitle": "Modelli e azioni",
"manage": "Gestisci modelli...",
"select": "Scegli modello",
+ "regenerate": "Rigenera",
"addTemplate": "Nuovo modello",
"editTemplate": "Modifica modello",
"namePlaceholder": "Nome del modello",
@@ -3409,7 +3412,7 @@
"chips": {
"catchUp": "Aggiornami",
"keyDecisions": "Elenca le decisioni chiave",
- "inFlight": "Mostra i progetti in corso"
+ "openActionItems": "Elenca le attività aperte"
}
},
"invite": "Invita",
@@ -3802,7 +3805,10 @@
"typeMessage": "Scrivi un messaggio...",
"send": "Invia",
"voiceDraftStreamingOnly": "L'input vocale non è disponibile con il tuo provider di trascrizione: supporta solo la dettatura dal vivo. Scegli un altro provider in Impostazioni → Da voce a testo.",
- "commands": "Comandi"
+ "commands": "Comandi",
+ "slashNavigate": "per navigare",
+ "slashSelect": "per selezionare",
+ "slashClose": "per chiudere"
},
"tools": {
"search_notesName": "Cerca nelle note",
@@ -4654,15 +4660,10 @@
},
"embeddedChat": {
"askPlaceholder": "Chiedi qualcosa sulla tua nota",
- "title": "Chat",
- "emptyState": "Fai una domanda su questa nota",
- "dock": "Ancora nella barra laterale",
- "undock": "Sgancia dalla barra laterale",
"close": "Chiudi chat",
"newChat": "Nuova chat",
"conversationSelector": "Cambia conversazione",
"history": "Cronologia",
- "quickActions": "Azioni rapide",
"generateSummary": "Genera riepilogo"
},
"transcriptionPreview": {
diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.json
index 44c51eb19..d6a760168 100644
--- a/src/locales/ja/translation.json
+++ b/src/locales/ja/translation.json
@@ -212,7 +212,8 @@
"policyUnresolved": "組織の設定がまだ読み込まれていません。しばらくしてからもう一度お試しください。",
"managedConfigLoading": "組織のマネージド設定を確認しています。しばらくしてからもう一度お試しください。",
"managedConfigUnavailable": "マネージド エンタープライズ アクセスを利用できません。再度サインインするか、管理者にお問い合わせください。",
- "managedPolicyConflict": "ワークスペースのポリシーによりマネージド アクセスがブロックされています。管理者にお問い合わせください。"
+ "managedPolicyConflict": "ワークスペースのポリシーによりマネージド アクセスがブロックされています。管理者にお問い合わせください。",
+ "resizePanel": "パネルのサイズを変更"
},
"onboarding": {
"rehaul": {
@@ -2961,6 +2962,7 @@
},
"actions": {
"allActions": "すべてのアクション",
+ "selectAction": "アクションを選択",
"manage": "アクションを管理...",
"addAction": "新しいアクション",
"editAction": "アクションを編集",
@@ -2980,7 +2982,7 @@
"emptyReply": "モデルから空の応答が返されました。もう一度お試しいただくか、別のモデルを選択してください。",
"builtin": {
"generateNotes": {
- "name": "ノートを生成",
+ "name": "AI要約",
"description": "ノートを整理、構成、強化する"
},
"followUpEmail": {
@@ -2989,7 +2991,7 @@
"cta": "フォローアップメールを作成"
},
"detailedNotes": {
- "name": "AI要約",
+ "name": "詳細ノート",
"description": "決定事項とアクションを含む正確で網羅的な会議ノート"
},
"makeTodos": {
@@ -3056,6 +3058,7 @@
"managerTitle": "テンプレートとアクション",
"manage": "テンプレートを管理...",
"select": "テンプレートを選択",
+ "regenerate": "再生成",
"addTemplate": "新しいテンプレート",
"editTemplate": "テンプレートを編集",
"namePlaceholder": "テンプレート名",
@@ -3337,7 +3340,7 @@
"chips": {
"catchUp": "最新情報をまとめて",
"keyDecisions": "重要な決定事項を一覧に",
- "inFlight": "進行中のプロジェクトを表示"
+ "openActionItems": "未完了のアクションアイテムを一覧に"
}
},
"invite": "招待",
@@ -3802,7 +3805,10 @@
"typeMessage": "メッセージを入力...",
"send": "送信",
"voiceDraftStreamingOnly": "現在の文字起こしプロバイダーはライブ音声入力のみに対応しているため、音声入力は利用できません。設定 → 音声テキスト変換 で別のプロバイダーを選択してください。",
- "commands": "コマンド"
+ "commands": "コマンド",
+ "slashNavigate": "で移動",
+ "slashSelect": "で選択",
+ "slashClose": "で閉じる"
},
"tools": {
"search_notesName": "ノートを検索",
@@ -4654,15 +4660,10 @@
},
"embeddedChat": {
"askPlaceholder": "ノートについて何でも質問",
- "title": "チャット",
- "emptyState": "このノートについて質問してください",
- "dock": "サイドバーに固定",
- "undock": "サイドバーから外す",
"close": "チャットを閉じる",
"newChat": "新しいチャット",
"conversationSelector": "会話を切り替え",
"history": "履歴",
- "quickActions": "クイックアクション",
"generateSummary": "要約を作成"
},
"transcriptionPreview": {
diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.json
index d4cdf088c..e7b7b4eac 100644
--- a/src/locales/pt/translation.json
+++ b/src/locales/pt/translation.json
@@ -191,7 +191,8 @@
"policyUnresolved": "As configurações da sua organização ainda não foram carregadas. Tente novamente em instantes.",
"managedConfigLoading": "Verificando a configuração gerenciada da sua organização. Tente novamente em instantes.",
"managedConfigUnavailable": "O acesso empresarial gerenciado está indisponível. Entre novamente ou entre em contato com o administrador.",
- "managedPolicyConflict": "O acesso gerenciado está bloqueado pela política do seu espaço de trabalho. Entre em contato com o administrador."
+ "managedPolicyConflict": "O acesso gerenciado está bloqueado pela política do seu espaço de trabalho. Entre em contato com o administrador.",
+ "resizePanel": "Redimensionar painel"
},
"onboarding": {
"rehaul": {
@@ -3181,6 +3182,7 @@
},
"actions": {
"allActions": "Todas as ações",
+ "selectAction": "Selecionar ação",
"manage": "Gerenciar ações...",
"addAction": "Nova ação",
"editAction": "Editar ação",
@@ -3200,7 +3202,7 @@
"emptyReply": "O modelo retornou uma resposta vazia. Tente novamente ou escolha outro modelo.",
"builtin": {
"generateNotes": {
- "name": "Gerar notas",
+ "name": "Resumo com IA",
"description": "Limpar, estruturar e aprimorar suas notas"
},
"followUpEmail": {
@@ -3209,7 +3211,7 @@
"cta": "Redigir e-mail de acompanhamento"
},
"detailedNotes": {
- "name": "Resumo com IA",
+ "name": "Notas detalhadas",
"description": "Notas de reunião precisas e completas com decisões e ações"
},
"makeTodos": {
@@ -3276,6 +3278,7 @@
"managerTitle": "Modelos e ações",
"manage": "Gerenciar modelos...",
"select": "Escolher modelo",
+ "regenerate": "Gerar novamente",
"addTemplate": "Novo modelo",
"editTemplate": "Editar modelo",
"namePlaceholder": "Nome do modelo",
@@ -3409,7 +3412,7 @@
"chips": {
"catchUp": "Me atualize",
"keyDecisions": "Liste as decisões principais",
- "inFlight": "Mostre os projetos em andamento"
+ "openActionItems": "Liste as tarefas pendentes"
}
},
"invite": "Convidar",
@@ -3802,7 +3805,10 @@
"typeMessage": "Digite uma mensagem...",
"send": "Enviar",
"voiceDraftStreamingOnly": "A entrada por voz não está disponível com seu provedor de transcrição: ele só suporta ditado ao vivo. Escolha outro provedor em Configurações → Fala para texto.",
- "commands": "Comandos"
+ "commands": "Comandos",
+ "slashNavigate": "para navegar",
+ "slashSelect": "para selecionar",
+ "slashClose": "para fechar"
},
"tools": {
"search_notesName": "Pesquisar notas",
@@ -4654,15 +4660,10 @@
},
"embeddedChat": {
"askPlaceholder": "Pergunte sobre sua nota",
- "title": "Chat",
- "emptyState": "Faça uma pergunta sobre esta nota",
- "dock": "Fixar na barra lateral",
- "undock": "Desafixar da barra lateral",
"close": "Fechar chat",
"newChat": "Novo chat",
"conversationSelector": "Trocar conversa",
"history": "Histórico",
- "quickActions": "Ações rápidas",
"generateSummary": "Gerar resumo"
},
"transcriptionPreview": {
diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.json
index 77d18cb2f..bb8aca2c6 100644
--- a/src/locales/ru/translation.json
+++ b/src/locales/ru/translation.json
@@ -212,7 +212,8 @@
"policyUnresolved": "Настройки вашей организации ещё не загружены. Повторите попытку через мгновение.",
"managedConfigLoading": "Проверяется управляемая настройка вашей организации. Повторите попытку через некоторое время.",
"managedConfigUnavailable": "Управляемый корпоративный доступ недоступен. Войдите снова или обратитесь к администратору.",
- "managedPolicyConflict": "Управляемый доступ заблокирован политикой вашего рабочего пространства. Обратитесь к администратору."
+ "managedPolicyConflict": "Управляемый доступ заблокирован политикой вашего рабочего пространства. Обратитесь к администратору.",
+ "resizePanel": "Изменить размер панели"
},
"onboarding": {
"rehaul": {
@@ -3201,6 +3202,7 @@
},
"actions": {
"allActions": "Все действия",
+ "selectAction": "Выбрать действие",
"manage": "Управление действиями...",
"addAction": "Новое действие",
"editAction": "Редактировать действие",
@@ -3220,7 +3222,7 @@
"emptyReply": "Модель вернула пустой ответ. Попробуйте снова или выберите другую модель.",
"builtin": {
"generateNotes": {
- "name": "Сгенерировать заметки",
+ "name": "ИИ-сводка",
"description": "Очистить, структурировать и улучшить заметки"
},
"followUpEmail": {
@@ -3229,7 +3231,7 @@
"cta": "Составить письмо по итогам"
},
"detailedNotes": {
- "name": "ИИ-сводка",
+ "name": "Подробные заметки",
"description": "Точные и полные заметки по встрече с решениями и задачами"
},
"makeTodos": {
@@ -3296,6 +3298,7 @@
"managerTitle": "Шаблоны и действия",
"manage": "Управление шаблонами...",
"select": "Выбрать шаблон",
+ "regenerate": "Создать заново",
"addTemplate": "Новый шаблон",
"editTemplate": "Редактировать шаблон",
"namePlaceholder": "Название шаблона",
@@ -3433,7 +3436,7 @@
"chips": {
"catchUp": "Введи меня в курс дела",
"keyDecisions": "Перечисли ключевые решения",
- "inFlight": "Покажи текущие проекты"
+ "openActionItems": "Перечисли открытые задачи"
}
},
"invite": "Пригласить",
@@ -3846,7 +3849,10 @@
"typeMessage": "Введите сообщение...",
"send": "Отправить",
"voiceDraftStreamingOnly": "Голосовой ввод недоступен с вашим провайдером транскрипции: он поддерживает только живую диктовку. Выберите другого провайдера в Настройках → Речь в текст.",
- "commands": "Команды"
+ "commands": "Команды",
+ "slashNavigate": "навигация",
+ "slashSelect": "выбрать",
+ "slashClose": "закрыть"
},
"tools": {
"search_notesName": "Поиск заметок",
@@ -4698,15 +4704,10 @@
},
"embeddedChat": {
"askPlaceholder": "Спросите о своей заметке",
- "title": "Чат",
- "emptyState": "Задайте вопрос об этой заметке",
- "dock": "Закрепить на боковой панели",
- "undock": "Открепить от боковой панели",
"close": "Закрыть чат",
"newChat": "Новый чат",
"conversationSelector": "Сменить беседу",
"history": "История",
- "quickActions": "Быстрые действия",
"generateSummary": "Создать сводку"
},
"transcriptionPreview": {
diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.json
index 461138547..6f92a47a1 100644
--- a/src/locales/zh-CN/translation.json
+++ b/src/locales/zh-CN/translation.json
@@ -212,7 +212,8 @@
"policyUnresolved": "您所在组织的设置尚未加载完成。请稍后再试。",
"managedConfigLoading": "正在检查您组织的托管设置。请稍候再试。",
"managedConfigUnavailable": "托管企业访问不可用。请重新登录或联系管理员。",
- "managedPolicyConflict": "托管访问已被您工作区的策略阻止。请联系管理员。"
+ "managedPolicyConflict": "托管访问已被您工作区的策略阻止。请联系管理员。",
+ "resizePanel": "调整面板大小"
},
"onboarding": {
"rehaul": {
@@ -3181,6 +3182,7 @@
},
"actions": {
"allActions": "全部操作",
+ "selectAction": "选择操作",
"manage": "管理操作...",
"addAction": "新建操作",
"editAction": "编辑操作",
@@ -3200,7 +3202,7 @@
"emptyReply": "模型返回了空回复。请重试,或选择其他模型。",
"builtin": {
"generateNotes": {
- "name": "生成笔记",
+ "name": "AI 摘要",
"description": "清理、结构化和增强您的笔记"
},
"followUpEmail": {
@@ -3209,7 +3211,7 @@
"cta": "草拟跟进邮件"
},
"detailedNotes": {
- "name": "AI 摘要",
+ "name": "详细笔记",
"description": "准确、全面的会议笔记,包含决策和行动项"
},
"makeTodos": {
@@ -3276,6 +3278,7 @@
"managerTitle": "模板和操作",
"manage": "管理模板...",
"select": "选择模板",
+ "regenerate": "重新生成",
"addTemplate": "新建模板",
"editTemplate": "编辑模板",
"namePlaceholder": "模板名称",
@@ -3409,7 +3412,7 @@
"chips": {
"catchUp": "帮我补上进展",
"keyDecisions": "列出关键决定",
- "inFlight": "显示进行中的项目"
+ "openActionItems": "列出待办事项"
}
},
"invite": "邀请",
@@ -3802,7 +3805,10 @@
"typeMessage": "输入消息...",
"send": "发送",
"voiceDraftStreamingOnly": "当前转录服务商仅支持实时听写,因此无法使用语音输入。请在“设置 → 语音转文字”中选择其他服务商。",
- "commands": "命令"
+ "commands": "命令",
+ "slashNavigate": "导航",
+ "slashSelect": "选择",
+ "slashClose": "关闭"
},
"tools": {
"search_notesName": "搜索笔记",
@@ -4654,15 +4660,10 @@
},
"embeddedChat": {
"askPlaceholder": "询问关于笔记的任何问题",
- "title": "聊天",
- "emptyState": "就这条笔记提个问题",
- "dock": "固定到侧边栏",
- "undock": "从侧边栏取消固定",
"close": "关闭聊天",
"newChat": "新对话",
"conversationSelector": "切换对话",
"history": "历史记录",
- "quickActions": "快捷操作",
"generateSummary": "生成摘要"
},
"transcriptionPreview": {
diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.json
index 77b1b118b..4ed05bd34 100644
--- a/src/locales/zh-TW/translation.json
+++ b/src/locales/zh-TW/translation.json
@@ -212,7 +212,8 @@
"policyUnresolved": "貴組織的設定尚未載入完成。請稍後再試。",
"managedConfigLoading": "正在檢查您組織的託管設定。請稍候再試。",
"managedConfigUnavailable": "託管企業存取無法使用。請重新登入或聯絡管理員。",
- "managedPolicyConflict": "託管存取已被您工作區的政策封鎖。請聯絡管理員。"
+ "managedPolicyConflict": "託管存取已被您工作區的政策封鎖。請聯絡管理員。",
+ "resizePanel": "調整面板大小"
},
"onboarding": {
"rehaul": {
@@ -3181,6 +3182,7 @@
},
"actions": {
"allActions": "全部動作",
+ "selectAction": "選擇動作",
"manage": "管理動作...",
"addAction": "新增動作",
"editAction": "編輯動作",
@@ -3200,7 +3202,7 @@
"emptyReply": "模型傳回了空白回覆。請再試一次,或選擇其他模型。",
"builtin": {
"generateNotes": {
- "name": "生成筆記",
+ "name": "AI 摘要",
"description": "清理、結構化和增強您的筆記"
},
"followUpEmail": {
@@ -3209,7 +3211,7 @@
"cta": "草擬跟進郵件"
},
"detailedNotes": {
- "name": "AI 摘要",
+ "name": "詳細筆記",
"description": "準確、完整的會議筆記,包含決策和行動項目"
},
"makeTodos": {
@@ -3276,6 +3278,7 @@
"managerTitle": "範本與動作",
"manage": "管理範本...",
"select": "選擇範本",
+ "regenerate": "重新產生",
"addTemplate": "新增範本",
"editTemplate": "編輯範本",
"namePlaceholder": "範本名稱",
@@ -3409,7 +3412,7 @@
"chips": {
"catchUp": "幫我補上進度",
"keyDecisions": "列出關鍵決策",
- "inFlight": "顯示進行中的專案"
+ "openActionItems": "列出待辦事項"
}
},
"invite": "邀請",
@@ -3802,7 +3805,10 @@
"typeMessage": "輸入訊息...",
"send": "傳送",
"voiceDraftStreamingOnly": "目前的轉錄服務商僅支援即時聽寫,因此無法使用語音輸入。請在「設定 → 語音轉文字」中選擇其他服務商。",
- "commands": "指令"
+ "commands": "指令",
+ "slashNavigate": "瀏覽",
+ "slashSelect": "選擇",
+ "slashClose": "關閉"
},
"tools": {
"search_notesName": "搜尋筆記",
@@ -4654,15 +4660,10 @@
},
"embeddedChat": {
"askPlaceholder": "詢問關於筆記的任何問題",
- "title": "聊天",
- "emptyState": "就這條筆記提個問題",
- "dock": "固定到側邊欄",
- "undock": "從側邊欄取消固定",
"close": "關閉聊天",
"newChat": "新對話",
"conversationSelector": "切換對話",
"history": "歷史記錄",
- "quickActions": "快速操作",
"generateSummary": "產生摘要"
},
"transcriptionPreview": {
diff --git a/src/stores/actionStore.ts b/src/stores/actionStore.ts
index ac895e1f6..55512d53a 100644
--- a/src/stores/actionStore.ts
+++ b/src/stores/actionStore.ts
@@ -2,7 +2,7 @@ import { create } from "zustand";
import { useShallow } from "zustand/react/shallow";
import { TFunction } from "i18next";
import type { ActionItem, ActionKind } from "../types/electron";
-import { DETAILED_NOTES_KEY } from "../helpers/builtinActions";
+import { GENERATE_NOTES_KEY } from "../helpers/builtinActions";
interface ActionState {
actions: ActionItem[];
@@ -88,7 +88,7 @@ export function resolveTemplate(
): ActionItem | null {
return (
templates.find((a) => a.client_id === clientId) ??
- templates.find((a) => a.translation_key === DETAILED_NOTES_KEY) ??
+ templates.find((a) => a.translation_key === GENERATE_NOTES_KEY) ??
templates[0] ??
null
);
diff --git a/test/components/chatInputSlashCommands.test.js b/test/components/chatInputSlashCommands.test.js
index de931d94c..3404188d0 100644
--- a/test/components/chatInputSlashCommands.test.js
+++ b/test/components/chatInputSlashCommands.test.js
@@ -20,15 +20,6 @@ async function mountChatInput(t) {
export const getMicAnalyser = () => null;
export const useMeetingRecordingStore = { getState: () => ({ currentMicLevel: 0 }) };
`,
- // Radix positions the menu with real layout; render it in place instead.
- "/ui/popover": `
- import { createContext, createElement, useContext } from "react";
- const Open = createContext(false);
- export const Popover = ({ open, children }) =>
- createElement(Open.Provider, { value: open }, children);
- export const PopoverAnchor = () => null;
- export const PopoverContent = ({ children }) => (useContext(Open) ? children : null);
- `,
},
});
const { ChatInput } = await vite.ssrLoadModule("/components/chat/ChatInput.tsx");
@@ -58,7 +49,7 @@ const options = (container) => {
const listbox = findElement(container, (el) => el.getAttribute?.("role") === "listbox");
if (!listbox) return [];
return listbox.childNodes.map((option) => ({
- label: option.textContent,
+ label: option.textContent.trim(),
selected: option.getAttribute("aria-selected") === "true",
}));
};
@@ -68,13 +59,21 @@ test("typing / in the composer runs an action from the keyboard", async (t) => {
const ran = [];
const drafts = [];
const submitted = [];
- let escaped = 0;
+ const menuOpen = [];
+ const icon = () => null;
const commands = [
- { id: "email", label: "Follow-up email", run: () => ran.push("email") },
- { id: "todos", label: "Make to-dos", run: () => ran.push("todos") },
+ {
+ id: "email",
+ label: "Follow-up email",
+ icon,
+ description: "Draft it from the note",
+ run: () => ran.push("email"),
+ },
+ { id: "todos", label: "Create to-dos", icon, run: () => ran.push("todos") },
{
id: "tldr",
label: "Add TL;DR",
+ icon,
hint: "AI summary",
disabled: true,
run: () => ran.push("tldr"),
@@ -90,9 +89,9 @@ test("typing / in the composer runs an action from the keyboard", async (t) => {
draftText,
onDraftChange: (text) => drafts.push(text),
onTextSubmit: (text) => submitted.push(text),
- onEscape: () => escaped++,
focusOnIdle: false,
slashCommands: commands,
+ onSlashMenuOpenChange: (open) => menuOpen.push(open),
})
)
);
@@ -103,8 +102,30 @@ test("typing / in the composer runs an action from the keyboard", async (t) => {
await React.act(async () => textarea.dispatchEvent({ type: "focusin", bubbles: true }));
assert.deepEqual(
options(container).map((option) => option.label),
- ["Follow-up email", "Make to-dos", "Add TL;DRAI summary"]
+ ["Follow-up emailDraft it from the note", "Create to-dos", "Add TL;DRAI summary"],
+ "each command shows its description"
+ );
+ assert.equal(menuOpen.at(-1), true, "the host hears the menu open, to hide the chat");
+ const listbox = findElement(container, (el) => el.getAttribute?.("role") === "listbox");
+ const pressBetweenRows = listbox.dispatchEvent({
+ type: "mousedown",
+ bubbles: true,
+ preventDefault() {
+ this.defaultPrevented = true;
+ },
+ });
+ assert.equal(pressBetweenRows, false, "a press between the rows keeps focus in the composer");
+
+ const row = (index) =>
+ findElement(container, (el) => el.getAttribute?.("role") === "listbox").childNodes[index];
+ const selected = () => options(container).map((option) => option.selected);
+ await React.act(async () =>
+ row(2).dispatchEvent({ type: "mouseover", bubbles: true, relatedTarget: null })
);
+ assert.deepEqual(selected(), [true, false, false], "a row sliding under a resting pointer");
+ await React.act(async () => row(1).dispatchEvent({ type: "mousemove", bubbles: true }));
+ assert.deepEqual(selected(), [false, true, false], "moving the pointer picks the row");
+ await key(textarea, "ArrowUp");
await key(textarea, "ArrowDown");
assert.deepEqual(
@@ -130,7 +151,6 @@ test("typing / in the composer runs an action from the keyboard", async (t) => {
drafts.length = 0;
await key(textarea, "Escape");
assert.deepEqual(drafts, [""], "Escape clears the filter");
- assert.equal(escaped, 0, "Escape dismisses the menu, not the composer");
await render("/");
await key(textarea, "Tab", { shiftKey: true });
@@ -141,24 +161,45 @@ test("typing / in the composer runs an action from the keyboard", async (t) => {
await render("/zzz");
assert.deepEqual(options(container), []);
+ assert.equal(menuOpen.at(-1), false, "and close, to show the chat again");
await key(textarea, "Enter");
assert.deepEqual(submitted, ["/zzz"], "a draft no command matches is sent as typed");
});
test("a / filter ranks labels with a word starting with it first", async () => {
const { matchSlashCommands } = await import("../../src/components/chat/slashCommands.ts");
- const commands = ["Make to-dos", "Shorten", "Slack update", "全部操作"].map((label) => ({
+ const commands = ["Create to-dos", "Shorten", "Slack update", "全部操作"].map((label) => ({
id: label,
label,
run: () => {},
}));
const labels = (draft) => matchSlashCommands(commands, draft).map((command) => command.label);
- assert.deepEqual(labels("/s"), ["Shorten", "Slack update", "Make to-dos"]);
- assert.deepEqual(labels("/DOS"), ["Make to-dos"]);
+ assert.deepEqual(labels("/s"), ["Shorten", "Slack update", "Create to-dos"]);
+ assert.deepEqual(labels("/DOS"), ["Create to-dos"]);
assert.deepEqual(labels("/操作"), ["全部操作"], "a label without spaces matches mid-word");
assert.deepEqual(labels("/操作"), ["全部操作"], "a CJK input method's full-width slash counts");
- assert.deepEqual(labels("/"), ["Make to-dos", "Shorten", "Slack update", "全部操作"]);
+ assert.deepEqual(labels("/"), ["Create to-dos", "Shorten", "Slack update", "全部操作"]);
assert.deepEqual(labels("Summarize /s"), [], "only a draft that starts with / asks");
assert.deepEqual(labels("/s\nmore"), [], "nor one that runs onto a new line");
});
+
+test("each / row shows its command's icon in the tile", async (t) => {
+ installBrowserGlobals(t);
+ const vite = await createRendererServer(t, { cachePrefix: "openwhispr-slash-menu-icons-test-" });
+ const SlashCommandMenu = (await vite.ssrLoadModule("/components/chat/SlashCommandMenu.tsx"))
+ .default;
+ const { Mail } = await vite.ssrLoadModule("/components/icons/index.ts");
+ const { renderToStaticMarkup } = require("react-dom/server");
+ const html = renderToStaticMarkup(
+ React.createElement(SlashCommandMenu, {
+ id: "menu",
+ label: "Commands",
+ commands: [{ id: "email", label: "Follow-up email", icon: Mail, run: () => {} }],
+ activeIndex: 0,
+ onActiveIndexChange: () => {},
+ onRun: () => {},
+ })
+ );
+ assert.ok(html.includes('data-icon="mail"'));
+});
diff --git a/test/components/floatingChatLayout.test.js b/test/components/floatingChatLayout.test.js
index 4d22baad0..fed1895bd 100644
--- a/test/components/floatingChatLayout.test.js
+++ b/test/components/floatingChatLayout.test.js
@@ -39,6 +39,15 @@ function createElement(overrides = {}) {
};
}
+// Opening the chat leaves the note where it was; a reader scrolls to its end to be followed.
+function scrollToBottom(contentRoot, scroller) {
+ const bottom = scroller.scrollHeight - scroller.clientHeight;
+ scroller.scrollTop = bottom - 100;
+ contentRoot.dispatch("scroll");
+ scroller.scrollTop = bottom;
+ contentRoot.dispatch("scroll");
+}
+
test("near-bottom detection uses the real scroll range", async () => {
const { isNearScrollBottom } = await load();
@@ -100,13 +109,17 @@ test("viewport resizes preserve pinned content without yanking a reader", async
);
assert.deepEqual(observedElements, [panel, contentRoot]);
- assert.equal(container.style.getPropertyValue("--floating-inset"), "232px");
+ assert.equal(container.style.getPropertyValue("--floating-inset"), "240px");
+ assert.equal(scheduledFrames.size, 0, "opening the chat doesn't scroll the note");
+ resizeCallback();
+ assert.equal(scheduledFrames.size, 0, "nor does the panel growing as it opens");
+ assert.equal(scroller.scrollTop, 700);
- scheduledFrames.get(nextFrameId)();
+ scrollToBottom(contentRoot, scroller);
scroller.clientHeight = 150;
resizeCallback();
scheduledFrames.get(nextFrameId)();
- assert.equal(scroller.scrollTop, 850, "a pinned scroller follows a viewport shrink");
+ assert.equal(scroller.scrollTop, 850, "a reader at the bottom follows a viewport shrink");
scroller.scrollTop = 600;
contentRoot.dispatch("scroll");
@@ -127,15 +140,15 @@ test("viewport resizes preserve pinned content without yanking a reader", async
assert.equal(container.style.getPropertyValue("--floating-inset"), "");
});
-test("the in-view chat always opens at two-thirds height and ignores content growth", async () => {
- const { observeFloatingChatSize } = await load();
- const panel = { style: { height: "" } };
+test("the in-view chat grows to fit, up to three-quarters height, whatever its content", async () => {
+ const { observeFloatingChatMaxHeight } = await load();
+ const panel = { style: { maxHeight: "" } };
const container = { clientHeight: 600 };
const observed = [];
let onResize;
let disconnected = false;
- const cleanup = observeFloatingChatSize({ panel, container }, (callback) => {
+ const cleanup = observeFloatingChatMaxHeight({ panel, container }, (callback) => {
onResize = callback;
return {
observe(element) {
@@ -147,41 +160,41 @@ test("the in-view chat always opens at two-thirds height and ignores content gro
};
});
- assert.equal(panel.style.height, "400px");
- assert.deepEqual(observed, [container], "message and composer resizes cannot grow the panel");
+ assert.equal(panel.style.maxHeight, "450px");
+ assert.deepEqual(observed, [container], "content resizes cannot raise the cap");
onResize();
- assert.equal(panel.style.height, "400px", "content changes scroll inside a fixed panel");
+ assert.equal(panel.style.maxHeight, "450px", "content changes scroll inside the capped panel");
container.clientHeight = 360;
onResize();
- assert.equal(panel.style.height, "240px", "the panel follows viewport changes");
+ assert.equal(panel.style.maxHeight, "240px", "the cap follows viewport changes");
cleanup();
assert.equal(disconnected, true);
});
test("the note viewport caps the in-view chat in a short window", async () => {
- const { observeFloatingChatSize } = await load();
- const panel = { style: { height: "" } };
+ const { observeFloatingChatMaxHeight } = await load();
+ const panel = { style: { maxHeight: "" } };
const container = { clientHeight: 600 };
let onResize;
- const stopSelected = observeFloatingChatSize({ panel, container }, (callback) => {
+ const stopSelected = observeFloatingChatMaxHeight({ panel, container }, (callback) => {
onResize = callback;
return { observe() {}, disconnect() {} };
});
- assert.equal(panel.style.height, "400px");
+ assert.equal(panel.style.maxHeight, "450px");
onResize();
- assert.equal(panel.style.height, "400px", "long chat history stays inside the panel");
+ assert.equal(panel.style.maxHeight, "450px", "a long / menu stays inside the cap");
container.clientHeight = 900;
onResize();
- assert.equal(panel.style.height, "600px", "only viewport changes resize the panel");
+ assert.equal(panel.style.maxHeight, "675px", "only viewport changes move the cap");
container.clientHeight = 240;
onResize();
- assert.equal(panel.style.height, "128px", "the top clearance caps a short viewport");
+ assert.equal(panel.style.maxHeight, "120px", "the top clearance caps a short viewport");
stopSelected();
});
@@ -230,10 +243,12 @@ test("upward wheel intent cancels resize pinning until the reader returns to bot
clientHeight: 300,
contains: (target) => target === transcriptRow,
});
- const { contentRoot, scheduledFrames, resizeCallback, nextFrameId, cleanup } =
- createLayoutHarness(observeFloatingChatLayout, { scroller });
+ const { contentRoot, scheduledFrames, resizeCallback, cleanup } = createLayoutHarness(
+ observeFloatingChatLayout,
+ { scroller }
+ );
- scheduledFrames.get(nextFrameId)();
+ scrollToBottom(contentRoot, scroller);
resizeCallback();
assert.equal(scheduledFrames.size, 1, "a followed resize schedules a bottom correction");
@@ -265,7 +280,7 @@ test("upward wheel over chrome outside the scroller keeps following", async () =
const harness = createLayoutHarness(observeFloatingChatLayout, { scroller });
const { contentRoot, scheduledFrames } = harness;
- scheduledFrames.get(harness.nextFrameId)();
+ scrollToBottom(contentRoot, scroller);
harness.resizeCallback();
assert.equal(scheduledFrames.size, 1, "a followed resize schedules a bottom correction");
diff --git a/test/components/noteActionChips.test.js b/test/components/noteActionChips.test.js
index b37f38340..c527bc4ea 100644
--- a/test/components/noteActionChips.test.js
+++ b/test/components/noteActionChips.test.js
@@ -1,8 +1,9 @@
const test = require("node:test");
const assert = require("node:assert/strict");
-const { createElement } = require("react");
+const React = require("react");
const { renderToStaticMarkup } = require("react-dom/server");
const { createRendererServer, installBrowserGlobals } = require("../lib/rendererTestHarness");
+const { installInteractiveDom, findElement } = require("../lib/interactiveDom");
// i18n is not initialized, so labels render as raw keys or their default values.
@@ -43,7 +44,7 @@ function renderTree(Component, props) {
tree = Component(props);
return null;
}
- renderToStaticMarkup(createElement(Harness));
+ renderToStaticMarkup(React.createElement(Harness));
return tree;
}
@@ -59,24 +60,24 @@ function collect(node, out = []) {
return out;
}
-test("the ask bar shows the first four actions as chips and every action under All actions", async (t) => {
+const ACTIONS = [
+ FOLLOW_UP,
+ action({ id: 4, client_id: "todos", name: "Create to-dos" }),
+ SHORTEN,
+ action({ id: 5, client_id: "tldr", name: "Add TL;DR", output: "summary" }),
+ action({ id: 6, client_id: "outline", name: "Create outline" }),
+];
+
+test("the open chat shows the first four actions as chips that run on click, disabled while they can't", async (t) => {
const ActionChips = await load(t, "/components/notes/ActionChips.tsx");
- const actions = [
- FOLLOW_UP,
- action({ id: 4, client_id: "todos", name: "Make to-dos" }),
- SHORTEN,
- action({ id: 5, client_id: "tldr", name: "Add TL;DR", output: "summary" }),
- action({ id: 6, client_id: "outline", name: "Create outline" }),
- ];
const ran = [];
- const tree = collect(
- renderTree(ActionChips, {
- actions,
- canRun: (a) => a.output === "chat",
- onRunAction: (a) => ran.push(a.name),
- onManageActions: () => ran.push("manage"),
- })
- );
+ const props = {
+ actions: ACTIONS,
+ canRun: (a) => a.output === "chat",
+ onRunAction: (a) => ran.push(a.name),
+ onManageActions: () => ran.push("manage"),
+ };
+ const tree = collect(renderTree(ActionChips, props));
const chips = tree.filter((node) => node.type === "button" && node.props.onClick);
assert.deepEqual(
@@ -89,45 +90,275 @@ test("the ask bar shows the first four actions as chips and every action under A
"a chip is disabled while its action can't run"
);
chips[0].props.onClick();
+ assert.deepEqual(ran, ["Follow-up email"]);
+});
+
+test("hovering a chip shows what its action does above the row", async (t) => {
+ let root;
+ t.after(async () => {
+ if (root) await React.act(async () => root.unmount());
+ });
+ installBrowserGlobals(t);
+ const container = installInteractiveDom(t);
+ const vite = await createRendererServer(t, {
+ cachePrefix: "openwhispr-note-action-chips-hover-",
+ // Radix needs real layout; the menu isn't under test here.
+ mockModules: {
+ "/ui/dropdown-menu": `
+ export const DropdownMenu = ({ children }) => children;
+ export const DropdownMenuTrigger = ({ children }) => children;
+ export const DropdownMenuContent = () => null;
+ `,
+ },
+ });
+ const ActionChips = (await vite.ssrLoadModule("/components/notes/ActionChips.tsx")).default;
+ const { createRoot } = require("react-dom/client");
+ root = createRoot(container);
+ let ran = 0;
+ const todos = action({
+ id: 4,
+ client_id: "todos",
+ name: "Create to-dos",
+ description: "List every to-do",
+ });
+ await React.act(async () =>
+ root.render(
+ React.createElement(ActionChips, {
+ actions: [FOLLOW_UP, todos],
+ // A disabled chip still shows what its action does.
+ canRun: (a) => a !== FOLLOW_UP,
+ onRunAction: () => ran++,
+ onManageActions: () => {},
+ })
+ )
+ );
+ const chip = findElement(
+ container,
+ (el) => el.tagName === "BUTTON" && el.textContent.trim() === "Create to-dos"
+ );
+ const description = () => findElement(container, (el) => el.textContent === "List every to-do");
+ const pointer = (type) =>
+ React.act(async () => chip.dispatchEvent({ type, bubbles: true, relatedTarget: null }));
+
+ assert.equal(description(), null);
+ await pointer("pointerover");
+ assert.ok(description(), "the hovered action's description shows");
+
+ const card = description().parentNode.parentNode;
+ const followUpChip = findElement(container, (el) => el.tagName === "BUTTON");
+ const strip = followUpChip.parentNode;
+ const move = (from, to) =>
+ React.act(async () =>
+ from.dispatchEvent({ type: "pointerout", bubbles: true, relatedTarget: to })
+ );
+ await move(chip, strip);
+ assert.ok(description(), "crossing the gap between chips keeps the card up");
+ await move(strip, followUpChip);
+ assert.equal(
+ description(),
+ null,
+ "and the next chip, even a disabled one, swaps it to its own action"
+ );
+ assert.ok(card.textContent.trim().startsWith(followUpChip.textContent.trim()));
+ assert.ok(
+ findElement(container, (el) => el === card),
+ "without remounting the card, so its entrance doesn't replay"
+ );
+ await move(followUpChip, null);
+ assert.equal(
+ findElement(container, (el) => el === card),
+ null,
+ "it goes once the pointer leaves the row"
+ );
+
+ await pointer("pointerover");
+ await pointer("click");
+ assert.equal(ran, 1);
+ assert.equal(description(), null, "and once the action runs, so it can't cover the reply");
+});
- const menuItems = tree.filter((node) => typeof node.type !== "string" && node.props.onClick);
- assert.equal(menuItems.length, actions.length + 1, "every action, then Manage Actions");
+test("the docked chips lead with Generate summary, held back while a summary is being written", async (t) => {
+ const ActionChips = await load(t, "/components/notes/ActionChips.tsx");
+ const ran = [];
+ const props = {
+ actions: ACTIONS,
+ canRun: () => true,
+ onRunAction: (a) => ran.push(a.name),
+ onManageActions: () => {},
+ docked: true,
+ };
+ const buttons = (generateSummary) =>
+ collect(renderTree(ActionChips, { ...props, generateSummary })).filter(
+ (node) => node.type === "button" && node.props.onClick
+ );
+
+ const idle = buttons({ run: () => ran.push("summary"), disabled: false });
+ assert.equal(idle.length, 5, "Generate summary, then the first four actions");
+ idle[0].props.onClick();
+ idle[1].props.onClick();
+ assert.deepEqual(ran, ["summary", "Follow-up email"]);
+ assert.equal(buttons({ run: () => {}, disabled: true })[0].props.disabled, true);
+ assert.equal(buttons(undefined).length, 4, "no pill when the note has no template to run");
+
+ // All actions (the menu's trigger) leads the docked row and opens toward the chips.
+ const order = (docked) =>
+ collect(renderTree(ActionChips, { ...props, docked }))
+ .filter((node) => node.props.align || (node.type === "button" && node.props.onClick))
+ .map((node) => node.props.align ?? "chip");
+ assert.deepEqual(order(true).slice(0, 2), ["start", "chip"]);
+ assert.deepEqual(order(false).slice(-2), ["chip", "end"], "the in-view chat keeps it last");
+});
+
+test("the action menu lists every action, then Manage Actions", async (t) => {
+ const ActionMenuItems = await load(t, "/components/notes/ActionMenuItems.tsx");
+ const ran = [];
+ const menuItems = collect(
+ renderTree(ActionMenuItems, {
+ actions: ACTIONS,
+ canRun: (a) => a.output === "chat",
+ onRunAction: (a) => ran.push(a.name),
+ onManageActions: () => ran.push("manage"),
+ })
+ ).filter((node) => typeof node.type !== "string" && node.props.onClick);
+
+ assert.equal(menuItems.length, ACTIONS.length + 1, "every action, then Manage Actions");
+ assert.deepEqual(
+ menuItems.slice(0, -1).map((item) => item.props.disabled),
+ [false, false, true, true, false]
+ );
menuItems.at(-2).props.onClick();
menuItems.at(-1).props.onClick();
- assert.deepEqual(ran, ["Follow-up email", "Create outline", "manage"]);
+ assert.deepEqual(ran, ["Create outline", "manage"]);
});
-test("the sidebar chat offers the note's chat actions, and Generate summary writes the summary", async (t) => {
- const EmbeddedChat = await load(t, "/components/notes/EmbeddedChat.tsx");
+test("the collapsed ask bar's picker runs the first action until one is picked, and remembers the pick", async (t) => {
+ const ActionPicker = await load(t, "/components/notes/ActionPicker.tsx");
const ran = [];
const props = {
- mode: "sidebar",
- onModeChange: () => {},
- messages: [],
- onTextSubmit: (text) => ran.push(["chat", text]),
- onCancel: () => {},
- chatActions: [FOLLOW_UP],
- onRunChatAction: (a) => ran.push(["action", a.name]),
- onGenerateSummary: () => ran.push(["summary"]),
- slashCommands: [{ id: "cmd", label: "Follow-up email", run: () => {} }],
+ actions: ACTIONS,
+ canRun: (a) => a.output === "chat",
+ onRunAction: (a) => ran.push(a.name),
+ onManageActions: () => {},
};
+ const runButton = (tree) => tree.find((node) => node.type === "button" && node.props.onClick);
- const idle = collect(renderTree(EmbeddedChat, { ...props, agentState: "idle" }));
- const pills = idle.filter((node) => node.type === "button" && node.props.onMouseDown);
- assert.deepEqual(
- pills.map((pill) => pill.key),
- ["summary", FOLLOW_UP.client_id]
+ const first = collect(renderTree(ActionPicker, props));
+ assert.equal(runButton(first).props.disabled, false);
+ runButton(first).props.onClick();
+ assert.deepEqual(ran, ["Follow-up email"], "the first action until one is picked");
+
+ const menu = first.find((node) => node.props.onManageActions);
+ menu.props.onRunAction(SHORTEN);
+
+ const next = collect(renderTree(ActionPicker, props));
+ assert.equal(
+ runButton(next).props.disabled,
+ true,
+ "a remounted picker remembers it, disabled while it can't run"
);
- for (const pill of pills) pill.props.onClick();
- assert.deepEqual(ran, [["summary"], ["action", "Follow-up email"]]);
- const composer = idle.find((node) => node.props.variant === "sidebar");
- assert.equal(composer.props.slashCommands, props.slashCommands, "/ reaches the sidebar composer");
+});
- const streaming = collect(renderTree(EmbeddedChat, { ...props, agentState: "streaming" })).filter(
- (node) => node.type === "button" && node.props.onMouseDown
+test("picking from the picker makes its main button run that action at once", async (t) => {
+ let root;
+ t.after(async () => {
+ if (root) await React.act(async () => root.unmount());
+ });
+ installBrowserGlobals(t);
+ const container = installInteractiveDom(t);
+ const vite = await createRendererServer(t, {
+ cachePrefix: "openwhispr-note-action-picker-",
+ // Radix needs real layout; render the menu's items in place.
+ mockModules: {
+ "/ui/dropdown-menu": `
+ import { createElement } from "react";
+ export const DropdownMenu = ({ children }) => children;
+ export const DropdownMenuTrigger = ({ children }) => children;
+ export const DropdownMenuContent = ({ children }) => children;
+ export const DropdownMenuItem = ({ children, onClick, disabled }) =>
+ createElement("button", { onClick, disabled, "data-menu-item": "" }, children);
+ export const DropdownMenuSeparator = () => null;
+ `,
+ },
+ });
+ const ActionPicker = (await vite.ssrLoadModule("/components/notes/ActionPicker.tsx")).default;
+ const { createRoot } = require("react-dom/client");
+ root = createRoot(container);
+ const ran = [];
+ await React.act(async () =>
+ root.render(
+ React.createElement(ActionPicker, {
+ actions: ACTIONS,
+ canRun: () => true,
+ onRunAction: (a) => ran.push(a.name),
+ onManageActions: () => {},
+ })
+ )
);
- assert.equal(streaming.length, 2);
- for (const pill of streaming) {
- assert.equal(pill.props.disabled, true, "no quick action starts while a reply streams");
- }
+ const click = (el) => React.act(async () => el.dispatchEvent({ type: "click", bubbles: true }));
+ const runButton = () =>
+ findElement(
+ container,
+ (el) =>
+ el.tagName === "BUTTON" &&
+ el.getAttribute("aria-label") === null &&
+ el.getAttribute("data-menu-item") === null
+ );
+
+ await click(
+ findElement(
+ container,
+ (el) =>
+ el.getAttribute?.("data-menu-item") !== null &&
+ el.textContent.trim().startsWith("Create outline")
+ )
+ );
+ assert.equal(
+ runButton().textContent.trim(),
+ "Create outline",
+ "the picker shows the picked action"
+ );
+ await click(runButton());
+ assert.deepEqual(ran, ["Create outline", "Create outline"]);
+});
+
+test("the docked chat shows the note's chips between its messages and its composer", async (t) => {
+ const EmbeddedChat = await load(t, "/components/notes/EmbeddedChat.tsx");
+ const chips = React.createElement("div", { "data-chips": "" });
+ const slashCommands = [{ id: "cmd", label: "Follow-up email", run: () => {} }];
+ const tree = collect(
+ renderTree(EmbeddedChat, {
+ onClose: () => {},
+ messages: [],
+ noteConversations: [],
+ activeConversationId: null,
+ onSwitchConversation: () => {},
+ onNewChat: () => {},
+ agentState: "idle",
+ onTextSubmit: () => {},
+ onCancel: () => {},
+ actionChips: chips,
+ slashCommands,
+ })
+ );
+
+ const order = tree.filter(
+ (node) => node === chips || node.props.emptyState || node.props.onTextSubmit
+ );
+ assert.deepEqual(
+ order.map((node) =>
+ node === chips ? "chips" : node.props.emptyState ? "messages" : "composer"
+ ),
+ ["messages", "chips", "composer"]
+ );
+ const composer = order.at(-1);
+ assert.equal(composer.props.slashCommands, slashCommands, "/ reaches the docked composer");
+});
+
+test("an action icon this build doesn't know shows a /", async (t) => {
+ installBrowserGlobals(t);
+ const vite = await createRendererServer(t, { cachePrefix: "openwhispr-action-icons-test-" });
+ const { getActionIcon } = await vite.ssrLoadModule("/components/notes/actionIcons.ts");
+ const icons = await vite.ssrLoadModule("/components/icons/index.ts");
+
+ assert.equal(getActionIcon({ icon: "rocket" }), icons.SquareSlash);
});
diff --git a/test/components/noteBottomBar.test.js b/test/components/noteBottomBar.test.js
index 21814d9c7..91769dc82 100644
--- a/test/components/noteBottomBar.test.js
+++ b/test/components/noteBottomBar.test.js
@@ -42,34 +42,187 @@ test("recording state renders no backdrop-filter surface over the live transcrip
assert.ok(html.includes("shadow-(--shadow-glass)"), "capsules keep the glass rim shadow");
});
+test("the bar and the open chat never blur the note behind them", async (t) => {
+ for (const chatOpen of [false, true]) {
+ const html = await renderBottomBar(t, { chatOpen });
+ assert.ok(
+ !/backdrop-|blur-\[/.test(html),
+ `no blur with the chat ${chatOpen ? "open" : "closed"}`
+ );
+ }
+});
+
test("in-view chat expands the existing capsule around one composer", async (t) => {
- const html = await renderBottomBar(t, {
- chatOpen: true,
- chatContent: createElement("div", null, "Chat"),
- });
+ const html = await renderBottomBar(t, { chatOpen: true });
assert.equal((html.match(/<textarea/g) ?? []).length, 1);
});
-test("the action chips sit above the composer, inside the chat once it opens", async (t) => {
+test("the collapsed composer offers the action picker; the chips wait for the chat to open", async (t) => {
const props = {
- chatContent: createElement("div", null, "Previous conversation"),
+ actionPicker: createElement("button", null, "Action picker"),
actionChips: createElement("button", null, "All actions"),
callout: createElement("button", null, "Generate summary"),
};
const closed = await renderBottomBar(t, { ...props, chatOpen: false });
assert.ok(closed.includes("Generate summary"));
+ assert.ok(!closed.includes("All actions"), "no chips over a collapsed composer");
assert.ok(
- closed.indexOf("All actions") < closed.indexOf("<textarea"),
- "the chips sit above the composer"
+ closed.indexOf("<textarea") < closed.indexOf("Action picker"),
+ "the picker sits in the composer"
);
+ assert.ok(!closed.includes("agentMode.input.send"), "in place of the send button");
const open = await renderBottomBar(t, { ...props, chatOpen: true });
+ assert.ok(!open.includes("Action picker"), "the picker steps aside once the chat opens");
assert.equal(open.split("All actions").length, 2, "the chips show once");
- assert.ok(
- open.indexOf("Previous conversation") < open.indexOf("All actions") &&
- open.indexOf("All actions") < open.indexOf("<textarea"),
- "an open chat keeps the chips, between its messages and the composer"
+ assert.ok(open.indexOf("All actions") < open.indexOf("<textarea"), "above the composer");
+});
+
+// The real DOM pieces the open chat needs: containment, pointer events, ResizeObserver.
+async function installHappyDom(t) {
+ const { Window } = await import("happy-dom");
+ const happyWindow = new Window();
+ const fromWindow = [
+ "document",
+ "navigator",
+ "Node",
+ "Element",
+ "HTMLElement",
+ "Event",
+ "PointerEvent",
+ "MouseEvent",
+ "FocusEvent",
+ "ResizeObserver",
+ "MutationObserver",
+ "getComputedStyle",
+ ];
+ const names = [
+ "window",
+ ...fromWindow,
+ "requestAnimationFrame",
+ "cancelAnimationFrame",
+ "IS_REACT_ACT_ENVIRONMENT",
+ ];
+ const originals = names.map((name) => [name, Object.getOwnPropertyDescriptor(globalThis, name)]);
+ const define = (name, value) =>
+ Object.defineProperty(globalThis, name, { value, configurable: true, writable: true });
+ define("window", happyWindow);
+ for (const name of fromWindow) define(name, happyWindow[name]);
+ define("requestAnimationFrame", happyWindow.requestAnimationFrame.bind(happyWindow));
+ define("cancelAnimationFrame", happyWindow.cancelAnimationFrame.bind(happyWindow));
+ define("IS_REACT_ACT_ENVIRONMENT", true);
+ t.after(async () => {
+ for (const [name, descriptor] of originals) {
+ if (descriptor) Object.defineProperty(globalThis, name, descriptor);
+ else delete globalThis[name];
+ }
+ await happyWindow.happyDOM.close();
+ });
+ return happyWindow;
+}
+
+test("a click outside or an Esc closes the open chat, unless it dismisses a menu over the page", async (t) => {
+ const { document, PointerEvent, MouseEvent, KeyboardEvent } = await installHappyDom(t);
+ const vite = await createRendererServer(t, {
+ cachePrefix: "openwhispr-note-bottom-bar-outside-test-",
+ mockModules: {
+ "/ui/useToast": `export const useToast = () => ({ toast: () => {} });`,
+ "/useVoiceDraft": `
+ export const useVoiceDraft = () => ({ status: "idle", streamingOnlyProvider: false });
+ `,
+ },
+ });
+ const NoteBottomBar = (await vite.ssrLoadModule("/components/notes/NoteBottomBar.tsx")).default;
+ const { createRoot } = require("react-dom/client");
+ const { act } = require("react");
+
+ const outside = document.createElement("p");
+ const host = document.createElement("div");
+ document.body.append(outside, host);
+ const root = createRoot(host);
+ let closed = 0;
+ let escaped = 0;
+ const render = (chatOpen) =>
+ act(async () =>
+ root.render(
+ createElement(NoteBottomBar, {
+ isRecording: false,
+ draftText: "",
+ onDraftChange: () => {},
+ onAskSubmit: () => {},
+ chatOpen,
+ actionChips: createElement("button", { id: "in-chat" }, "Chip"),
+ onClickOutside: () => closed++,
+ onInputEscape: () => escaped++,
+ })
+ )
+ );
+ const press = (target) =>
+ target.dispatchEvent(new PointerEvent("pointerdown", { bubbles: true, composed: true }));
+ const click = (target) => {
+ press(target);
+ target.dispatchEvent(new MouseEvent("click", { bubbles: true, composed: true, detail: 1 }));
+ };
+
+ await render(true);
+ click(document.getElementById("in-chat"));
+ assert.equal(closed, 0, "a click inside the chat keeps it open");
+ click(document.querySelector("[data-note-chat-panel]").previousElementSibling);
+ assert.equal(closed, 0, "as does one on the card's margin around it");
+ press(outside);
+ assert.equal(
+ closed,
+ 0,
+ "a press that never clicks (a touch scroll, a right-click) keeps it open"
);
+ document
+ .getElementById("in-chat")
+ .dispatchEvent(new MouseEvent("click", { bubbles: true, composed: true, detail: 0 }));
+ assert.equal(closed, 0, "nor does that stale press count for a later click from the keyboard");
+
+ const menu = document.createElement("div");
+ menu.setAttribute("data-radix-popper-content-wrapper", "");
+ document.body.append(menu);
+ press(outside);
+ // Radix closes the menu on the press, before the click arrives.
+ menu.remove();
+ outside.dispatchEvent(new MouseEvent("click", { bubbles: true, composed: true, detail: 1 }));
+ assert.equal(closed, 0, "a click that dismisses a menu over the page only closes the menu");
+
+ press(outside);
+ outside.dispatchEvent(
+ new MouseEvent("click", { bubbles: true, composed: true, detail: 1, clientX: 40 })
+ );
+ assert.equal(closed, 0, "a drag that selects the note's text keeps it open");
+
+ click(outside);
+ assert.equal(closed, 1);
+
+ const pressEscape = () =>
+ document
+ .getElementById("in-chat")
+ .dispatchEvent(
+ new KeyboardEvent("keydown", { key: "Escape", bubbles: true, cancelable: true })
+ );
+ // Radix closes a menu on a capturing document listener and prevents the key's default.
+ const closeMenu = (event) => event.preventDefault();
+ document.addEventListener("keydown", closeMenu, true);
+ pressEscape();
+ document.removeEventListener("keydown", closeMenu, true);
+ assert.equal(escaped, 0, "an Esc that closes a menu over the chat only closes the menu");
+ // The note clears a transcript selection on any Esc that reaches the page.
+ let reachedPage = 0;
+ const countPageEscape = () => reachedPage++;
+ document.addEventListener("keydown", countPageEscape);
+ pressEscape();
+ document.removeEventListener("keydown", countPageEscape);
+ assert.equal(escaped, 1, "Esc closes the chat from anywhere in it, not just the composer");
+ assert.equal(reachedPage, 0, "and goes no further");
+
+ await render(false);
+ click(outside);
+ assert.equal(closed, 1, "a closed chat doesn't listen");
+ await act(async () => root.unmount());
});
diff --git a/test/components/noteEditorSummaryDeletion.test.js b/test/components/noteEditorSummaryDeletion.test.js
index c66fab126..b6c530a2e 100644
--- a/test/components/noteEditorSummaryDeletion.test.js
+++ b/test/components/noteEditorSummaryDeletion.test.js
@@ -116,6 +116,15 @@ const TEMPLATE = {
output: null,
translation_key: "notes.actions.builtin.detailedNotes",
};
+const DEFAULT_TEMPLATE = {
+ ...TEMPLATE,
+ id: 2,
+ client_id: "notes.actions.builtin.generateNotes",
+ name: "AI Summary",
+ prompt: "Summarize the note.",
+ sections: null,
+ translation_key: "notes.actions.builtin.generateNotes",
+};
function baseProps(enhancement) {
return {
@@ -137,7 +146,7 @@ async function loadNoteEditor(t) {
electronAPI: {
getSpeakerProfiles: async () => [],
getSpeakerMappings: async () => [],
- getActions: async () => [TEMPLATE],
+ getActions: async () => [TEMPLATE, DEFAULT_TEMPLATE, ...(globalThis.__noteActions ?? [])],
},
},
});
@@ -182,7 +191,12 @@ async function loadNoteEditor(t) {
export function useEmbeddedChat(options) {
globalThis.__embeddedChatOptions = options;
return {
- messages: [],
+ messages: globalThis.__embeddedChatMessages ?? [],
+ noteConversations: globalThis.__embeddedChatConversations,
+ switchConversation() {},
+ agentState: globalThis.__embeddedChatAgentState ?? "idle",
+ sendMessage: (...args) => globalThis.__embeddedChatSent?.push(args),
+ sendInNewChat: (...args) => globalThis.__embeddedChatSent?.push(["new chat", ...args]),
send() {},
reset() {},
isStreaming: false,
@@ -325,7 +339,7 @@ test("a typed note without a summary offers one with the default template", asyn
});
assert.ok(callout, "notes with no transcript still offer a summary");
callout.props.onClick();
- assert.deepEqual(ran, [TEMPLATE.client_id]);
+ assert.deepEqual(ran, [DEFAULT_TEMPLATE.client_id]);
await unmount();
});
@@ -440,36 +454,161 @@ test("the note's chat names the user's own speakers and leaves attendees to the
await unmount();
});
-// The note's bottom bar: the element that receives the in-view chat as `chatContent`.
+// The note's ask bar.
function findBottomBar(tree) {
let bar = null;
walk(tree, (node) => {
- if (!bar && "chatContent" in node.props) bar = node;
+ if (!bar && "onAskSubmit" in node.props) bar = node;
});
return bar;
}
-test("the in-view chat mounts on its first open and stays to fade out", async (t) => {
+test("the collapsed composer keeps its send button while the note has no actions", async (t) => {
+ const { render, latest, unmount } = await loadNoteEditor(t);
+ await render(ENHANCEMENT);
+ assert.ok(!findBottomBar(latest()).props.actionPicker);
+ await unmount();
+});
+
+function findDockedChat(tree) {
+ let chat = null;
+ walk(tree, (node) => {
+ if (!chat && "onSwitchConversation" in node.props) chat = node;
+ });
+ return chat;
+}
+
+const FOLLOW_UP = {
+ ...TEMPLATE,
+ id: 3,
+ client_id: "follow-up",
+ kind: "action",
+ name: "Follow-up",
+ prompt: "Draft a follow-up.",
+ sections: null,
+ output: "chat",
+ translation_key: null,
+};
+
+test("a question sent from the ask bar opens the docked chat in a new conversation", async (t) => {
+ globalThis.__embeddedChatSent = [];
+ t.after(() => delete globalThis.__embeddedChatSent);
const { render, latest, unmount } = await loadNoteEditor(t);
- // Closing checks whether focus is inside the chat; the harness DOM has no elements.
- const originalHTMLElement = globalThis.HTMLElement;
- globalThis.HTMLElement ??= class {};
+
+ await render(ENHANCEMENT);
+ await React.act(async () => findBottomBar(latest()).props.onInputFocus());
+ assert.equal(findBottomBar(latest()).props.chatOpen, true, "focus still unfolds the bar");
+ assert.equal(findDockedChat(latest()), null);
+
+ await React.act(async () => findBottomBar(latest()).props.onAskSubmit("What did we decide?"));
+ const bar = findBottomBar(latest());
+ assert.equal(bar.props.chatOpen, false);
+ assert.equal(bar.props.hideInput, true, "the ask bar folds away");
+ assert.ok(findDockedChat(latest()), "the docked chat opens");
+ assert.deepEqual(globalThis.__embeddedChatSent, [["new chat", "What did we decide?"]]);
+ await unmount();
+});
+
+test("the docked chat holds the conversation and its history, and its chips continue it", async (t) => {
+ const messages = [{ id: "m1", role: "user", content: "Who owns the copy pass?" }];
+ const conversations = [{ id: 7, title: "Copy pass", updated_at: "2026-10-08" }];
+ globalThis.__noteActions = [FOLLOW_UP];
+ globalThis.__embeddedChatMessages = messages;
+ globalThis.__embeddedChatConversations = conversations;
+ globalThis.__embeddedChatSent = [];
t.after(() => {
- if (originalHTMLElement === undefined) delete globalThis.HTMLElement;
- else globalThis.HTMLElement = originalHTMLElement;
+ delete globalThis.__noteActions;
+ delete globalThis.__embeddedChatMessages;
+ delete globalThis.__embeddedChatConversations;
+ delete globalThis.__embeddedChatSent;
});
+ const { render, latest, unmount } = await loadNoteEditor(t);
- // Every keystroke in the note re-renders the editor; a chat nobody opened isn't
- // rendered, so its conversation isn't parsed on each one.
await render(ENHANCEMENT);
- assert.ok(!findBottomBar(latest()).props.chatContent);
+ await React.act(async () => findBottomBar(latest()).props.onAskSubmit("And the deadline?"));
+ const docked = findDockedChat(latest()).props;
+ assert.equal(docked.messages, messages);
+ assert.equal(docked.noteConversations, conversations);
+
+ await React.act(async () => docked.actionChips.props.onRunAction(FOLLOW_UP));
+ const [cta, options] = globalThis.__embeddedChatSent.at(-1);
+ assert.equal(cta, "Follow-up", "the docked chat's own chip continues the open conversation");
+ assert.ok(options.requestText.includes("Draft a follow-up."));
+ await unmount();
+});
- await React.act(async () => findBottomBar(latest()).props.onInputFocus());
- assert.equal(findBottomBar(latest()).props.chatOpen, true);
- assert.ok(findBottomBar(latest()).props.chatContent);
+test("a chat action from the collapsed picker opens the docked chat, with the actions and Generate summary", async (t) => {
+ globalThis.__noteActions = [FOLLOW_UP];
+ globalThis.__embeddedChatSent = [];
+ t.after(() => {
+ delete globalThis.__noteActions;
+ delete globalThis.__embeddedChatSent;
+ });
+ const { render, latest, unmount } = await loadNoteEditor(t);
+ const ran = [];
+
+ await render(ENHANCEMENT, { onRunNoteAction: (action) => ran.push(action.client_id) });
+ const bar = findBottomBar(latest());
+ await React.act(async () => bar.props.actionPicker.props.onRunAction(FOLLOW_UP));
+
+ const docked = findDockedChat(latest());
+ assert.ok(docked, "the docked chat opens without the bar ever unfolding");
+ const chips = docked.props.actionChips.props;
+ assert.equal(chips.docked, true);
+ assert.deepEqual(chips.actions, [FOLLOW_UP]);
+ assert.equal(docked.props.slashCommands.length, 1, "and offers the same / menu");
+ chips.generateSummary.run();
+ assert.deepEqual(ran, [DEFAULT_TEMPLATE.client_id], "Generate summary runs the default template");
+ const [[marker, shown, { requestText }]] = globalThis.__embeddedChatSent;
+ assert.equal(marker, "new chat", "from the ask bar it starts a new conversation");
+ assert.equal(shown, "Follow-up");
+ assert.ok(requestText.includes("Draft a follow-up."));
+ await unmount();
+});
+
+test("a summary action from the collapsed picker runs on the summary and leaves the chat closed", async (t) => {
+ const shorten = {
+ ...TEMPLATE,
+ id: 4,
+ client_id: "shorten",
+ kind: "action",
+ name: "Shorten",
+ prompt: "Shorten it.",
+ sections: null,
+ output: "summary",
+ translation_key: null,
+ };
+ globalThis.__noteActions = [shorten];
+ globalThis.__embeddedChatSent = [];
+ t.after(() => {
+ delete globalThis.__noteActions;
+ delete globalThis.__embeddedChatSent;
+ });
+ const { render, latest, unmount } = await loadNoteEditor(t);
+ const ran = [];
+
+ await render(ENHANCEMENT, { onRunNoteAction: (action) => ran.push(action.client_id) });
+ const bar = findBottomBar(latest());
+ await React.act(async () => bar.props.actionPicker.props.onRunAction(shorten));
+
+ assert.deepEqual(ran, ["shorten"]);
+ assert.equal(findDockedChat(latest()), null);
+ assert.deepEqual(globalThis.__embeddedChatSent, []);
+ await unmount();
+});
- await React.act(async () => findBottomBar(latest()).props.onInputEscape());
- assert.equal(findBottomBar(latest()).props.chatOpen, false);
- assert.ok(findBottomBar(latest()).props.chatContent, "closing keeps it mounted for the fade");
+test("a question sent while a reply is still coming waits as the docked chat's draft", async (t) => {
+ globalThis.__embeddedChatAgentState = "streaming";
+ globalThis.__embeddedChatSent = [];
+ t.after(() => {
+ delete globalThis.__embeddedChatAgentState;
+ delete globalThis.__embeddedChatSent;
+ });
+ const { render, latest, unmount } = await loadNoteEditor(t);
+
+ await render(ENHANCEMENT);
+ await React.act(async () => findBottomBar(latest()).props.onAskSubmit("And the budget?"));
+ assert.deepEqual(globalThis.__embeddedChatSent, []);
+ assert.equal(findDockedChat(latest()).props.draftText, "And the budget?");
await unmount();
});
diff --git a/test/helpers/builtinActionsDatabase.test.js b/test/helpers/builtinActionsDatabase.test.js
index 643e66120..059518dd5 100644
--- a/test/helpers/builtinActionsDatabase.test.js
+++ b/test/helpers/builtinActionsDatabase.test.js
@@ -103,37 +103,26 @@ for (const action of BUILTIN_ACTIONS) {
});
}
-test("launch puts the default AI Summary template first, under its current name", (t) => {
+test("launch puts the default AI Summary template first, then Detailed Notes", (t) => {
const db = createDb(t);
if (!db) return;
- // As main shipped them: Generate Notes first, and the default under its old name.
+ // As an earlier build ordered them, with Detailed Notes as the default.
db.db
.prepare("UPDATE actions SET sort_order = 0 WHERE translation_key = ?")
- .run(GENERATE_NOTES_KEY);
- db.db
- .prepare("UPDATE actions SET sort_order = 1, name = 'Detailed Notes' WHERE translation_key = ?")
.run(DETAILED_NOTES_KEY);
+ db.db
+ .prepare("UPDATE actions SET sort_order = 1 WHERE translation_key = ?")
+ .run(GENERATE_NOTES_KEY);
db.db.close();
relaunch((migrated) => {
const [first, second] = migrated.getActions();
- assert.equal(first.translation_key, DETAILED_NOTES_KEY);
- assert.equal(first.name, "AI Summary");
- assert.equal(second.translation_key, GENERATE_NOTES_KEY);
- migrated.db
- .prepare("UPDATE actions SET name = 'Team notes' WHERE translation_key = ?")
- .run(DETAILED_NOTES_KEY);
- });
- relaunch((again) => {
- assert.equal(
- builtinRows(again, DETAILED_NOTES_KEY)[0].name,
- "Team notes",
- "the user's name stays"
- );
+ assert.equal(first.translation_key, GENERATE_NOTES_KEY);
+ assert.equal(second.translation_key, DETAILED_NOTES_KEY);
});
});
-test("an upgrade to sections keeps a name the user gave the default template", (t) => {
+test("an upgrade to sections keeps a name the user gave Detailed Notes", (t) => {
const db = createDb(t);
if (!db) return;
const detailed = BUILTIN_ACTIONS.find((a) => a.translationKey === DETAILED_NOTES_KEY);
@@ -235,7 +224,7 @@ test("an older build renaming the newer built-ins doesn't stop the next launch",
const db = createDb(t);
if (!db) return;
const newerKeys = ["notes.actions.builtin.makeTodos", "notes.actions.builtin.createOutline"];
- // What a build that predates Make to-dos and Create outline does to their rows.
+ // What a build that predates Create to-dos and Create outline does to their rows.
db.db
.prepare(
"UPDATE actions SET translation_key = ? WHERE is_builtin = 1 AND translation_key IN (?, ?)"
diff --git a/test/hooks/embeddedChatNewChat.test.js b/test/hooks/embeddedChatNewChat.test.js
new file mode 100644
index 000000000..9f70ecea5
--- /dev/null
+++ b/test/hooks/embeddedChatNewChat.test.js
@@ -0,0 +1,133 @@
+const test = require("node:test");
+const assert = require("node:assert/strict");
+const React = require("react");
+const { createRoot } = require("react-dom/client");
+const { createRendererServer, installBrowserGlobals } = require("../lib/rendererTestHarness");
+const { installInteractiveDom } = require("../lib/interactiveDom");
+
+// Persistence keeps its messages in state, as the real hook does, and the stream records
+// the history each send hands the model.
+const MOCKS = {
+ "/chat/useChatStreaming": `
+ export function useChatStreaming() {
+ return {
+ agentState: "idle",
+ sendToAI: async (text, history) => {
+ globalThis.__sent.push(history.map((message) => message.content));
+ },
+ cancelStream() {},
+ };
+ }
+ `,
+ "/chat/useChatPersistence": `
+ import { useState } from "react";
+ export function useChatPersistence() {
+ const [messages, setMessages] = useState([]);
+ return {
+ messages,
+ setMessages,
+ createConversation: async (title) => {
+ if (globalThis.__failCreate) throw new Error("offline");
+ globalThis.__created.push(title);
+ return 2;
+ },
+ saveUserMessage: async () => {},
+ saveAssistantMessage() {},
+ loadConversation: async () =>
+ setMessages([{ id: "m0", role: "user", content: "Earlier question", isStreaming: false }]),
+ handleNewChat: () => setMessages([]),
+ };
+ }
+ `,
+};
+
+test("a message sent into a new chat leaves the open conversation behind", async (t) => {
+ let root;
+ t.after(async () => {
+ if (root) await React.act(async () => root.unmount());
+ delete globalThis.__sent;
+ delete globalThis.__created;
+ });
+ globalThis.__sent = [];
+ globalThis.__created = [];
+ installBrowserGlobals(t, {
+ window: {
+ electronAPI: {
+ getConversationsForNote: async () => [{ id: 1, title: "Earlier", updated_at: "" }],
+ },
+ },
+ });
+ const container = installInteractiveDom(t);
+ const vite = await createRendererServer(t, {
+ cachePrefix: "openwhispr-embedded-chat-new-chat-test-",
+ mockModules: MOCKS,
+ });
+ const { useEmbeddedChat } = await vite.ssrLoadModule("/hooks/useEmbeddedChat.ts");
+ let chat;
+ function Harness() {
+ chat = useEmbeddedChat({ noteId: 5, folderId: null, noteTitle: "Kickoff", noteContent: "" });
+ return null;
+ }
+ root = createRoot(container);
+ await React.act(async () => root.render(React.createElement(Harness)));
+ assert.equal(chat.activeConversationId, null, "the note opens on a new conversation");
+
+ await React.act(async () => chat.switchConversation(1));
+ assert.equal(chat.activeConversationId, 1);
+
+ await React.act(async () => chat.sendMessage("Follow-up"));
+ assert.deepEqual(globalThis.__sent, [["Earlier question", "Follow-up"]]);
+ assert.deepEqual(globalThis.__created, [], "a plain send continues it");
+
+ await React.act(async () => chat.sendInNewChat("New question"));
+ assert.deepEqual(
+ globalThis.__sent.at(-1),
+ ["New question"],
+ "no earlier messages reach the model"
+ );
+ assert.deepEqual(
+ globalThis.__created,
+ ["New question · Kickoff"],
+ "and the message starts a conversation of its own, named after it and the note"
+ );
+});
+
+test("a question that could not start a new chat goes back to the caller as a draft", async (t) => {
+ let root;
+ t.after(async () => {
+ if (root) await React.act(async () => root.unmount());
+ delete globalThis.__sent;
+ delete globalThis.__created;
+ delete globalThis.__failCreate;
+ });
+ globalThis.__sent = [];
+ globalThis.__created = [];
+ globalThis.__failCreate = true;
+ installBrowserGlobals(t, {
+ window: { electronAPI: { getConversationsForNote: async () => [] } },
+ });
+ const container = installInteractiveDom(t);
+ const vite = await createRendererServer(t, {
+ cachePrefix: "openwhispr-embedded-chat-unsent-test-",
+ mockModules: MOCKS,
+ });
+ const { useEmbeddedChat } = await vite.ssrLoadModule("/hooks/useEmbeddedChat.ts");
+ const unsent = [];
+ let chat;
+ function Harness() {
+ chat = useEmbeddedChat({
+ noteId: 5,
+ folderId: null,
+ noteTitle: "Kickoff",
+ noteContent: "",
+ onNewChatUnsent: (text) => unsent.push(text),
+ });
+ return null;
+ }
+ root = createRoot(container);
+ await React.act(async () => root.render(React.createElement(Harness)));
+
+ await React.act(async () => chat.sendInNewChat("Will this go?"));
+ assert.deepEqual(unsent, ["Will this go?"]);
+ assert.deepEqual(globalThis.__sent, [], "nothing reached the model");
+});
diff --git a/test/hooks/useResizableWidth.test.js b/test/hooks/useResizableWidth.test.js
new file mode 100644
index 000000000..407c1d978
--- /dev/null
+++ b/test/hooks/useResizableWidth.test.js
@@ -0,0 +1,99 @@
+const test = require("node:test");
+const assert = require("node:assert/strict");
+
+test("dragging a panel's edge away from it widens it, in either direction and layout", async () => {
+ const { resizedWidth } = await import("../../src/hooks/useResizableWidth.ts");
+ const limits = { min: 180, max: 420 };
+
+ // The notes list's handle is on its end edge: right in left-to-right, left in right-to-left.
+ assert.equal(resizedWidth(208, 40, { edge: "end", rtl: false, ...limits }), 248);
+ assert.equal(resizedWidth(208, -40, { edge: "end", rtl: true, ...limits }), 248);
+ // The docked chat's is on its start edge, so dragging toward the note widens it.
+ assert.equal(resizedWidth(400, -60, { edge: "start", rtl: false, ...limits, max: 1200 }), 460);
+ assert.equal(resizedWidth(400, 60, { edge: "start", rtl: true, ...limits, max: 1200 }), 460);
+
+ assert.equal(resizedWidth(208, -500, { edge: "end", rtl: false, ...limits }), 180, "no narrower");
+ assert.equal(resizedWidth(208, 500, { edge: "end", rtl: false, ...limits }), 420, "no wider");
+});
+
+test("a drag saves the width, and a click or a drag the browser took away does not strand it", async (t) => {
+ const React = require("react");
+ const { createRoot } = require("react-dom/client");
+ const { installBrowserGlobals } = require("../lib/rendererTestHarness");
+ const { installInteractiveDom } = require("../lib/interactiveDom");
+ const { useResizableWidth } = await import("../../src/hooks/useResizableWidth.ts");
+
+ installBrowserGlobals(t);
+ const originalGetComputedStyle = globalThis.getComputedStyle;
+ globalThis.getComputedStyle = () => ({ direction: "ltr" });
+ const container = installInteractiveDom(t);
+ let root;
+ t.after(() => {
+ globalThis.getComputedStyle = originalGetComputedStyle;
+ });
+
+ let resize;
+ function Harness() {
+ resize = useResizableWidth({
+ storageKey: "panelWidth",
+ edge: "start",
+ min: 100,
+ max: 600,
+ getDragMax: () => 300,
+ });
+ return null;
+ }
+ root = createRoot(container);
+ await React.act(async () => root.render(React.createElement(Harness)));
+
+ // The panel's rendered width follows what the hook last asked for, as the DOM does.
+ const panel = {
+ getBoundingClientRect: () => ({ width: resize.width ?? 200 }),
+ };
+ resize.panelRef.current = panel;
+
+ const startDrag = async (clientX) => {
+ const handle = new EventTarget();
+ handle.setPointerCapture = () => {};
+ await React.act(async () =>
+ resize.startResize({
+ button: 0,
+ pointerId: 1,
+ clientX,
+ preventDefault() {},
+ currentTarget: handle,
+ })
+ );
+ const move = (x, y = 0) =>
+ React.act(async () => {
+ const event = new Event("pointermove");
+ event.clientX = x;
+ event.clientY = y;
+ handle.dispatchEvent(event);
+ });
+ const release = (type) => React.act(async () => handle.dispatchEvent(new Event(type)));
+ return { move, release };
+ };
+
+ const click = await startDrag(500);
+ await click.move(500, 40);
+ await click.move(501);
+ await click.release("pointerup");
+ assert.equal(resize.width, null, "a click keeps the panel's default width");
+ assert.equal(localStorage.getItem("panelWidth"), null, "and saves nothing");
+ assert.equal(resize.isResizing, false);
+
+ const drag = await startDrag(500);
+ await drag.move(300); // The start edge: leftward widens, 200 -> 400, held to the 300 cap.
+ await drag.release("pointerup");
+ await drag.release("lostpointercapture");
+ assert.equal(resize.width, 300, "the drag stops at the panel's cap");
+ assert.equal(localStorage.getItem("panelWidth"), "300");
+
+ const taken = await startDrag(500);
+ await taken.move(520);
+ assert.equal(resize.isResizing, true);
+ await taken.release("lostpointercapture");
+ assert.equal(resize.isResizing, false, "capture lost without pointerup still ends the drag");
+ await React.act(async () => root.unmount());
+});
diff --git a/test/hooks/useStickToBottom.test.js b/test/hooks/useStickToBottom.test.js
index 4f32d9a85..4cbaae9d1 100644
--- a/test/hooks/useStickToBottom.test.js
+++ b/test/hooks/useStickToBottom.test.js
@@ -5,8 +5,9 @@ const { createRoot } = require("react-dom/client");
const { createRendererServer, installBrowserGlobals } = require("../lib/rendererTestHarness");
const { installInteractiveDom } = require("../lib/interactiveDom");
-// Models the platform rule the hook depends on: an observer only hears about the
-// box it observes, so a padding change reaches border-box observers alone.
+// Models the platform rules the hook depends on: an observer only hears about the box
+// it observes. Padding an auto-height element grows its border box; padding a
+// fixed-size scroller shrinks its content box instead.
function installResizeObservers(t) {
const original = globalThis.ResizeObserver;
const observers = new Set();
@@ -36,6 +37,14 @@ function installResizeObservers(t) {
if (hears) observer.callback([]);
}
},
+ padScroller(element) {
+ for (const observer of [...observers]) {
+ const hears = observer.targets.some(
+ (target) => target.element === element && target.box === "content-box"
+ );
+ if (hears) observer.callback([]);
+ }
+ },
};
}
@@ -74,6 +83,16 @@ test("added bottom padding keeps a pinned conversation at its end", async (t) =>
assert.equal(scroller.scrollTop, 720, "the last lines stay above the composer");
});
+test("an overlay padding the scroller itself leaves a pinned transcript where it is", async (t) => {
+ const { scroller, resizeObservers } = await mountScroller(t);
+
+ // The note chat opens over a transcript and pads its scroller to stay reachable.
+ scroller.scrollHeight = 1430;
+ resizeObservers.padScroller(scroller);
+
+ assert.equal(scroller.scrollTop, 600);
+});
+
test("added bottom padding never pulls a reader back down", async (t) => {
const { scroller, content, resizeObservers } = await mountScroller(t);
scroller.scrollTop = 100;
diff --git a/test/lib/interactiveDom.js b/test/lib/interactiveDom.js
index a6fbd04e4..39cb84230 100644
--- a/test/lib/interactiveDom.js
+++ b/test/lib/interactiveDom.js
@@ -147,6 +147,8 @@ function installInteractiveDom(t) {
this.ownerDocument.activeElement = this;
}
+ scrollIntoView() {}
+
// Tag-name and [attribute] selectors only.
querySelectorAll(selector) {
const attribute = selector.match(/^\[([\w-]+)\]$/)?.[1];