From a3f96c86cff75ab3035664e90b246956f7717beb Mon Sep 17 00:00:00 2001 From: Michael Gartner Date: Mon, 17 Aug 2026 14:45:18 -0600 Subject: [PATCH 1/2] Enhance QuickSwitcherDialog with original title visibility feature - Implemented a tooltip to reveal original titles for bookmarks with aliases, improving user experience by allowing inspection of original content. - Refactored rendering logic to conditionally display original titles in the menu items based on selection state. - Updated utility function to manage bookmark title presentation, ensuring clarity between aliases and original titles. --- CHANGELOG.md | 4 + src/components/QuickSwitcherDialog.tsx | 102 ++++++++++++++++--------- src/utils/quickSwitcher.ts | 9 +++ tests/quickSwitcher.test.ts | 25 ++++++ 4 files changed, 102 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 825c32f..5952fe0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,5 @@ # Changelog + +## Unreleased + +- Hide original page and block content for aliased saved entries, with a reveal tooltip for inspecting the original. diff --git a/src/components/QuickSwitcherDialog.tsx b/src/components/QuickSwitcherDialog.tsx index 90a9100..8dba5a1 100644 --- a/src/components/QuickSwitcherDialog.tsx +++ b/src/components/QuickSwitcherDialog.tsx @@ -7,6 +7,7 @@ import { Menu, MenuItem, Spinner, + Tooltip, } from "@blueprintjs/core"; import React, { useCallback, @@ -22,6 +23,8 @@ import type { } from "~/types/quickSwitcher"; import { filterBookmarks, + getBookmarkRowPresentation, + getBookmarkTargetLabel, getBookmarkTargetType, getBookmarkTargetUid, } from "~/utils/quickSwitcher"; @@ -151,18 +154,6 @@ const getModeFromTabId = ({ tabId: string | number; }): QuickSwitcherDialogMode => (tabId === "manage" ? "manage" : "open"); -const getBookmarkDisplayTitle = ({ - bookmark, -}: { - bookmark: QuickSwitcherBookmark; -}): string => bookmark.alias || bookmark.title; - -const getBookmarkSubtitle = ({ - bookmark, -}: { - bookmark: QuickSwitcherBookmark; -}): string | undefined => (bookmark.alias ? bookmark.title : undefined); - const renderFooterActionContent = ({ label, hotkeys = [], @@ -804,11 +795,9 @@ const QuickSwitcherDialog = ({ const renderRowContent = ({ breadcrumbs = [], - subtitle, title, }: { breadcrumbs?: string[]; - subtitle?: string; title: string; }): React.ReactElement => (
{title} - {subtitle ? ( -
{subtitle}
- ) : null}
); + const renderOriginalTitleButton = ({ + bookmark, + }: { + bookmark: QuickSwitcherBookmark; + }): React.ReactElement | null => { + const { originalTitle } = getBookmarkRowPresentation({ bookmark }); + if (!originalTitle) { + return null; + } + + const targetLabel = getBookmarkTargetLabel({ bookmark }).toLowerCase(); + return ( + +
Original {targetLabel}
+
{originalTitle}
+ + } + hoverOpenDelay={250} + > +