From 60dbe33e31c4805789ffc3c8a4fa7779af9c945c Mon Sep 17 00:00:00 2001 From: tianma-if Date: Sat, 25 Jul 2026 16:01:25 +0800 Subject: [PATCH] fix: use app tooltips for editor actions --- apps/web/src/components/EditorPane.tsx | 74 ++++++++++++------- .../src/components/GitHubRepositoryLink.tsx | 27 ++++--- apps/web/src/components/ThemeToggle.tsx | 37 ++++++---- packages/shared/src/i18n/en-US.ts | 2 +- packages/shared/src/i18n/zh-CN.ts | 2 +- 5 files changed, 84 insertions(+), 58 deletions(-) diff --git a/apps/web/src/components/EditorPane.tsx b/apps/web/src/components/EditorPane.tsx index fb406f5d..7212dea7 100644 --- a/apps/web/src/components/EditorPane.tsx +++ b/apps/web/src/components/EditorPane.tsx @@ -102,6 +102,15 @@ const EDITOR_AUTO_SAVE_DELAY_MS = 1200; const MOBILE_DRAFT_PERSIST_DELAY_MS = 800; const NOTE_SEARCH_HIGHLIGHT_PLUGIN_KEY = new PluginKey("edgeever-note-search-highlight"); +const IconTooltip = ({ label, children }: { label: string; children: ReactNode }) => ( + + + {children} + {label} + + +); + type NoteSearchMatch = { from: number; to: number; @@ -2527,12 +2536,16 @@ const RichEditorPane = ({ - - + + + + + + {t("editor.updatedAt", { time: updatedLabel })} @@ -2616,9 +2629,11 @@ const RichEditorPane = ({ )} - + + + @@ -2651,27 +2666,32 @@ const RichEditorPane = ({ - + + + - + + + {!readOnly && ( - + + + )} diff --git a/apps/web/src/components/GitHubRepositoryLink.tsx b/apps/web/src/components/GitHubRepositoryLink.tsx index 6fdad7ea..1fba98e7 100644 --- a/apps/web/src/components/GitHubRepositoryLink.tsx +++ b/apps/web/src/components/GitHubRepositoryLink.tsx @@ -1,5 +1,6 @@ import { type ReactNode } from "react"; import { useTranslation } from "react-i18next"; +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; import { cn } from "@/lib/utils"; const GITHUB_REPOSITORY_URL = "https://github.com/tianma-if/edgeever"; @@ -18,27 +19,25 @@ export const GitHubRepositoryLink = ({ children, className, iconClassName, - title, }: { children?: ReactNode; className?: string; iconClassName?: string; - title?: string; }) => { const { t } = useTranslation(); - const resolvedTitle = title ?? t("common.githubRepository"); + const resolvedTitle = t("common.githubRepository"); return ( - - - {children} - + + + + + + {children} + + + {resolvedTitle} + + ); }; diff --git a/apps/web/src/components/ThemeToggle.tsx b/apps/web/src/components/ThemeToggle.tsx index 55c02f6a..4956b057 100644 --- a/apps/web/src/components/ThemeToggle.tsx +++ b/apps/web/src/components/ThemeToggle.tsx @@ -2,6 +2,7 @@ import { MoonStar, SunMedium } from "lucide-react"; import { useTranslation } from "react-i18next"; import { Button } from "@/components/ui/button"; import { cn } from "@/lib/utils"; +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; import { useTheme } from "./ThemeProvider"; export const ThemeToggle = ({ className, showLabel = false }: { className?: string; showLabel?: boolean }) => { @@ -11,20 +12,26 @@ export const ThemeToggle = ({ className, showLabel = false }: { className?: stri const label = nextTheme === "dark" ? t("settings.themeToggleToDark") : t("settings.themeToggleToLight"); return ( - + + + + + + {label} + + ); }; diff --git a/packages/shared/src/i18n/en-US.ts b/packages/shared/src/i18n/en-US.ts index a2a58c21..9a2cb6bd 100644 --- a/packages/shared/src/i18n/en-US.ts +++ b/packages/shared/src/i18n/en-US.ts @@ -13,7 +13,7 @@ export const enUS = { processing: "Processing", saving: "Saving", copied: "Copied", - githubRepository: "GitHub repository", + githubRepository: "Open source", }, dialogs: { memoDelete: { diff --git a/packages/shared/src/i18n/zh-CN.ts b/packages/shared/src/i18n/zh-CN.ts index 9775a517..4d23127a 100644 --- a/packages/shared/src/i18n/zh-CN.ts +++ b/packages/shared/src/i18n/zh-CN.ts @@ -13,7 +13,7 @@ export const zhCN = { processing: "处理中", saving: "保存中", copied: "已复制", - githubRepository: "GitHub 仓库", + githubRepository: "开源", }, dialogs: { memoDelete: {