dx: default to common prop

Massimo Melina committed Nov 4, 2023 at 16:10 UTC a9b23d58f76664d712dba7cfee9cad9cca43115c
8 files changed +13 -19
admin/src/AccountsPage.ts
+1 -1
@@ -42,7 +42,7 @@ export default function AccountsPage() {
42
43 const sideContent = !(sel.length > 0) || !list ? null // this clever test is true both when some accounts are selected and when we are in "new account" modes
44 : selectionMode && sel.length > 1 ? h(Fragment, {},
45 - h(Flex, { alignItems: 'center' },
45 + h(Flex, {},
46 h(Typography, {variant: 'h6'}, sel.length + " selected"),
47 h(Button, { onClick: deleteAccounts, startIcon: h(Delete) }, "Remove"),
48 ),
admin/src/ConfigFilePage.ts
+1 -1
@@ -19,7 +19,7 @@ export default function ConfigFilePage() {
19 useEffect(() => { setSaved(data?.text) }, [data])
20 useEffect(() => { saved !== undefined && setText(saved || '') }, [saved])
21 return h(Fragment, {},
22 - h(Flex, { alignItems: 'center', flexWrap: 'wrap', justifyContent: 'space-between' },
22 + h(Flex, { flexWrap: 'wrap', justifyContent: 'space-between' },
23 h(Btn, { icon: ContentCopy, onClick: copy }, "Copy excluding passwords"),
24 edit ? h(Fragment, {},
25 reloadBtn(reload),
admin/src/DataTable.ts
+1 -1
@@ -119,7 +119,7 @@ export function DataTable({ columns, initialState={}, actions, actionsProps, ini
119 }, showCols.map(col =>
120 h(Box, { key: col.field, gridColumn: col.flex && '1/-1' },
121 h(Box, { bgcolor: '#0003', p: 1 }, col.headerName || col.field),
122 - h(Flex, { minHeight: '2.5em', px: 1, alignItems: 'center', wordBreak: 'break-word' },
122 + h(Flex, { minHeight: '2.5em', px: 1, wordBreak: 'break-word' },
123 renderCell(col, rowToShow) )
124 ) ))
125 }
admin/src/FilePicker.ts
+1 -1
@@ -144,7 +144,7 @@ export default function FilePicker({ onSelect, multiple=true, files=true, folder
144 }
145 })
146 ),
147 - h(Flex, {},
147 + h(Flex, { alignItems: 'stretch' },
148 (multiple || folders || !files) && h(Button, {
149 variant: 'contained',
150 disabled: !cwd || !folders && !sel.length && files,
admin/src/InternetPage.ts
+2 -2
@@ -120,7 +120,7 @@ export default function InternetPage() {
120 const domain = !isIP(hostname) && hostname
121 return config && h(Card, {}, h(CardContent, {},
122 h(Box, { fontSize: 'x-large', mb: 2 }, "Address / Domain"),
123 - h(Flex, { flexWrap: 'wrap', alignItems: 'center' },
123 + h(Flex, { flexWrap: 'wrap' },
124 url || "Automatic, not configured",
125 h(Button, {
126 size: 'small',
@@ -139,7 +139,7 @@ export default function InternetPage() {
139 function networkBox() {
140 if (error) return element
141 if (!nat) return h(CircularProgress)
142 - return h(Flex, { justifyContent: 'space-around', alignItems: 'center' },
142 + return h(Flex, { justifyContent: 'space-around' },
143 h(Device, { name: "Local network", icon: HomeWorkTwoTone, color: localColor, ip: nat?.localIp,
144 below: port && h(Box, { fontSize: 'smaller' }, "port ", port),
145 }),
admin/src/VfsPage.ts
+2 -2
@@ -55,7 +55,7 @@ export default function VfsPage() {
55 file: selectedFiles[0] as VfsNode // it's actually Snapshot<VfsNode> but it's easier this way
56 })
57 : h(Fragment, {},
58 - h(Flex, { alignItems: 'center' },
58 + h(Flex, {},
59 h(Typography, {variant: 'h6'}, selectedFiles.length + ' selected'),
60 h(Button, { onClick: deleteFiles, startIcon: h(Delete) }, "Remove"),
61 ),
@@ -74,7 +74,7 @@ export default function VfsPage() {
74 if (isSideBreakpoint || !sideContent) return
75 const { close } = newDialog({
76 title: selectedFiles.length > 1 ? "Multiple selection" :
77 - h(Flex, { alignItems: 'center' }, vfsNodeIcon(selectedFiles[0] as VfsNode), selectedFiles[0].name || "Home"),
77 + h(Flex, {}, vfsNodeIcon(selectedFiles[0] as VfsNode), selectedFiles[0].name || "Home"),
78 Content: () => sideContent,
79 onClose: selectNone,
80 })
admin/src/mui.ts
+4 -11
@@ -4,16 +4,8 @@
4 import { Refresh, SvgIconComponent } from '@mui/icons-material'
5 import { SxProps } from '@mui/system'
6 import { createElement as h, FC, forwardRef, Fragment, ReactNode } from 'react'
7 -import {
8 - Box, BoxProps, Breakpoint,
9 - ButtonProps,
10 - CircularProgress,
11 - IconButton,
12 - IconButtonProps,
13 - Link, LinkProps,
14 - Tooltip,
15 - TooltipProps, useMediaQuery
16 -} from '@mui/material'
7 +import { Box, BoxProps, Breakpoint, ButtonProps, CircularProgress, IconButton, IconButtonProps, Link, LinkProps,
8 + Tooltip, TooltipProps, useMediaQuery } from '@mui/material'
9 import { formatPerc, WIKI_URL } from '../../src/cross'
10 import { dontBotherWithKeys, useStateMounted } from '@hfs/shared'
11 import { Promisable } from '@hfs/mui-grid-form'
@@ -65,7 +57,8 @@ export function Flex({ gap='.8em', vert=false, center=false, children=null, prop
57 display: 'flex',
58 gap,
59 flexDirection: vert ? 'column' : undefined,
68 - ...center && { alignItems: 'center', justifyContent: 'center' },
60 + alignItems: vert ? undefined : 'center',
61 + ...center && { justifyContent: 'center' },
62 ...rest,
63 },
64 ...props
src/cross.ts
+1
@@ -358,6 +358,7 @@ export async function promiseBestEffort<T>(promises: Promise<T>[]) {
358 return res.filter(x => x.status === 'fulfilled').map((x: any) => x.value as T)
359 }
360
361 +// run at a specific point in time, also solving the limit of setTimeout, which doesn't work with +32bit delays
362 export function runAt(ts: number, cb: Callback) {
363 let cancel = false
364 let t: any