Skip to content

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

optimizing the settings conection in the perspectives

Ilian Sapundshieva66e8a1b8084
diff --git a/app/components/FolderContainer.js b/app/components/FolderContainer.js
index 15ae35048..228366e15 100644
--- a/app/components/FolderContainer.js
+++ b/app/components/FolderContainer.js
@@ -134,7 +134,6 @@ type Props = {
currentDirectoryPath: string | null,
searchResultCount: number,
lastSelectedEntry: string | null,
- settings: Object,
addTags: () => void,
removeTags: () => void,
removeAllTags: () => void,
@@ -300,7 +299,6 @@ class FolderContainer extends React.Component<Props, State> {
addTags={this.props.addTags}
editTagForEntry={this.props.editTagForEntry}
deleteDirectory={this.props.deleteDirectory}
- settings={this.props.settings}
removeTags={this.props.removeTags}
removeAllTags={this.props.removeAllTags}
windowWidth={this.props.windowWidth}
@@ -322,7 +320,6 @@ class FolderContainer extends React.Component<Props, State> {
setLastSelectedEntry={this.props.setLastSelectedEntry}
perspectiveCommand={this.state.perspectiveCommand}
deleteDirectory={this.props.deleteDirectory}
- settings={this.props.settings}
addTags={this.props.addTags}
removeTags={this.props.removeTags}
removeAllTags={this.props.removeAllTags}
@@ -436,8 +433,7 @@ function mapStateToProps(state) {
perspectives: getPerspectives(state),
directoryContent: getDirectoryContent(state),
searchResultCount: getSearchResultCount(state),
- isReadOnlyMode: isReadOnlyMode(state),
- settings: state.settings
+ isReadOnlyMode: isReadOnlyMode(state)
};
}
diff --git a/app/perspectives/grid-perspective/src/index.js b/app/perspectives/grid-perspective/src/index.js
index 58440f08a..6d94ba8d3 100644
--- a/app/perspectives/grid-perspective/src/index.js
+++ b/app/perspectives/grid-perspective/src/index.js
@@ -18,6 +18,7 @@
*/
import React from 'react';
+import { connect } from 'react-redux';
import removeMd from 'remove-markdown';
import { withStyles } from '@material-ui/core/styles';
import classNames from 'classnames';
@@ -49,6 +50,11 @@ import {
findColorForFileEntry
} from '../../../services/utils-io';
import { type Tag } from '../../../reducers/taglibrary';
+import {
+ getTagTextColor,
+ getTagColor,
+ getSupportedFileTypes
+} from '../../../reducers/settings';
import { extractTitle } from '../../../utils/paths';
import {
formatFileSize,
@@ -223,7 +229,6 @@ type Props = {
removeAllTags: () => void,
editTagForEntry: () => void,
perspectiveCommand: Object,
- settings: Object,
directoryContent: Array<FileSystemEntry>
};
@@ -762,8 +767,8 @@ class GridPerspective extends React.Component<Props, State> {
renderTag = (tag: Object, fsEntry) => {
return (
<TagContainer
- defaultTextColor={this.props.settings.tagTextColor}
- defaultBackgroundColor={this.props.settings.tagBackgroundColor}
+ defaultTextColor={this.props.tagTextColor}
+ defaultBackgroundColor={this.props.tagBackgroundColor}
tag={tag}
entryPath={fsEntry.path}
handleTagMenu={this.handleTagMenu}
@@ -780,7 +785,7 @@ class GridPerspective extends React.Component<Props, State> {
const fsEntryColor = findColorForFileEntry(
fsEntry.extension,
fsEntry.isFile,
- this.props.settings.supportedFileTypes
+ this.props.supportedFileTypes
);
let thumbPathUrl = fsEntry.thumbPath
? 'url("' + fsEntry.thumbPath + '")'
@@ -1202,4 +1207,14 @@ class GridPerspective extends React.Component<Props, State> {
}
}
-export default withStyles(styles)(GridPerspective);
+function mapStateToProps(state) {
+ return {
+ tagTextColor: getTagTextColor(state),
+ tagBackgroundColor: getTagColor(state),
+ supportedFileTypes: getSupportedFileTypes(state)
+ };
+}
+
+export default connect(mapStateToProps)(
+ withStyles(styles)(GridPerspective)
+);