admin/config: nicer

Massimo Melina committed Dec 18, 2025 at 12:00 UTC 95807e4344989195c2294bdbf1dbe9fbd585f8ce
2 files changed +5 -5
admin/src/ConfigFilePage.ts
+2 -2
@@ -30,7 +30,7 @@ export default function ConfigFilePage() {
30 modified: text !== saved,
31 onClick: save,
32 }),
33 - h(Alert, { severity: 'warning', sx: { flex: 1, minWidth: '10em' } }, "Be careful, you can easily break things here"),
33 + h(Alert, { severity: 'warning', sx: { minWidth: '10em' } }, "Be careful, you can easily break things here"),
34 ) : h(Btn, {
35 icon: Edit,
36 variant: 'outlined',
@@ -39,7 +39,7 @@ export default function ConfigFilePage() {
39 setTimeout(() => focusSelector('main textarea'), 500)
40 }
41 }, "Edit"),
42 - h(Box, { flex: 1, minWidth: 'fit-content' }, h(DisplayField, { label: "File path", value: data?.fullPath }))
42 + h(Box, { flex: 1, minWidth: 'fit-content' }, h(DisplayField, { label: "File path", value: data?.fullPath, size: 'small' }))
43 ),
44 element || text !== undefined && // avoids bad undo behaviour on start
45 h(KeepInScreen, { margin: 10 }, h(TextEditor, {
mui-grid-form/misc-fields.ts
+3 -3
@@ -1,7 +1,7 @@
1 // This file is part of HFS - Copyright 2021-2023, Massimo Melina <a@rejetto.com> - License https://www.gnu.org/licenses/gpl-3.0.txt
2
3 import { createElement as h, useEffect, useState } from 'react'
4 -import { StringField } from './StringField'
4 +import { StringField, StringFieldProps } from './StringField'
5 import { FieldProps } from '.'
6 import {
7 Box, Checkbox, FormControl, FormControlLabel, FormGroup, FormHelperText, FormLabel, IconButton,
@@ -11,10 +11,10 @@ import { Cancel } from '@mui/icons-material'
11 import _ from 'lodash'
12 import { useGetSize } from '@hfs/shared'
13
14 -export function DisplayField({ value, empty='-', ...props }: any) {
14 +export function DisplayField({ value, empty='-', ...props }: Omit<StringFieldProps, 'onChange'> & { value: any }) {
15 if (!props.toField && empty !== undefined && value !== 0 && !value)
16 value = empty
17 - return h(StringField, { ...props, value, disabled: true })
17 + return h(StringField, { ...props, value, disabled: true, onChange() {} })
18 }
19
20 export function NumberField({ value, onChange, setApi, required, min=0, max, step, unit, clearable, ...props }: FieldProps<number | null>) {