refactor(ui): replace native app tooltips
github/actions/ci GitHub Actions CI finished: success

Wrap app controls with the shared Tooltip component and use cursor-positioned tooltip placement for icon buttons, chips, path labels, and media controls.

Leave native title attributes on the window chrome buttons so Minimize, Maximize, and Close keep platform-style behavior.
This commit is contained in:
2026-06-30 23:25:43 +01:00
parent 1a971899d1
commit d619b01f2e
17 changed files with 421 additions and 327 deletions
+9 -1
View File
@@ -32,6 +32,7 @@ export function Tooltip({
block = false,
anchorToCursor = false,
followCursor = false,
disabled = false,
className = "",
children,
}: {
@@ -47,6 +48,8 @@ export function Tooltip({
anchorToCursor?: boolean;
/** Track the cursor (fixed position) instead of anchoring to a side. */
followCursor?: boolean;
/** Render the wrapper but suppress tooltip display. */
disabled?: boolean;
/** Extra classes for the wrapper (e.g. layout). */
className?: string;
children: ReactNode;
@@ -83,6 +86,7 @@ export function Tooltip({
frame.current = undefined;
};
const show = (event: MouseEvent<HTMLElement>) => {
if (disabled) return;
clear();
if (anchorToCursor || followCursor) place(event.clientX, event.clientY);
if (delay <= 0) {
@@ -110,6 +114,10 @@ export function Tooltip({
return clear;
}, []);
useEffect(() => {
if (disabled) hide();
}, [disabled]);
const Wrapper = block ? "div" : "span";
const cursorTooltip = (
<motion.span
@@ -140,7 +148,7 @@ export function Tooltip({
onPointerDown={hide}
>
{children}
{anchorToCursor || followCursor ? (
{disabled ? null : anchorToCursor || followCursor ? (
mounted ? createPortal(cursorTooltip, document.body) : null
) : (
<span