Skip to content

Commit

Permalink
admin/fs: better layout
Browse files Browse the repository at this point in the history
  • Loading branch information
rejetto committed Apr 15, 2024
1 parent 97ba141 commit e9fa319
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
1 change: 1 addition & 0 deletions admin/src/VfsMenuBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default function VfsMenuBar({ statusApi }: { statusApi: ApiObject }) {
alertDialog(h(List, { dense: true }, res.map(x => h(ListItem, { key: x.name },
h(ListItemIcon, {}, h(Storage)),
h(ListItemText, {
sx: { wordBreak: 'break-word' },
primary: x.name + prefix(' (', x.description, ')'),
secondary: formatDiskSpace(x)
}),
Expand Down
7 changes: 5 additions & 2 deletions admin/src/VfsPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,12 @@ export default function VfsPage() {
title: selectedFiles.length > 1 ? "Multiple selection" :
h(Flex, {},
vfsNodeIcon(selectedFiles[0] as VfsNode),
selectedFiles[0].name || "Home",
h(Box, { color: 'text.secondary' }, ancestors.join(' / '))
h(Flex, { flexWrap: 'wrap', gap: '0 0.5em' },
selectedFiles[0].name || "Home",
h(Box, { component: 'span', color: 'text.secondary' }, ancestors.join(' /'))
)
),
dialogProps: { sx: { justifyContent: 'flex-end' } },
Content: () => sideContent,
onClose() {
state.selectedFiles = []
Expand Down
8 changes: 3 additions & 5 deletions admin/src/VfsTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,15 @@ export default function VfsTree({ id2node, statusApi }:{ id2node: Map<string, Vf
sx: {
display: 'flex',
gap: '.5em',
lineHeight: '2em',
alignItems: 'center',
minHeight: '1.8em', pt: '.2em', // comfy, make single-line ones taller
}
},
h(Box, { display: 'flex', flex: 0, },
vfsNodeIcon(node),
// attributes
h(Box, { sx: {
flex: 0, ml: '2px', my: '2px', '&>*': { fontSize: '87%', opacity: .6, mt: '-2px' },
display: 'grid', gridAutoFlow: 'column', gridTemplateRows: 'auto auto',
display: 'grid', gridAutoFlow: 'column', gridTemplateRows: 'auto auto', height: '1em',
} },
node.can_delete !== undefined && iconTooltip(Delete, "Delete permission"),
node.can_upload !== undefined && iconTooltip(Upload, "Upload permission"),
Expand All @@ -104,8 +103,7 @@ export default function VfsTree({ id2node, statusApi }:{ id2node: Map<string, Vf
const ps = node.parent?.source
const { source } = node
const rel = ps && source?.startsWith(ps) ? '.' + source.slice(ps.length) : source
return !rel || !source?.endsWith(name) || rel.length > 45
? h(Box, { lineHeight: '1.2em' }, name)
return !rel || !source?.endsWith(name) || rel.length > 45 ? name
: h('span', {},
h('span', { style: { opacity: .4 } }, rel.slice(0,-name.length)),
rel.slice(-name.length),
Expand Down
4 changes: 1 addition & 3 deletions admin/src/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ form { max-width: 100%; } // make fields with unbreakable text (LinkField) to no
.MuiSvgIcon-root {
vertical-align: bottom;
}
.MuiTreeItem-content {
box-sizing: border-box; /* avoid unwanted scrolling caused by its width:100% + padding */
}
div.MuiTreeItem-content { padding: 0; } // remove wasting horizontal padding
.MuiDataGrid-columnHeaders {
background-color: #8882;
}
Expand Down

0 comments on commit e9fa319

Please sign in to comment.