Skip to content

Commit 8397c8d

Browse files
committed
Show document search shortcut hint
1 parent 392dd3b commit 8397c8d

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

components/Sidebar.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,11 @@ const Sidebar: React.FC<SidebarProps> = (props) => {
291291
return map;
292292
}, [commands]);
293293

294+
const focusSearchShortcutString = useMemo(() => {
295+
const command = commandMap.get('document-tree-focus-search');
296+
return command?.shortcutString ?? null;
297+
}, [commandMap]);
298+
294299
const getEffectiveShortcut = useCallback((commandId: string): string[] | null => {
295300
const custom = customShortcuts[commandId];
296301
if (custom && custom.length > 0) {
@@ -500,8 +505,13 @@ const Sidebar: React.FC<SidebarProps> = (props) => {
500505
value={searchTerm}
501506
onChange={(e) => setSearchTerm(e.target.value)}
502507
onKeyDown={handleSearchKeyDown}
503-
className="w-full bg-background border border-border-color rounded-md pl-9 pr-9 py-1 text-xs text-text-main focus:ring-2 focus:ring-primary focus:outline-none placeholder:text-text-secondary"
508+
className={`w-full bg-background border border-border-color rounded-md pl-9 py-1 text-xs text-text-main focus:ring-2 focus:ring-primary focus:outline-none placeholder:text-text-secondary ${focusSearchShortcutString && !searchTerm.trim() ? 'pr-24' : 'pr-9'}`}
504509
/>
510+
{focusSearchShortcutString && !searchTerm.trim() && (
511+
<span className="pointer-events-none absolute right-2.5 top-1/2 -translate-y-1/2 text-[10px] font-medium uppercase tracking-wide text-text-tertiary">
512+
{focusSearchShortcutString}
513+
</span>
514+
)}
505515
{searchTerm.trim() && (
506516
<button
507517
type="button"

0 commit comments

Comments
 (0)