Skip to content

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

fix(notes): remove Team space from the New note dropdown (#2429)

Joshua74945726b0ed
diff --git a/src/components/notes/NewNoteMenu.tsx b/src/components/notes/NewNoteMenu.tsx
index 92426fc99..daaa5063a 100644
--- a/src/components/notes/NewNoteMenu.tsx
+++ b/src/components/notes/NewNoteMenu.tsx
@@ -1,6 +1,6 @@
-import { useRef, useState } from "react";
+import { useRef } from "react";
import { useTranslation } from "react-i18next";
-import { ChevronDown, MessageSquare, NotebookPen, Plus, Users } from "../icons";
+import { ChevronDown, MessageSquare, NotebookPen, Plus } from "../icons";
import {
DropdownMenu,
DropdownMenuContent,
@@ -14,8 +14,6 @@ import {
SPLIT_BUTTON_SEGMENT_CLASS,
} from "../ui/splitButton";
import { cn } from "../lib/utils";
-import { useCanCreateTeamSpace } from "../../hooks/useCanCreateTeamSpace";
-import CreateSpaceDialog from "./CreateSpaceDialog";
// Matched to the search bar it sits beside: the same translucent fill that
// lifts on hover, under the same hairline. The note's Share control keeps its
@@ -35,83 +33,66 @@ interface NewNoteMenuProps {
/** The topbar's split "New note" button; the chevron offers the other things to create. */
export default function NewNoteMenu({ onNewNote, onNewChat }: NewNoteMenuProps) {
const { t } = useTranslation();
- const canCreateTeamSpace = useCanCreateTeamSpace();
- const [createSpaceOpen, setCreateSpaceOpen] = useState(false);
const itemChosenRef = useRef(false);
- // The chat input and the space dialog take focus themselves, so those closes
- // keep it. A new note focuses nothing (the editor mounts fresh), and dismissing
- // the menu returns focus to the chevron, as Radix does by default.
+ // The chat input takes focus itself, so selecting chat keeps it. A new note
+ // focuses nothing (the editor mounts fresh), and dismissing the menu returns
+ // focus to the chevron, as Radix does by default.
const keepFocus = (action: () => void) => () => {
itemChosenRef.current = true;
action();
};
return (
- <>
- <div className={cn(SPLIT_BUTTON_GROUP_CLASS, SOFT_GROUP_CLASS, "h-8")}>
- <button
- type="button"
- onClick={onNewNote}
- className={cn(
- SPLIT_BUTTON_SEGMENT_CLASS,
- SOFT_SEGMENT_CLASS,
- "gap-1.5 whitespace-nowrap ps-3 pe-3.5"
- )}
- >
- <Plus size={14} />
- {t("notes.list.newNote")}
- </button>
- <span aria-hidden="true" className={cn(SPLIT_BUTTON_DIVIDER_CLASS, SOFT_DIVIDER_CLASS)} />
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <button
- type="button"
- aria-label={t("notes.createMenu.chooseType")}
- className={cn(SPLIT_BUTTON_SEGMENT_CLASS, SOFT_SEGMENT_CLASS, "w-8 justify-center")}
- >
- <ChevronDown size={14} />
- </button>
- </DropdownMenuTrigger>
- <DropdownMenuContent
- align="end"
- sideOffset={6}
- className="min-w-44"
- onCloseAutoFocus={(event) => {
- if (!itemChosenRef.current) return;
- itemChosenRef.current = false;
- event.preventDefault();
- }}
+ <div className={cn(SPLIT_BUTTON_GROUP_CLASS, SOFT_GROUP_CLASS, "h-8")}>
+ <button
+ type="button"
+ onClick={onNewNote}
+ className={cn(
+ SPLIT_BUTTON_SEGMENT_CLASS,
+ SOFT_SEGMENT_CLASS,
+ "gap-1.5 whitespace-nowrap ps-3 pe-3.5"
+ )}
+ >
+ <Plus size={14} />
+ {t("notes.list.newNote")}
+ </button>
+ <span aria-hidden="true" className={cn(SPLIT_BUTTON_DIVIDER_CLASS, SOFT_DIVIDER_CLASS)} />
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <button
+ type="button"
+ aria-label={t("notes.createMenu.chooseType")}
+ className={cn(SPLIT_BUTTON_SEGMENT_CLASS, SOFT_SEGMENT_CLASS, "w-8 justify-center")}
>
- <DropdownMenuItem onSelect={onNewNote} className="gap-2.5">
- <NotebookPen className="h-4 w-4" />
- {t("notes.createMenu.note")}
- </DropdownMenuItem>
- {onNewChat && (
- <>
- <DropdownMenuSeparator />
- <DropdownMenuItem onSelect={keepFocus(onNewChat)} className="gap-2.5">
- <MessageSquare className="h-4 w-4" />
- {t("notes.createMenu.assistantChat")}
- </DropdownMenuItem>
- </>
- )}
- {canCreateTeamSpace && (
- <>
- <DropdownMenuSeparator />
- <DropdownMenuItem
- onSelect={keepFocus(() => setCreateSpaceOpen(true))}
- className="gap-2.5"
- >
- <Users className="h-4 w-4" />
- {t("notes.createMenu.teamSpace")}
- </DropdownMenuItem>
- </>
- )}
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
- <CreateSpaceDialog open={createSpaceOpen} onOpenChange={setCreateSpaceOpen} />
- </>
+ <ChevronDown size={14} />
+ </button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent
+ align="end"
+ sideOffset={6}
+ className="min-w-44"
+ onCloseAutoFocus={(event) => {
+ if (!itemChosenRef.current) return;
+ itemChosenRef.current = false;
+ event.preventDefault();
+ }}
+ >
+ <DropdownMenuItem onSelect={onNewNote} className="gap-2.5">
+ <NotebookPen className="h-4 w-4" />
+ {t("notes.createMenu.note")}
+ </DropdownMenuItem>
+ {onNewChat && (
+ <>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem onSelect={keepFocus(onNewChat)} className="gap-2.5">
+ <MessageSquare className="h-4 w-4" />
+ {t("notes.createMenu.assistantChat")}
+ </DropdownMenuItem>
+ </>
+ )}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </div>
);
}
diff --git a/src/locales/ar/translation.json b/src/locales/ar/translation.json
index 8f1c57956..03a4837d4 100644
--- a/src/locales/ar/translation.json
+++ b/src/locales/ar/translation.json
@@ -2091,7 +2091,6 @@
"createMenu": {
"note": "ملاحظة",
"assistantChat": "دردشة مع المساعد",
- "teamSpace": "مساحة فريق",
"chooseType": "اختر ما تريد إنشاءه"
},
"editor": {
diff --git a/src/locales/de/translation.json b/src/locales/de/translation.json
index e69b7d7d3..4ff9427b7 100644
--- a/src/locales/de/translation.json
+++ b/src/locales/de/translation.json
@@ -3292,7 +3292,6 @@
"createMenu": {
"note": "Notiz",
"assistantChat": "Assistent-Chat",
- "teamSpace": "Team-Bereich",
"chooseType": "Auswählen, was erstellt werden soll"
},
"editor": {
diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json
index 4853df327..cdafcbf21 100644
--- a/src/locales/en/translation.json
+++ b/src/locales/en/translation.json
@@ -3292,7 +3292,6 @@
"createMenu": {
"note": "Note",
"assistantChat": "Assistant chat",
- "teamSpace": "Team space",
"chooseType": "Choose what to create"
},
"editor": {
diff --git a/src/locales/es/translation.json b/src/locales/es/translation.json
index 0d39c3317..ae742fee6 100644
--- a/src/locales/es/translation.json
+++ b/src/locales/es/translation.json
@@ -2993,7 +2993,6 @@
"createMenu": {
"note": "Nota",
"assistantChat": "Chat con el asistente",
- "teamSpace": "Espacio de equipo",
"chooseType": "Elegir qué crear"
},
"editor": {
diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.json
index 8a9249c51..7c79e9220 100644
--- a/src/locales/fr/translation.json
+++ b/src/locales/fr/translation.json
@@ -3292,7 +3292,6 @@
"createMenu": {
"note": "Note",
"assistantChat": "Chat avec l'assistant",
- "teamSpace": "Espace d'équipe",
"chooseType": "Choisir quoi créer"
},
"editor": {
diff --git a/src/locales/it/translation.json b/src/locales/it/translation.json
index 1845ab07e..8a051fe7d 100644
--- a/src/locales/it/translation.json
+++ b/src/locales/it/translation.json
@@ -2940,7 +2940,6 @@
"createMenu": {
"note": "Nota",
"assistantChat": "Chat con l'assistente",
- "teamSpace": "Spazio del team",
"chooseType": "Scegli cosa creare"
},
"editor": {
diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.json
index 2d7b1fab2..f5ea3121c 100644
--- a/src/locales/ja/translation.json
+++ b/src/locales/ja/translation.json
@@ -3001,7 +3001,6 @@
"createMenu": {
"note": "ノート",
"assistantChat": "アシスタントとのチャット",
- "teamSpace": "チームスペース",
"chooseType": "作成する項目を選択"
},
"upload": {
diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.json
index 3d552e26b..7aa3ac997 100644
--- a/src/locales/pt/translation.json
+++ b/src/locales/pt/translation.json
@@ -2940,7 +2940,6 @@
"createMenu": {
"note": "Nota",
"assistantChat": "Chat com o assistente",
- "teamSpace": "Espaço de equipe",
"chooseType": "Escolher o que criar"
},
"editor": {
diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.json
index 105376862..25fafb0f0 100644
--- a/src/locales/ru/translation.json
+++ b/src/locales/ru/translation.json
@@ -2960,7 +2960,6 @@
"createMenu": {
"note": "Заметка",
"assistantChat": "Чат с помощником",
- "teamSpace": "Командное пространство",
"chooseType": "Выбрать, что создать"
},
"editor": {
diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.json
index 77e4feebf..305559389 100644
--- a/src/locales/zh-CN/translation.json
+++ b/src/locales/zh-CN/translation.json
@@ -2940,7 +2940,6 @@
"createMenu": {
"note": "笔记",
"assistantChat": "助手聊天",
- "teamSpace": "团队空间",
"chooseType": "选择要创建的内容"
},
"editor": {
diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.json
index 4bf53a3bd..482601c6f 100644
--- a/src/locales/zh-TW/translation.json
+++ b/src/locales/zh-TW/translation.json
@@ -2940,7 +2940,6 @@
"createMenu": {
"note": "筆記",
"assistantChat": "助理聊天",
- "teamSpace": "團隊空間",
"chooseType": "選擇要建立的內容"
},
"editor": {
diff --git a/test/components/newNoteMenu.test.js b/test/components/newNoteMenu.test.js
index 982535a45..ded483af3 100644
--- a/test/components/newNoteMenu.test.js
+++ b/test/components/newNoteMenu.test.js
@@ -50,12 +50,12 @@ test("the New note menu always offers a note and an assistant chat", async (t) =
assert.match(markup, /notes\.createMenu\.assistantChat/);
});
-test("the New note menu offers a team space only when the user can create one", async (t) => {
+test("the New note menu never offers a team space, even with create permission", async (t) => {
const withoutPermission = await renderMenu(t, { canCreateTeamSpace: false });
assert.doesNotMatch(withoutPermission, /notes\.createMenu\.teamSpace/);
const withPermission = await renderMenu(t, { canCreateTeamSpace: true });
- assert.match(withPermission, /notes\.createMenu\.teamSpace/);
+ assert.doesNotMatch(withPermission, /notes\.createMenu\.teamSpace/);
});
// The Chat tab disappears entirely when an org turns the assistant off, so the