Skip to content

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

chore: migration to mui grid v2 component

Ilian Sapundshiev9179f4e1a398
diff --git a/package.json b/package.json
index 92f460ad9..d4e0ab7fa 100644
--- a/package.json
+++ b/package.json
@@ -244,7 +244,7 @@
"zod-to-json-schema": "^3.24.1"
},
"optionalDependencies": {
- "@tagspacespro/tagspacespro": "5.0.115"
+ "@tagspacespro/tagspacespro": "5.0.116"
},
"devDependencies": {
"@electron/notarize": "^2.5.0",
diff --git a/src/renderer/components/EntryProperties.tsx b/src/renderer/components/EntryProperties.tsx
index 5b30c74cf..ae08427f1 100644
--- a/src/renderer/components/EntryProperties.tsx
+++ b/src/renderer/components/EntryProperties.tsx
@@ -62,7 +62,7 @@ import {
inputBaseClasses,
} from '@mui/material';
import FormHelperText from '@mui/material/FormHelperText';
-import Grid from '@mui/material/Grid';
+import Grid from '@mui/material/Grid2';
import Stack from '@mui/material/Stack';
import { styled, useTheme } from '@mui/material/styles';
import { formatBytes } from '@tagspaces/tagspaces-common/misc';
@@ -97,74 +97,6 @@ import TagsSelect from './TagsSelect';
import TransparentBackground from './TransparentBackground';
import MoveCopyFilesDialog from './dialogs/MoveCopyFilesDialog';
-const PREFIX = 'EntryProperties';
-
-const classes = {
- entryProperties: `${PREFIX}-entryProperties`,
- tags: `${PREFIX}-tags`,
- editTagsButton: `${PREFIX}-editTagsButton`,
- textField: `${PREFIX}-textField`,
- dropText: `${PREFIX}-dropText`,
- propertyName: `${PREFIX}-propertyName`,
- actionPlaceholder: `${PREFIX}-actionPlaceholder`,
- button: `${PREFIX}-button`,
- mdHelpers: `${PREFIX}-mdHelpers`,
- formControl: `${PREFIX}-formControl`,
-};
-
-const Root = styled('div')(({ theme }) => ({
- [`& .${classes.tags}`]: {
- padding: '5px 5px 2px 2px',
- margin: 6,
- clear: 'both',
- boxShadow:
- '0 1px 1px 0 rgba(0,0,0,0.16),0 1px 1px 0 rgba(239,239,239,0.12)',
- },
-
- [`& .${classes.editTagsButton}`]: {
- float: 'right',
- margin: '0 0 10px 0',
- },
-
- [`& .${classes.textField}`]: {
- marginLeft: theme.spacing(1),
- marginRight: theme.spacing(1),
- width: '100vh',
- },
-
- [`& .${classes.dropText}`]: {
- display: 'flex',
- width: '100%',
- padding: '20px',
- color: '#728496',
- },
-
- [`& .${classes.propertyName}`]: {
- marginTop: 10,
- },
-
- [`& .${classes.actionPlaceholder}`]: {
- textAlign: 'end',
- },
-
- [`& .${classes.button}`]: {
- position: 'relative',
- padding: '8px 12px 6px 8px',
- margin: '0',
- },
-
- [`& .${classes.mdHelpers}`]: {
- borderRadius: '0.25rem',
- paddingLeft: '0.25rem',
- paddingRight: '0.25rem',
- backgroundColor: '#bcc0c561',
- },
- [`& .${classes.formControl}`]: {
- marginLeft: theme.spacing(0),
- width: '100%',
- },
-}));
-
const ThumbnailTextField = styled(TextField)(({ theme }) => ({
[`& .${inputBaseClasses.root}`]: {
height: 220,
@@ -383,9 +315,6 @@ function EntryProperties(props: Props) {
};
const toggleMoveCopyFilesDialog = () => {
- /*props.setSelectedEntries([
- { name: '', isFile: true, tags: [], ...openedEntry.current }
- ]);*/
setMoveCopyFilesDialogOpened(!isMoveCopyFilesDialogOpened);
};
@@ -426,10 +355,6 @@ function EntryProperties(props: Props) {
showNotification(t('core:thisFunctionalityIsAvailableInPro'));
return;
}
- /*if (!Pro.MetaOperations) {
- showNotification(t('Saving color not supported'));
- return;
- }*/
setDisplayColorPicker(!displayColorPicker);
};
@@ -483,7 +408,6 @@ function EntryProperties(props: Props) {
(tag) => !openedEntry.tags.some((obj) => obj.title === tag.title),
);
return addTagsToFsEntry(openedEntry, tags);
- //return addTags([openedEntry.path], tags);
};
if (!openedEntry || !openedEntry.path || openedEntry.path === '') {
@@ -505,14 +429,6 @@ function EntryProperties(props: Props) {
perspective,
};
saveDirectoryPerspective(openedEntry, perspective, openedEntry.locationID);
- /*.then((entryMeta: TS.FileSystemEntryMeta) => {
- openedEntry.meta = entryMeta;
- //return updateOpenedFile(openedEntry.path, entryMeta);
- })
- .catch((error) => {
- console.warn('Error saving perspective for folder ' + error);
- showNotification(t('Error saving perspective for folder'));
- });*/
};
let perspectiveDefault;
@@ -558,19 +474,10 @@ function EntryProperties(props: Props) {
const showLinkForDownloading =
isCloudLocation && openedEntry.isFile && !openedEntry.isEncrypted;
- /*const thumbUrl = location.getThumbPath(
- openedEntry.meta?.thumbPath,
- openedEntry.meta?.lastUpdated,
- );
- const backgroundUrl = location.getFolderBgndPath(
- openedEntry.path,
- openedEntry.meta?.lastUpdated,
- );*/
-
return (
- <Root>
+ <div>
<Grid container>
- <Grid item xs={12}>
+ <Grid size={12}>
<TsTextField
error={fileNameError.current}
label={
@@ -618,7 +525,7 @@ function EntryProperties(props: Props) {
}}
name="name"
data-tid="fileNameProperties"
- defaultValue={entryName} // openedEntry.current.name}
+ defaultValue={entryName}
inputRef={fileNameRef}
retrieveValue={() => fileNameRef.current.value}
onClick={() => {
@@ -642,17 +549,12 @@ function EntryProperties(props: Props) {
</FormHelperText>
)}
</Grid>
- <Grid item xs={12}>
+ <Grid size={12}>
<TagDropContainer entryPath={openedEntry.path}>
<TagsSelect
label={t('core:fileTags')}
dataTid="PropertiesTagsSelectTID"
placeholderText={t('core:dropHere')}
- /*isReadOnlyMode={
- isReadOnlyMode ||
- openedEntry.current.editMode ||
- editName !== undefined
- }*/
tags={getAllTags(openedEntry)}
tagMode="default"
handleChange={handleChange}
@@ -664,7 +566,7 @@ function EntryProperties(props: Props) {
</Grid>
{geoLocation && (
- <Grid item xs={12}>
+ <Grid size={12}>
<MapContainer
style={{
height: '200px',
@@ -756,67 +658,64 @@ function EntryProperties(props: Props) {
</Grid>
)}
- <Grid container item xs={12} spacing={1}>
- <Grid item xs={12}>
+ <Grid size={12}>
+ <TsTextField
+ value={ldtm}
+ label={t('core:fileLDTM')}
+ retrieveValue={() => ldtm}
+ slotProps={{
+ input: {
+ readOnly: true,
+ },
+ }}
+ />
+ </Grid>
+
+ <Grid size={12}>
+ <Tooltip
+ title={
+ !location?.haveObjectStoreSupport() &&
+ dirProps.current &&
+ !openedEntry.isFile &&
+ dirProps.current.dirsCount +
+ ' ' +
+ t('core:directories') +
+ ', ' +
+ dirProps.current.filesCount +
+ ' ' +
+ t('core:files')
+ }
+ >
<TsTextField
- value={ldtm}
- label={t('core:fileLDTM')}
- retrieveValue={() => ldtm}
+ value={fileSize()}
+ retrieveValue={() => fileSize()}
+ label={t('core:fileSize')}
slotProps={{
input: {
readOnly: true,
+ ...(!openedEntry.isFile && {
+ endAdornment: (
+ <TsButton
+ variant="text"
+ onClick={() =>
+ getOpenedDirProps().then((props) => {
+ dirProps.current = props;
+ forceUpdate();
+ })
+ }
+ >
+ {t('core:calculate')}
+ </TsButton>
+ ),
+ }),
},
}}
/>
- </Grid>
- </Grid>
- <Grid container item xs={12} spacing={1}>
- <Grid item xs={12}>
- <Tooltip
- title={
- !location?.haveObjectStoreSupport() &&
- dirProps.current &&
- !openedEntry.isFile &&
- dirProps.current.dirsCount +
- ' ' +
- t('core:directories') +
- ', ' +
- dirProps.current.filesCount +
- ' ' +
- t('core:files')
- }
- >
- <TsTextField
- value={fileSize()}
- retrieveValue={() => fileSize()}
- label={t('core:fileSize')}
- slotProps={{
- input: {
- readOnly: true,
- ...(!openedEntry.isFile && {
- endAdornment: (
- <TsButton
- variant="text"
- onClick={() =>
- getOpenedDirProps().then((props) => {
- dirProps.current = props;
- forceUpdate();
- })
- }
- >
- {t('core:calculate')}
- </TsButton>
- ),
- }),
- },
- }}
- />
- </Tooltip>
- </Grid>
+ </Tooltip>
</Grid>
- <Grid item xs={12}>
- <FormControl fullWidth={true} className={classes.formControl}>
+ <Grid size={12}>
+ <FormControl fullWidth={true}>
<TsTextField
name="path"
title={openedEntry.url || openedEntry.path}
@@ -861,55 +760,47 @@ function EntryProperties(props: Props) {
</FormControl>
</Grid>
- <Grid
- container
- item
- xs={12}
- alignItems="center"
- justifyContent="center"
- >
- <Grid item xs={12}>
- <TsTextField
- data-tid="sharingLinkTID"
- name="sharinglink"
- label={<>{t('core:sharingLink')}</>}
- value={sharingLink}
- inputRef={sharingLinkRef}
- slotProps={{
- input: {
- readOnly: true,
- endAdornment: (
- <InputAdornment position="end">
- <TsButton
- tooltip={t('core:copyLinkToClipboard')}
- data-tid="copyLinkToClipboardTID"
- variant="text"
- onClick={() => {
- const entryTitle = extractTitle(
- openedEntry.name,
- !openedEntry.isFile,
- location?.getDirSeparator(),
- );
- const clibboardItem = generateClipboardLink(
- sharingLink,
- entryTitle,
- );
- const promise =
- navigator.clipboard.write(clibboardItem);
- showNotification(t('core:linkCopied'));
- }}
- >
- {t('core:copy')}
- </TsButton>
- <InfoIcon tooltip={t('core:sharingLinkTooltip')} />
- </InputAdornment>
- ),
- },
- }}
- />
- </Grid>
+ <Grid size={12}>
+ <TsTextField
+ data-tid="sharingLinkTID"
+ name="sharinglink"
+ label={<>{t('core:sharingLink')}</>}
+ value={sharingLink}
+ inputRef={sharingLinkRef}
+ slotProps={{
+ input: {
+ readOnly: true,
+ endAdornment: (
+ <InputAdornment position="end">
+ <TsButton
+ tooltip={t('core:copyLinkToClipboard')}
+ data-tid="copyLinkToClipboardTID"
+ variant="text"
+ onClick={() => {
+ const entryTitle = extractTitle(
+ openedEntry.name,
+ !openedEntry.isFile,
+ location?.getDirSeparator(),
+ );
+ const clibboardItem = generateClipboardLink(
+ sharingLink,
+ entryTitle,
+ );
+ const promise =
+ navigator.clipboard.write(clibboardItem);
+ showNotification(t('core:linkCopied'));
+ }}
+ >
+ {t('core:copy')}
+ </TsButton>
+ <InfoIcon tooltip={t('core:sharingLinkTooltip')} />
+ </InputAdornment>
+ ),
+ },
+ }}
+ />
{showLinkForDownloading && (
- <Grid item xs={12}>
+ <Grid size={12}>
<TsTextField
name="downloadLink"
label={<>{t('core:downloadLink')}</>}
@@ -942,7 +833,7 @@ function EntryProperties(props: Props) {
</Grid>
{!openedEntry.isFile && (
- <Grid item xs={12}>
+ <Grid size={12}>
<PerspectiveSelector
onChange={changePerspective}
defaultValue={perspectiveDefault}
@@ -953,7 +844,7 @@ function EntryProperties(props: Props) {
)}
{!openedEntry.isFile && (
- <Grid item xs={12} style={{ marginTop: 5 }}>
+ <Grid size={12} style={{ marginTop: 5 }}>
<TsTextField
name="path"
label={<>{t('core:backgroundColor')}</>}
@@ -1059,14 +950,76 @@ function EntryProperties(props: Props) {
/>
</Grid>
)}
- <Grid container item xs={12} spacing={1}>
- <Grid item xs={openedEntry.isFile ? 12 : 6}>
- <FormHelperText>{t('core:thumbnail')}</FormHelperText>
+ <Grid size={openedEntry.isFile ? 12 : 6}>
+ <FormHelperText>{t('core:thumbnail')}</FormHelperText>
+ <ThumbnailTextField
+ margin="dense"
+ variant="outlined"
+ style={{ marginTop: 0 }}
+ fullWidth
+ slotProps={{
+ input: {
+ readOnly: true,
+ startAdornment: (
+ <InputAdornment position="end">
+ <Stack
+ direction="column"
+ spacing={0}
+ style={{ alignItems: 'center' }}
+ >
+ {!readOnlyMode &&
+ !isEditMode &&
+ editName === undefined && (
+ <ProTooltip tooltip={t('changeThumbnail')}>
+ <TsButton
+ data-tid="changeThumbnailTID"
+ fullWidth
+ variant="text"
+ onClick={toggleThumbFilesDialog}
+ >
+ {t('core:change')}
+ </TsButton>
+ </ProTooltip>
+ )}
+ <div
+ role="button"
+ tabIndex={0}
+ style={{
+ backgroundSize: 'cover',
+ backgroundRepeat: 'no-repeat',
+ backgroundImage: thumbImage.current,
+ backgroundPosition: 'center',
+ borderRadius: 8,
+ minHeight: 150,
+ minWidth: 150,
+ marginBottom: 5,
+ }}
+ onClick={toggleThumbFilesDialog}
+ />
+ </Stack>
+ </InputAdornment>
+ ),
+ },
+ }}
+ />
+ </Grid>
+ {!openedEntry.isFile && (
+ <Grid size={6}>
+ <FormHelperText
+ style={{
+ marginLeft: AppConfig.defaultSpaceBetweenButtons,
+ }}
+ >
+ {t('core:backgroundImage')}
+ </FormHelperText>
<ThumbnailTextField
margin="dense"
- variant="outlined"
- style={{ marginTop: 0 }}
fullWidth
+ style={{
+ marginTop: 0,
+ marginLeft: AppConfig.defaultSpaceBetweenButtons,
+ }}
+ variant="outlined"
slotProps={{
input: {
readOnly: true,
@@ -1080,31 +1033,32 @@ function EntryProperties(props: Props) {
{!readOnlyMode &&
!isEditMode &&
editName === undefined && (
- <ProTooltip tooltip={t('changeThumbnail')}>
+ <ProTooltip tooltip={t('changeBackgroundImage')}>
<TsButton
- data-tid="changeThumbnailTID"
+ data-tid="changeBackgroundImageTID"
fullWidth
variant="text"
- onClick={toggleThumbFilesDialog}
+ onClick={toggleBgndImgDialog}
>
{t('core:change')}
</TsButton>
</ProTooltip>
)}
<div
+ data-tid="propsBgnImageTID"
role="button"
tabIndex={0}
style={{
backgroundSize: 'cover',
backgroundRepeat: 'no-repeat',
- backgroundImage: thumbImage.current,
+ backgroundImage: backgroundImage.current,
backgroundPosition: 'center',
borderRadius: 8,
minHeight: 150,
minWidth: 150,
marginBottom: 5,
}}
- onClick={toggleThumbFilesDialog}
+ onClick={toggleBgndImgDialog}
/>
</Stack>
</InputAdornment>
@@ -1113,73 +1067,8 @@ function EntryProperties(props: Props) {
}}
/>
</Grid>
- {!openedEntry.isFile && (
- <Grid item xs={6}>
- <FormHelperText>{t('core:backgroundImage')}</FormHelperText>
- <ThumbnailTextField
- margin="dense"
- fullWidth
- style={{ marginTop: 0 }}
- variant="outlined"
- slotProps={{
- input: {
- readOnly: true,
- startAdornment: (
- <InputAdornment position="end">
- <Stack
- direction="column"
- spacing={0}
- style={{ alignItems: 'center' }}
- >
- {!readOnlyMode &&
- !isEditMode &&
- editName === undefined && (
- <ProTooltip tooltip={t('changeBackgroundImage')}>
- <TsButton
- data-tid="changeBackgroundImageTID"
- fullWidth
- variant="text"
- onClick={toggleBgndImgDialog}
- >
- {t('core:change')}
- </TsButton>
- </ProTooltip>
- )}
- <div
- data-tid="propsBgnImageTID"
- role="button"
- tabIndex={0}
- style={{
- backgroundSize: 'cover',
- backgroundRepeat: 'no-repeat',
- backgroundImage: backgroundImage.current,
- backgroundPosition: 'center',
- borderRadius: 8,
- minHeight: 150,
- minWidth: 150,
- marginBottom: 5,
- }}
- onClick={toggleBgndImgDialog}
- />
- </Stack>
- </InputAdornment>
- ),
- },
- }}
- />
- </Grid>
- )}
- </Grid>
- </Grid>
- <Grid
- container
- item
- xs={12}
- spacing={1}
- alignItems="center"
- justifyContent="center"
- >
- <Grid item xs={12}>
+ )}
+ <Grid size={12}>
<TsTextField
data-tid="entryIDTID"
name="entryid"
@@ -1189,12 +1078,6 @@ function EntryProperties(props: Props) {
slotProps={{
input: {
readOnly: true,
- // startAdornment: (
- // <InputAdornment position="start">
- // <InfoIcon tooltip={t('core:entryIdTooltip')} />
- // {/* <IDIcon style={{ color: theme.palette.text.secondary }} /> */}
- // </InputAdornment>
- // ),
endAdornment: (
<InputAdornment position="end">
<TsButton
@@ -1289,7 +1172,7 @@ function EntryProperties(props: Props) {
currentDirectoryPath={openedEntry.path}
/>
)}
- </Root>
+ </div>
);
}
diff --git a/src/renderer/components/RenderHistory.tsx b/src/renderer/components/RenderHistory.tsx
index 2a7c74872..a7e6cf244 100644
--- a/src/renderer/components/RenderHistory.tsx
+++ b/src/renderer/components/RenderHistory.tsx
@@ -62,7 +62,7 @@ function RenderHistory(props: Props) {
return (
<ListItem
dense
- style={{ paddingLeft: 0 }}
+ style={{ paddingLeft: 0, height: 40 }}
key={item.creationTimeStamp}
>
<TsButton
diff --git a/src/renderer/components/SearchPopover.tsx b/src/renderer/components/SearchPopover.tsx
index 74db393b4..d9b0b46da 100644
--- a/src/renderer/components/SearchPopover.tsx
+++ b/src/renderer/components/SearchPopover.tsx
@@ -16,9 +16,9 @@
*
*/
-import React from 'react';
import AppConfig from '-/AppConfig';
import { CloseIcon, CreateFileIcon, EditIcon } from '-/components/CommonIcons';
+import EditSearchQuery from '-/components/EditSearchQuery';
import { SidePanel, classes } from '-/components/SidePanels.css';
import TooltipTS from '-/components/Tooltip';
import TsButton from '-/components/TsButton';
@@ -26,21 +26,21 @@ import TsIconButton from '-/components/TsIconButton';
import { useDirectoryContentContext } from '-/hooks/useDirectoryContentContext';
import { useLocationIndexContext } from '-/hooks/useLocationIndexContext';
import { useSavedSearchesContext } from '-/hooks/useSavedSearchesContext';
+import { useSearchQueryContext } from '-/hooks/useSearchQueryContext';
import { isDesktopMode } from '-/reducers/settings';
import { openURLExternally } from '-/services/utils-io';
import { TS } from '-/tagspaces.namespace';
import ButtonGroup from '@mui/material/ButtonGroup';
import FormControl from '@mui/material/FormControl';
import FormHelperText from '@mui/material/FormHelperText';
-import Grid from '@mui/material/Grid';
+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';
import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';
-import EditSearchQuery from '-/components/EditSearchQuery';
-import { useSearchQueryContext } from '-/hooks/useSearchQueryContext';
interface Props {
style?: any;
@@ -138,7 +138,7 @@ function SearchPopover(props: Props) {
justifyContent="center"
alignItems="flex-end"
>
- <Grid item xs={9}>
+ <Grid size={9}>
<TooltipTS title={t('storedSearchQueriesTooltip')}>
<FormControl
variant="outlined"
@@ -172,8 +172,7 @@ function SearchPopover(props: Props) {
</TooltipTS>
</Grid>
<Grid
- item
- xs={3}
+ size={3}
style={{ display: 'flex', alignSelf: 'center', paddingTop: 40 }}
>
<ButtonGroup
@@ -200,7 +199,7 @@ function SearchPopover(props: Props) {
</TsIconButton>
</ButtonGroup>
</Grid>
- <Grid item xs={12}>
+ <Grid size={12}>
<EditSearchQuery />
</Grid>
</Grid>
diff --git a/src/renderer/components/StoredSearches.tsx b/src/renderer/components/StoredSearches.tsx
index 7a70d124b..6f0d19d80 100644
--- a/src/renderer/components/StoredSearches.tsx
+++ b/src/renderer/components/StoredSearches.tsx
@@ -16,20 +16,15 @@
*
*/
-import React, { useContext, useReducer, useRef, useState } from 'react';
-import { bindActionCreators } from 'redux';
-import { connect } from 'react-redux';
-import classNames from 'classnames';
-import TsIconButton from '-/components/TsIconButton';
+import RenderHistory from '-/components/RenderHistory';
+import { SidePanel, classes } from '-/components/SidePanels.css';
import TsButton from '-/components/TsButton';
-import Grid from '@mui/material/Grid';
-import EditIcon from '@mui/icons-material/Edit';
-import MenuIcon from '@mui/icons-material/MoreVert';
-import SearchIcon from '@mui/icons-material/FilterAltTwoTone';
-import ArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
-import ArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
-import Typography from '@mui/material/Typography';
-import ListItem from '@mui/material/ListItem';
+import TsIconButton from '-/components/TsIconButton';
+import BookmarksMenu from '-/components/menus/BookmarksMenu';
+import HistoryMenu from '-/components/menus/HistoryMenu';
+import SearchMenu from '-/components/menus/SearchMenu';
+import { useSavedSearchesContext } from '-/hooks/useSavedSearchesContext';
+import { useSearchQueryContext } from '-/hooks/useSearchQueryContext';
import {
actions as SettingsActions,
getFileEditHistory,
@@ -39,18 +34,20 @@ import {
getShowUnixHiddenEntries,
getStoredSearchesVisible,
} from '-/reducers/settings';
-import { Pro } from '../pro';
import { TS } from '-/tagspaces.namespace';
-import SearchMenu from '-/components/menus/SearchMenu';
-import HistoryMenu from '-/components/menus/HistoryMenu';
-import BookmarksMenu from '-/components/menus/BookmarksMenu';
-import { classes, SidePanel } from '-/components/SidePanels.css';
+import EditIcon from '@mui/icons-material/Edit';
+import SearchIcon from '@mui/icons-material/FilterAltTwoTone';
+import ArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
+import ArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
+import MenuIcon from '@mui/icons-material/MoreVert';
+import Grid from '@mui/material/Grid2';
+import Typography from '@mui/material/Typography';
+import classNames from 'classnames';
+import React, { useContext, useReducer, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
-import RenderHistory from '-/components/RenderHistory';
-import { useDirectoryContentContext } from '-/hooks/useDirectoryContentContext';
-import { useSavedSearchesContext } from '-/hooks/useSavedSearchesContext';
-import SaveSearchDialog from '-/components/dialogs/SaveSearchDialog';
-import { useSearchQueryContext } from '-/hooks/useSearchQueryContext';
+import { connect } from 'react-redux';
+import { bindActionCreators } from 'redux';
+import { Pro } from '../pro';
interface Props {
style?: any;
@@ -177,7 +174,7 @@ function StoredSearches(props: Props) {
}}
>
<Grid container direction="row">
- <Grid item xs={10} style={{ alignSelf: 'center' }}>
+ <Grid size={10} style={{ alignSelf: 'center' }}>
<TsIconButton
data-tid={
props.storedSearchesVisible
@@ -206,7 +203,7 @@ function StoredSearches(props: Props) {
{t('core:savedSearchesTitle')}
</Typography>
</Grid>
- <Grid item xs={2} style={{ alignSelf: 'center' }}>
+ <Grid size={2} style={{ alignSelf: 'center' }}>
<SearchMenu
anchorEl={searchMenuAnchorEl}
open={Boolean(searchMenuAnchorEl)}
@@ -228,55 +225,57 @@ function StoredSearches(props: Props) {
</Grid>
<Grid container direction="row">
{props.storedSearchesVisible && noSearchesFound && (
- <Grid item xs={12} style={{ textAlign: 'center' }}>
+ <Grid size={12} style={{ textAlign: 'center' }}>
<Typography variant="caption">{t('noSavedSearches')}</Typography>
</Grid>
)}
</Grid>
- {props.storedSearchesVisible &&
- searches.map((search) => (
- <ListItem dense style={{ paddingLeft: 0 }} key={search.uuid}>
- <Grid item xs={10} style={{ width: 250 }}>
- <TsButton
- data-tid={
- 'StoredSearchTID' +
- search.title.trim().replaceAll(/\s+/g, '-')
- }
- variant="text"
- style={{
- textTransform: 'none',
- fontWeight: 'normal',
- justifyContent: 'start',
- }}
- onClick={() => findFromSavedSearch(search.uuid)}
- >
- <SearchIcon />
- &nbsp;
- <span
+ <Grid>
+ {props.storedSearchesVisible &&
+ searches.map((search) => (
+ <Grid container direction="row" key={search.uuid}>
+ <Grid size={10}>
+ <TsButton
+ data-tid={
+ 'StoredSearchTID' +
+ search.title.trim().replaceAll(/\s+/g, '-')
+ }
+ variant="text"
style={{
- whiteSpace: 'nowrap',
- textOverflow: 'ellipsis',
- overflow: 'hidden',
- maxWidth: 220,
+ textTransform: 'none',
+ fontWeight: 'normal',
+ justifyContent: 'start',
}}
+ onClick={() => findFromSavedSearch(search.uuid)}
>
- {search.title}
- </span>
- </TsButton>
- </Grid>
- <Grid item xs={2}>
- <TsIconButton
- aria-label={t('core:searchEditBtn')}
- onClick={() => openSaveSearchDialog(search.uuid)}
- data-tid="editSearchTID"
- >
- <EditIcon />
- </TsIconButton>
+ <SearchIcon />
+ &nbsp;
+ <span
+ style={{
+ whiteSpace: 'nowrap',
+ textOverflow: 'ellipsis',
+ overflow: 'hidden',
+ maxWidth: 220,
+ }}
+ >
+ {search.title}
+ </span>
+ </TsButton>
+ </Grid>
+ <Grid size={2}>
+ <TsIconButton
+ aria-label={t('core:searchEditBtn')}
+ onClick={() => openSaveSearchDialog(search.uuid)}
+ data-tid="editSearchTID"
+ >
+ <EditIcon />
+ </TsIconButton>
+ </Grid>
</Grid>
- </ListItem>
- ))}
+ ))}
+ </Grid>
<Grid container direction="row">
- <Grid item xs={10} style={{ alignSelf: 'center' }}>
+ <Grid size={10} style={{ alignSelf: 'center' }}>
<TsIconButton
data-tid="BookmarksTID"
style={{ minWidth: 'auto', padding: 7 }}
@@ -293,7 +292,7 @@ function StoredSearches(props: Props) {
{t('core:showBookmarks')}
</Typography>
</Grid>
- <Grid item xs={2} style={{ alignSelf: 'center' }}>
+ <Grid size={2} style={{ alignSelf: 'center' }}>
<TsIconButton
data-tid="BookmarksMenuTID"
onClick={(event: any) => {
@@ -307,7 +306,7 @@ function StoredSearches(props: Props) {
</Grid>
<Grid container direction="row">
{props.showBookmarks && !bookmarksAvailable && (
- <Grid item xs={12} style={{ textAlign: 'center' }}>
+ <Grid size={12} style={{ textAlign: 'center' }}>
<Typography variant="caption">{t('noItems')}</Typography>
</Grid>
)}
@@ -320,7 +319,7 @@ function StoredSearches(props: Props) {
/>
)}
<Grid container direction="row">
- <Grid item xs={10} style={{ alignSelf: 'center' }}>
+ <Grid size={10} style={{ alignSelf: 'center' }}>
<TsIconButton
data-tid={
props.fileOpenHistory
@@ -341,7 +340,7 @@ function StoredSearches(props: Props) {
{t('core:fileOpenHistory')}
</Typography>
</Grid>
- <Grid item xs={2} style={{ alignSelf: 'center' }}>
+ <Grid size={2} style={{ alignSelf: 'center' }}>
<TsIconButton
data-tid="fileOpenMenuTID"
onClick={(event: any) => {
@@ -355,7 +354,7 @@ function StoredSearches(props: Props) {
</Grid>
<Grid container direction="row">
{props.fileOpenHistory && !openedFilesAvailable && (
- <Grid item xs={12} style={{ textAlign: 'center' }}>
+ <Grid size={12} style={{ textAlign: 'center' }}>
<Typography variant="caption">{t('noItems')}</Typography>
</Grid>
)}
@@ -368,7 +367,7 @@ function StoredSearches(props: Props) {
/>
)}
<Grid container direction="row">
- <Grid item xs={10} style={{ alignSelf: 'center' }}>
+ <Grid size={10} style={{ alignSelf: 'center' }}>
<TsIconButton
data-tid="fileEditHistoryTID"
style={{ minWidth: 'auto', padding: 7 }}
@@ -385,7 +384,7 @@ function StoredSearches(props: Props) {
{t('core:fileEditHistory')}
</Typography>
</Grid>
- <Grid item xs={2} style={{ alignSelf: 'center' }}>
+ <Grid size={2} style={{ alignSelf: 'center' }}>
<TsIconButton
data-tid="FileEditedMenuTID"
onClick={(event: any) => {
@@ -399,7 +398,7 @@ function StoredSearches(props: Props) {
</Grid>
<Grid container direction="row">
{props.fileEditHistory && !editedFilesAvailable && (
- <Grid item xs={12} style={{ textAlign: 'center' }}>
+ <Grid size={12} style={{ textAlign: 'center' }}>
<Typography variant="caption">{t('noItems')}</Typography>
</Grid>
)}
@@ -412,7 +411,7 @@ function StoredSearches(props: Props) {
/>
)}
<Grid container direction="row">
- <Grid item xs={10} style={{ alignSelf: 'center' }}>
+ <Grid size={10} style={{ alignSelf: 'center' }}>
<TsIconButton
data-tid={
props.folderOpenHistory
@@ -437,7 +436,7 @@ function StoredSearches(props: Props) {
{t('core:folderOpenHistory')}
</Typography>
</Grid>
- <Grid item xs={2} style={{ alignSelf: 'center' }}>
+ <Grid size={2} style={{ alignSelf: 'center' }}>
<TsIconButton
data-tid="FolderOpenMenuTID"
onClick={(event: any) => {
@@ -475,7 +474,7 @@ function StoredSearches(props: Props) {
/>
<Grid container direction="row">
{props.folderOpenHistory && !openedFoldersAvailable && (
- <Grid item xs={12} style={{ textAlign: 'center' }}>
+ <Grid size={12} style={{ textAlign: 'center' }}>
<Typography variant="caption">{t('noItems')}</Typography>
</Grid>
)}
diff --git a/src/renderer/components/TagGroupTitleDnD.tsx b/src/renderer/components/TagGroupTitleDnD.tsx
index b89b30fcb..6b1fcd789 100644
--- a/src/renderer/components/TagGroupTitleDnD.tsx
+++ b/src/renderer/components/TagGroupTitleDnD.tsx
@@ -16,19 +16,19 @@
*
*/
-import React, { useRef } from 'react';
-import Typography from '@mui/material/Typography';
-import IconButton from '@mui/material/IconButton';
-import MoreVertIcon from '@mui/icons-material/MoreVert';
+import DragItemTypes from '-/components/DragItemTypes';
+import { SidePanel, classes } from '-/components/SidePanels.css';
+import { useCurrentLocationContext } from '-/hooks/useCurrentLocationContext';
+import { TS } from '-/tagspaces.namespace';
+import { CommonLocation } from '-/utils/CommonLocation';
import ArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
import ArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';
+import MoreVertIcon from '@mui/icons-material/MoreVert';
+import Grid from '@mui/material/Grid2';
+import IconButton from '@mui/material/IconButton';
+import Typography from '@mui/material/Typography';
+import React, { useRef } from 'react';
import { useDrag, useDrop } from 'react-dnd';
-import Grid from '@mui/material/Grid';
-import { TS } from '-/tagspaces.namespace';
-import DragItemTypes from '-/components/DragItemTypes';
-import { classes, SidePanel } from '-/components/SidePanels.css';
-import { CommonLocation } from '-/utils/CommonLocation';
-import { useCurrentLocationContext } from '-/hooks/useCurrentLocationContext';
interface Props {
index: number;
@@ -135,7 +135,7 @@ function TagGroupTitleDnD(props: Props) {
alignContent="center"
style={{ flexWrap: 'nowrap' }}
>
- <Grid item xs={2} style={{ maxWidth: 40 }}>
+ <Grid size={2} style={{ maxWidth: 40 }}>
<IconButton
style={{ minWidth: 'auto', padding: 7 }}
onClick={(event: any) => handleTagGroupTitleClick(event, tagGroup)}
@@ -144,7 +144,7 @@ function TagGroupTitleDnD(props: Props) {
{tagGroup.expanded ? <ArrowDownIcon /> : <ArrowRightIcon />}
</IconButton>
</Grid>
- <Grid item xs={8} style={{ alignSelf: 'center' }}>
+ <Grid size={8} style={{ alignSelf: 'center' }}>
<Typography
variant="inherit"
className={classes.header}
@@ -177,7 +177,7 @@ function TagGroupTitleDnD(props: Props) {
)}
</Typography>
</Grid>
- <Grid item xs={2} style={{ textAlign: 'end' }}>
+ <Grid size={2} style={{ textAlign: 'end' }}>
{!isReadOnly && (
<IconButton
style={{ minWidth: 'auto', padding: 7 }}
diff --git a/src/renderer/components/dialogs/components/CreateFile.tsx b/src/renderer/components/dialogs/components/CreateFile.tsx
index 828e87788..aaa0c059b 100644
--- a/src/renderer/components/dialogs/components/CreateFile.tsx
+++ b/src/renderer/components/dialogs/components/CreateFile.tsx
@@ -16,34 +16,19 @@
*
*/
-import React, { useEffect, useReducer, useState } from 'react';
-import { styled } from '@mui/material/styles';
-import TsButton from '-/components/TsButton';
-import Button from '@mui/material/Button';
-import ButtonGroup from '@mui/material/ButtonGroup';
-import Typography from '@mui/material/Typography';
-import Grid from '@mui/material/Grid';
import Tooltip from '-/components/Tooltip';
-import FormHelperText from '@mui/material/FormHelperText';
-import { FormControl } from '@mui/material';
import TsTextField from '-/components/TsTextField';
-import { fileNameValidation } from '-/services/utils-io';
import { useTargetPathContext } from '-/components/dialogs/hooks/useTargetPathContext';
-import { useTranslation } from 'react-i18next';
+import { fileNameValidation } from '-/services/utils-io';
import { TS } from '-/tagspaces.namespace';
-
-const PREFIX = 'CreateFile';
-
-const classes = {
- createButton: `${PREFIX}-createButton`,
-};
-
-const StyledGrid = styled(Grid)(() => ({
- [`& .${classes.createButton}`]: {
- width: '100%',
- textAlign: 'center',
- },
-}));
+import { FormControl } from '@mui/material';
+import Button from '@mui/material/Button';
+import ButtonGroup from '@mui/material/ButtonGroup';
+import FormHelperText from '@mui/material/FormHelperText';
+import Grid from '@mui/material/Grid2';
+import Typography from '@mui/material/Typography';
+import React, { useEffect, useReducer, useState } from 'react';
+import { useTranslation } from 'react-i18next';
interface Props {
fileName: string;
@@ -124,7 +109,7 @@ function CreateFile(props: Props) {
};
return (
- <StyledGrid style={{ flexGrow: 1, width: '100%' }} container spacing={1}>
+ <Grid container spacing={1}>
<FormControl fullWidth={true} error={inputError}>
<TsTextField
error={inputError}
@@ -160,61 +145,48 @@ function CreateFile(props: Props) {
/>
</FormControl>
) : (
- <Grid item xs={12}>
- <ButtonGroup
- style={{
- textAlign: 'center',
- width: '100%',
- }}
+ <ButtonGroup style={{ margin: '0 auto' }}>
+ <Button
+ onClick={() => createFile('md')}
+ data-tid={tid('createMarkdownButton')}
+ disabled={noSuitableLocation}
+ >
+ <Tooltip title={t('createMarkdownTitle')}>
+ <Typography
+ variant="button"
+ style={{ fontWeight: 'bold' }}
+ display="block"
+ gutterBottom
+ >
+ {t('createMarkdown')}
+ </Typography>
+ </Tooltip>
+ </Button>
+ <Button
+ onClick={() => createFile('html')}
+ data-tid={tid('createRichTextFileButton')}
+ disabled={noSuitableLocation}
+ >
+ <Tooltip title={t('createNoteTitle')}>
+ <Typography variant="button" display="block" gutterBottom>
+ {t('createRichTextFile')}
+ </Typography>
+ </Tooltip>
+ </Button>
+ <Button
+ onClick={() => createFile('txt')}
+ data-tid={tid('createTextFileButton')}
+ disabled={noSuitableLocation}
>
- <Button
- // variant="contained"
- onClick={() => createFile('md')}
- className={classes.createButton}
- data-tid={tid('createMarkdownButton')}
- disabled={noSuitableLocation}
- >
- <Tooltip title={t('createMarkdownTitle')}>
- <Typography
- variant="button"
- style={{ fontWeight: 'bold' }}
- display="block"
- gutterBottom
- >
- {t('createMarkdown')}
- </Typography>
- </Tooltip>
- </Button>
- <Button
- // variant="contained"
- onClick={() => createFile('html')}
- className={classes.createButton}
- data-tid={tid('createRichTextFileButton')}
- disabled={noSuitableLocation}
- >
- <Tooltip title={t('createNoteTitle')}>
- <Typography variant="button" display="block" gutterBottom>
- {t('createRichTextFile')}
- </Typography>
- </Tooltip>
- </Button>
- <Button
- // variant="contained"
- onClick={() => createFile('txt')}
- className={classes.createButton}
- data-tid={tid('createTextFileButton')}
- disabled={noSuitableLocation}
- >
- <Tooltip title={t('createTextFileTitle')}>
- <Typography variant="button" display="block" gutterBottom>
- {t('createTextFile')}
- </Typography>
- </Tooltip>
- </Button>
- </ButtonGroup>
- </Grid>
+ <Tooltip title={t('createTextFileTitle')}>
+ <Typography variant="button" display="block" gutterBottom>
+ {t('createTextFile')}
+ </Typography>
+ </Tooltip>
+ </Button>
+ </ButtonGroup>
)}
- </StyledGrid>
+ </Grid>
);
}
diff --git a/src/renderer/components/dialogs/components/CreateLink.tsx b/src/renderer/components/dialogs/components/CreateLink.tsx
index a5be61d6a..c13773ec8 100644
--- a/src/renderer/components/dialogs/components/CreateLink.tsx
+++ b/src/renderer/components/dialogs/components/CreateLink.tsx
@@ -16,29 +16,15 @@
*
*/
-import React, { useEffect, useReducer, useState } from 'react';
-import { styled } from '@mui/material/styles';
-import Grid from '@mui/material/Grid';
import TsTextField from '-/components/TsTextField';
-import FormHelperText from '@mui/material/FormHelperText';
-import { FormControl } from '@mui/material';
-import { fileNameValidation, urlValidation } from '-/services/utils-io';
import { useTargetPathContext } from '-/components/dialogs/hooks/useTargetPathContext';
-import { useTranslation } from 'react-i18next';
+import { fileNameValidation, urlValidation } from '-/services/utils-io';
import { TS } from '-/tagspaces.namespace';
-
-const PREFIX = 'CreateLink';
-
-const classes = {
- createButton: `${PREFIX}-createButton`,
-};
-
-const StyledGrid = styled(Grid)(() => ({
- [`& .${classes.createButton}`]: {
- width: '100%',
- textAlign: 'center',
- },
-}));
+import { FormControl } from '@mui/material';
+import FormHelperText from '@mui/material/FormHelperText';
+import Grid from '@mui/material/Grid2';
+import React, { useEffect, useReducer, useState } from 'react';
+import { useTranslation } from 'react-i18next';
interface Props {
fileName: string;
@@ -125,7 +111,7 @@ function CreateLink(props: Props) {
};
return (
- <StyledGrid style={{ flexGrow: 1, width: '100%' }} container spacing={1}>
+ <Grid container spacing={1}>
<FormControl fullWidth={true} error={inputError}>
<TsTextField
error={inputError}
@@ -161,7 +147,7 @@ function CreateLink(props: Props) {
)}
{urlInputError && <FormHelperText>{urlInputError}</FormHelperText>}
</FormControl>
- </StyledGrid>
+ </Grid>
);
}
diff --git a/src/renderer/components/dialogs/components/LocalForm.tsx b/src/renderer/components/dialogs/components/LocalForm.tsx
index 84e5fbc48..117829fff 100644
--- a/src/renderer/components/dialogs/components/LocalForm.tsx
+++ b/src/renderer/components/dialogs/components/LocalForm.tsx
@@ -24,7 +24,7 @@ import { selectDirectoryDialog } from '-/services/utils-io';
import FolderIcon from '@mui/icons-material/Folder';
import FormControl from '@mui/material/FormControl';
import FormHelperText from '@mui/material/FormHelperText';
-import Grid from '@mui/material/Grid';
+import Grid from '@mui/material/Grid2';
import InputAdornment from '@mui/material/InputAdornment';
import { extractDirectoryName } from '@tagspaces/tagspaces-common/paths';
import { useTranslation } from 'react-i18next';
@@ -65,7 +65,7 @@ function LocalForm(props: Props) {
return (
<Grid container>
- <Grid item xs={12}>
+ <Grid size={12}>
<FormControl fullWidth={true}>
<TsTextField
required
@@ -82,7 +82,7 @@ function LocalForm(props: Props) {
/>
</FormControl>
</Grid>
- <Grid item xs={12}>
+ <Grid size={12}>
<FormControl fullWidth={true}>
<TsTextField
required
diff --git a/src/renderer/components/dialogs/components/ObjectStoreForm.tsx b/src/renderer/components/dialogs/components/ObjectStoreForm.tsx
index a3c35828a..042d18933 100644
--- a/src/renderer/components/dialogs/components/ObjectStoreForm.tsx
+++ b/src/renderer/components/dialogs/components/ObjectStoreForm.tsx
@@ -23,7 +23,7 @@ import VisibilityOff from '@mui/icons-material/VisibilityOff';
import Autocomplete from '@mui/material/Autocomplete';
import FormControl from '@mui/material/FormControl';
import FormHelperText from '@mui/material/FormHelperText';
-import Grid from '@mui/material/Grid';
+import Grid from '@mui/material/Grid2';
import InputAdornment from '@mui/material/InputAdornment';
import { useTranslation } from 'react-i18next';
@@ -145,7 +145,7 @@ function ObjectStoreForm(props: Props) {
return (
<Grid container>
- <Grid item xs={12}>
+ <Grid size={12}>
<FormControl fullWidth={true}>
<TsTextField
required
@@ -168,7 +168,7 @@ function ObjectStoreForm(props: Props) {
)}
</FormControl>
</Grid>
- <Grid item xs={12}>
+ <Grid size={12}>
<FormControl fullWidth={true}>
<TsTextField
name="storePath"
@@ -189,7 +189,7 @@ function ObjectStoreForm(props: Props) {
)}
</FormControl>
</Grid>
- <Grid item xs={12}>
+ <Grid size={12}>
<FormControl fullWidth={true}>
<TsTextField
required
@@ -211,7 +211,7 @@ function ObjectStoreForm(props: Props) {
)}
</FormControl>
</Grid>
- <Grid item xs={12}>
+ <Grid size={12}>
{/* error={cloudErrorSecretAccessKey} */}
<FormControl fullWidth={true}>
<TsTextField
@@ -244,7 +244,7 @@ function ObjectStoreForm(props: Props) {
/>
</FormControl>
</Grid>
- <Grid item xs={12}>
+ <Grid size={12}>
<FormControl fullWidth={true}>
<TsTextField
name="sessionToken"
@@ -258,7 +258,7 @@ function ObjectStoreForm(props: Props) {
/>
</FormControl>
</Grid>
- <Grid item xs={12}>
+ <Grid size={12}>
<FormControl fullWidth={true} error={cloudErrorBucketName}>
<TsTextField
name="bucketName"
@@ -272,7 +272,7 @@ function ObjectStoreForm(props: Props) {
/>
</FormControl>
</Grid>
- <Grid item xs={12}>
+ <Grid size={12}>
<FormControl fullWidth={true}>
<TsTextField
name="endpointURL"
@@ -284,7 +284,7 @@ function ObjectStoreForm(props: Props) {
/>
</FormControl>
</Grid>
- <Grid item xs={12}>
+ <Grid size={12}>
<FormControl fullWidth={true} error={cloudErrorRegion}>
<Autocomplete
options={regions}
diff --git a/src/renderer/components/dialogs/components/TargetPath.tsx b/src/renderer/components/dialogs/components/TargetPath.tsx
index 4b1da2c82..fec347ac8 100644
--- a/src/renderer/components/dialogs/components/TargetPath.tsx
+++ b/src/renderer/components/dialogs/components/TargetPath.tsx
@@ -16,13 +16,12 @@
*
*/
-import React from 'react';
-import Typography from '@mui/material/Typography';
-import Grid from '@mui/material/Grid';
import { InfoIcon } from '-/components/CommonIcons';
import { useTargetPathContext } from '-/components/dialogs/hooks/useTargetPathContext';
-import { useTranslation } from 'react-i18next';
import { useCurrentLocationContext } from '-/hooks/useCurrentLocationContext';
+import Grid from '@mui/material/Grid2';
+import Typography from '@mui/material/Typography';
+import { useTranslation } from 'react-i18next';
function TargetPath() {
const { t } = useTranslation();
@@ -31,7 +30,7 @@ function TargetPath() {
const currentLocation = findLocation();
return (
- <Grid item style={{ marginTop: 20 }} xs={12}>
+ <Grid container style={{ marginTop: 20 }}>
{targetDirectoryPath ? (
<Typography
style={{ display: 'flex', alignItems: 'center' }}