From 0f2390a0b7b9afbbd2580687169b2cc98034ac04 Mon Sep 17 00:00:00 2001 From: aarohee-he <200436693+aarohee-he@users.noreply.github.com> Date: Tue, 5 Aug 2025 22:15:06 -0400 Subject: [PATCH] feat: add tooltips to editor buttons (#4934) Co-authored-by: Anthony Cooper Co-authored-by: aarohee-he Co-authored-by: Mishti Gala --- .../ActionButton/AddMemoRelationPopover.tsx | 20 +++++++--- .../ActionButton/LocationSelector.tsx | 38 +++++++++++++------ .../MemoEditor/ActionButton/MarkdownMenu.tsx | 21 +++++++--- .../MemoEditor/ActionButton/TagSelector.tsx | 20 +++++++--- .../ActionButton/UploadAttachmentButton.tsx | 37 +++++++++++------- .../ActionButton/VisibilitySelector.tsx | 36 +++++++++++------- web/src/locales/en.json | 8 ++++ 7 files changed, 127 insertions(+), 53 deletions(-) diff --git a/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx b/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx index 9743d9773..3fd59907d 100644 --- a/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx +++ b/web/src/components/MemoEditor/ActionButton/AddMemoRelationPopover.tsx @@ -13,6 +13,7 @@ import { extractUserIdFromName } from "@/store/common"; import { Memo, MemoRelation_Memo, MemoRelation_Type } from "@/types/proto/api/v1/memo_service"; import { useTranslate } from "@/utils/i18n"; import { MemoEditorContext } from "../types"; +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; const AddMemoRelationPopover = () => { const t = useTranslate(); @@ -95,11 +96,20 @@ const AddMemoRelationPopover = () => { return ( - - - + + + + + + + + +

{t("tooltip.link-memo")}

+
+
+
{/* Search and selection interface */} diff --git a/web/src/components/MemoEditor/ActionButton/LocationSelector.tsx b/web/src/components/MemoEditor/ActionButton/LocationSelector.tsx index ce6d2ad00..f58c5938d 100644 --- a/web/src/components/MemoEditor/ActionButton/LocationSelector.tsx +++ b/web/src/components/MemoEditor/ActionButton/LocationSelector.tsx @@ -8,6 +8,7 @@ import { Input } from "@/components/ui/input"; import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; import { Location } from "@/types/proto/api/v1/memo_service"; import { useTranslate } from "@/utils/i18n"; +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; interface Props { location?: Location; @@ -94,19 +95,32 @@ const LocationSelector = (props: Props) => { return ( - - + + + {!props.location && ( + +

{t("tooltip.select-location")}

+
)} - - + +
diff --git a/web/src/components/MemoEditor/ActionButton/MarkdownMenu.tsx b/web/src/components/MemoEditor/ActionButton/MarkdownMenu.tsx index a1dacdd1b..2953859c8 100644 --- a/web/src/components/MemoEditor/ActionButton/MarkdownMenu.tsx +++ b/web/src/components/MemoEditor/ActionButton/MarkdownMenu.tsx @@ -3,6 +3,8 @@ import { Button } from "@/components/ui/button"; import { useTranslate } from "@/utils/i18n"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "../../ui/dropdown-menu"; import { EditorRefActions } from "../Editor"; +import { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from "@/components/ui/tooltip"; + interface Props { editorRef: React.RefObject; @@ -61,11 +63,20 @@ const MarkdownMenu = (props: Props) => { return ( - - - + + + + + + + + +

{t("tooltip.markdown-menu")}

+
+
+
diff --git a/web/src/components/MemoEditor/ActionButton/TagSelector.tsx b/web/src/components/MemoEditor/ActionButton/TagSelector.tsx index cb1ba0657..f40e5036c 100644 --- a/web/src/components/MemoEditor/ActionButton/TagSelector.tsx +++ b/web/src/components/MemoEditor/ActionButton/TagSelector.tsx @@ -6,6 +6,7 @@ import { userStore } from "@/store"; import { useTranslate } from "@/utils/i18n"; import { Popover, PopoverContent, PopoverTrigger } from "../../ui/popover"; import { EditorRefActions } from "../Editor"; +import { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from "@/components/ui/tooltip"; interface Props { editorRef: React.RefObject; @@ -34,11 +35,20 @@ const TagSelector = observer((props: Props) => { return ( - - - + + + + + + + + +

{t("tooltip.tags")}

+
+
+
{tags.length > 0 ? (
diff --git a/web/src/components/MemoEditor/ActionButton/UploadAttachmentButton.tsx b/web/src/components/MemoEditor/ActionButton/UploadAttachmentButton.tsx index 00fe6cc13..bb73f05c6 100644 --- a/web/src/components/MemoEditor/ActionButton/UploadAttachmentButton.tsx +++ b/web/src/components/MemoEditor/ActionButton/UploadAttachmentButton.tsx @@ -6,6 +6,8 @@ import { Button } from "@/components/ui/button"; import { attachmentStore } from "@/store"; import { Attachment } from "@/types/proto/api/v1/attachment_service"; import { MemoEditorContext } from "../types"; +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; +import { t } from "i18next"; interface Props { isUploading?: boolean; @@ -73,19 +75,28 @@ const UploadAttachmentButton = observer((props: Props) => { const isUploading = state.uploadingFlag || props.isUploading; return ( - + + + + + + +

{t("tooltip.upload-attachment")}

+
+
+
); }); diff --git a/web/src/components/MemoEditor/ActionButton/VisibilitySelector.tsx b/web/src/components/MemoEditor/ActionButton/VisibilitySelector.tsx index b25dfa918..ae3fb96e4 100644 --- a/web/src/components/MemoEditor/ActionButton/VisibilitySelector.tsx +++ b/web/src/components/MemoEditor/ActionButton/VisibilitySelector.tsx @@ -2,6 +2,7 @@ import VisibilityIcon from "@/components/VisibilityIcon"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import { Visibility } from "@/types/proto/api/v1/memo_service"; import { useTranslate } from "@/utils/i18n"; +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; // ⬅️ ADD this line interface Props { value: Visibility; @@ -26,19 +27,28 @@ const VisibilitySelector = (props: Props) => { }; return ( - + + + + + + +

{t("tooltip.select-visibility")}

+
+
+
); }; diff --git a/web/src/locales/en.json b/web/src/locales/en.json index 7dfde32f9..d4b165ad6 100644 --- a/web/src/locales/en.json +++ b/web/src/locales/en.json @@ -443,5 +443,13 @@ "rename-success": "Renamed tag successfully", "rename-tag": "Rename tag", "rename-tip": "All your memos with this tag will be updated." + }, + "tooltip": { + "link-memo": "Link Memo", + "markdown-menu": "Markdown", + "select-location": "Location", + "select-visibility": "Visibility", + "tags": "Tags", + "upload-attachment": "Upload Attachment(s)" } }