TagSpaces is an offline, open source, document manager with tagging support
chore: ui improvement in the settings for file types
Ilian Sapundshiev5fffb85665c2
diff --git a/src/renderer/components/dialogs/components/SettingsFileTypes.tsx b/src/renderer/components/dialogs/components/SettingsFileTypes.tsxindex e108aa4bd..fd2996e7e 100644--- a/src/renderer/components/dialogs/components/SettingsFileTypes.tsx+++ b/src/renderer/components/dialogs/components/SettingsFileTypes.tsx@@ -38,6 +38,7 @@ import { TS } from '-/tagspaces.namespace';import useFirstRender from '-/utils/useFirstRender';import RemoveIcon from '@mui/icons-material/RemoveCircle';import FormControl from '@mui/material/FormControl';+import InputAdornment from '@mui/material/InputAdornment';import MenuItem from '@mui/material/MenuItem';import Paper from '@mui/material/Paper';import Table from '@mui/material/Table';@@ -248,25 +249,20 @@ function SettingsFileTypes() {const columns: ColumnData[] = [{- width: 60,+ width: '160px',label: t('core:fileExtension'),dataKey: 'type',},{- //width: '35%',+ width: '45%',label: t('core:fileOpener'),dataKey: 'viewer',},{- // width: '45%',+ width: '45%',label: t('core:fileEditor'),dataKey: 'editor',},- {- width: 100,- label: t('core:actions'),- dataKey: 'color',- },];const VirtuosoTableComponents: TableComponents<TS.FileTypes> = {@@ -336,7 +332,7 @@ function SettingsFileTypes() {function rowContent(_index: number, item: TS.FileTypes) {return (<React.Fragment>- <TableCell align={'center'} sx={{ padding: '0 5px 0px 5px' }}>+ <TableCell align={'left'} sx={{ padding: '0 5px 0px 5px' }}><FormControlerror={(isValidationInProgress.current && item.type === '') ||@@ -348,6 +344,12 @@ function SettingsFileTypes() {<TsTextFielddata-tid={'typeTID' + item.type}defaultValue={item.type}+ style={{+ width: 160,+ marginTop: 0,+ paddingLeft: 0,+ paddingRight: 0,+ }}error={(isValidationInProgress.current && item.type === '') ||items.current.filter(@@ -359,10 +361,52 @@ function SettingsFileTypes() {const withoutSpecialChars = sanitizeFileTypeInput(nextValue);updateItems(item, 'type', withoutSpecialChars);}}+ slotProps={{+ input: {+ startAdornment: (+ <InputAdornment position="start">+ <TransparentBackground>+ <TsButton+ tooltip={t('core:colorPickerDialogTitle')}+ data-tid="settingsFileTypes_openColorPicker_"+ className={classes.colorChooserButton}+ style={{+ backgroundColor: `${item.color}`,+ minWidth: 40,+ maxWidth: 40,+ cursor: 'pointer',+ }}+ onClick={() => {+ openColorPicker(item);+ }}+ >+ + <div />+ </TsButton>+ </TransparentBackground>+ </InputAdornment>+ ),+ endAdornment: (+ <InputAdornment position="end">+ <TsIconButton+ tooltip={t('removeFileType', { itemType: item.type })}+ data-tid="settingsFileTypes_remove_"+ className={classes.fileExtRemove}+ onClick={() => onRemoveItem(item)}+ >+ <RemoveIcon />+ </TsIconButton>+ </InputAdornment>+ ),+ },+ }}/></FormControl></TableCell>- <TableCell align={'center'} sx={{ padding: '0 5px 0px 0' }}>+ <TableCell+ align={'center'}+ sx={{ minWith: 180, padding: '0 5px 0px 0' }}+ ><FormControlerror={isValidationInProgress.current && item.viewer === ''}>@@ -370,8 +414,7 @@ function SettingsFileTypes() {data-tid={'viewerTID' + item.type}error={isValidationInProgress.current && item.viewer === ''}value={item.viewer}- style={{ maxWidth: 170, marginTop: 0 }}- // input={<Input id="" />}+ style={{ minWidth: 150, maxWidth: 190, marginTop: 0 }}onChange={(event) => {const extension: TS.Extension = extensions.find((ext) => ext.extensionId === event.target.value,@@ -415,8 +458,7 @@ function SettingsFileTypes() {<TableCell align={'center'} sx={{ padding: '0 5px 0px 0' }}><TsSelectvalue={item.editor}- // input={<Input id="" />}- style={{ maxWidth: 170, marginTop: 0 }}+ style={{ minWidth: 150, maxWidth: 190, marginTop: 0 }}onChange={(event) =>updateItems(item, 'editor', event.target.value)}@@ -439,35 +481,6 @@ function SettingsFileTypes() {))}</TsSelect></TableCell>- <TableCell align={'center'} sx={{ padding: '0 5px 0px 5px' }}>- <TransparentBackground>- <TsButton- tooltip={t('core:colorPickerDialogTitle')}- data-tid="settingsFileTypes_openColorPicker_"- className={classes.colorChooserButton}- style={{- backgroundColor: `${item.color}`,- minWidth: 50,- maxWidth: 50,- cursor: 'pointer',- }}- onClick={() => {- openColorPicker(item);- }}- >- - <div />- </TsButton>- </TransparentBackground>- <TsIconButton- tooltip={t('removeFileType', { itemType: item.type })}- data-tid="settingsFileTypes_remove_"- className={classes.fileExtRemove}- onClick={() => onRemoveItem(item)}- >- <RemoveIcon />- </TsIconButton>- </TableCell></React.Fragment>);}diff --git a/src/renderer/locales/en/core.json b/src/renderer/locales/en/core.jsonindex 90623340e..ca12f669e 100644--- a/src/renderer/locales/en/core.json+++ b/src/renderer/locales/en/core.json@@ -291,7 +291,7 @@"setAsThumbnail": "Use as Thumbnail for Current Folder","setAsBackground": "Use as Background Image","setAsParentFolderThumbnail": "Use as Thumbnail for Parent Folder",- "fileExtension": "File Ext.",+ "fileExtension": "File Extension","fileTitle": "Title","fileTags": "Tags","fileSize": "Size",