Skip to content

TagSpaces is an offline, open source, document manager with tagging support

chore: ui improvements

Ilian Sapundshiev0cbf6646b52e
diff --git a/src/renderer/components/EditSearchQuery.tsx b/src/renderer/components/EditSearchQuery.tsx
index 4e744be9e..182d4cfd0 100644
--- a/src/renderer/components/EditSearchQuery.tsx
+++ b/src/renderer/components/EditSearchQuery.tsx
@@ -16,7 +16,6 @@
*
*/
-import React from 'react';
import AppConfig from '-/AppConfig';
import {
ArchiveIcon,
@@ -33,30 +32,28 @@ import {
UntaggedIcon,
VideoIcon,
} from '-/components/CommonIcons';
-import { classes } from '-/components/SidePanels.css';
+import TagsSelect from '-/components/TagsSelect';
import TooltipTS from '-/components/Tooltip';
import TsIconButton from '-/components/TsIconButton';
+import TsSelect from '-/components/TsSelect';
import TsTextField from '-/components/TsTextField';
-import { useDirectoryContentContext } from '-/hooks/useDirectoryContentContext';
import { useLocationIndexContext } from '-/hooks/useLocationIndexContext';
+import { useSearchQueryContext } from '-/hooks/useSearchQueryContext';
import { isDesktopMode } from '-/reducers/settings';
+import { Stack } from '@mui/material';
import Box from '@mui/material/Box';
import FormControl from '@mui/material/FormControl';
import FormHelperText from '@mui/material/FormHelperText';
import InputAdornment from '@mui/material/InputAdornment';
import MenuItem from '@mui/material/MenuItem';
-import OutlinedInput from '@mui/material/OutlinedInput';
-import Select from '@mui/material/Select';
import ToggleButton from '@mui/material/ToggleButton';
import ToggleButtonGroup from '@mui/material/ToggleButtonGroup';
import Typography from '@mui/material/Typography';
import { DatePicker, LocalizationProvider } from '@mui/x-date-pickers';
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
+import React from 'react';
import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';
-import TagsSelect from './TagsSelect';
-import { useSearchQueryContext } from '-/hooks/useSearchQueryContext';
-import { Stack } from '@mui/material';
interface Props {
executeSearchOnEnter?: boolean;
@@ -73,9 +70,7 @@ function EditSearchQuery(props: Props) {
const handleFileSizeChange = (event: React.ChangeEvent<HTMLInputElement>) => {
const { target } = event;
const { value, name } = target;
- if (name === 'fileSize') {
- setTempSearchQuery({ fileSize: value });
- }
+ setTempSearchQuery({ fileSize: value });
};
const handleLastModifiedChange = (
@@ -84,9 +79,7 @@ function EditSearchQuery(props: Props) {
const { target } = event;
const { value, name } = target;
- if (name === 'lastModified') {
- setTempSearchQuery({ lastModified: value });
- }
+ setTempSearchQuery({ lastModified: value });
};
function removeTags(tagsArray, removeTagsArray) {
@@ -154,10 +147,10 @@ function EditSearchQuery(props: Props) {
const { target } = event;
const { value, name } = target;
- if (name === 'fileTypes') {
- const types = JSON.parse(value);
- setTempSearchQuery({ fileTypes: types });
- }
+ // if (name === 'fileTypes') {
+ const types = JSON.parse(value);
+ setTempSearchQuery({ fileTypes: types });
+ // }
};
return (
@@ -222,10 +215,7 @@ function EditSearchQuery(props: Props) {
},
}}
/>
- <FormControl
- className={classes.formControl}
- disabled={isIndexing !== undefined}
- >
+ <FormControl disabled={isIndexing !== undefined}>
<ToggleButtonGroup
onChange={switchSearchBoxing}
size="small"
@@ -250,10 +240,7 @@ function EditSearchQuery(props: Props) {
</ToggleButton>
</ToggleButtonGroup>
</FormControl>
- <FormControl
- className={classes.formControl}
- disabled={isIndexing !== undefined}
- >
+ <FormControl disabled={isIndexing !== undefined}>
<ToggleButtonGroup
onChange={switchSearchType}
size="small"
@@ -278,10 +265,7 @@ function EditSearchQuery(props: Props) {
</ToggleButton>
</ToggleButtonGroup>
</FormControl>
- <FormControl
- className={classes.formControl}
- disabled={isIndexing !== undefined}
- >
+ <FormControl disabled={isIndexing !== undefined}>
<ToggleButtonGroup
onChange={() => {
setTempSearchQuery({
@@ -305,10 +289,7 @@ function EditSearchQuery(props: Props) {
</ToggleButton>
</ToggleButtonGroup>
</FormControl>
- <FormControl
- className={classes.formControl}
- disabled={isIndexing !== undefined}
- >
+ <FormControl disabled={isIndexing !== undefined}>
<TagsSelect
dataTid="searchTagsAndTID"
placeholderText={t('core:selectTags')}
@@ -319,10 +300,7 @@ function EditSearchQuery(props: Props) {
tagMode="remove"
/>
</FormControl>
- <FormControl
- className={classes.formControl}
- disabled={isIndexing !== undefined}
- >
+ <FormControl disabled={isIndexing !== undefined}>
<TagsSelect
dataTid="searchTagsOrTID"
placeholderText={t('core:selectTags')}
@@ -333,10 +311,7 @@ function EditSearchQuery(props: Props) {
tagMode="remove"
/>
</FormControl>
- <FormControl
- className={classes.formControl}
- disabled={isIndexing !== undefined}
- >
+ <FormControl disabled={isIndexing !== undefined}>
<TagsSelect
dataTid="searchTagsNotTID"
placeholderText={t('core:selectTags')}
@@ -347,20 +322,14 @@ function EditSearchQuery(props: Props) {
tagMode="remove"
/>
</FormControl>
- <FormControl
- className={classes.formControl}
- disabled={isIndexing !== undefined}
- >
+ <FormControl disabled={isIndexing !== undefined}>
<TooltipTS title={t('filterByTypTooltip')}>
<FormHelperText style={{ marginLeft: 0 }}>
{t('core:fileType')}
</FormHelperText>
- <Select
- fullWidth
+ <TsSelect
value={JSON.stringify(tempSearchQuery.fileTypes)}
onChange={handleFileTypeChange}
- size={desktopMode ? 'small' : 'medium'}
- input={<OutlinedInput name="fileTypes" id="file-type" />}
>
<MenuItem value={JSON.stringify(AppConfig.SearchTypeGroups.any)}>
{t('core:anyType')}
@@ -468,24 +437,17 @@ function EditSearchQuery(props: Props) {
</TsIconButton>
{t('core:searchEmails')}
</MenuItem>
- </Select>
+ </TsSelect>
</TooltipTS>
</FormControl>
- <FormControl
- className={classes.formControl}
- disabled={isIndexing !== undefined}
- >
+ <FormControl disabled={isIndexing !== undefined}>
<TooltipTS title={t('filterBySizeTooltip')}>
<FormHelperText style={{ marginLeft: 0 }}>
{t('core:sizeSearchTitle')}
</FormHelperText>
- <Select
- fullWidth
+ <TsSelect
value={tempSearchQuery.fileSize}
onChange={handleFileSizeChange}
- size={desktopMode ? 'small' : 'medium'}
- input={<OutlinedInput name="fileSize" id="file-size" />}
- displayEmpty
>
<MenuItem value="">{t('core:sizeAny')}</MenuItem>
<MenuItem value="sizeEmpty">{t('core:sizeEmpty')}</MenuItem>
@@ -513,24 +475,17 @@ function EditSearchQuery(props: Props) {
{t('core:sizeHuge')}
&nbsp;(&gt;&nbsp;1GB)
</MenuItem>
- </Select>
+ </TsSelect>
</TooltipTS>
</FormControl>
- <FormControl
- className={classes.formControl}
- disabled={isIndexing !== undefined}
- >
+ <FormControl disabled={isIndexing !== undefined}>
<TooltipTS title={t('filterByLastModifiedDateTooltip')}>
<FormHelperText style={{ marginLeft: 0 }}>
{t('core:lastModifiedSearchTitle')}
</FormHelperText>
- <Select
- fullWidth
+ <TsSelect
value={tempSearchQuery.lastModified}
onChange={handleLastModifiedChange}
- size={desktopMode ? 'small' : 'medium'}
- input={<OutlinedInput name="lastModified" id="modification-date" />}
- displayEmpty
>
<MenuItem value="">{t('core:anyTime')}</MenuItem>
<MenuItem value="today">{t('core:today')}</MenuItem>
@@ -540,10 +495,10 @@ function EditSearchQuery(props: Props) {
<MenuItem value="past6Months">{t('core:past6Months')}</MenuItem>
<MenuItem value="pastYear">{t('core:pastYear')}</MenuItem>
<MenuItem value="moreThanYear">{t('core:moreThanYear')}</MenuItem>
- </Select>
+ </TsSelect>
</TooltipTS>
</FormControl>
- <FormControl className={classes.formControl}>
+ <FormControl>
<TooltipTS title={t('enterTimePeriodTooltip')}>
<LocalizationProvider dateAdapter={AdapterDateFns}>
<Box position="relative" display="inline-flex">
diff --git a/src/renderer/components/SearchPopover.tsx b/src/renderer/components/SearchPopover.tsx
index d9b0b46da..a80974136 100644
--- a/src/renderer/components/SearchPopover.tsx
+++ b/src/renderer/components/SearchPopover.tsx
@@ -23,6 +23,7 @@ import { SidePanel, classes } from '-/components/SidePanels.css';
import TooltipTS from '-/components/Tooltip';
import TsButton from '-/components/TsButton';
import TsIconButton from '-/components/TsIconButton';
+import TsSelect from '-/components/TsSelect';
import { useDirectoryContentContext } from '-/hooks/useDirectoryContentContext';
import { useLocationIndexContext } from '-/hooks/useLocationIndexContext';
import { useSavedSearchesContext } from '-/hooks/useSavedSearchesContext';
@@ -35,7 +36,6 @@ import FormControl from '@mui/material/FormControl';
import FormHelperText from '@mui/material/FormHelperText';
import Grid from '@mui/material/Grid2';
import MenuItem from '@mui/material/MenuItem';
-import Select from '@mui/material/Select';
import Typography from '@mui/material/Typography';
import Links from 'assets/links';
import React from 'react';
@@ -147,15 +147,10 @@ function SearchPopover(props: Props) {
<FormHelperText style={{ marginLeft: 0 }}>
{t('core:savedSearchesTitle')}
</FormHelperText>
- <Select
+ <TsSelect
name="savedSearch"
- labelId="saved-searches"
disabled={isIndexing !== undefined}
- size={desktopMode ? 'small' : 'medium'}
onChange={handleSavedSearchChange}
- displayEmpty
- fullWidth
- variant="outlined"
value={tempSearchQuery.uuid ? tempSearchQuery.uuid : -1}
>
<MenuItem value={-1} style={{ display: 'none' }} />
@@ -167,7 +162,7 @@ function SearchPopover(props: Props) {
<span style={{ width: '100%' }}>{search.title}</span>
</MenuItem>
))}
- </Select>
+ </TsSelect>
</FormControl>
</TooltipTS>
</Grid>
diff --git a/src/renderer/components/SidePanels.css.tsx b/src/renderer/components/SidePanels.css.tsx
index 3acb69342..b220ddcf1 100644
--- a/src/renderer/components/SidePanels.css.tsx
+++ b/src/renderer/components/SidePanels.css.tsx
@@ -21,7 +21,6 @@ import { styled } from '@mui/material/styles';
const PREFIX = 'SidePanel';
export const classes = {
panel: `${PREFIX}-panel`,
- fontIcon: `${PREFIX}-fontIcon`,
header: `${PREFIX}-header`,
icon: `${PREFIX}-icon`,
locationListArea: `${PREFIX}-locationListArea`,
@@ -29,7 +28,6 @@ export const classes = {
listItemSelected: `${PREFIX}-listItemSelected`,
panelTitle: `${PREFIX}-panelTitle`,
toolbar: `${PREFIX}-toolbar`,
- formControl: `${PREFIX}-formControl`,
mainActionButton: `${PREFIX}-mainActionButton`,
leftIcon: `${PREFIX}-leftIcon`,
};
@@ -38,9 +36,6 @@ export const SidePanel = styled('div')(({ theme }) => ({
height: '100%',
paddingLeft: 5,
paddingRight: 0,
- [`& .${classes.fontIcon}`]: {
- color: theme.palette.text.primary,
- },
[`& .${classes.header}`]: {
color: theme.palette.text.primary,
},
@@ -73,10 +68,6 @@ export const SidePanel = styled('div')(({ theme }) => ({
[`& .${classes.toolbar}`]: {
display: 'flex',
},
- [`& .${classes.formControl}`]: {
- width: '100%',
- marginBottom: 10,
- },
[`& .${classes.mainActionButton}`]: {
marginTop: 10,
marginLeft: 0,
diff --git a/src/renderer/components/TsTextField.tsx b/src/renderer/components/TsTextField.tsx
index e09a90de9..1c034628c 100644
--- a/src/renderer/components/TsTextField.tsx
+++ b/src/renderer/components/TsTextField.tsx
@@ -113,7 +113,7 @@ function TsTextField(props: TSTextFieldProps) {
margin="dense"
size={desktopMode ? 'small' : 'medium'}
variant="outlined"
- fullWidth={true}
+ fullWidth
sx={{
backgroundColor: alpha(theme.palette.divider, 0.2),
'&:hover': {
diff --git a/src/renderer/components/dialogs/components/SettingsFileTypes.tsx b/src/renderer/components/dialogs/components/SettingsFileTypes.tsx
index 839087387..e108aa4bd 100644
--- a/src/renderer/components/dialogs/components/SettingsFileTypes.tsx
+++ b/src/renderer/components/dialogs/components/SettingsFileTypes.tsx
@@ -16,46 +16,45 @@
*
*/
-import React, { useState, useEffect, useRef, useReducer } from 'react';
-import { styled } from '@mui/material/styles';
-import { useSelector, useDispatch } from 'react-redux';
-import { getUuid } from '@tagspaces/tagspaces-common/utils-io';
-import MenuItem from '@mui/material/MenuItem';
-import Input from '@mui/material/Input';
-import FormControl from '@mui/material/FormControl';
+import AppConfig from '-/AppConfig';
+import TransparentBackground from '-/components/TransparentBackground';
+import TsButton from '-/components/TsButton';
import TsIconButton from '-/components/TsIconButton';
+import TsSelect from '-/components/TsSelect';
+import TsTextField from '-/components/TsTextField';
+import ColorPickerDialog from '-/components/dialogs/ColorPickerDialog';
+import ConfirmDialog from '-/components/dialogs/ConfirmDialog';
+import { useExtensionsContext } from '-/hooks/useExtensionsContext';
+import { AppDispatch } from '-/reducers/app';
+import {
+ actions as SettingsActions,
+ getSupportedFileTypes,
+ isDevMode,
+} from '-/reducers/settings';
+import defaultSettings from '-/reducers/settings-default';
+import { dataTidFormat } from '-/services/test';
+import { getUserDataDir } from '-/services/utils-io';
+import { TS } from '-/tagspaces.namespace';
+import useFirstRender from '-/utils/useFirstRender';
import RemoveIcon from '@mui/icons-material/RemoveCircle';
-import TsButton from '-/components/TsButton';
-import Select from '@mui/material/Select';
+import FormControl from '@mui/material/FormControl';
+import MenuItem from '@mui/material/MenuItem';
+import Paper from '@mui/material/Paper';
import Table from '@mui/material/Table';
import TableBody from '@mui/material/TableBody';
import TableCell from '@mui/material/TableCell';
import TableContainer from '@mui/material/TableContainer';
-import TableHead from '@mui/material/TableHead';
import TableRow from '@mui/material/TableRow';
-import Paper from '@mui/material/Paper';
+import { styled } from '@mui/material/styles';
+import { getUuid } from '@tagspaces/tagspaces-common/utils-io';
+import React, { useEffect, useReducer, useRef, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+import { useDispatch, useSelector } from 'react-redux';
import {
- TableVirtuoso,
TableComponents,
+ TableVirtuoso,
TableVirtuosoHandle,
} from 'react-virtuoso';
-import ColorPickerDialog from '-/components/dialogs/ColorPickerDialog';
-import TransparentBackground from '-/components/TransparentBackground';
-import { TS } from '-/tagspaces.namespace';
-import {
- actions as SettingsActions,
- getSupportedFileTypes,
- isDevMode,
-} from '-/reducers/settings';
-import ConfirmDialog from '-/components/dialogs/ConfirmDialog';
-import { AppDispatch } from '-/reducers/app';
-import defaultSettings from '-/reducers/settings-default';
-import useFirstRender from '-/utils/useFirstRender';
-import { useTranslation } from 'react-i18next';
-import { getUserDataDir } from '-/services/utils-io';
-import AppConfig from '-/AppConfig';
-import { useExtensionsContext } from '-/hooks/useExtensionsContext';
-import { dataTidFormat } from '-/services/test';
const PREFIX = 'SettingsFileTypes';
@@ -264,7 +263,7 @@ function SettingsFileTypes() {
dataKey: 'editor',
},
{
- //width: 80,
+ width: 100,
label: t('core:actions'),
dataKey: 'color',
},
@@ -337,7 +336,7 @@ function SettingsFileTypes() {
function rowContent(_index: number, item: TS.FileTypes) {
return (
<React.Fragment>
- <TableCell sx={{ padding: '0 5px 20px 5px' }}>
+ <TableCell align={'center'} sx={{ padding: '0 5px 0px 5px' }}>
<FormControl
error={
(isValidationInProgress.current && item.type === '') ||
@@ -346,7 +345,7 @@ function SettingsFileTypes() {
).length > 1
}
>
- <Input
+ <TsTextField
data-tid={'typeTID' + item.type}
defaultValue={item.type}
error={
@@ -363,16 +362,16 @@ function SettingsFileTypes() {
/>
</FormControl>
</TableCell>
- <TableCell align={'left'} sx={{ padding: '0 5px 20px 0' }}>
+ <TableCell align={'center'} sx={{ padding: '0 5px 0px 0' }}>
<FormControl
error={isValidationInProgress.current && item.viewer === ''}
>
- <Select
+ <TsSelect
data-tid={'viewerTID' + item.type}
error={isValidationInProgress.current && item.viewer === ''}
value={item.viewer}
- sx={{ width: 180 }}
- input={<Input id="" />}
+ style={{ maxWidth: 170, marginTop: 0 }}
+ // input={<Input id="" />}
onChange={(event) => {
const extension: TS.Extension = extensions.find(
(ext) => ext.extensionId === event.target.value,
@@ -410,14 +409,14 @@ function SettingsFileTypes() {
</MenuItem>
),
)}
- </Select>
+ </TsSelect>
</FormControl>
</TableCell>
- <TableCell align={'right'} sx={{ padding: '0 5px 20px 0' }}>
- <Select
+ <TableCell align={'center'} sx={{ padding: '0 5px 0px 0' }}>
+ <TsSelect
value={item.editor}
- input={<Input id="" />}
- sx={{ width: 180 }}
+ // input={<Input id="" />}
+ style={{ maxWidth: 170, marginTop: 0 }}
onChange={(event) =>
updateItems(item, 'editor', event.target.value)
}
@@ -438,9 +437,9 @@ function SettingsFileTypes() {
<small style={{ marginLeft: 5 }}>v{extension.version}</small>
</MenuItem>
))}
- </Select>
+ </TsSelect>
</TableCell>
- <TableCell sx={{ padding: '0 5px 20px 5px' }}>
+ <TableCell align={'center'} sx={{ padding: '0 5px 0px 5px' }}>
<TransparentBackground>
<TsButton
tooltip={t('core:colorPickerDialogTitle')}
@@ -532,7 +531,7 @@ function SettingsFileTypes() {
<TableVirtuoso
style={{
overflowX: 'hidden',
- height: 'calc(100% - 30px)',
+ height: 'calc(100% - 50px)',
overflowY: 'auto',
background: 'transparent',
}}
diff --git a/src/renderer/components/dialogs/components/SettingsGeneral.tsx b/src/renderer/components/dialogs/components/SettingsGeneral.tsx
index 74e44607f..107a7d60a 100644
--- a/src/renderer/components/dialogs/components/SettingsGeneral.tsx
+++ b/src/renderer/components/dialogs/components/SettingsGeneral.tsx
@@ -427,24 +427,6 @@ function SettingsGeneral() {
checked={settings.showUnixHiddenEntries}
/>
</ListItem>
- {/* <ListItem>
- <ListItemText style={{ maxWidth: '300px' }} primary={t('core:tagDelimiterChoose')} />
- <Select
- style={{ minWidth: '170px' }}
- data-tid="settingsTagDelimiterChoose"
- value={this.settings.tagDelimiter}
- onChange={this.handleTagDelimiterChange}
- slotProps={{
- input: {
- name: 'tagDelimiter',
- id: 'tag-delimiter',
- }}}
- >
- <MenuItem value=" ">{t('core:tagDelimiterSpace')}</MenuItem>
- <MenuItem value="_">{t('core:tagDelimiterUnderscore')}</MenuItem>
- <MenuItem value=",">{t('core:tagDelimiterComma')}</MenuItem>
- </Select>
- </ListItem> */}
<ListItem>
<ListItemText primary={t('core:maxSearchResultChoose')} />
<TsTextField