Skip to content

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

refactor(notes): redesign bottom bar and compact action picker

Gabriel Stein17ea38da952b
diff --git a/src/components/notes/ActionPicker.tsx b/src/components/notes/ActionPicker.tsx
index 6971fa5be..0c5d4365c 100644
--- a/src/components/notes/ActionPicker.tsx
+++ b/src/components/notes/ActionPicker.tsx
@@ -49,26 +49,24 @@ export default function ActionPicker({
if (!activeAction) return null;
return (
- <div className="flex items-center">
+ <div className="flex items-center shrink-0">
<button
onClick={() => handleRun(activeAction)}
disabled={disabled}
aria-label={t("notes.actions.runAction", { name: getActionName(activeAction, t) })}
className={cn(
- "flex items-center gap-2 h-11 pl-5 pr-3 rounded-l-xl",
- "bg-accent/8 dark:bg-accent/12",
- "backdrop-blur-xl",
- "border border-r-0 border-accent/15 dark:border-accent/20",
- "shadow-sm hover:shadow-md",
- "text-accent/70 hover:text-accent",
- "transition-[background-color,color,transform] duration-200",
- "hover:bg-accent/12 dark:hover:bg-accent/18",
+ "flex items-center gap-1.5 h-7 pl-2.5 pr-1.5 rounded-l-lg",
+ "bg-accent/6 dark:bg-accent/10",
+ "text-accent/60 dark:text-accent/50",
+ "transition-colors duration-150",
+ "hover:bg-accent/10 dark:hover:bg-accent/15",
+ "hover:text-accent/80 dark:hover:text-accent/70",
"active:scale-[0.98]",
- "disabled:opacity-40 disabled:pointer-events-none"
+ "disabled:opacity-30 disabled:pointer-events-none"
)}
>
- <Sparkles size={14} />
- <span className="text-xs font-semibold tracking-tight">
+ <Sparkles size={11} />
+ <span className="text-[11px] font-semibold tracking-tight">
{getActionName(activeAction, t)}
</span>
</button>
@@ -79,18 +77,16 @@ export default function ActionPicker({
disabled={disabled}
aria-label={t("notes.actions.selectAction")}
className={cn(
- "flex items-center justify-center h-11 w-8 rounded-r-xl",
- "bg-accent/8 dark:bg-accent/12",
- "backdrop-blur-xl",
- "border border-l-0 border-accent/15 dark:border-accent/20",
- "shadow-sm hover:shadow-md",
- "text-accent/50 hover:text-accent",
- "transition-[background-color,color,transform] duration-200",
- "hover:bg-accent/15 dark:hover:bg-accent/22",
- "disabled:opacity-40 disabled:pointer-events-none"
+ "flex items-center justify-center h-7 w-5 rounded-r-lg",
+ "bg-accent/6 dark:bg-accent/10",
+ "text-accent/35 dark:text-accent/25",
+ "transition-colors duration-150",
+ "hover:bg-accent/10 dark:hover:bg-accent/15",
+ "hover:text-accent/60",
+ "disabled:opacity-30 disabled:pointer-events-none"
)}
>
- <ChevronDown size={12} />
+ <ChevronDown size={10} />
</button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" side="top" sideOffset={8} className="min-w-48">
diff --git a/src/components/notes/EmbeddedChat.tsx b/src/components/notes/EmbeddedChat.tsx
index 0ce8f9043..161d712fe 100644
--- a/src/components/notes/EmbeddedChat.tsx
+++ b/src/components/notes/EmbeddedChat.tsx
@@ -56,9 +56,7 @@ export default function EmbeddedChat({
const header = (
<div className="h-9 flex items-center px-3 shrink-0">
- <span className="text-xs font-medium text-foreground/50">
- {t("embeddedChat.title")}
- </span>
+ <span className="text-xs font-medium text-foreground/50">{t("embeddedChat.title")}</span>
<div className="flex-1" />
<div className="flex items-center gap-0.5">
{mode === "floating" ? (
diff --git a/src/components/notes/NoteBottomBar.tsx b/src/components/notes/NoteBottomBar.tsx
index 0fb321c45..23de72a7d 100644
--- a/src/components/notes/NoteBottomBar.tsx
+++ b/src/components/notes/NoteBottomBar.tsx
@@ -1,8 +1,9 @@
-import { useState, useRef, useCallback } from "react";
+import { useState, useRef, useCallback, useEffect } from "react";
import { useTranslation } from "react-i18next";
-import { Mic, SendHorizontal } from "lucide-react";
+import { Mic, ArrowUp, Square, Loader2 } from "lucide-react";
import { cn } from "../lib/utils";
-import DictationWidget from "./DictationWidget";
+
+const BAR_COUNT = 5;
interface NoteBottomBarProps {
isRecording: boolean;
@@ -25,14 +26,31 @@ export default function NoteBottomBar({
}: NoteBottomBarProps) {
const { t } = useTranslation();
const [inputText, setInputText] = useState("");
+ const [isExpanded, setIsExpanded] = useState(false);
const inputRef = useRef<HTMLInputElement>(null);
+ const containerRef = useRef<HTMLDivElement>(null);
+ const [elapsed, setElapsed] = useState(0);
+
+ useEffect(() => {
+ if (!isRecording) {
+ setElapsed(0);
+ return;
+ }
+ const id = setInterval(() => setElapsed((s) => s + 1), 1000);
+ return () => clearInterval(id);
+ }, [isRecording]);
+
+ const minutes = String(Math.floor(elapsed / 60)).padStart(2, "0");
+ const seconds = String(elapsed % 60).padStart(2, "0");
+
+ const hasText = inputText.trim().length > 0;
const handleSubmit = useCallback(() => {
const text = inputText.trim();
if (!text || askDisabled) return;
onAskSubmit(text);
setInputText("");
- requestAnimationFrame(() => inputRef.current?.focus());
+ setIsExpanded(false);
}, [inputText, askDisabled, onAskSubmit]);
const handleKeyDown = useCallback(
@@ -41,83 +59,151 @@ export default function NoteBottomBar({
e.preventDefault();
handleSubmit();
}
+ if (e.key === "Escape") {
+ setIsExpanded(false);
+ inputRef.current?.blur();
+ }
},
[handleSubmit]
);
- if (isRecording || isProcessing) {
- return (
- <DictationWidget
- isRecording={isRecording}
- isProcessing={isProcessing}
- onStart={onStartRecording}
- onStop={onStopRecording}
- actionPicker={actionPicker}
- />
- );
- }
+ const handleInputFocus = useCallback(() => {
+ setIsExpanded(true);
+ }, []);
+
+ useEffect(() => {
+ if (!isExpanded) return;
+ const handleClickOutside = (e: MouseEvent) => {
+ if (!hasText && containerRef.current && !containerRef.current.contains(e.target as Node)) {
+ setIsExpanded(false);
+ }
+ };
+ document.addEventListener("mousedown", handleClickOutside);
+ return () => document.removeEventListener("mousedown", handleClickOutside);
+ }, [isExpanded, hasText]);
return (
- <div className="absolute bottom-5 left-0 right-0 z-10 flex justify-center pointer-events-none">
- <div
- className={cn(
- "flex items-center h-12 px-2 gap-2 pointer-events-auto",
- "rounded-xl",
- "bg-background/80 dark:bg-surface-1/80",
- "backdrop-blur-xl",
- "border border-border/15 dark:border-white/8",
- "shadow-sm"
- )}
- >
- <button
- onClick={onStartRecording}
+ <div
+ ref={containerRef}
+ className="absolute bottom-0 left-0 right-0 z-10 px-5 pb-4 pointer-events-none"
+ >
+ <div className="flex items-end gap-2 pointer-events-auto">
+ <div
className={cn(
- "flex items-center justify-center w-11 h-11 rounded-full",
- "bg-primary/8 dark:bg-primary/12",
- "border border-primary/15 dark:border-primary/20",
- "shadow-sm hover:shadow-md",
- "text-primary/60 hover:text-primary",
- "transition-all duration-200",
- "hover:bg-primary/14 dark:hover:bg-primary/20",
- "hover:scale-105",
- "active:scale-[0.97]"
+ "shrink-0 transition-all duration-300 ease-out overflow-hidden",
+ isExpanded && !isRecording ? "w-0 opacity-0" : "w-auto opacity-100"
)}
- aria-label={t("notes.editor.transcribe")}
>
- <Mic size={16} />
- </button>
+ {isRecording ? (
+ <button
+ onClick={onStopRecording}
+ className={cn(
+ "flex items-center gap-2 h-10 pl-3.5 pr-3 rounded-xl",
+ "bg-foreground/3 dark:bg-white/4",
+ "border border-border/20 dark:border-white/6",
+ "backdrop-blur-sm",
+ "transition-colors duration-150",
+ "hover:bg-foreground/5 dark:hover:bg-white/6"
+ )}
+ >
+ <div className="flex items-end gap-0.5 h-3.5">
+ {Array.from({ length: BAR_COUNT }, (_, i) => (
+ <div
+ key={i}
+ className="w-0.5 rounded-full bg-foreground/40 dark:bg-white/40 origin-bottom"
+ style={{
+ height: "100%",
+ animation: `waveform-bar ${0.5 + i * 0.07}s ease-in-out infinite`,
+ animationDelay: `${i * 0.04}s`,
+ }}
+ />
+ ))}
+ </div>
+ <span className="text-[11px] font-medium tabular-nums text-foreground/40 dark:text-foreground/30">
+ {minutes}:{seconds}
+ </span>
+ <Square size={9} fill="currentColor" className="text-foreground/30" />
+ </button>
+ ) : isProcessing ? (
+ <div
+ className={cn(
+ "flex items-center justify-center w-10 h-10 rounded-xl",
+ "bg-foreground/3 dark:bg-white/4",
+ "border border-border/20 dark:border-white/6"
+ )}
+ >
+ <Loader2 size={14} className="animate-spin text-foreground/25" />
+ </div>
+ ) : (
+ <button
+ onClick={onStartRecording}
+ className={cn(
+ "flex items-center justify-center w-10 h-10 rounded-xl",
+ "bg-foreground/3 dark:bg-white/4",
+ "border border-border/20 dark:border-white/6",
+ "backdrop-blur-sm",
+ "text-foreground/30 dark:text-foreground/20",
+ "transition-all duration-200",
+ "hover:bg-foreground/6 dark:hover:bg-white/8",
+ "hover:text-foreground/50 dark:hover:text-foreground/35",
+ "hover:border-border/30 dark:hover:border-white/10",
+ "active:scale-95"
+ )}
+ aria-label={t("notes.editor.transcribe")}
+ >
+ <Mic size={15} />
+ </button>
+ )}
+ </div>
- <input
- ref={inputRef}
- type="text"
- value={inputText}
- onChange={(e) => setInputText(e.target.value)}
- onKeyDown={handleKeyDown}
- disabled={askDisabled}
- placeholder={t("embeddedChat.askPlaceholder")}
+ <div
className={cn(
- "input-inline flex-1 bg-transparent outline-none min-w-0 p-0",
- "text-[13px] text-foreground placeholder:text-muted-foreground/30"
+ "flex-1 min-w-0 flex items-center h-10 px-3 gap-2",
+ "rounded-xl",
+ "bg-foreground/3 dark:bg-white/4",
+ "border",
+ "transition-all duration-200",
+ isExpanded
+ ? "border-foreground/12 dark:border-white/10 shadow-[0_0_0_3px_rgba(0,0,0,0.02)] dark:shadow-[0_0_0_3px_rgba(255,255,255,0.02)]"
+ : "border-border/20 dark:border-white/6"
)}
- />
-
- {inputText.trim() && (
- <button
- onClick={handleSubmit}
+ >
+ <input
+ ref={inputRef}
+ type="text"
+ value={inputText}
+ onChange={(e) => setInputText(e.target.value)}
+ onKeyDown={handleKeyDown}
+ onFocus={handleInputFocus}
disabled={askDisabled}
+ placeholder={t("embeddedChat.askPlaceholder")}
className={cn(
- "p-1 rounded-sm shrink-0",
- "focus:outline-none focus-visible:ring-1 focus-visible:ring-ring/30",
- "transition-colors duration-100",
- "text-primary hover:text-primary/80"
+ "input-inline flex-1 bg-transparent outline-none min-w-0 p-0",
+ "text-[13px] text-foreground",
+ "placeholder:text-foreground/25 dark:placeholder:text-foreground/15"
)}
- aria-label={t("embeddedChat.send")}
- >
- <SendHorizontal size={14} />
- </button>
- )}
+ />
- {actionPicker}
+ {hasText ? (
+ <button
+ onClick={handleSubmit}
+ disabled={askDisabled}
+ className={cn(
+ "flex items-center justify-center w-6 h-6 rounded-md shrink-0",
+ "bg-foreground dark:bg-foreground/90 text-background",
+ "transition-all duration-150",
+ "hover:bg-foreground/85 dark:hover:bg-foreground/80",
+ "active:scale-90",
+ "disabled:opacity-30"
+ )}
+ aria-label={t("embeddedChat.send")}
+ >
+ <ArrowUp size={13} strokeWidth={2.5} />
+ </button>
+ ) : !isExpanded ? (
+ <div className="shrink-0">{actionPicker}</div>
+ ) : null}
+ </div>
</div>
</div>
);