diff --git a/src/app.css b/src/app.css index 57189fc..bad39b5 100644 --- a/src/app.css +++ b/src/app.css @@ -998,10 +998,18 @@ button.carousel-dot:is(.active, [disabled].active) { } .szh-menu .szh-menu__item { padding: 8px 16px !important; + transition: all 0.1s ease-in-out; } .szh-menu .szh-menu__item * { vertical-align: middle; } +.szh-menu .szh-menu__item a { + display: block; + color: inherit; + text-decoration: none; + padding: 8px 16px !important; + margin: -8px -16px !important; +} .szh-menu .szh-menu__item:not(.szh-menu__item--disabled, .szh-menu__item--hover) { color: var(--text-color); diff --git a/src/components/icon.jsx b/src/components/icon.jsx index 088050d..896c1db 100644 --- a/src/components/icon.jsx +++ b/src/components/icon.jsx @@ -48,6 +48,7 @@ const ICONS = { thread: 'mingcute:route-line', group: 'mingcute:group-line', bot: 'mingcute:android-2-line', + menu: 'mingcute:rows-4-line', }; const modules = import.meta.glob('/node_modules/@iconify-icons/mingcute/*.js'); diff --git a/src/components/link.jsx b/src/components/link.jsx index c55084c..ba4886d 100644 --- a/src/components/link.jsx +++ b/src/components/link.jsx @@ -1,3 +1,4 @@ +import { forwardRef } from 'preact/compat'; import { useLocation } from 'react-router-dom'; import states from '../utils/states'; @@ -10,7 +11,7 @@ import states from '../utils/states'; 3. Not using because it modifies history.state that *persists* across page reloads. I don't need that, so using valtio's states instead. */ -const Link = (props) => { +const Link = forwardRef((props, ref) => { let routerLocation; try { routerLocation = useLocation(); @@ -21,6 +22,7 @@ const Link = (props) => { const isActive = hash === to; return ( { }} /> ); -}; +}); export default Link; diff --git a/src/components/timeline.jsx b/src/components/timeline.jsx index c0fb39b..b5a5c83 100644 --- a/src/components/timeline.jsx +++ b/src/components/timeline.jsx @@ -1,7 +1,9 @@ +import { FocusableItem, Menu, MenuDivider, MenuItem } from '@szhsin/react-menu'; import { useEffect, useRef, useState } from 'preact/hooks'; import { useHotkeys } from 'react-hotkeys-hook'; import { useDebouncedCallback } from 'use-debounce'; +import states from '../utils/states'; import useInterval from '../utils/useInterval'; import usePageVisibility from '../utils/usePageVisibility'; import useScroll from '../utils/useScroll'; @@ -254,7 +256,35 @@ function Timeline({ >
- {headerStart || ( + + + + } + > + + Home + + + Bookmarks + + + Favourites + + + { + states.showSettings = true; + }} + > + {' '} + Settings + + + {headerStart !== null && headerStart !== undefined ? ( + headerStart + ) : ( @@ -379,6 +409,22 @@ function Timeline({ ); } +function MenuLink(props) { + return ( + + {({ ref, closeMenu }) => ( + + closeMenu(detail === 0 ? 'Enter' : undefined) + } + /> + )} + + ); +} + function groupBoosts(values) { let newValues = []; let boostStash = []; diff --git a/src/pages/following.jsx b/src/pages/following.jsx index 85c536e..c9954e3 100644 --- a/src/pages/following.jsx +++ b/src/pages/following.jsx @@ -11,8 +11,8 @@ import useTitle from '../utils/useTitle'; const LIMIT = 20; -function Following({ title, id, headerStart }) { - useTitle('Following', '/l/f'); +function Following({ title, path, id, headerStart }) { + useTitle(title || 'Following', path, '/l/f'); const { masto, instance } = api(); const snapStates = useSnapshot(states); const homeIterator = useRef(); diff --git a/src/pages/home.jsx b/src/pages/home.jsx index a4dcf1c..4129252 100644 --- a/src/pages/home.jsx +++ b/src/pages/home.jsx @@ -24,23 +24,7 @@ function Home() { return ( <> - { - e.preventDefault(); - e.stopPropagation(); - states.showSettings = true; - }} - > - - - } - /> +