Files
tunarr/web/src/components/form/BasicCheckboxInput.tsx
Christian Benincasa f25f3f599f feat: add support for loudnorm audio filter
Allows for better loudness normalization vs straight volume adjustment
using the ffmpeg loudnorm filter. The i, lra, and tp values are all
configurable in the advanced transcode settings.
2026-02-15 08:20:31 -05:00

44 lines
1.0 KiB
TypeScript

import type { FormControlProps, FormHelperTextProps } from '@mui/material';
import {
Checkbox,
FormControl,
FormControlLabel,
FormHelperText,
} from '@mui/material';
import { isNil } from 'lodash-es';
import type { ReactNode } from 'react';
import { useFieldContext } from '../../hooks/form.ts';
type Props = {
label: string;
formControlProps?: FormControlProps;
helperText?: ReactNode;
formHelperTextProps?: FormHelperTextProps;
};
export function BasicCheckboxInput({
formControlProps,
formHelperTextProps,
helperText,
label,
}: Props) {
const field = useFieldContext<boolean>();
return (
<FormControl {...formControlProps}>
<FormControlLabel
control={
<Checkbox
value={field.state.value}
checked={field.state.value}
onChange={(_, checked) => field.handleChange(checked)}
/>
}
label={label}
/>
{!isNil(helperText) && (
<FormHelperText {...formHelperTextProps}>{helperText}</FormHelperText>
)}
</FormControl>
);
}