Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

Enhance NotesToolbar with tooltips and localization support

itzadetunji8ce5bd042389
diff --git a/src/components/launch/NotesToolbar.tsx b/src/components/launch/NotesToolbar.tsx
index 546d76440..c744b525c 100644
--- a/src/components/launch/NotesToolbar.tsx
+++ b/src/components/launch/NotesToolbar.tsx
@@ -1,6 +1,8 @@
import type { Editor } from "@tiptap/react";
import { Bold, Code, Italic, List, ListOrdered, Quote, Strikethrough } from "lucide-react";
import { type ReactNode, useEffect, useReducer } from "react";
+import { Tooltip } from "@/components/ui/tooltip";
+import { useScopedT } from "@/contexts/I18nContext";
import { cn } from "@/lib/utils";
type NotesToolbarProps = {
@@ -9,6 +11,7 @@ type NotesToolbarProps = {
type ToolbarButtonProps = {
"aria-label": string;
+ tooltipContent: string;
active?: boolean;
disabled?: boolean;
onClick: () => void;
@@ -17,25 +20,28 @@ type ToolbarButtonProps = {
function ToolbarButton({
"aria-label": ariaLabel,
+ tooltipContent,
active = false,
disabled = false,
onClick,
children,
}: ToolbarButtonProps) {
return (
- <button
- type="button"
- aria-label={ariaLabel}
- aria-pressed={active}
- disabled={disabled}
- onClick={onClick}
- className={cn(
- "shrink-0 inline-flex h-8 w-8 items-center justify-center rounded-md border-0 bg-transparent text-gray-700 transition-colors hover:bg-gray-200 hover:text-gray-900 disabled:cursor-not-allowed disabled:opacity-35",
- active && "bg-gray-900 text-white hover:bg-gray-800 hover:text-white",
- )}
- >
- {children}
- </button>
+ <Tooltip content={tooltipContent}>
+ <button
+ type="button"
+ aria-label={ariaLabel}
+ aria-pressed={active}
+ disabled={disabled}
+ onClick={onClick}
+ className={cn(
+ "shrink-0 inline-flex h-8 w-8 items-center justify-center rounded-md border-0 bg-transparent text-gray-700 transition-colors hover:bg-gray-200 hover:text-gray-900 disabled:cursor-not-allowed disabled:opacity-35",
+ active && "bg-gray-900 text-white hover:bg-gray-800 hover:text-white",
+ )}
+ >
+ {children}
+ </button>
+ </Tooltip>
);
}
@@ -63,12 +69,14 @@ function useEditorRevision(editor: Editor | null): void {
export function NotesToolbar({ editor }: NotesToolbarProps) {
useEditorRevision(editor);
+ const t = useScopedT("launch");
return (
<div className="flex items-center gap-1 rounded-[0.625rem] max-w-fit border border-gray-200 bg-gray-50 p-1.5 overflow-scroll no-scrollbar">
<div className="flex items-center justify-between flex-1 shrink-0 gap-1">
<ToolbarButton
- aria-label="Bold"
+ aria-label={t("tooltips.notesToolbar.bold")}
+ tooltipContent={t("tooltips.notesToolbar.bold")}
active={editor?.isActive("bold") ?? false}
disabled={!editor?.can().chain().focus().toggleBold().run()}
onClick={() => editor?.chain().focus().toggleBold().run()}
@@ -76,7 +84,8 @@ export function NotesToolbar({ editor }: NotesToolbarProps) {
<Bold size={16} />
</ToolbarButton>
<ToolbarButton
- aria-label="Italic"
+ aria-label={t("tooltips.notesToolbar.italic")}
+ tooltipContent={t("tooltips.notesToolbar.italic")}
active={editor?.isActive("italic") ?? false}
disabled={!editor?.can().chain().focus().toggleItalic().run()}
onClick={() => editor?.chain().focus().toggleItalic().run()}
@@ -84,7 +93,8 @@ export function NotesToolbar({ editor }: NotesToolbarProps) {
<Italic size={16} />
</ToolbarButton>
<ToolbarButton
- aria-label="Strikethrough"
+ aria-label={t("tooltips.notesToolbar.strikethrough")}
+ tooltipContent={t("tooltips.notesToolbar.strikethrough")}
active={editor?.isActive("strike") ?? false}
disabled={!editor?.can().chain().focus().toggleStrike().run()}
onClick={() => editor?.chain().focus().toggleStrike().run()}
@@ -97,7 +107,8 @@ export function NotesToolbar({ editor }: NotesToolbarProps) {
<span className="mx-0.5 h-5 w-px bg-gray-300" aria-hidden="true" />
</div>
<ToolbarButton
- aria-label="Bullet list"
+ aria-label={t("tooltips.notesToolbar.bulletList")}
+ tooltipContent={t("tooltips.notesToolbar.bulletList")}
active={editor?.isActive("bulletList") ?? false}
disabled={!editor?.can().chain().focus().toggleBulletList().run()}
onClick={() => editor?.chain().focus().toggleBulletList().run()}
@@ -105,7 +116,8 @@ export function NotesToolbar({ editor }: NotesToolbarProps) {
<List size={16} />
</ToolbarButton>
<ToolbarButton
- aria-label="Numbered list"
+ aria-label={t("tooltips.notesToolbar.numberedList")}
+ tooltipContent={t("tooltips.notesToolbar.numberedList")}
active={editor?.isActive("orderedList") ?? false}
disabled={!editor?.can().chain().focus().toggleOrderedList().run()}
onClick={() => editor?.chain().focus().toggleOrderedList().run()}
@@ -118,7 +130,8 @@ export function NotesToolbar({ editor }: NotesToolbarProps) {
<span className="mx-0.5 h-5 w-px bg-gray-300" aria-hidden="true" />
</div>
<ToolbarButton
- aria-label="Blockquote"
+ aria-label={t("tooltips.notesToolbar.blockquote")}
+ tooltipContent={t("tooltips.notesToolbar.blockquote")}
active={editor?.isActive("blockquote") ?? false}
disabled={!editor?.can().chain().focus().toggleBlockquote().run()}
onClick={() => editor?.chain().focus().toggleBlockquote().run()}
@@ -126,7 +139,8 @@ export function NotesToolbar({ editor }: NotesToolbarProps) {
<Quote size={16} />
</ToolbarButton>
<ToolbarButton
- aria-label="Code block"
+ aria-label={t("tooltips.notesToolbar.codeBlock")}
+ tooltipContent={t("tooltips.notesToolbar.codeBlock")}
active={editor?.isActive("codeBlock") ?? false}
disabled={!editor?.can().chain().focus().toggleCodeBlock().run()}
onClick={() => editor?.chain().focus().toggleCodeBlock().run()}
diff --git a/src/i18n/locales/ar/launch.json b/src/i18n/locales/ar/launch.json
index ef000a875..f902e8127 100644
--- a/src/i18n/locales/ar/launch.json
+++ b/src/i18n/locales/ar/launch.json
@@ -9,7 +9,18 @@
"openVideoFile": "فتح ملف فيديو",
"openProject": "فتح مشروع",
"useVerticalTray": "استخدام الشريط العمودي",
- "useHorizontalTray": "استخدام الشريط الأفقي"
+ "useHorizontalTray": "استخدام الشريط الأفقي",
+ "openNotes": "فتح الملاحظات",
+ "openNotesPlaceholder": "اكتب ملاحظاتك هنا...",
+ "notesToolbar": {
+ "bold": "غامق",
+ "italic": "مائل",
+ "strikethrough": "يتوسطه خط",
+ "bulletList": "قائمة نقطية",
+ "numberedList": "قائمة مرقمة",
+ "blockquote": "اقتباس",
+ "codeBlock": "كتلة تعليمات برمجية"
+ }
},
"audio": {
"enableSystemAudio": "تفعيل صوت النظام",
diff --git a/src/i18n/locales/en/launch.json b/src/i18n/locales/en/launch.json
index af9d60b55..0bdb21d64 100644
--- a/src/i18n/locales/en/launch.json
+++ b/src/i18n/locales/en/launch.json
@@ -12,7 +12,16 @@
"useHorizontalTray": "Use horizontal tray",
"openStudio": "Open Studio",
"openNotes": "Open Notes",
- "openNotesPlaceholder": "Take notes here..."
+ "openNotesPlaceholder": "Take notes here...",
+ "notesToolbar": {
+ "bold": "Bold",
+ "italic": "Italic",
+ "strikethrough": "Strikethrough",
+ "bulletList": "Bullet list",
+ "numberedList": "Numbered list",
+ "blockquote": "Blockquote",
+ "codeBlock": "Code block"
+ }
},
"audio": {
"enableSystemAudio": "Enable system audio",
diff --git a/src/i18n/locales/es/launch.json b/src/i18n/locales/es/launch.json
index bc6ba52a8..1d78246f6 100644
--- a/src/i18n/locales/es/launch.json
+++ b/src/i18n/locales/es/launch.json
@@ -9,7 +9,18 @@
"openVideoFile": "Abrir archivo de video",
"openProject": "Abrir proyecto",
"useVerticalTray": "Usar bandeja vertical",
- "useHorizontalTray": "Usar bandeja horizontal"
+ "useHorizontalTray": "Usar bandeja horizontal",
+ "openNotes": "Abrir notas",
+ "openNotesPlaceholder": "Escribe tus notas aquí...",
+ "notesToolbar": {
+ "bold": "Negrita",
+ "italic": "Cursiva",
+ "strikethrough": "Tachado",
+ "bulletList": "Lista con viñetas",
+ "numberedList": "Lista numerada",
+ "blockquote": "Cita",
+ "codeBlock": "Bloque de código"
+ }
},
"audio": {
"enableSystemAudio": "Activar audio del sistema",
diff --git a/src/i18n/locales/fr/launch.json b/src/i18n/locales/fr/launch.json
index 0a89376c2..36b4fdc65 100644
--- a/src/i18n/locales/fr/launch.json
+++ b/src/i18n/locales/fr/launch.json
@@ -9,7 +9,18 @@
"openVideoFile": "Ouvrir un fichier vidéo",
"openProject": "Ouvrir un projet",
"useVerticalTray": "Utiliser la barre verticale",
- "useHorizontalTray": "Utiliser la barre horizontale"
+ "useHorizontalTray": "Utiliser la barre horizontale",
+ "openNotes": "Ouvrir les notes",
+ "openNotesPlaceholder": "Prenez des notes ici...",
+ "notesToolbar": {
+ "bold": "Gras",
+ "italic": "Italique",
+ "strikethrough": "Barré",
+ "bulletList": "Liste à puces",
+ "numberedList": "Liste numérotée",
+ "blockquote": "Citation",
+ "codeBlock": "Bloc de code"
+ }
},
"audio": {
"enableSystemAudio": "Activer l'audio système",
diff --git a/src/i18n/locales/it/launch.json b/src/i18n/locales/it/launch.json
index 66c18bc9d..4d89c40dd 100644
--- a/src/i18n/locales/it/launch.json
+++ b/src/i18n/locales/it/launch.json
@@ -9,7 +9,18 @@
"openVideoFile": "Apri file video",
"openProject": "Apri progetto",
"useVerticalTray": "Usa barra verticale",
- "useHorizontalTray": "Usa barra orizzontale"
+ "useHorizontalTray": "Usa barra orizzontale",
+ "openNotes": "Apri note",
+ "openNotesPlaceholder": "Scrivi le tue note qui...",
+ "notesToolbar": {
+ "bold": "Grassetto",
+ "italic": "Corsivo",
+ "strikethrough": "Barrato",
+ "bulletList": "Elenco puntato",
+ "numberedList": "Elenco numerato",
+ "blockquote": "Citazione",
+ "codeBlock": "Blocco di codice"
+ }
},
"audio": {
"enableSystemAudio": "Abilita audio di sistema",
diff --git a/src/i18n/locales/ja-JP/launch.json b/src/i18n/locales/ja-JP/launch.json
index 66fd8ee6b..1010f1676 100644
--- a/src/i18n/locales/ja-JP/launch.json
+++ b/src/i18n/locales/ja-JP/launch.json
@@ -9,7 +9,18 @@
"openVideoFile": "動画ファイルを開く",
"openProject": "プロジェクトを開く",
"useVerticalTray": "縦型トレイを使用",
- "useHorizontalTray": "横型トレイを使用"
+ "useHorizontalTray": "横型トレイを使用",
+ "openNotes": "ノートを開く",
+ "openNotesPlaceholder": "ここにメモを入力...",
+ "notesToolbar": {
+ "bold": "太字",
+ "italic": "斜体",
+ "strikethrough": "取り消し線",
+ "bulletList": "箇条書きリスト",
+ "numberedList": "番号付きリスト",
+ "blockquote": "引用",
+ "codeBlock": "コードブロック"
+ }
},
"audio": {
"enableSystemAudio": "システム音声を有効にする",
diff --git a/src/i18n/locales/ko-KR/launch.json b/src/i18n/locales/ko-KR/launch.json
index 361ce8657..28a27a7cc 100644
--- a/src/i18n/locales/ko-KR/launch.json
+++ b/src/i18n/locales/ko-KR/launch.json
@@ -9,7 +9,18 @@
"openVideoFile": "비디오 파일 열기",
"openProject": "프로젝트 열기",
"useVerticalTray": "세로 트레이 사용",
- "useHorizontalTray": "가로 트레이 사용"
+ "useHorizontalTray": "가로 트레이 사용",
+ "openNotes": "노트 열기",
+ "openNotesPlaceholder": "여기에 메모를 입력하세요...",
+ "notesToolbar": {
+ "bold": "굵게",
+ "italic": "기울임꼴",
+ "strikethrough": "취소선",
+ "bulletList": "글머리 기호 목록",
+ "numberedList": "번호 매기기 목록",
+ "blockquote": "인용문",
+ "codeBlock": "코드 블록"
+ }
},
"audio": {
"enableSystemAudio": "시스템 오디오 활성화",
diff --git a/src/i18n/locales/pt-BR/launch.json b/src/i18n/locales/pt-BR/launch.json
index 185380920..4f865d452 100644
--- a/src/i18n/locales/pt-BR/launch.json
+++ b/src/i18n/locales/pt-BR/launch.json
@@ -7,7 +7,18 @@
"pauseRecording": "Pausar gravação",
"resumeRecording": "Retomar gravação",
"openVideoFile": "Abrir arquivo de vídeo",
- "openProject": "Abrir projeto"
+ "openProject": "Abrir projeto",
+ "openNotes": "Abrir notas",
+ "openNotesPlaceholder": "Escreva suas notas aqui...",
+ "notesToolbar": {
+ "bold": "Negrito",
+ "italic": "Itálico",
+ "strikethrough": "Tachado",
+ "bulletList": "Lista com marcadores",
+ "numberedList": "Lista numerada",
+ "blockquote": "Citação",
+ "codeBlock": "Bloco de código"
+ }
},
"audio": {
"enableSystemAudio": "Ativar áudio do sistema",
diff --git a/src/i18n/locales/ru/launch.json b/src/i18n/locales/ru/launch.json
index 9b3361296..5f9b68d68 100644
--- a/src/i18n/locales/ru/launch.json
+++ b/src/i18n/locales/ru/launch.json
@@ -9,7 +9,18 @@
"openVideoFile": "Открыть видеофайл",
"openProject": "Открыть проект",
"useVerticalTray": "Использовать вертикальную панель",
- "useHorizontalTray": "Использовать горизонтальную панель"
+ "useHorizontalTray": "Использовать горизонтальную панель",
+ "openNotes": "Открыть заметки",
+ "openNotesPlaceholder": "Пишите заметки здесь...",
+ "notesToolbar": {
+ "bold": "Жирный",
+ "italic": "Курсив",
+ "strikethrough": "Зачеркнутый",
+ "bulletList": "Маркированный список",
+ "numberedList": "Нумерованный список",
+ "blockquote": "Цитата",
+ "codeBlock": "Блок кода"
+ }
},
"audio": {
"enableSystemAudio": "Включить системное аудио",
diff --git a/src/i18n/locales/tr/launch.json b/src/i18n/locales/tr/launch.json
index 921a52634..4fb7e98f3 100644
--- a/src/i18n/locales/tr/launch.json
+++ b/src/i18n/locales/tr/launch.json
@@ -9,7 +9,18 @@
"openVideoFile": "Video dosyası aç",
"openProject": "Proje aç",
"useVerticalTray": "Dikey araç çubuğunu kullan",
- "useHorizontalTray": "Yatay araç çubuğunu kullan"
+ "useHorizontalTray": "Yatay araç çubuğunu kullan",
+ "openNotes": "Notları aç",
+ "openNotesPlaceholder": "Notlarınızı buraya yazın...",
+ "notesToolbar": {
+ "bold": "Kalın",
+ "italic": "İtalik",
+ "strikethrough": "Üstü çizili",
+ "bulletList": "Madde işaretli liste",
+ "numberedList": "Numaralı liste",
+ "blockquote": "Alıntı",
+ "codeBlock": "Kod bloğu"
+ }
},
"audio": {
"enableSystemAudio": "Sistem sesini etkinleştir",
diff --git a/src/i18n/locales/vi/launch.json b/src/i18n/locales/vi/launch.json
index efbaad5d4..0a237bb6a 100644
--- a/src/i18n/locales/vi/launch.json
+++ b/src/i18n/locales/vi/launch.json
@@ -9,7 +9,18 @@
"openVideoFile": "Mở tệp video",
"openProject": "Mở dự án",
"useVerticalTray": "Dùng khay dọc",
- "useHorizontalTray": "Dùng khay ngang"
+ "useHorizontalTray": "Dùng khay ngang",
+ "openNotes": "Mở ghi chú",
+ "openNotesPlaceholder": "Ghi chú của bạn tại đây...",
+ "notesToolbar": {
+ "bold": "In đậm",
+ "italic": "In nghiêng",
+ "strikethrough": "Gạch ngang",
+ "bulletList": "Danh sách dấu đầu dòng",
+ "numberedList": "Danh sách đánh số",
+ "blockquote": "Trích dẫn",
+ "codeBlock": "Khối mã"
+ }
},
"audio": {
"enableSystemAudio": "Bật âm thanh hệ thống",
diff --git a/src/i18n/locales/zh-CN/launch.json b/src/i18n/locales/zh-CN/launch.json
index c08996585..0e7d66a8a 100644
--- a/src/i18n/locales/zh-CN/launch.json
+++ b/src/i18n/locales/zh-CN/launch.json
@@ -9,7 +9,18 @@
"openVideoFile": "打开视频文件",
"openProject": "打开项目",
"useVerticalTray": "使用竖向托盘",
- "useHorizontalTray": "使用横向托盘"
+ "useHorizontalTray": "使用横向托盘",
+ "openNotes": "打开笔记",
+ "openNotesPlaceholder": "在此输入笔记...",
+ "notesToolbar": {
+ "bold": "加粗",
+ "italic": "斜体",
+ "strikethrough": "删除线",
+ "bulletList": "无序列表",
+ "numberedList": "有序列表",
+ "blockquote": "引用",
+ "codeBlock": "代码块"
+ }
},
"audio": {
"enableSystemAudio": "启用系统音频",
diff --git a/src/i18n/locales/zh-TW/launch.json b/src/i18n/locales/zh-TW/launch.json
index d0b529ebe..ca64e3299 100644
--- a/src/i18n/locales/zh-TW/launch.json
+++ b/src/i18n/locales/zh-TW/launch.json
@@ -9,7 +9,18 @@
"openVideoFile": "開啟影片檔案",
"openProject": "開啟專案",
"useVerticalTray": "使用直向托盤",
- "useHorizontalTray": "使用橫向托盤"
+ "useHorizontalTray": "使用橫向托盤",
+ "openNotes": "開啟筆記",
+ "openNotesPlaceholder": "在此輸入筆記...",
+ "notesToolbar": {
+ "bold": "粗體",
+ "italic": "斜體",
+ "strikethrough": "刪除線",
+ "bulletList": "項目符號清單",
+ "numberedList": "編號清單",
+ "blockquote": "引言",
+ "codeBlock": "程式碼區塊"
+ }
},
"audio": {
"enableSystemAudio": "啟用系統音訊",