this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Autoscroll to active tab on load

+26 -3
+24 -1
src/components/shortcuts.jsx
··· 3 3 import { Trans, useLingui } from '@lingui/react/macro'; 4 4 import { MenuDivider } from '@szhsin/react-menu'; 5 5 import { memo } from 'preact/compat'; 6 - import { useRef, useState } from 'preact/hooks'; 6 + import { useEffect, useRef, useState } from 'preact/hooks'; 7 7 import { useHotkeys } from 'react-hotkeys-hook'; 8 8 import { useNavigate } from 'react-router-dom'; 9 9 import { useSnapshot } from 'valtio'; ··· 35 35 (!settings.shortcutsViewMode && settings.shortcutsColumnsMode); 36 36 37 37 const menuRef = useRef(); 38 + const tabBarRef = useRef(); 38 39 39 40 const hasLists = useRef(false); 40 41 const formattedShortcuts = shortcuts ··· 83 84 }) 84 85 .filter(Boolean); 85 86 87 + // Auto-scroll to active tab on first render 88 + useEffect(() => { 89 + if ( 90 + snapStates.settings.shortcutsViewMode === 'tab-menu-bar' && 91 + tabBarRef.current 92 + ) { 93 + const timeoutId = setTimeout(() => { 94 + const activeTab = tabBarRef.current?.querySelector('.is-active'); 95 + if (activeTab) { 96 + activeTab.scrollIntoView({ 97 + behavior: 'smooth', 98 + block: 'nearest', 99 + inline: 'center', 100 + }); 101 + } 102 + }, 100); 103 + 104 + return () => clearTimeout(timeoutId); 105 + } 106 + }, []); 107 + 86 108 const navigate = useNavigate(); 87 109 useHotkeys( 88 110 ['1', '2', '3', '4', '5', '6', '7', '8', '9'], ··· 113 135 <div id="shortcuts"> 114 136 {snapStates.settings.shortcutsViewMode === 'tab-menu-bar' ? ( 115 137 <nav 138 + ref={tabBarRef} 116 139 class="tab-bar" 117 140 onContextMenu={(e) => { 118 141 e.preventDefault();
+2 -2
src/locales/en.po
··· 1529 1529 msgstr "" 1530 1530 1531 1531 #: src/components/nav-menu.jsx:440 1532 - #: src/components/shortcuts.jsx:218 1532 + #: src/components/shortcuts.jsx:241 1533 1533 #: src/pages/list.jsx:139 1534 1534 msgid "All Lists" 1535 1535 msgstr "" ··· 1954 1954 msgstr "" 1955 1955 1956 1956 #: src/components/shortcuts-settings.jsx:235 1957 - #: src/components/shortcuts.jsx:195 1957 + #: src/components/shortcuts.jsx:218 1958 1958 msgid "Shortcuts" 1959 1959 msgstr "" 1960 1960