fix: both fixed and popup menu buttons were displayed sometimes

Massimo Melina committed Sep 6, 2023 at 19:07 UTC 49c6e7e6b4d39f73a3a6d0f1ddb560e2daa872f4
1 file changed +3 -2
frontend/src/BrowseFiles.ts
+3 -2
@@ -191,6 +191,7 @@ const Entry = memo(({ entry, midnight, separator }: EntryProps) => {
191 const menuOnLink = getHFS().fileMenuOnLink
192 const onClick = menuOnLink && fileMenu || undefined
193 const small = useWindowSize().width < 800
194 + const showingButton = !menuOnLink || isFolder && small
195 return h('li', { className, label: separator },
196 showFilter && h(Checkbox, {
197 value: selected[uri],
@@ -203,7 +204,7 @@ const Entry = memo(({ entry, midnight, separator }: EntryProps) => {
204 h('span', { className: 'link-wrapper' }, // container to handle mouse over for both children
205 isFolder ? h(Fragment, {},
206 h(Link, { to: uri }, ico, entry.n.slice(0,-1)),
206 - menuOnLink && h('button', { className: 'popup-menu-button', onClick: fileMenu }, hIcon('menu'), t`Menu`)
207 + menuOnLink && !showingButton && h('button', { className: 'popup-menu-button', onClick: fileMenu }, hIcon('menu'), t`Menu`)
208 )
209 : containerDir ? h(Fragment, {},
210 h('a', { href: uri, onClick, tabIndex: -1 }, ico),
@@ -214,7 +215,7 @@ const Entry = memo(({ entry, midnight, separator }: EntryProps) => {
215 h(CustomCode, { name: 'afterEntryName', props: { entry } }),
216 h('div', { className: 'entry-panel' },
217 h(EntryDetails, { entry, midnight }),
217 - (!menuOnLink || isFolder && small) && h('button', { className: 'file-menu-button', onClick: fileMenu }, hIcon('menu')),
218 + showingButton && h('button', { className: 'file-menu-button', onClick: fileMenu }, hIcon('menu')),
219 ),
220 h('div'),
221 )