import { Autocomplete, Box, TextField, Typography } from '@mui/material' import { useAtomValue, useSetAtom } from 'jotai' import { useEffect } from 'react' import { customArgsState, savedTemplatesState } from '../atoms/downloadTemplate' import { useI18n } from '../hooks/useI18n' const ExtraDownloadOptions: React.FC = () => { const { i18n } = useI18n() const customTemplates = useAtomValue(savedTemplatesState) const setCustomArgs = useSetAtom(customArgsState) useEffect(() => { setCustomArgs( customTemplates .find(f => f.name.toLocaleLowerCase() === 'default') ?.content ?? '' ) }, []) return ( <> ({ label: name, content }))} autoHighlight defaultValue={ customTemplates .filter(({ id, name }) => id === "0" || name.toLowerCase() === "default") .map(({ name, content }) => ({ label: name, content })) .at(0) } getOptionLabel={(option) => option.label} onChange={(_, value) => { setCustomArgs(value?.content!) }} renderOption={(props, option) => ( {option.label} {option.content} )} sx={{ width: '100%', mt: 2 }} renderInput={(params) => } /> ) } export default ExtraDownloadOptions