Skip to content

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

fix: UX updates and clarification

Chadpihae3423a6daf31
diff --git a/src/components/CreateWorkspaceDialog.tsx b/src/components/CreateWorkspaceDialog.tsx
index dac887aeb..d2d54cfbf 100644
--- a/src/components/CreateWorkspaceDialog.tsx
+++ b/src/components/CreateWorkspaceDialog.tsx
@@ -79,6 +79,9 @@ export default function CreateWorkspaceDialog({ open, onOpenChange, onCreated }:
placeholder={t("workspaces.create.namePlaceholder")}
maxLength={80}
/>
+ <p className="text-[11px] text-muted-foreground">
+ {t("workspaces.create.freePlanNote")}
+ </p>
</div>
<DialogFooter className="pt-2">
<Button
diff --git a/src/components/chat/ChatMessage.tsx b/src/components/chat/ChatMessage.tsx
index 187a00a99..4240f1710 100644
--- a/src/components/chat/ChatMessage.tsx
+++ b/src/components/chat/ChatMessage.tsx
@@ -12,6 +12,7 @@ import {
import { cn } from "../lib/utils";
import { MarkdownRenderer } from "../ui/MarkdownRenderer";
import type { ToolCallInfo } from "./types";
+import { extractNoteCards } from "./noteCards";
import { toolIcons } from "./toolIcons";
interface ChatMessageProps {
@@ -22,8 +23,6 @@ interface ChatMessageProps {
onOpenNote?: (noteId: number) => void;
}
-const NOTE_TOOLS = new Set(["create_note", "update_note", "get_note"]);
-
function ToolCallStep({ toolCall }: { toolCall: ToolCallInfo }) {
const { t } = useTranslation();
const [expanded, setExpanded] = useState(false);
@@ -166,25 +165,6 @@ function NoteCard({
);
}
-function extractNoteCards(toolCalls?: ToolCallInfo[]): Array<{ noteId: number; title: string }> {
- if (!toolCalls) return [];
- const cards: Array<{ noteId: number; title: string }> = [];
- const seen = new Set<number>();
-
- for (const tc of toolCalls) {
- if (tc.status !== "completed" || !NOTE_TOOLS.has(tc.name) || !tc.metadata?.id) continue;
- const noteId = Number(tc.metadata.id);
- if (seen.has(noteId)) continue;
- seen.add(noteId);
- const title =
- (tc.metadata.title as string) ||
- tc.result?.replace(/^(Created|Updated|Retrieved) note: "(.+)"$/, "$2") ||
- "Note";
- cards.push({ noteId, title });
- }
- return cards;
-}
-
export function ChatMessage({
role,
content,
diff --git a/src/components/chat/noteCards.ts b/src/components/chat/noteCards.ts
new file mode 100644
index 000000000..093b18e63
--- /dev/null
+++ b/src/components/chat/noteCards.ts
@@ -0,0 +1,55 @@
+import type { ToolCallInfo } from "./types";
+
+export interface NoteCardRef {
+ noteId: number;
+ title: string;
+}
+
+const NOTE_TOOLS = new Set(["create_note", "update_note", "get_note"]);
+// Search answers can ground on many hits; cap the cards so a broad search
+// doesn't bury the answer under a wall of note buttons.
+const MAX_SEARCH_CARDS = 5;
+
+function cardFromHit(hit: Record<string, unknown>, seen: Set<number>): NoteCardRef | null {
+ // Cloud search hits carry null ids for notes with no local row — nothing to
+ // open. Non-numeric ids (cloud UUIDs) are equally unopenable locally.
+ if (hit.id == null) return null;
+ const noteId = Number(hit.id);
+ if (!Number.isFinite(noteId) || seen.has(noteId)) return null;
+ seen.add(noteId);
+ return { noteId, title: typeof hit.title === "string" && hit.title ? hit.title : "Note" };
+}
+
+// Note cards rendered under an assistant message: one per note the turn
+// created/updated/fetched, plus up to MAX_SEARCH_CARDS notes its searches
+// grounded on. Single pass in toolCalls order, deduped across tools.
+export function extractNoteCards(toolCalls?: ToolCallInfo[]): NoteCardRef[] {
+ if (!toolCalls) return [];
+ const cards: NoteCardRef[] = [];
+ const seen = new Set<number>();
+ let searchCards = 0;
+
+ for (const tc of toolCalls) {
+ if (tc.status !== "completed") continue;
+ if (NOTE_TOOLS.has(tc.name) && tc.metadata && !Array.isArray(tc.metadata)) {
+ if (!tc.metadata.id) continue;
+ const noteId = Number(tc.metadata.id);
+ if (!Number.isFinite(noteId) || seen.has(noteId)) continue;
+ seen.add(noteId);
+ const title =
+ (tc.metadata.title as string) ||
+ tc.result?.replace(/^(Created|Updated|Retrieved) note: "(.+)"$/, "$2") ||
+ "Note";
+ cards.push({ noteId, title });
+ } else if (tc.name === "search_notes" && Array.isArray(tc.metadata)) {
+ for (const hit of tc.metadata) {
+ if (searchCards >= MAX_SEARCH_CARDS) break;
+ const card = cardFromHit(hit, seen);
+ if (!card) continue;
+ cards.push(card);
+ searchCards += 1;
+ }
+ }
+ }
+ return cards;
+}
diff --git a/src/components/chat/types.ts b/src/components/chat/types.ts
index ea269b339..a9f7e6024 100644
--- a/src/components/chat/types.ts
+++ b/src/components/chat/types.ts
@@ -4,7 +4,8 @@ export interface ToolCallInfo {
arguments: string;
status: "executing" | "completed" | "error";
result?: string;
- metadata?: Record<string, unknown>;
+ // Single object for note tools; search_notes attaches its result array.
+ metadata?: Record<string, unknown> | Array<Record<string, unknown>>;
}
export interface Message {
diff --git a/src/components/chat/useChatStreaming.ts b/src/components/chat/useChatStreaming.ts
index b01820df3..fd76a430f 100644
--- a/src/components/chat/useChatStreaming.ts
+++ b/src/components/chat/useChatStreaming.ts
@@ -198,7 +198,7 @@ export function useChatStreaming({
: result.displayText;
const metadata =
result.success && result.data && typeof result.data === "object"
- ? (result.data as Record<string, unknown>)
+ ? (result.data as Record<string, unknown> | Array<Record<string, unknown>>)
: undefined;
return { data, displayText: result.displayText, metadata };
}
diff --git a/src/components/notes/CreateSpaceDialog.tsx b/src/components/notes/CreateSpaceDialog.tsx
index ff5f50516..79d28275c 100644
--- a/src/components/notes/CreateSpaceDialog.tsx
+++ b/src/components/notes/CreateSpaceDialog.tsx
@@ -1,4 +1,4 @@
-import { useCallback, useEffect, useMemo, useRef, useState } from "react";
+import { useCallback, useEffect, useMemo, useState } from "react";
import { useShallow } from "zustand/react/shallow";
import { useTranslation } from "react-i18next";
import { Check, Loader2, Plus } from "lucide-react";
@@ -12,7 +12,6 @@ import {
} from "../ui/dialog";
import { Button } from "../ui/button";
import { Input } from "../ui/input";
-import { Popover, PopoverAnchor, PopoverContent } from "../ui/popover";
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../ui/select";
import { useToast } from "../ui/useToast";
import CreateWorkspaceDialog from "../CreateWorkspaceDialog";
@@ -24,7 +23,7 @@ import { useWorkspace } from "../../hooks/useWorkspace";
import { useWorkspaceStore } from "../../stores/workspaceStore";
import { useAuth } from "../../hooks/useAuth";
import { useDelayedFlag } from "../../hooks/useDelayedFlag";
-import { clampEmojiInput } from "../../lib/emojiInput";
+import { EmojiPickerInput } from "./EmojiPickerInput";
import { orderMemberCandidates } from "../../lib/memberCandidates";
import {
manageableWorkspaces as findManageableWorkspaces,
@@ -34,44 +33,20 @@ import { revealContainer, setActiveContext } from "../../stores/noteStore";
import { cn } from "../lib/utils";
import type { Team, WorkspaceMember } from "../../types/electron";
-const EMOJI_CHOICES = [
- "📝",
- "📋",
- "💡",
- "🚀",
- "🎯",
- "📣",
- "🛠️",
- "🎨",
- "📊",
- "💼",
- "🤝",
- "🌱",
- "🔬",
- "🧪",
- "📚",
- "✨",
- "🔥",
- "⭐",
- "💬",
- "🗂️",
- "🧭",
- "🌍",
- "🔒",
- "🏆",
-];
-
interface CreateSpaceDialogProps {
open: boolean;
onOpenChange: (open: boolean) => void;
/** Workspace preselected by the opener (e.g. a sidebar workspace row's + button). */
initialWorkspaceId?: string | null;
+ /** Opens the given workspace's billing in Settings (the 402 upsell CTA). */
+ onOpenWorkspaceBilling?: (workspaceId: string) => void;
}
export default function CreateSpaceDialog({
open,
onOpenChange,
initialWorkspaceId = null,
+ onOpenWorkspaceBilling,
}: CreateSpaceDialogProps) {
const { t } = useTranslation();
const { toast } = useToast();
@@ -92,8 +67,6 @@ export default function CreateSpaceDialog({
);
const [name, setName] = useState("");
const [emoji, setEmoji] = useState("");
- const [emojiPickerOpen, setEmojiPickerOpen] = useState(false);
- const emojiInputRef = useRef<HTMLInputElement>(null);
const [memberSearch, setMemberSearch] = useState("");
const [selectedIds, setSelectedIds] = useState<Set<string>>(new Set());
const [membersError, setMembersError] = useState(false);
@@ -105,6 +78,7 @@ export default function CreateSpaceDialog({
const [newTeamOpen, setNewTeamOpen] = useState(false);
const [newTeamName, setNewTeamName] = useState("");
const [isCreating, setIsCreating] = useState(false);
+ const [planBlocked, setPlanBlocked] = useState(false);
const [selectedWorkspaceId, setSelectedWorkspaceId] = useState<string | null>(null);
const showSpinner = useDelayedFlag(isCreating);
@@ -183,7 +157,6 @@ export default function CreateSpaceDialog({
if (!nextOpen) {
setName("");
setEmoji("");
- setEmojiPickerOpen(false);
setMemberSearch("");
setSelectedIds(new Set());
setRosterWorkspaceId(null);
@@ -192,6 +165,7 @@ export default function CreateSpaceDialog({
setSelectedTeamIds(new Set());
setNewTeamOpen(false);
setNewTeamName("");
+ setPlanBlocked(false);
setSelectedWorkspaceId(null);
}
};
@@ -223,12 +197,6 @@ export default function CreateSpaceDialog({
});
};
- // Linux has no OS emoji panel; the in-app grid is the fallback.
- const openEmojiPicker = async (): Promise<void> => {
- const nativeShown = await window.electronAPI?.showEmojiPanel?.().catch(() => false);
- if (!nativeShown) setEmojiPickerOpen(true);
- };
-
const handleWorkspaceChange = (workspaceId: string) => {
setSelectedWorkspaceId(workspaceId);
setSelectedIds(new Set());
@@ -237,6 +205,7 @@ export default function CreateSpaceDialog({
setSelectedTeamIds(new Set());
setNewTeamOpen(false);
setNewTeamName("");
+ setPlanBlocked(false);
};
// A space needs at least one team (existing or new) unless team loading
@@ -279,14 +248,16 @@ export default function CreateSpaceDialog({
}
handleOpenChange(false);
} catch (err) {
+ // Workspace entitlement is separate from the user's personal plan, so a
+ // paying user can hit this on a fresh (Free) workspace — an inline
+ // explainer with a billing CTA, not an error toast.
+ if (err instanceof CloudApiError && err.code === "upgrade_required") {
+ setPlanBlocked(true);
+ return;
+ }
toast({
title: t("notes.spaces.couldNotCreate"),
- description:
- err instanceof CloudApiError && err.code === "upgrade_required"
- ? t("notes.spaces.upgradeRequired")
- : err instanceof Error
- ? err.message
- : t("common.unknownError"),
+ description: err instanceof Error ? err.message : t("common.unknownError"),
variant: "destructive",
});
} finally {
@@ -361,46 +332,11 @@ export default function CreateSpaceDialog({
<label className="text-xs font-medium text-foreground/50">
{t("notes.spaces.emojiLabel")}
</label>
- <Popover open={emojiPickerOpen} onOpenChange={setEmojiPickerOpen}>
- <PopoverAnchor asChild>
- <Input
- ref={emojiInputRef}
- value={emoji}
- onChange={(e) => setEmoji(clampEmojiInput(e.target.value))}
- onClick={() => void openEmojiPicker()}
- aria-label={t("notes.spaces.changeEmoji")}
- className="text-center"
- />
- </PopoverAnchor>
- <PopoverContent
- className="w-auto min-w-0 p-1.5"
- onOpenAutoFocus={(e) => e.preventDefault()}
- onCloseAutoFocus={(e) => e.preventDefault()}
- onInteractOutside={(e) => {
- if (e.target === emojiInputRef.current) e.preventDefault();
- }}
- >
- <div className="grid grid-cols-8 gap-0.5">
- {EMOJI_CHOICES.map((choice) => (
- <button
- key={choice}
- type="button"
- onClick={() => {
- setEmoji(choice === emoji ? "" : choice);
- setEmojiPickerOpen(false);
- emojiInputRef.current?.focus();
- }}
- className={cn(
- "flex h-7 w-7 items-center justify-center rounded-md text-base outline-none transition-colors hover:bg-accent focus-visible:bg-accent",
- choice === emoji && "bg-accent"
- )}
- >
- {choice}
- </button>
- ))}
- </div>
- </PopoverContent>
- </Popover>
+ <EmojiPickerInput
+ value={emoji}
+ onChange={setEmoji}
+ ariaLabel={t("notes.spaces.changeEmoji")}
+ />
</div>
<div className="space-y-1.5 flex-1">
<label className="text-xs font-medium text-foreground/50">
@@ -542,6 +478,30 @@ export default function CreateSpaceDialog({
)}
</div>
+ {planBlocked && workspace && (
+ <div className="rounded-lg border border-border/50 dark:border-border-subtle/70 bg-card/50 dark:bg-surface-2/50 px-4 py-6 flex items-center justify-between gap-3">
+ <div className="min-w-0">
+ <p className="text-xs font-medium text-foreground">
+ {t("notes.spaces.planBlocked.title", { workspace: workspace.name })}
+ </p>
+ <p className="text-xs text-muted-foreground mt-0.5">
+ {t("notes.spaces.planBlocked.description")}
+ </p>
+ </div>
+ <Button
+ variant="outline"
+ size="sm"
+ className="shrink-0"
+ onClick={() => {
+ handleOpenChange(false);
+ onOpenWorkspaceBilling?.(workspace.id);
+ }}
+ >
+ {t("notes.spaces.planBlocked.cta")}
+ </Button>
+ </div>
+ )}
+
<DialogFooter>
<Button
variant="ghost"
diff --git a/src/components/notes/EmojiPickerInput.tsx b/src/components/notes/EmojiPickerInput.tsx
new file mode 100644
index 000000000..460660446
--- /dev/null
+++ b/src/components/notes/EmojiPickerInput.tsx
@@ -0,0 +1,114 @@
+import { useRef, useState } from "react";
+import { Popover, PopoverAnchor, PopoverContent } from "../ui/popover";
+import { Input } from "../ui/input";
+import { clampEmojiInput } from "../../lib/emojiInput";
+import { cn } from "../lib/utils";
+
+const EMOJI_CHOICES = [
+ "📝",
+ "📋",
+ "💡",
+ "🚀",
+ "🎯",
+ "📣",
+ "🛠️",
+ "🎨",
+ "📊",
+ "💼",
+ "🤝",
+ "🌱",
+ "🔬",
+ "🧪",
+ "📚",
+ "✨",
+ "🔥",
+ "⭐",
+ "💬",
+ "🗂️",
+ "🧭",
+ "🌍",
+ "🔒",
+ "🏆",
+];
+
+interface EmojiPickerInputProps {
+ value: string;
+ onChange: (value: string) => void;
+ ariaLabel: string;
+ className?: string;
+ autoFocus?: boolean;
+ /**
+ * The grid renders in a portal, so focus leaves the host's DOM subtree while
+ * it is open — inline-edit hosts that commit on blur-outside use this to
+ * suppress the commit until the picker closes.
+ */
+ onPickerOpenChange?: (open: boolean) => void;
+}
+
+// Emoji field with the OS emoji panel where one exists (macOS) and a 24-emoji
+// grid fallback (Linux, or when the panel can't be shown).
+export function EmojiPickerInput({
+ value,
+ onChange,
+ ariaLabel,
+ className,
+ autoFocus,
+ onPickerOpenChange,
+}: EmojiPickerInputProps) {
+ const [pickerOpen, setPickerOpen] = useState(false);
+ const inputRef = useRef<HTMLInputElement>(null);
+
+ const setOpen = (open: boolean): void => {
+ setPickerOpen(open);
+ onPickerOpenChange?.(open);
+ };
+
+ const openPicker = async (): Promise<void> => {
+ const nativeShown = await window.electronAPI?.showEmojiPanel?.().catch(() => false);
+ if (!nativeShown) setOpen(true);
+ };
+
+ return (
+ <Popover open={pickerOpen} onOpenChange={setOpen}>
+ <PopoverAnchor asChild>
+ <Input
+ ref={inputRef}
+ autoFocus={autoFocus}
+ value={value}
+ onChange={(e) => onChange(clampEmojiInput(e.target.value))}
+ onClick={() => void openPicker()}
+ aria-label={ariaLabel}
+ className={cn("text-center", className)}
+ />
+ </PopoverAnchor>
+ <PopoverContent
+ className="w-auto min-w-0 p-1.5"
+ onOpenAutoFocus={(e) => e.preventDefault()}
+ onCloseAutoFocus={(e) => e.preventDefault()}
+ onInteractOutside={(e) => {
+ if (e.target === inputRef.current) e.preventDefault();
+ }}
+ >
+ <div className="grid grid-cols-8 gap-0.5">
+ {EMOJI_CHOICES.map((choice) => (
+ <button
+ key={choice}
+ type="button"
+ onClick={() => {
+ onChange(choice === value ? "" : choice);
+ setOpen(false);
+ inputRef.current?.focus();
+ }}
+ className={cn(
+ "flex h-7 w-7 items-center justify-center rounded-md text-base outline-none transition-colors hover:bg-accent focus-visible:bg-accent",
+ choice === value && "bg-accent"
+ )}
+ >
+ {choice}
+ </button>
+ ))}
+ </div>
+ </PopoverContent>
+ </Popover>
+ );
+}
diff --git a/src/components/notes/NoteEditor.tsx b/src/components/notes/NoteEditor.tsx
index 37e55edd0..9ae46d0d0 100644
--- a/src/components/notes/NoteEditor.tsx
+++ b/src/components/notes/NoteEditor.tsx
@@ -718,10 +718,13 @@ export default function NoteEditor({
if (fresh) updateNoteInStore(fresh);
}, [conflict, note.client_note_id, note.folder_id, note.space_id, onCancelPendingSaves]);
- // Keep the local edits; the next push wins last-write.
+ // Keep the local edits, overwriting the cloud revision the user just saw.
+ // Advancing the base first is what lets the next push succeed instead of
+ // 409ing against the same conflict and re-raising the banner.
const handleConflictKeep = useCallback(() => {
+ if (conflict) void window.electronAPI.setNoteCloudBase?.(note.id, conflict.updated_at);
clearNoteConflict(note.client_note_id);
- }, [note.client_note_id]);
+ }, [conflict, note.id, note.client_note_id]);
const noteDate = formatNoteDate(note.created_at);
const shortDate = formatShortDate(note.created_at);
diff --git a/src/components/notes/PersonalNotesView.tsx b/src/components/notes/PersonalNotesView.tsx
index 8efbf06ad..f88b3c3b1 100644
--- a/src/components/notes/PersonalNotesView.tsx
+++ b/src/components/notes/PersonalNotesView.tsx
@@ -51,6 +51,7 @@ import {
} from "../../stores/meetingRecordingStore";
import { useNotesOnboarding } from "../../hooks/useNotesOnboarding";
import { useTeamSpacesCapability } from "../../hooks/useTeamSpacesCapability";
+import { useWorkspaceStore } from "../../stores/workspaceStore";
import { useAuth } from "../../hooks/useAuth";
import NotesOnboarding from "./NotesOnboarding";
import { isRegenerableNoteTitle } from "../../helpers/regenerableNoteTitle";
@@ -646,6 +647,12 @@ export default function PersonalNotesView({
onNewNote={handleNewNoteIn}
onShowStructureIntro={() => setShowStructureIntro(true)}
onUpgrade={() => onOpenSettings?.("plansBilling")}
+ onOpenWorkspaceBilling={(workspaceId) => {
+ // Settings' billing section shows the ACTIVE workspace, so point
+ // it at the one whose plan blocked the space create first.
+ useWorkspaceStore.getState().setActiveWorkspaceId(workspaceId);
+ onOpenSettings?.("plansBilling");
+ }}
/>
</div>
</div>
diff --git a/src/components/notes/SpaceSyncToastListener.tsx b/src/components/notes/SpaceSyncToastListener.tsx
index 4c8e49d77..86e43206b 100644
--- a/src/components/notes/SpaceSyncToastListener.tsx
+++ b/src/components/notes/SpaceSyncToastListener.tsx
@@ -1,5 +1,6 @@
import { useEffect } from "react";
import { useTranslation } from "react-i18next";
+import { readPurgeDisplacedNote } from "../../stores/noteStore";
import { useToast } from "../ui/useToast";
const DEDUPE_MS = 15_000;
@@ -24,13 +25,24 @@ export default function SpaceSyncToastListener() {
const dispose = window.electronAPI?.onSyncEvent?.(({ name, payload }) => {
if (name === "space-revoked") {
- const { spaceName } = (payload ?? {}) as { spaceName?: string | null };
+ const { spaceName, spaceId } = (payload ?? {}) as {
+ spaceName?: string | null;
+ spaceId?: number | null;
+ };
if (!spaceName) return;
const now = Date.now();
if (now - (lastRevokedAt.get(spaceName) ?? 0) < DEDUPE_MS) return;
lastRevokedAt.set(spaceName, now);
+ // When the purge closed the note the user was reading, say which one
+ // vanished instead of only naming the space.
+ const displaced = spaceId != null ? readPurgeDisplacedNote(spaceId) : null;
toast({
- title: t("notes.spaces.accessRevoked", { space: spaceName }),
+ title: displaced
+ ? t("notes.spaces.accessRevokedActiveNote", {
+ space: spaceName,
+ title: displaced.title || t("notes.list.untitled"),
+ })
+ : t("notes.spaces.accessRevoked", { space: spaceName }),
variant: "destructive",
});
} else if (name === "folder-name-taken") {
diff --git a/src/components/notes/SpacesTree.tsx b/src/components/notes/SpacesTree.tsx
index f203a91a3..429e31337 100644
--- a/src/components/notes/SpacesTree.tsx
+++ b/src/components/notes/SpacesTree.tsx
@@ -42,7 +42,7 @@ import {
import { useTeamSpacesCapability } from "../../hooks/useTeamSpacesCapability";
import { useAuth } from "../../hooks/useAuth";
import { useWorkspace } from "../../hooks/useWorkspace";
-import { clampEmojiInput } from "../../lib/emojiInput";
+import { EmojiPickerInput } from "./EmojiPickerInput";
import { canManageSpace, canMoveBetweenSpaces } from "../../lib/spacePermissions";
import { groupTeamSpacesByWorkspace } from "../../lib/workspaceSelection";
import { readIsSubscribed, subscribeIsSubscribed } from "../../lib/subscriptionFlag";
@@ -138,6 +138,7 @@ interface SpacesTreeProps {
onNewNote: (spaceId: number, folderId: number | null) => void;
onShowStructureIntro?: () => void;
onUpgrade?: () => void;
+ onOpenWorkspaceBilling?: (workspaceId: string) => void;
}
function spaceDisplayName(space: SpaceItem, t: TFn): string {
@@ -1076,6 +1077,7 @@ export default function SpacesTree({
onNewNote,
onShowStructureIntro,
onUpgrade,
+ onOpenWorkspaceBilling,
}: SpacesTreeProps) {
const { t } = useTranslation();
const { toast, dismiss } = useToast();
@@ -1104,6 +1106,7 @@ export default function SpacesTree({
const [renameSpaceName, setRenameSpaceName] = useState("");
const [renameSpaceEmoji, setRenameSpaceEmoji] = useState("");
const [spaceRenameFocus, setSpaceRenameFocus] = useState<"name" | "emoji">("name");
+ const emojiPickerOpenRef = useRef(false);
const [showCreateSpace, setShowCreateSpace] = useState(false);
const [createSpaceWorkspaceId, setCreateSpaceWorkspaceId] = useState<string | null>(null);
const [membersSpaceId, setMembersSpaceId] = useState<number | null>(null);
@@ -1197,29 +1200,23 @@ export default function SpacesTree({
});
};
+ // Every permitted cross-space move enters a team space (private→team or
+ // team→team): moving OUT of a team space is policy-blocked in
+ // canMoveBetweenSpaces, and there is only one private space.
const confirmCrossSpaceMove = (
- fromSpaceId: number,
+ _fromSpaceId: number,
toSpaceId: number,
isFolder: boolean,
onConfirm: () => void
) => {
const intoSpace = spaces.find((s) => s.id === toSpaceId);
- const fromSpace = spaces.find((s) => s.id === fromSpaceId);
- if (!intoSpace || !fromSpace) return;
- const movingIntoTeam = intoSpace.kind === "team";
- const moveInDescription = t(
- isFolder ? "notes.spaces.confirmMoveInFolder" : "notes.spaces.confirmMoveIn",
- { space: intoSpace.name }
- );
+ if (!intoSpace) return;
showConfirmDialog({
- title: movingIntoTeam
- ? t("notes.spaces.confirmMoveInTitle", { space: intoSpace.name })
- : t("notes.spaces.confirmMoveOutTitle", { space: fromSpace.name }),
- description: movingIntoTeam
- ? moveInDescription
- : t(isFolder ? "notes.spaces.confirmMoveOutFolder" : "notes.spaces.confirmMoveOut", {
- space: fromSpace.name,
- }),
+ title: t("notes.spaces.confirmMoveInTitle", { space: intoSpace.name }),
+ description: t(
+ isFolder ? "notes.spaces.confirmMoveInFolder" : "notes.spaces.confirmMoveIn",
+ { space: intoSpace.name }
+ ),
confirmText: t("notes.spaces.moveConfirm"),
onConfirm,
});
@@ -1335,6 +1332,8 @@ export default function SpacesTree({
confirmCrossSpaceMove(note.spaceId, target.spaceId, false, commit);
},
canCrossSpaceDrop: (note, target) => allowsCrossSpaceMove(note.spaceId, target.spaceId),
+ onCrossSpaceVeto: () =>
+ toast({ title: t("notes.spaces.cantMoveOut"), duration: 4000 }),
onHoverTarget: (key) => setContainerExpanded(key, true),
});
@@ -1811,11 +1810,17 @@ export default function SpacesTree({
role="none"
className="flex items-center gap-1 h-[30px] px-2"
onBlur={(e) => {
+ // The emoji grid is portaled: while it's open, focus sits outside
+ // this row and a blur-commit would unmount the picker mid-pick.
+ if (emojiPickerOpenRef.current) return;
if (!e.currentTarget.contains(e.relatedTarget as Node | null)) {
confirmSpaceRename();
}
}}
onKeyDown={(e) => {
+ // Portal events bubble through the React tree — Enter/Escape
+ // inside the open picker must not commit or cancel the rename.
+ if (emojiPickerOpenRef.current) return;
if (e.key === "Enter") {
confirmSpaceRename();
focusRowSoon(spaceKey);
@@ -1826,12 +1831,15 @@ export default function SpacesTree({
}
}}
>
- <input
+ <EmojiPickerInput
autoFocus={spaceRenameFocus === "emoji"}
value={renameSpaceEmoji}
- onChange={(e) => setRenameSpaceEmoji(clampEmojiInput(e.target.value))}
- aria-label={t("notes.spaces.changeEmoji")}
+ onChange={setRenameSpaceEmoji}
+ ariaLabel={t("notes.spaces.changeEmoji")}
className={cn(FOLDER_INPUT_CLASS, "w-8 shrink-0 px-0 text-center")}
+ onPickerOpenChange={(open) => {
+ emojiPickerOpenRef.current = open;
+ }}
/>
<input
autoFocus={spaceRenameFocus === "name"}
@@ -2076,6 +2084,7 @@ export default function SpacesTree({
if (!open) setCreateSpaceWorkspaceId(null);
}}
initialWorkspaceId={createSpaceWorkspaceId}
+ onOpenWorkspaceBilling={onOpenWorkspaceBilling}
/>
{membersSpace && (
diff --git a/src/components/notes/overview/ContainerOverview.tsx b/src/components/notes/overview/ContainerOverview.tsx
index d81e77eef..3955e978a 100644
--- a/src/components/notes/overview/ContainerOverview.tsx
+++ b/src/components/notes/overview/ContainerOverview.tsx
@@ -1,5 +1,5 @@
import { useEffect, useMemo, useState } from "react";
-import { UserPlus } from "lucide-react";
+import { Plus, UserPlus } from "lucide-react";
import { useTranslation } from "react-i18next";
import InviteTeammateDialog from "../../InviteTeammateDialog";
import { useWorkspaceStore } from "../../../stores/workspaceStore";
@@ -114,15 +114,27 @@ export function ContainerOverview({
<p className="text-xs text-foreground/35 dark:text-foreground/25">
{metaParts.join(" · ")}
</p>
- {canInvite && (
- <button
- onClick={() => setShowInviteDialog(true)}
- className="mt-1 inline-flex items-center gap-1.5 px-3 h-7 rounded-md border border-border/40 dark:border-white/10 text-xs font-medium text-foreground/60 hover:text-foreground/85 hover:border-border/70 hover:bg-foreground/3 dark:hover:bg-white/3 transition-colors duration-150 focus:outline-none focus-visible:ring-1 focus-visible:ring-ring/30"
- >
- <UserPlus size={12} />
- {t("notes.overview.invite")}
- </button>
- )}
+ <div className="mt-1 flex items-center gap-2">
+ {/* The empty state keeps its own focal create CTA in the list. */}
+ {notes.length > 0 && (
+ <button
+ onClick={onNewNote}
+ className="inline-flex items-center gap-1.5 px-3 h-7 rounded-md border border-border/40 dark:border-white/10 text-xs font-medium text-foreground/60 hover:text-foreground/85 hover:border-border/70 hover:bg-foreground/3 dark:hover:bg-white/3 transition-colors duration-150 focus:outline-none focus-visible:ring-1 focus-visible:ring-ring/30"
+ >
+ <Plus size={12} />
+ {t("notes.list.newNote")}
+ </button>
+ )}
+ {canInvite && (
+ <button
+ onClick={() => setShowInviteDialog(true)}
+ className="inline-flex items-center gap-1.5 px-3 h-7 rounded-md border border-border/40 dark:border-white/10 text-xs font-medium text-foreground/60 hover:text-foreground/85 hover:border-border/70 hover:bg-foreground/3 dark:hover:bg-white/3 transition-colors duration-150 focus:outline-none focus-visible:ring-1 focus-visible:ring-ring/30"
+ >
+ <UserPlus size={12} />
+ {t("notes.overview.invite")}
+ </button>
+ )}
+ </div>
</div>
<OverviewExplainerBanner kind={space.kind === "team" ? "team" : "private"} />
diff --git a/src/components/ui/dialog.tsx b/src/components/ui/dialog.tsx
index 1dd441869..ef9d0f8c9 100644
--- a/src/components/ui/dialog.tsx
+++ b/src/components/ui/dialog.tsx
@@ -162,6 +162,8 @@ const ConfirmDialog: React.FC<ConfirmDialogProps> = ({
children,
confirmDisabled = false,
}) => {
+ const confirmRef = React.useRef<HTMLButtonElement>(null);
+
const handleConfirm = () => {
onConfirm();
onOpenChange(false);
@@ -172,9 +174,19 @@ const ConfirmDialog: React.FC<ConfirmDialogProps> = ({
onOpenChange(false);
};
+ // Radix auto-focuses the first tabbable — the Cancel button — so Enter used
+ // to cancel. Focus Confirm instead, except: destructive dialogs keep Cancel
+ // focused (Enter must never destroy by default), and dialogs with children
+ // keep Radix's choice (a type-to-confirm input owns focus and Enter itself).
+ const handleOpenAutoFocus = (event: Event) => {
+ if (children != null || variant === "destructive") return;
+ event.preventDefault();
+ confirmRef.current?.focus();
+ };
+
return (
<Dialog open={open} onOpenChange={onOpenChange}>
- <DialogContent className="sm:max-w-[425px]">
+ <DialogContent className="sm:max-w-[425px]" onOpenAutoFocus={handleOpenAutoFocus}>
<DialogHeader>
<DialogTitle>{title}</DialogTitle>
{description && <DialogDescription>{description}</DialogDescription>}
@@ -185,6 +197,7 @@ const ConfirmDialog: React.FC<ConfirmDialogProps> = ({
{cancelText}
</Button>
<Button
+ ref={confirmRef}
variant={variant === "destructive" ? "destructive" : "default"}
onClick={handleConfirm}
disabled={confirmDisabled}