From 105e8b237ff48f3ef9177dca0461b3b87dfdf8db Mon Sep 17 00:00:00 2001 From: "Bingxi Zhao (Frank)" <13051345080@163.com> Date: Sun, 27 Sep 2026 05:01:54 +0800 Subject: [PATCH] fix(web): replace native title hints in question bank and reading workspace (#1526) --- .../reading/workspace/ReadAloudButton.tsx | 99 +++++++------- .../reading/workspace/ReadingActionCards.tsx | 20 +-- .../reading/workspace/ReadingComposer.tsx | 20 +-- .../reading/workspace/ReadingWorkspace.tsx | 128 +++++++++--------- .../reading/workspace/SourceNavigator.tsx | 20 +-- .../reading/workspace/WorkspaceMenu.tsx | 24 ++-- .../space/question-bank/BankSelectionBar.tsx | 19 +-- .../space/question-bank/BankToolbar.tsx | 45 +++--- .../space/question-bank/CategoryManager.tsx | 104 +++++++------- .../space/question-bank/CategoryMenu.tsx | 72 +++++----- .../space/question-bank/QuestionCard.tsx | 91 +++++++------ web/tests/native-button-title-baseline.json | 92 +++++++++++++ web/tests/native-button-title.test.ts | 94 +++++++++++++ web/tests/question-bank-tooltips.spec.tsx | 33 +++++ 14 files changed, 565 insertions(+), 296 deletions(-) create mode 100644 web/tests/native-button-title-baseline.json create mode 100644 web/tests/native-button-title.test.ts create mode 100644 web/tests/question-bank-tooltips.spec.tsx diff --git a/web/components/reading/workspace/ReadAloudButton.tsx b/web/components/reading/workspace/ReadAloudButton.tsx index ce7bded56..e48505f06 100644 --- a/web/components/reading/workspace/ReadAloudButton.tsx +++ b/web/components/reading/workspace/ReadAloudButton.tsx @@ -4,6 +4,7 @@ import { ListChecks, Loader2, Sparkles, Square, Volume2 } from "lucide-react"; import { useTranslation } from "react-i18next"; import { useReadingActions } from "@/components/reading/reading-actions-context"; +import Tooltip from "@/shared/ui/Tooltip"; const READ_ALOUD_KEY = "read_aloud:read"; @@ -26,29 +27,30 @@ export function ReadAloudButton({ disabled }: { disabled?: boolean }) { ? t("Stop reading aloud") : t("Read this page aloud"); return ( - + + + ); } @@ -74,16 +76,17 @@ export function PageToolButtons({ "flex size-7 shrink-0 items-center justify-center rounded-md text-[var(--muted-foreground)] transition hover:bg-[var(--muted)] hover:text-[var(--foreground)] disabled:cursor-not-allowed disabled:opacity-40"; return ( <> - + + + {shared.actions .filter( (entry) => !entry.needsSelection && entry.key !== READ_ALOUD_KEY, @@ -91,21 +94,21 @@ export function PageToolButtons({ .map((entry) => { const busy = shared.busyKey === entry.key; return ( - + + + ); })} diff --git a/web/components/reading/workspace/ReadingActionCards.tsx b/web/components/reading/workspace/ReadingActionCards.tsx index b2cfd493e..1bc7b8021 100644 --- a/web/components/reading/workspace/ReadingActionCards.tsx +++ b/web/components/reading/workspace/ReadingActionCards.tsx @@ -16,6 +16,7 @@ import { useReadingActions, type ReadingActionCard, } from "@/components/reading/reading-actions-context"; +import Tooltip from "@/shared/ui/Tooltip"; /** * Where a reading action's answer lands: under the conversation, in the same @@ -98,15 +99,16 @@ function ActionCard({

{title}

- + + + {card.quote ? (
diff --git a/web/components/reading/workspace/ReadingComposer.tsx b/web/components/reading/workspace/ReadingComposer.tsx index 0d028facf..6aea99c03 100644 --- a/web/components/reading/workspace/ReadingComposer.tsx +++ b/web/components/reading/workspace/ReadingComposer.tsx @@ -29,6 +29,7 @@ import { } from "@/lib/ask-user-state"; import { notify } from "@/lib/notifications"; import { setReadingViewport } from "@/lib/reading-turn-state"; +import Tooltip from "@/shared/ui/Tooltip"; export function ReadingComposer({ placeholder, @@ -188,15 +189,16 @@ function QuotedPassage({

{quote}

- + + + ); } diff --git a/web/components/reading/workspace/ReadingWorkspace.tsx b/web/components/reading/workspace/ReadingWorkspace.tsx index 0ebe8edaf..e477153ed 100644 --- a/web/components/reading/workspace/ReadingWorkspace.tsx +++ b/web/components/reading/workspace/ReadingWorkspace.tsx @@ -4,6 +4,7 @@ import { scopedUrl } from "@/lib/workspace-scope"; import { READING_HOME, readingFolderRoute, readingSessionIdFromPath } from "@/lib/learning-routes"; import { browserStorage } from "@/shared/storage"; +import Tooltip from "@/shared/ui/Tooltip"; import Link from "next/link"; import dynamic from "next/dynamic"; @@ -491,39 +492,44 @@ export function ReadingWorkspacePage() { {/* The outline opens on the left, so its switch lives on the left: it sat at the far right, next to the companion's, and a learner had to guess which of two panel icons was which. */} - - - + + + + + + + + + + +
{notice && ( @@ -538,24 +544,23 @@ export function ReadingWorkspacePage() { /> {/* An icon, like every other control on this bar: as the only labelled button it read as the page's primary action. */} - + + + - - + + + )} - + + +
{expanded && ( diff --git a/web/components/reading/workspace/WorkspaceMenu.tsx b/web/components/reading/workspace/WorkspaceMenu.tsx index aba3b9976..ee7ced5ea 100644 --- a/web/components/reading/workspace/WorkspaceMenu.tsx +++ b/web/components/reading/workspace/WorkspaceMenu.tsx @@ -10,6 +10,7 @@ import { type WorkspaceMenuSection, } from "@/components/reading/workspace-menu-context"; import { MenuItem } from "./WorkspaceChrome"; +import Tooltip from "@/shared/ui/Tooltip"; export type WorkspaceMenuSections = Partial< Record @@ -69,17 +70,18 @@ export function WorkspaceMenu({ return (
- + + + {open && ( <>
setOpen(false)} /> diff --git a/web/components/space/question-bank/BankSelectionBar.tsx b/web/components/space/question-bank/BankSelectionBar.tsx index bf741b429..5fd422698 100644 --- a/web/components/space/question-bank/BankSelectionBar.tsx +++ b/web/components/space/question-bank/BankSelectionBar.tsx @@ -5,6 +5,7 @@ import { CheckSquare, FolderMinus, X } from "lucide-react"; import type { NotebookCategory } from "@/lib/notebook-api"; import CategoryMenu from "./CategoryMenu"; import type { BankScope } from "./useQuestionBank"; +import Tooltip from "@/shared/ui/Tooltip"; interface BankSelectionBarProps { count: number; @@ -79,14 +80,16 @@ export default function BankSelectionBar({ )} - + + +
); } diff --git a/web/components/space/question-bank/BankToolbar.tsx b/web/components/space/question-bank/BankToolbar.tsx index 6132c95e7..166e7c9a3 100644 --- a/web/components/space/question-bank/BankToolbar.tsx +++ b/web/components/space/question-bank/BankToolbar.tsx @@ -14,6 +14,7 @@ import type { ScoreTrend, } from "@/lib/notebook-api"; import type { BankSort, ReviewFilters } from "./useQuestionBank"; +import Tooltip from "@/shared/ui/Tooltip"; interface BankToolbarProps { search: string; @@ -61,28 +62,33 @@ export default function BankToolbar({ {refreshing ? ( ) : search ? ( - + + + + + ) : null}
- + + +