Skip to content

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

some small UI fixex (#1260)

Stanimir7bed2c190891
diff --git a/app/perspectives/grid-perspective/components/GridPagination.tsx b/app/perspectives/grid-perspective/components/GridPagination.tsx
index 65a64d3e9..18709ec45 100644
--- a/app/perspectives/grid-perspective/components/GridPagination.tsx
+++ b/app/perspectives/grid-perspective/components/GridPagination.tsx
@@ -112,12 +112,16 @@ const GridPagination = (props: Props) => {
{page === 1 && directories.map(entry => renderCell(entry))}
{files.map(entry => renderCell(entry))}
{isAppLoading && (
- <Typography style={{ padding: 15 }}>
+ <Typography
+ style={{ padding: 15, color: theme.palette.text.primary }}
+ >
{i18n.t('core:loading')}
</Typography>
)}
{!isAppLoading && files.length < 1 && directories.length < 1 && (
- <Typography style={{ padding: 15 }}>
+ <Typography
+ style={{ padding: 15, color: theme.palette.text.primary }}
+ >
{i18n.t('core:noFileFolderFound')}
</Typography>
)}
@@ -125,7 +129,9 @@ const GridPagination = (props: Props) => {
files.length < 1 &&
directories.length >= 1 &&
!showDirectories && (
- <Typography style={{ padding: 15 }}>
+ <Typography
+ style={{ padding: 15, color: theme.palette.text.primary }}
+ >
{i18n.t('core:noFileButFoldersFound')}
</Typography>
)}
diff --git a/app/perspectives/grid-perspective/components/MainContainer.tsx b/app/perspectives/grid-perspective/components/MainContainer.tsx
index 48671514a..28f2dace7 100644
--- a/app/perspectives/grid-perspective/components/MainContainer.tsx
+++ b/app/perspectives/grid-perspective/components/MainContainer.tsx
@@ -23,7 +23,6 @@ import { bindActionCreators } from 'redux';
import memoize from 'memoize-one';
import { GlobalHotKeys } from 'react-hotkeys';
import { withStyles } from '@material-ui/core/styles';
-import Typography from '@material-ui/core/Typography';
import { FileSystemEntry } from '-/services/utils-io';
import { Tag } from '-/reducers/taglibrary';
import {
@@ -119,7 +118,7 @@ interface State {
sortBy: string;
orderBy: null | boolean;
fileOperationsEnabled: boolean;
- allFilesSelected: boolean;
+ // allFilesSelected: boolean;
showDirectories: boolean;
showTags: boolean;
isDeleteMultipleFilesDialogOpened: boolean;
@@ -133,8 +132,11 @@ interface State {
}
class GridPerspective extends React.Component<Props, State> {
+ static allFilesSelected: boolean;
+
constructor(props) {
super(props);
+ GridPerspective.allFilesSelected = false;
const settings = JSON.parse(localStorage.getItem('tsPerspectiveGrid')); // loading settings
this.state = {
fileContextMenuOpened: false,
@@ -167,7 +169,7 @@ class GridPerspective extends React.Component<Props, State> {
thumbnailMode:
settings && settings.thumbnailMode ? settings.thumbnailMode : 'cover', // contain
fileOperationsEnabled: false,
- allFilesSelected: false,
+ // allFilesSelected: false,
showDirectories:
settings && typeof settings.showDirectories !== 'undefined'
? settings.showDirectories
@@ -204,6 +206,8 @@ class GridPerspective extends React.Component<Props, State> {
return true;
});
fileOperationsEnabled = !selectionContainsDirectories;
+ } else {
+ GridPerspective.allFilesSelected = false;
}
return {
@@ -364,14 +368,12 @@ class GridPerspective extends React.Component<Props, State> {
clearSelection = () => {
const { setSelectedEntries, setLastSelectedEntry } = this.props;
setSelectedEntries([]);
- this.setState({
- allFilesSelected: false
- });
+ GridPerspective.allFilesSelected = false;
setLastSelectedEntry(null);
};
toggleSelectAllFiles = () => {
- if (this.state.allFilesSelected) {
+ if (GridPerspective.allFilesSelected) {
this.clearSelection();
} else {
const selectedEntries = [];
@@ -382,9 +384,7 @@ class GridPerspective extends React.Component<Props, State> {
return true;
});
this.props.setSelectedEntries(selectedEntries);
- this.setState({
- allFilesSelected: !this.state.allFilesSelected
- });
+ GridPerspective.allFilesSelected = !GridPerspective.allFilesSelected;
}
};
@@ -799,7 +799,7 @@ class GridPerspective extends React.Component<Props, State> {
selectedEntries={this.props.selectedEntries}
loadParentDirectoryContent={loadParentDirectoryContent}
toggleSelectAllFiles={this.toggleSelectAllFiles}
- allFilesSelected={this.state.allFilesSelected}
+ allFilesSelected={GridPerspective.allFilesSelected}
handleLayoutSwitch={this.handleLayoutSwitch}
openAddRemoveTagsDialog={this.openAddRemoveTagsDialog}
fileOperationsEnabled={this.state.fileOperationsEnabled}
diff --git a/app/reducers/app.ts b/app/reducers/app.ts
index 00a0d8879..c77b4bb04 100644
--- a/app/reducers/app.ts
+++ b/app/reducers/app.ts
@@ -1063,11 +1063,28 @@ export const actions = {
PlatformIO.showInFileManager(filePath);
},
renameDirectory: (directoryPath: string, newDirectoryName: string) => (
- dispatch: (actions: Object) => void
+ dispatch: (actions: Object) => void,
+ getState: () => any
) =>
PlatformIO.renameDirectoryPromise(directoryPath, newDirectoryName)
.then(newDirPath => {
- dispatch(actions.reflectRenameEntry(directoryPath, newDirPath));
+ const { currentDirectoryPath, openedFiles } = getState().app;
+ if (currentDirectoryPath === directoryPath) {
+ dispatch(actions.loadDirectoryContent(newDirPath));
+ if (openedFiles && openedFiles.length > 0) {
+ if (openedFiles[0].path === directoryPath) {
+ const openedFile = openedFiles[0];
+ openedFile.path = newDirPath;
+ dispatch(actions.addToEntryContainer(openedFile));
+ }
+ }
+ dispatch(
+ LocationIndexActions.reflectRenameEntry(directoryPath, newDirPath)
+ );
+ } else {
+ dispatch(actions.reflectRenameEntry(directoryPath, newDirPath));
+ }
+
dispatch(
actions.showNotification(
`Renaming directory ${extractDirectoryName(