fix: admin/fs: avoid unwanted scrolling

Massimo Melina committed Mar 16, 2022 at 20:20 UTC dcc42d343b749aafc72722bd95d2aaef91297ec7
4 files changed +8 -2
admin/src/VfsMenuBar.ts
+2 -2
@@ -2,7 +2,7 @@
2
3 import { state, useSnapState } from './state'
4 import { createElement as h } from 'react'
5 -import { Box, Button } from '@mui/material'
5 +import { Box, Button, Hidden } from '@mui/material'
6 import { Add, Delete, Refresh } from '@mui/icons-material'
7 import { alertDialog, confirmDialog } from './dialog'
8 import { apiCall } from './api'
@@ -33,7 +33,7 @@ export default function VfsMenuBar() {
33 ]
34 }, 'Add'),
35 h(Button, { onClick: removeFiles, disabled: !selectedFiles.length, startIcon: h(Delete) }, 'Remove'),
36 - h(Button, { onClick(){ reloadVfs() }, startIcon: h(Refresh) }, 'Reload'),
36 + h(Button, { onClick(){ reloadVfs() }, startIcon: h(Refresh) }, h(Hidden, { smDown:true }, 'Reload')),
37 )
38 }
39
admin/src/VfsTree.ts
+1
@@ -44,6 +44,7 @@ export default function VfsTree({ id2node }:{ id2node: Map<string, VfsNode> }) {
44 expanded,
45 selected,
46 multiSelect: true,
47 + sx: { overflowX: 'auto' },
48 onNodeSelect(ev, ids) {
49 setSelected(ids)
50 state.selectedFiles = onlyTruthy(ids.map(id => id2node.get(id)))
admin/src/index.css
+4
@@ -13,3 +13,7 @@ code {
13 font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
14 monospace;
15 }
16 +
17 +.MuiTreeItem-content {
18 + box-sizing: border-box; /* avoid unwanted scrolling caused by its width:100% + padding */
19 +}
todo.md
+1
@@ -1,6 +1,7 @@
1 # To do
2 - admin/logs
3 - admin/config: hide advanced settings
4 +- admin/fs: drag&drop to move items around
5 - admin/fs: support insert/delete key
6 - if specified config is a folder, check for file config.yaml inside
7 - merge accounts in config