diff --git a/.cursor/rules/mobile-first-ui-ux.mdc b/.cursor/rules/mobile-first-ui-ux.mdc index 3dca9096..cc64f96a 100644 --- a/.cursor/rules/mobile-first-ui-ux.mdc +++ b/.cursor/rules/mobile-first-ui-ux.mdc @@ -1,3 +1,6 @@ --- -alwaysApply: true +description: anything related to UI/UX +alwaysApply: false --- + +This is a mobile-first application. All UI elements should be designed with that in mind. The application should work well on small screens, including older smartphones. The UX should be immaculate on mobile, even when in flight mode. (We use local caches and local relays, so that app works offline too.) diff --git a/src/components/ThreePaneLayout.tsx b/src/components/ThreePaneLayout.tsx index c6923530..64053547 100644 --- a/src/components/ThreePaneLayout.tsx +++ b/src/components/ThreePaneLayout.tsx @@ -19,6 +19,7 @@ import { HighlightVisibility } from './HighlightsPanel' import { HighlightButtonRef } from './HighlightButton' import { BookmarkReference } from '../utils/contentLoader' import { useIsMobile } from '../hooks/useMediaQuery' +import { useScrollDirection } from '../hooks/useScrollDirection' interface ThreePaneLayoutProps { // Layout state @@ -86,6 +87,13 @@ const ThreePaneLayout: React.FC = (props) => { const isMobile = useIsMobile() const sidebarRef = useRef(null) const highlightsRef = useRef(null) + + // Detect scroll direction to hide/show mobile buttons + const scrollDirection = useScrollDirection({ + threshold: 10, + enabled: isMobile && !props.isSidebarOpen && props.isHighlightsCollapsed + }) + const showMobileButtons = scrollDirection !== 'down' // Lock body scroll when mobile sidebar or highlights is open useEffect(() => { @@ -204,7 +212,7 @@ const ThreePaneLayout: React.FC = (props) => { {/* Mobile bookmark button - only show when viewing article */} {isMobile && !props.isSidebarOpen && props.isHighlightsCollapsed && (