TagSpaces is an offline, open source, document manager with tagging support
typescript migration
Ilian Sapundshievf98032b54590
diff --git a/app/components/EntryContainer.tsx b/app/components/EntryContainer.tsxindex 5f2aae93e..18e3ad287 100644--- a/app/components/EntryContainer.tsx+++ b/app/components/EntryContainer.tsx@@ -1,3 +1,4 @@+// @ts-nocheck/*** TagSpaces - universal file and folder organizer* Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)@@ -46,7 +47,8 @@ import PlatformIO from '../services/platform-io';import AddRemoveTagsDialog from './dialogs/AddRemoveTagsDialog';import {// getAllPropertiesPromise,- openLinkExternally, FileSystemEntry+ openLinkExternally,+ FileSystemEntry} from '../services/utils-io';import i18n from '../services/i18n';import {@@ -76,13 +78,13 @@ import {const defaultSplitSize = 103;const openedSplitSize = 360;const fullSplitSize = 600;-const maxCharactersTitleLength = 50;+// const maxCharactersTitleLength = 50;const bufferedSplitResize = buffer({timeout: 300,id: 'buffered-split-resize'});-const styles = theme => ({+const styles: any = (theme: any) => ({panel: {width: '100%',flexDirection: 'column',@@ -164,54 +166,55 @@ const styles = theme => ({}});-type Props = {- classes: any,- openedFiles: Array<OpenedEntry>,- settings: any,- keyBindings: any,- closeAllFiles: () => void,- renameFile: () => void,- renameDirectory: () => void,- addTags: () => void,- removeTags: () => void,- editTagForEntry: () => void,- openFile: (filePath: string) => void,- getNextFile: (path: string) => string,- getPrevFile: (path: string) => string,- openFileNatively: (path: string) => void,+interface Props {+ classes: any;+ theme: any;+ openedFiles: Array<OpenedEntry>;+ settings: any;+ keyBindings: any;+ closeAllFiles: () => void;+ renameFile: () => void;+ renameDirectory: () => void;+ addTags: () => void;+ removeTags: () => void;+ editTagForEntry: () => void;+ openFile: (filePath: string) => void;+ getNextFile: (path: string) => string;+ getPrevFile: (path: string) => string;+ openFileNatively: (path: string) => void;showNotification: (text: string,notificationType?: string, // NotificationTypesautohide?: boolean- ) => void,- removeAllTags: () => void,- deleteFile: (path: string) => void,- toggleEntryFullWidth: () => void,- isReadOnlyMode: boolean,- setEntryPropertiesSplitSize: (size: number) => void,- reflectUpdateSidecarMeta: (path: string, entryMeta: Object) => void,- updateThumbnailUrl: (path: string, thumbUrl: string) => void,- setLastSelectedEntry: (path: string) => void,- setSelectedEntries: (selectedEntries: Array<Object>) => void,- directoryContent: Array<Object>-};+ ) => void;+ removeAllTags: () => void;+ deleteFile: (path: string) => void;+ toggleEntryFullWidth: () => void;+ isReadOnlyMode: boolean;+ setEntryPropertiesSplitSize: (size: number) => void;+ reflectUpdateSidecarMeta: (path: string, entryMeta: Object) => void;+ updateThumbnailUrl: (path: string, thumbUrl: string) => void;+ setLastSelectedEntry: (path: string) => void;+ setSelectedEntries: (selectedEntries: Array<Object>) => void;+ directoryContent: Array<Object>;+}-type State = {- isPropertiesPanelVisible?: boolean,- isFullscreen: boolean,- currentEntry?: OpenedEntry | null,- entryProps?: Object | null,- editingSupported?: boolean,- isSaveBeforeCloseConfirmDialogOpened?: boolean,- isSaveBeforeReloadConfirmDialogOpened?: boolean,- openedSplitSize?: number,- isEditTagsModalOpened?: boolean,- selectedItem?: Object,- isDeleteEntryModalOpened?: boolean,- shouldCopyFile?: boolean,- entryPropertiesSplitSize?: number,- EntryPropertiesKey: string-};+interface State {+ isPropertiesPanelVisible?: boolean;+ isFullscreen: boolean;+ currentEntry?: OpenedEntry | null;+ entryProps?: any | null;+ editingSupported?: boolean;+ isSaveBeforeCloseConfirmDialogOpened?: boolean;+ isSaveBeforeReloadConfirmDialogOpened?: boolean;+ openedSplitSize?: number;+ isEditTagsModalOpened?: boolean;+ selectedItem?: any;+ isDeleteEntryModalOpened?: boolean;+ shouldCopyFile?: boolean;+ entryPropertiesSplitSize?: number;+ EntryPropertiesKey: string;+}class EntryContainer extends React.Component<Props, State> {state = {@@ -696,7 +699,7 @@ class EntryContainer extends React.Component<Props, State> {if (this.state.currentEntry && this.state.currentEntry.path) {const prevFilePath = this.props.getPrevFile(this.state.currentEntry.path);const prevFile = this.props.directoryContent.filter(- (entry: FileSystemEntry) => entry.path === prevFilePath+ (entry: FileSystemEntry) => entry.path === prevFilePath);this.props.openFile(prevFilePath);this.props.setLastSelectedEntry(prevFilePath);diff --git a/app/components/EntryProperties.tsx b/app/components/EntryProperties.tsxindex 270a92646..79ddff360 100644--- a/app/components/EntryProperties.tsx+++ b/app/components/EntryProperties.tsx@@ -1,3 +1,4 @@+// @ts-nocheck/*** TagSpaces - universal file and folder organizer* Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)@@ -54,7 +55,7 @@ import {const ThumbnailChooserDialog =Pro && Pro.UI ? Pro.UI.ThumbnailChooserDialog : false;-const styles = theme => ({+const styles: any = (theme: any) => ({entryProperties: {overflowY: AppConfig.isFirefox ? 'auto' : 'overlay',padding: 10,@@ -155,51 +156,53 @@ marked.setOptions({xhtml: true});-type Props = {- classes: Object,- entryPath: string,- shouldReload: boolean | null,- shouldCopyFile: boolean,- editTagForEntry: () => void,- renameFile: (path: string, nextPath: string) => void,- renameDirectory: (path: string, nextPath: string) => void,- normalizeShouldCopyFile: () => void,- showNotification: (message: string) => void,- reflectUpdateSidecarMeta: (path: string, entryMeta: Object) => void,- updateThumbnailUrl: (path: string, thumbUrl: string) => void,- addTags: () => void,- removeTags: () => void,- removeAllTags: () => void,- resetState: (stateName: string) => void,- isReadOnlyMode: boolean,- setPropertiesEditMode: (editMode: boolean) => void-};--type State = {- name: string,- originalName: string,- description: string,- color: string,- path: string,- tagMenuAnchorEl: boolean | null,- tagMenuOpened: boolean | null,- isEditTagDialogOpened: boolean | null,- isDeleteTagDialogOpened: boolean,- isFileThumbChooseDialogOpened: boolean,- isMoveCopyFilesDialogOpened: boolean,- isEditName: boolean,- isEditDescription: boolean,- displayColorPicker: boolean,- thumbPath: string,- isFile: boolean-};+interface Props {+ classes: any;+ entryPath: string;+ shouldReload: boolean | null;+ shouldCopyFile: boolean;+ editTagForEntry: () => void;+ renameFile: (path: string, nextPath: string) => void;+ renameDirectory: (path: string, nextPath: string) => void;+ normalizeShouldCopyFile: () => void;+ showNotification: (message: string) => void;+ reflectUpdateSidecarMeta: (path: string, entryMeta: Object) => void;+ updateThumbnailUrl: (path: string, thumbUrl: string) => void;+ addTags: () => void;+ removeTags: () => void;+ removeAllTags: () => void;+ resetState: (stateName: string) => void;+ isReadOnlyMode: boolean;+ setPropertiesEditMode: (editMode: boolean) => void;+}++interface State {+ name: string;+ originalName: string;+ description: string;+ color: string;+ path: string;+ size: number;+ tag: any;+ tagMenuAnchorEl: boolean | null;+ tagMenuOpened: boolean | null;+ isEditTagDialogOpened: boolean | null;+ isDeleteTagDialogOpened: boolean;+ isFileThumbChooseDialogOpened: boolean;+ isMoveCopyFilesDialogOpened: boolean;+ isEditName: boolean;+ isEditDescription: boolean;+ displayColorPicker: boolean;+ thumbPath: string;+ isFile: boolean;+}class EntryProperties extends Component<Props, State> {state = {name: '',originalName: '',description: '',- size: '',+ size: 0,color: '#3498db',path: '',tagMenuAnchorEl: null,@@ -215,6 +218,9 @@ class EntryProperties extends Component<Props, State> {isFile: false};+ fileName: any;+ fileDescription: any;+componentDidMount() {this.loadEntryProperties(this.props.entryPath);}@@ -473,7 +479,7 @@ class EntryProperties extends Component<Props, State> {});};- handleTagMenu = (event: Object, tag, tagGroup) => {+ handleTagMenu = (event: any, tag, tagGroup) => {this.setState({tagMenuOpened: true,tagMenuAnchorEl: event.currentTarget,@@ -484,7 +490,7 @@ class EntryProperties extends Component<Props, State> {handleCloseTagMenu = () => this.setState({ tagMenuOpened: false });- handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {+ handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {const target = event.target;const value = target.type === 'checkbox' ? target.checked : target.value;const name = target.name;diff --git a/app/components/FileSourceDnd.tsx b/app/components/FileSourceDnd.tsxindex defd9e97f..6776f78e9 100644--- a/app/components/FileSourceDnd.tsx+++ b/app/components/FileSourceDnd.tsx@@ -21,20 +21,20 @@ import { DragSource } from 'react-dnd';import { ConnectDragSource } from 'react-dnd';import DragItemTypes from './DragItemTypes';-type Props = {- children: Array<Object>;- connectDragSource: ConnectDragSource;-};+interface Props {+ children: Array<Object>;+ connectDragSource: ConnectDragSource;+}const boxSource = {- beginDrag(props) {- // console.log('beginDrag', props);- return {- path: props.children.props.entryPath- };- }+ beginDrag(props) {+ // console.log('beginDrag', props);+ return {+ path: props.children.props.entryPath+ };+ }- /* endDrag(props, monitor) {+ /* endDrag(props, monitor) {const item = monitor.getItem();const dropResult = monitor.getDropResult();@@ -51,13 +51,13 @@ const boxSource = {};const FileSourceDnd = (props: Props) =>- props.connectDragSource(<span>{props.children}</span>);+ props.connectDragSource(<span>{props.children}</span>);export default DragSource(- DragItemTypes.FILE,- boxSource,- (connect, monitor) => ({- connectDragSource: connect.dragSource(),- isDragging: monitor.isDragging()- })+ DragItemTypes.FILE,+ boxSource,+ (connect, monitor) => ({+ connectDragSource: connect.dragSource(),+ isDragging: monitor.isDragging()+ }))(FileSourceDnd);diff --git a/app/components/FolderContainer.tsx b/app/components/FolderContainer.tsxindex 76c2200dc..c779da048 100644--- a/app/components/FolderContainer.tsx+++ b/app/components/FolderContainer.tsx@@ -1,3 +1,4 @@+// @ts-nocheck/*** TagSpaces - universal file and folder organizer* Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)@@ -29,18 +30,18 @@ import LocationMenu from './menus/LocationMenu';import DirectoryMenu from './menus/DirectoryMenu';import i18n from '../services/i18n';import {- getPerspectives,- getMaxSearchResults,- getDesktopMode+ getPerspectives,+ getMaxSearchResults,+ getDesktopMode} from '../reducers/settings';import {- actions as AppActions,- getDirectoryContent,- getDirectoryPath,- getLastSelectedEntry,- getSearchResultCount,- isReadOnlyMode,- getCurrentLocationPath+ actions as AppActions,+ getDirectoryContent,+ getDirectoryPath,+ getLastSelectedEntry,+ getSearchResultCount,+ isReadOnlyMode,+ getCurrentLocationPath} from '../reducers/app';import TaggingActions from '../reducers/tagging-actions';import { normalizePath, extractShortDirectoryName } from '../utils/paths';@@ -49,498 +50,494 @@ import LoadingLazy from '../components/LoadingLazy';import { Pro } from '../pro';const GridPerspective = React.lazy(() =>- import(- /* webpackChunkName: "GridPerspective" */ '../perspectives/grid-perspective/'- )+ import(+ /* webpackChunkName: "GridPerspective" */ '../perspectives/grid-perspective/'+ ));const GridPerspectiveAsync = props => (- <React.Suspense fallback={<LoadingLazy />}>- <GridPerspective {...props} />- </React.Suspense>+ <React.Suspense fallback={<LoadingLazy />}>+ <GridPerspective {...props} />+ </React.Suspense>);let GalleryPerspective = React.Fragment;if (Pro && Pro.Perspectives && Pro.Perspectives.GalleryPerspective) {- // GalleryPerspective = React.lazy(() => import(/* webpackChunkName: "GalleryPerspective" */ '../node_modules/@tagspaces/pro/modules/perspectives/gallery'));- GalleryPerspective = Pro.Perspectives.GalleryPerspective;+ // GalleryPerspective = React.lazy(() => import(/* webpackChunkName: "GalleryPerspective" */ '../node_modules/@tagspaces/pro/modules/perspectives/gallery'));+ GalleryPerspective = Pro.Perspectives.GalleryPerspective;}const GalleryPerspectiveAsync = props => (- <React.Suspense fallback={<LoadingLazy />}>- <GalleryPerspective {...props} />- </React.Suspense>+ <React.Suspense fallback={<LoadingLazy />}>+ <GalleryPerspective {...props} />+ </React.Suspense>);let MapiquePerspective = React.Fragment;if (Pro && Pro.Perspectives && Pro.Perspectives.MapiquePerspective) {- // MapiquePerspective = React.lazy(() => import(/* webpackChunkName: "MapiquePerspective" */ '../node_modules/@tagspaces/pro/modules/perspectives/mapique'));- MapiquePerspective = Pro.Perspectives.MapiquePerspective;+ // MapiquePerspective = React.lazy(() => import(/* webpackChunkName: "MapiquePerspective" */ '../node_modules/@tagspaces/pro/modules/perspectives/mapique'));+ MapiquePerspective = Pro.Perspectives.MapiquePerspective;}const MapiquePerspectiveAsync = props => (- <React.Suspense fallback={<LoadingLazy />}>- <MapiquePerspective {...props} />- </React.Suspense>+ <React.Suspense fallback={<LoadingLazy />}>+ <MapiquePerspective {...props} />+ </React.Suspense>);let TreeVizPerspective = React.Fragment;if (Pro && Pro.Perspectives && Pro.Perspectives.TreeVizPerspective) {- // TreeVizPerspective = React.lazy(() => import(/* webpackChunkName: "TreeVizPerspective" */ '../node_modules/@tagspaces/pro/modules/perspectives/treeviz'));- TreeVizPerspective = Pro.Perspectives.TreeVizPerspective;+ // TreeVizPerspective = React.lazy(() => import(/* webpackChunkName: "TreeVizPerspective" */ '../node_modules/@tagspaces/pro/modules/perspectives/treeviz'));+ TreeVizPerspective = Pro.Perspectives.TreeVizPerspective;}const TreeVizPerspectiveAsync = props => (- <React.Suspense fallback={<LoadingLazy />}>- <TreeVizPerspective {...props} />- </React.Suspense>+ <React.Suspense fallback={<LoadingLazy />}>+ <TreeVizPerspective {...props} />+ </React.Suspense>);const WelcomePanel = React.lazy(() =>- import(/* webpackChunkName: "WelcomePanel" */ './WelcomePanel')+ import(/* webpackChunkName: "WelcomePanel" */ './WelcomePanel'));const WelcomePanelAsync = props => (- <React.Suspense fallback={<LoadingLazy />}>- <WelcomePanel {...props} />- </React.Suspense>+ <React.Suspense fallback={<LoadingLazy />}>+ <WelcomePanel {...props} />+ </React.Suspense>);const CounterBadge = withStyles(theme => ({- badge: {- top: '50%',- right: -15,- color:- theme.palette.type === 'light'- ? theme.palette.grey[900]- : theme.palette.grey[200],- backgroundColor:- theme.palette.type === 'light'- ? theme.palette.grey[200]- : theme.palette.grey[900]- }+ badge: {+ top: '50%',+ right: -15,+ color:+ theme.palette.type === 'light'+ ? theme.palette.grey[900]+ : theme.palette.grey[200],+ backgroundColor:+ theme.palette.type === 'light'+ ? theme.palette.grey[200]+ : theme.palette.grey[900]+ }}))(Badge);-const styles = theme => ({- mainPanel: {- flex: '1 1 100%',- width: '100%',- height: '100%',- maxHeight: '100%',- overflow: 'hidden',- backgroundColor: theme.palette.background.default,- display: 'flex',- flexDirection: 'column'- },- toolbar: {- paddingLeft: 5,- paddingRight: 5,- paddingTop: 5,- display: 'flex',- justifyContent: 'center'- },- topPanel: {- height: 50,- width: '100%',- overflowX: 'overlay',- backgroundColor: theme.palette.background.default- },- centerPanel: {- flex: '1 1 auto',- width: '100%',- backgroundColor: theme.palette.background.default- },- flexMiddle: {- flex: '1 1 10%',- display: 'flex',- flexDirection: 'column'- },- folderButton: {- minWidth: 30,- whiteSpace: 'nowrap',- paddingLeft: 3,- paddingRight: 3,- margin: '0 auto'- },- locationSelectorButton: {- whiteSpace: 'nowrap',- paddingLeft: 10,- paddingRight: 10,- alignItems: 'center'- }+const styles: any = (theme: any) => ({+ mainPanel: {+ flex: '1 1 100%',+ width: '100%',+ height: '100%',+ maxHeight: '100%',+ overflow: 'hidden',+ backgroundColor: theme.palette.background.default,+ display: 'flex',+ flexDirection: 'column'+ },+ toolbar: {+ paddingLeft: 5,+ paddingRight: 5,+ paddingTop: 5,+ display: 'flex',+ justifyContent: 'center'+ },+ topPanel: {+ height: 50,+ width: '100%',+ overflowX: 'overlay',+ backgroundColor: theme.palette.background.default+ },+ centerPanel: {+ flex: '1 1 auto',+ width: '100%',+ backgroundColor: theme.palette.background.default+ },+ flexMiddle: {+ flex: '1 1 10%',+ display: 'flex',+ flexDirection: 'column'+ },+ folderButton: {+ minWidth: 30,+ whiteSpace: 'nowrap',+ paddingLeft: 3,+ paddingRight: 3,+ margin: '0 auto'+ },+ locationSelectorButton: {+ whiteSpace: 'nowrap',+ paddingLeft: 10,+ paddingRight: 10,+ alignItems: 'center'+ }});interface Props {- classes: Object;- windowHeight: number;- windowWidth: number;- directoryContent: Array<Object>;- currentDirectoryPath: string | null;- searchResultCount: number;- addTags: () => void;- removeTags: () => void;- removeAllTags: () => void;- editTagForEntry: () => void;- openFileNatively: (path: string) => void;- toggleCreateFileDialog: () => void;- deleteFile: () => void;- renameFile: () => void;- openDirectory: () => void;- showInFileManager: () => void;- openFile: (path: string) => void;- deleteDirectory: (path: string) => void;- reflectCreateEntry: (path: string, isFile: boolean) => void;- loadDirectoryContent: (path: string) => void;- loadParentDirectoryContent: () => void;- setLastSelectedEntry: (entryPath: string | null) => void;- isReadOnlyMode: boolean;- isDesktopMode: boolean;- showNotification: (content: string) => void;- openSearchPanel: () => void;- showDrawer: () => void;- maxSearchResults: number;+ classes: any;+ windowHeight: number;+ windowWidth: number;+ directoryContent: Array<Object>;+ currentDirectoryPath: string | null;+ searchResultCount: number;+ addTags: () => void;+ removeTags: () => void;+ removeAllTags: () => void;+ editTagForEntry: () => void;+ openFileNatively: (path: string) => void;+ toggleCreateFileDialog: () => void;+ deleteFile: () => void;+ renameFile: () => void;+ openDirectory: () => void;+ showInFileManager: () => void;+ openFile: (path: string) => void;+ deleteDirectory: (path: string) => void;+ reflectCreateEntry: (path: string, isFile: boolean) => void;+ loadDirectoryContent: (path: string) => void;+ loadParentDirectoryContent: () => void;+ setLastSelectedEntry: (entryPath: string | null) => void;+ isReadOnlyMode: boolean;+ isDesktopMode: boolean;+ showNotification: (content: string) => void;+ openSearchPanel: () => void;+ showDrawer: () => void;+ maxSearchResults: number;}interface State {- currentPerspective: string;- currentPath?: string;- pathParts?: Array<string>;- isPropertiesPanelVisible?: boolean;- locationChooserMenuOpened?: boolean;- locationChooserMenuAnchorEl?: null | Object;- directoryMenuOpened?: boolean;- directoryMenuAnchorEl?: null | Object;- perspectiveChooserMenuOpened?: boolean;- perspectiveChooserMenuAnchorEl?: null | Object;- directoryContextMenuOpened: boolean;- directoryContextMenuAnchorEl: null | Object;- perspectiveCommand?: null | Object;+ currentPerspective: string;+ currentPath?: string;+ pathParts?: Array<string>;+ isPropertiesPanelVisible?: boolean;+ locationChooserMenuOpened?: boolean;+ locationChooserMenuAnchorEl?: null | Object;+ directoryMenuOpened?: boolean;+ directoryMenuAnchorEl?: null | Object;+ perspectiveChooserMenuOpened?: boolean;+ perspectiveChooserMenuAnchorEl?: null | Object;+ directoryContextMenuOpened: boolean;+ directoryContextMenuAnchorEl: null | Object;+ perspectiveCommand?: null | Object;}class FolderContainer extends React.Component<Props, State> {- state = {- currentPerspective: window.ExtDefaultPerspective || 'default',- currentPath: '',- pathParts: [],- isPropertiesPanelVisible: false,- isDirectoryMenuOpened: false,- directoryContextMenuOpened: false,- directoryContextMenuAnchorEl: null,- perspectiveChooserMenuOpened: false,- perspectiveChooserMenuAnchorEl: null,- perspectiveCommand: null- };+ state = {+ currentPerspective: window.ExtDefaultPerspective || 'default',+ currentPath: '',+ pathParts: [],+ isPropertiesPanelVisible: false,+ isDirectoryMenuOpened: false,+ directoryContextMenuOpened: false,+ directoryContextMenuAnchorEl: null,+ perspectiveChooserMenuOpened: false,+ perspectiveChooserMenuAnchorEl: null,+ perspectiveCommand: null+ };- static getDerivedStateFromProps(nextProps, prevState) {- if (- nextProps.currentDirectoryPath &&- prevState.currentPath !== nextProps.currentDirectoryPath- ) {- let currentLocationPath = '';- if (nextProps.currentLocationPath) {- currentLocationPath = nextProps.currentLocationPath;- }- // Make the path unix like ending always with /- const addSlash = PlatformIO.haveObjectStoreSupport() ? '//' : '/';- let normalizedCurrentPath =- addSlash +- normalizePath(nextProps.currentDirectoryPath.split('\\').join('/'));- const normalizedCurrentLocationPath =- addSlash + normalizePath(currentLocationPath.split('\\').join('/'));- // console.log('Current path : ' + normalizedCurrentPath);- // console.log('Current location path : ' + normalizedCurrentLocationPath);- let pathParts = [];- while (- normalizedCurrentPath.lastIndexOf('/') > 0 &&- normalizedCurrentPath.startsWith(normalizedCurrentLocationPath)- ) {- pathParts.push(- normalizedCurrentPath.substring(- PlatformIO.haveObjectStoreSupport() ? 2 : 1- )- );- normalizedCurrentPath = normalizedCurrentPath.substring(- 0,- normalizedCurrentPath.lastIndexOf('/')- );- }- // console.log('Path parts : ' + JSON.stringify(pathParts));- if (pathParts.length >= 1) {- pathParts = pathParts.slice(1, pathParts.length); // remove current directory- }- pathParts = pathParts.reverse();- if (pathParts.length > 2) {- pathParts = pathParts.slice(pathParts.length - 2, pathParts.length); // leave only the last 2 dirs in the path- }- return {- ...prevState,- currentPath: nextProps.currentDirectoryPath,- pathParts- };- }- return null;- }+ static getDerivedStateFromProps(nextProps, prevState) {+ if (+ nextProps.currentDirectoryPath &&+ prevState.currentPath !== nextProps.currentDirectoryPath+ ) {+ let currentLocationPath = '';+ if (nextProps.currentLocationPath) {+ currentLocationPath = nextProps.currentLocationPath;+ }+ // Make the path unix like ending always with /+ const addSlash = PlatformIO.haveObjectStoreSupport() ? '//' : '/';+ let normalizedCurrentPath =+ addSlash ++ normalizePath(nextProps.currentDirectoryPath.split('\\').join('/'));+ const normalizedCurrentLocationPath =+ addSlash + normalizePath(currentLocationPath.split('\\').join('/'));+ // console.log('Current path : ' + normalizedCurrentPath);+ // console.log('Current location path : ' + normalizedCurrentLocationPath);+ let pathParts = [];+ while (+ normalizedCurrentPath.lastIndexOf('/') > 0 &&+ normalizedCurrentPath.startsWith(normalizedCurrentLocationPath)+ ) {+ pathParts.push(+ normalizedCurrentPath.substring(+ PlatformIO.haveObjectStoreSupport() ? 2 : 1+ )+ );+ normalizedCurrentPath = normalizedCurrentPath.substring(+ 0,+ normalizedCurrentPath.lastIndexOf('/')+ );+ }+ // console.log('Path parts : ' + JSON.stringify(pathParts));+ if (pathParts.length >= 1) {+ pathParts = pathParts.slice(1, pathParts.length); // remove current directory+ }+ pathParts = pathParts.reverse();+ if (pathParts.length > 2) {+ pathParts = pathParts.slice(pathParts.length - 2, pathParts.length); // leave only the last 2 dirs in the path+ }+ return {+ ...prevState,+ currentPath: nextProps.currentDirectoryPath,+ pathParts+ };+ }+ return null;+ }- openDirectoryMenu = (event: React.ChangeEvent<HTMLInputElement>) => {- this.setState({- directoryContextMenuOpened: true,- directoryContextMenuAnchorEl: event ? event.currentTarget : null- });- };+ openDirectoryMenu = (event: React.ChangeEvent<HTMLInputElement>) => {+ this.setState({+ directoryContextMenuOpened: true,+ directoryContextMenuAnchorEl: event ? event.currentTarget : null+ });+ };- closeDirectoryMenu = () => {- this.setState({- directoryContextMenuOpened: false,- directoryContextMenuAnchorEl: null- });- };+ closeDirectoryMenu = () => {+ this.setState({+ directoryContextMenuOpened: false,+ directoryContextMenuAnchorEl: null+ });+ };- switchPerspective = (perspectiveId: string) => {- if (!Pro) {- this.props.showNotification(i18n.t('core:needProVersion'));- return;- }- this.setState({- currentPerspective: perspectiveId || 'default'- });- };+ switchPerspective = (perspectiveId: string) => {+ if (!Pro) {+ this.props.showNotification(i18n.t('core:needProVersion'));+ return;+ }+ this.setState({+ currentPerspective: perspectiveId || 'default'+ });+ };- togglePerspectiveChooserClose = (event?: Object) => {- this.setState({- perspectiveChooserMenuOpened: !this.state.perspectiveChooserMenuOpened,- perspectiveChooserMenuAnchorEl: event ? event.currentTarget : null- });- };+ togglePerspectiveChooserClose = (event?: any) => {+ this.setState({+ perspectiveChooserMenuOpened: !this.state.perspectiveChooserMenuOpened,+ perspectiveChooserMenuAnchorEl: event ? event.currentTarget : null+ });+ };- renderPerspective() {- if (- !this.props.currentDirectoryPath ||- this.props.currentDirectoryPath.length < 2- ) {- return <WelcomePanelAsync />;- } else if (this.state.currentPerspective === 'gallery') {- return (- <GalleryPerspectiveAsync- directoryContent={this.props.directoryContent}- currentDirectoryPath={this.props.currentDirectoryPath}- windowWidth={this.props.windowWidth}- switchPerspective={this.switchPerspective}- />- );- } else if (this.state.currentPerspective === 'treeviz') {- return (- <TreeVizPerspectiveAsync- directoryContent={this.props.directoryContent}- currentDirectoryPath={this.props.currentDirectoryPath}- windowWidth={this.props.windowWidth}- switchPerspective={this.switchPerspective}- />- );- } else if (this.state.currentPerspective === 'mapique') {- return (- <MapiquePerspectiveAsync- directoryContent={this.props.directoryContent}- currentDirectoryPath={this.props.currentDirectoryPath}- windowWidth={this.props.windowWidth}- switchPerspective={this.switchPerspective}- />- );- }- // else if (this.state.currentPerspective === 'default') {- return (- <GridPerspectiveAsync- directoryContent={this.props.directoryContent}- loadDirectoryContent={this.props.loadDirectoryContent}- openFile={this.props.openFile}- loadParentDirectoryContent={this.props.loadParentDirectoryContent}- deleteFile={this.props.deleteFile}- renameFile={this.props.renameFile}- openDirectory={this.props.openDirectory}- showInFileManager={this.props.showInFileManager}- currentDirectoryPath={this.props.currentDirectoryPath}- setLastSelectedEntry={this.props.setLastSelectedEntry}- perspectiveCommand={this.state.perspectiveCommand}- addTags={this.props.addTags}- editTagForEntry={this.props.editTagForEntry}- deleteDirectory={this.props.deleteDirectory}- removeTags={this.props.removeTags}- removeAllTags={this.props.removeAllTags}- windowWidth={this.props.windowWidth}- />- );- }+ renderPerspective() {+ if (+ !this.props.currentDirectoryPath ||+ this.props.currentDirectoryPath.length < 2+ ) {+ return <WelcomePanelAsync />;+ } else if (this.state.currentPerspective === 'gallery') {+ return (+ <GalleryPerspectiveAsync+ directoryContent={this.props.directoryContent}+ currentDirectoryPath={this.props.currentDirectoryPath}+ windowWidth={this.props.windowWidth}+ switchPerspective={this.switchPerspective}+ />+ );+ } else if (this.state.currentPerspective === 'treeviz') {+ return (+ <TreeVizPerspectiveAsync+ directoryContent={this.props.directoryContent}+ currentDirectoryPath={this.props.currentDirectoryPath}+ windowWidth={this.props.windowWidth}+ switchPerspective={this.switchPerspective}+ />+ );+ } else if (this.state.currentPerspective === 'mapique') {+ return (+ <MapiquePerspectiveAsync+ directoryContent={this.props.directoryContent}+ currentDirectoryPath={this.props.currentDirectoryPath}+ windowWidth={this.props.windowWidth}+ switchPerspective={this.switchPerspective}+ />+ );+ }+ // else if (this.state.currentPerspective === 'default') {+ return (+ <GridPerspectiveAsync+ directoryContent={this.props.directoryContent}+ loadDirectoryContent={this.props.loadDirectoryContent}+ openFile={this.props.openFile}+ loadParentDirectoryContent={this.props.loadParentDirectoryContent}+ deleteFile={this.props.deleteFile}+ renameFile={this.props.renameFile}+ openDirectory={this.props.openDirectory}+ showInFileManager={this.props.showInFileManager}+ currentDirectoryPath={this.props.currentDirectoryPath}+ setLastSelectedEntry={this.props.setLastSelectedEntry}+ perspectiveCommand={this.state.perspectiveCommand}+ addTags={this.props.addTags}+ editTagForEntry={this.props.editTagForEntry}+ deleteDirectory={this.props.deleteDirectory}+ removeTags={this.props.removeTags}+ removeAllTags={this.props.removeAllTags}+ windowWidth={this.props.windowWidth}+ />+ );+ }- render() {- const {- currentDirectoryPath = '',- loadDirectoryContent,- searchResultCount,- classes,- maxSearchResults,- openSearchPanel,- showDrawer,- isDesktopMode,- loadParentDirectoryContent- } = this.props;- const normalizedCurrentDirPath = normalizePath(- currentDirectoryPath.split('\\').join('/')- );- let searchResultCounterText = searchResultCount + ' ' + i18n.t('entries');- if (searchResultCount >= maxSearchResults) {- searchResultCounterText =- 'More than ' +- (maxSearchResults - 1) +- ' entries found, showing only the first ' +- maxSearchResults;- }- return (- <div>- <div className={classes.mainPanel}>- <div className={classes.topPanel}>- <div className={classes.toolbar}>- {isDesktopMode ? (- <LocationMenu />- ) : (- <Button- id="mobileMenuButton"- style={{ marginLeft: -8 }}- onClick={showDrawer}- >- <MenuIcon />- </Button>- )}- <CounterBadge- showZero={true}- title={searchResultCounterText}- badgeContent={searchResultCount}- color="secondary"- max={maxSearchResults - 1}- onClick={() => {- openSearchPanel();- }}- />- <div className={classes.flexMiddle} />- {currentDirectoryPath && (- <React.Fragment>- {isDesktopMode &&- this.state.pathParts &&- this.state.pathParts.map(pathPart => (- <Button- key={pathPart}- onClick={() => loadDirectoryContent(pathPart)}- title={'Navigate to: ' + pathPart}- style={{- paddingLeft: 3,- paddingRight: 0,- minWidth: 10- }}- >- {extractShortDirectoryName(pathPart, '/')}- / - </Button>- ))}- {!isDesktopMode &&- this.state.pathParts &&- this.state.pathParts.length > 0 && (- <React.Fragment>- <Button- onClick={loadParentDirectoryContent}- data-tid="openParentDirectory"- style={{ paddingLeft: 3, paddingRight: 0 }}- >- <BackButtonIcon />- </Button>- </React.Fragment>- )}- <Button- data-tid="folderContainerOpenDirMenu"- title={- i18n.t('core:openDirectoryMenu') +- ' - ' +- (currentDirectoryPath || '')- }- className={classes.folderButton}- onClick={this.openDirectoryMenu}- onContextMenu={this.openDirectoryMenu}- >- {extractShortDirectoryName(- normalizePath(normalizedCurrentDirPath),- '/'- )}- <MoreVertIcon />- </Button>- <DirectoryMenu- open={this.state.directoryContextMenuOpened}- onClose={this.closeDirectoryMenu}- anchorEl={this.state.directoryContextMenuAnchorEl}- directoryPath={currentDirectoryPath}- loadDirectoryContent={this.props.loadDirectoryContent}- openFileNatively={this.props.openFileNatively}- openDirectory={this.props.openDirectory}- loadParentDirectoryContent={loadParentDirectoryContent}- showInFileManager={this.props.showInFileManager}- reflectCreateEntry={this.props.reflectCreateEntry}- openFile={this.props.openFile}- toggleCreateFileDialog={this.props.toggleCreateFileDialog}- deleteDirectory={this.props.deleteDirectory}- showNotification={this.props.showNotification}- switchPerspective={this.switchPerspective}- isReadOnlyMode={this.props.isReadOnlyMode}- />- </React.Fragment>- )}- </div>- </div>- <div- className={classes.centerPanel}- style={{ height: this.props.windowHeight }}- >- {this.renderPerspective()}- </div>- </div>- </div>- );- }+ render() {+ const {+ currentDirectoryPath = '',+ loadDirectoryContent,+ searchResultCount,+ classes,+ maxSearchResults,+ openSearchPanel,+ showDrawer,+ isDesktopMode,+ loadParentDirectoryContent+ } = this.props;+ const normalizedCurrentDirPath = normalizePath(+ currentDirectoryPath.split('\\').join('/')+ );+ let searchResultCounterText = searchResultCount + ' ' + i18n.t('entries');+ if (searchResultCount >= maxSearchResults) {+ searchResultCounterText =+ 'More than ' ++ (maxSearchResults - 1) ++ ' entries found, showing only the first ' ++ maxSearchResults;+ }+ return (+ <div>+ <div className={classes.mainPanel}>+ <div className={classes.topPanel}>+ <div className={classes.toolbar}>+ {isDesktopMode ? (+ <LocationMenu />+ ) : (+ <Button+ id="mobileMenuButton"+ style={{ marginLeft: -8 }}+ onClick={showDrawer}+ >+ <MenuIcon />+ </Button>+ )}+ <CounterBadge+ showZero={true}+ title={searchResultCounterText}+ badgeContent={searchResultCount}+ color="secondary"+ max={maxSearchResults - 1}+ onClick={() => {+ openSearchPanel();+ }}+ />+ <div className={classes.flexMiddle} />+ {currentDirectoryPath && (+ <React.Fragment>+ {isDesktopMode &&+ this.state.pathParts &&+ this.state.pathParts.map(pathPart => (+ <Button+ key={pathPart}+ onClick={() => loadDirectoryContent(pathPart)}+ title={'Navigate to: ' + pathPart}+ style={{+ paddingLeft: 3,+ paddingRight: 0,+ minWidth: 10+ }}+ >+ {extractShortDirectoryName(pathPart, '/')}+ / + </Button>+ ))}+ {!isDesktopMode &&+ this.state.pathParts &&+ this.state.pathParts.length > 0 && (+ <React.Fragment>+ <Button+ onClick={loadParentDirectoryContent}+ data-tid="openParentDirectory"+ style={{ paddingLeft: 3, paddingRight: 0 }}+ >+ <BackButtonIcon />+ </Button>+ </React.Fragment>+ )}+ <Button+ data-tid="folderContainerOpenDirMenu"+ title={+ i18n.t('core:openDirectoryMenu') ++ ' - ' ++ (currentDirectoryPath || '')+ }+ className={classes.folderButton}+ onClick={this.openDirectoryMenu}+ onContextMenu={this.openDirectoryMenu}+ >+ {extractShortDirectoryName(+ normalizePath(normalizedCurrentDirPath),+ '/'+ )}+ <MoreVertIcon />+ </Button>+ <DirectoryMenu+ open={this.state.directoryContextMenuOpened}+ onClose={this.closeDirectoryMenu}+ anchorEl={this.state.directoryContextMenuAnchorEl}+ directoryPath={currentDirectoryPath}+ loadDirectoryContent={this.props.loadDirectoryContent}+ openDirectory={this.props.openDirectory}+ reflectCreateEntry={this.props.reflectCreateEntry}+ openFile={this.props.openFile}+ toggleCreateFileDialog={this.props.toggleCreateFileDialog}+ deleteDirectory={this.props.deleteDirectory}+ switchPerspective={this.switchPerspective}+ isReadOnlyMode={this.props.isReadOnlyMode}+ />+ </React.Fragment>+ )}+ </div>+ </div>+ <div+ className={classes.centerPanel}+ style={{ height: this.props.windowHeight }}+ >+ {this.renderPerspective()}+ </div>+ </div>+ </div>+ );+ }}function mapStateToProps(state) {- return {- currentDirectoryPath: getDirectoryPath(state),- lastSelectedEntry: getLastSelectedEntry(state),- perspectives: getPerspectives(state),- directoryContent: getDirectoryContent(state),- searchResultCount: getSearchResultCount(state),- currentLocationPath: getCurrentLocationPath(state),- maxSearchResults: getMaxSearchResults(state),- isDesktopMode: getDesktopMode(state),- isReadOnlyMode: isReadOnlyMode(state)- };+ return {+ currentDirectoryPath: getDirectoryPath(state),+ lastSelectedEntry: getLastSelectedEntry(state),+ perspectives: getPerspectives(state),+ directoryContent: getDirectoryContent(state),+ searchResultCount: getSearchResultCount(state),+ currentLocationPath: getCurrentLocationPath(state),+ maxSearchResults: getMaxSearchResults(state),+ isDesktopMode: getDesktopMode(state),+ isReadOnlyMode: isReadOnlyMode(state)+ };}function mapActionCreatorsToProps(dispatch) {- return bindActionCreators(- {- addTags: TaggingActions.addTags,- removeTags: TaggingActions.removeTags,- removeAllTags: TaggingActions.removeAllTags,- editTagForEntry: TaggingActions.editTagForEntry,- openFileNatively: AppActions.openFileNatively,- toggleCreateFileDialog: AppActions.toggleCreateFileDialog,- deleteFile: AppActions.deleteFile,- renameFile: AppActions.renameFile,- getNextFile: AppActions.getNextFile,- getPrevFile: AppActions.getPrevFile,- openDirectory: AppActions.openDirectory,- showInFileManager: AppActions.showInFileManager,- openFile: AppActions.openFile,- deleteDirectory: AppActions.deleteDirectory,- reflectCreateEntry: AppActions.reflectCreateEntry,- loadDirectoryContent: AppActions.loadDirectoryContent,- loadParentDirectoryContent: AppActions.loadParentDirectoryContent,- setLastSelectedEntry: AppActions.setLastSelectedEntry,- showNotification: AppActions.showNotification,- openSearchPanel: AppActions.openSearchPanel- },- dispatch- );+ return bindActionCreators(+ {+ addTags: TaggingActions.addTags,+ removeTags: TaggingActions.removeTags,+ removeAllTags: TaggingActions.removeAllTags,+ editTagForEntry: TaggingActions.editTagForEntry,+ openFileNatively: AppActions.openFileNatively,+ toggleCreateFileDialog: AppActions.toggleCreateFileDialog,+ deleteFile: AppActions.deleteFile,+ renameFile: AppActions.renameFile,+ getNextFile: AppActions.getNextFile,+ getPrevFile: AppActions.getPrevFile,+ openDirectory: AppActions.openDirectory,+ showInFileManager: AppActions.showInFileManager,+ openFile: AppActions.openFile,+ deleteDirectory: AppActions.deleteDirectory,+ reflectCreateEntry: AppActions.reflectCreateEntry,+ loadDirectoryContent: AppActions.loadDirectoryContent,+ loadParentDirectoryContent: AppActions.loadParentDirectoryContent,+ setLastSelectedEntry: AppActions.setLastSelectedEntry,+ showNotification: AppActions.showNotification,+ openSearchPanel: AppActions.openSearchPanel+ },+ dispatch+ );}export default connect(- mapStateToProps,- mapActionCreatorsToProps+ mapStateToProps,+ mapActionCreatorsToProps)(withStyles(styles)(FolderContainer));diff --git a/app/components/LocationManager.tsx b/app/components/LocationManager.tsxindex acdb24c43..9ea38e32f 100644--- a/app/components/LocationManager.tsx+++ b/app/components/LocationManager.tsx@@ -1,3 +1,4 @@+// @ts-nocheck/*** TagSpaces - universal file and folder organizer* Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)@@ -80,61 +81,61 @@ import IOActions from '../reducers/io-actions';const isLocationsReadOnly = window.ExtLocationsReadOnly;interface Props {- classes: Object,- locations: Array<Location>,- perspectives: Array<Object>,- currentLocationId: string,- isReadOnlyMode: boolean,- hideDrawer: () => void,- openFile: (path: string) => void,- openURLExternally: (path: string) => void,- loadDirectoryContent: (path: string) => void,- openLocation: (location: Location) => void,- openFileNatively: (path: string) => void,- openDirectory: (path: string) => void,- showInFileManager: (path: string) => void,- createDirectoryIndex: (path: string) => void,- addLocation: (location: Location, openAfterCreate: boolean) => void,- editLocation: () => void,- moveLocationUp: (locationId: string) => void,- moveLocationDown: (locationId: string) => void,- closeLocation: (locationId: string) => void,- removeLocation: (location: Location) => void,+ classes: any;+ locations: Array<Location>;+ perspectives: Array<Object>;+ currentLocationId: string;+ isReadOnlyMode: boolean;+ hideDrawer: () => void;+ openFile: (path: string) => void;+ openURLExternally: (path: string) => void;+ loadDirectoryContent: (path: string) => void;+ openLocation: (location: Location) => void;+ openFileNatively: (path: string) => void;+ openDirectory: (path: string) => void;+ showInFileManager: (path: string) => void;+ createDirectoryIndex: (path: string) => void;+ addLocation: (location: Location, openAfterCreate: boolean) => void;+ editLocation: () => void;+ moveLocationUp: (locationId: string) => void;+ moveLocationDown: (locationId: string) => void;+ closeLocation: (locationId: string) => void;+ removeLocation: (location: Location) => void;// renameDirectory: (directoryPath: string, newDirectoryName: string) => void,- reflectCreateEntry: (path: string, isFile: boolean) => void,- deleteDirectory: (directoryPath: string) => void,+ reflectCreateEntry: (path: string, isFile: boolean) => void;+ deleteDirectory: (directoryPath: string) => void;showNotification: (text: string,notificationType: string,autohide: boolean- ) => void,- moveFiles: (files: Array<string>, destination: string) => void-};+ ) => void;+ moveFiles: (files: Array<string>, destination: string) => void;+}interface State {- locationDirectoryContextMenuAnchorEl?: Object | null,- locationContextMenuOpened?: boolean,- directoryContextMenuAnchorEl?: Object | null,- directoryContextMenuOpened?: boolean,- selectedLocation?: Location | null,- selectedDirectoryPath?: string | null,- locationRootPath?: string | null,- isCreateLocationDialogOpened?: boolean,- isEditLocationDialogOpened?: boolean,- isDeleteLocationDialogOpened?: boolean,- isSelectDirectoryDialogOpened?: boolean,- createLocationDialogKey: string,- isCreateDirectoryDialogOpened?: boolean,- locationManagerMenuOpened: boolean,- locationManagerMenuAnchorEl: Object | null,- dirs?: Object-};+ locationDirectoryContextMenuAnchorEl?: Object | null;+ locationContextMenuOpened?: boolean;+ directoryContextMenuAnchorEl?: Object | null;+ directoryContextMenuOpened?: boolean;+ selectedLocation?: Location | null;+ selectedDirectoryPath?: string | null;+ locationRootPath?: string | null;+ isCreateLocationDialogOpened?: boolean;+ isEditLocationDialogOpened?: boolean;+ isDeleteLocationDialogOpened?: boolean;+ isSelectDirectoryDialogOpened?: boolean;+ createLocationDialogKey: string;+ isCreateDirectoryDialogOpened?: boolean;+ locationManagerMenuOpened: boolean;+ locationManagerMenuAnchorEl: Object | null;+ dirs?: Object;+}type SubFolder = {- uuid: string,- name: string,- path: string,- children?: Array<SubFolder>+ uuid: string;+ name: string;+ path: string;+ children?: Array<SubFolder>;};class LocationManager extends React.Component<Props, State> {@@ -404,7 +405,10 @@ class LocationManager extends React.Component<Props, State> {this.setState({ isDeleteLocationDialogOpened: true });};- handleDirectoryContextMenu = (event: React.ChangeEvent<HTMLInputElement> , directoryPath: string) => {+ handleDirectoryContextMenu = (+ event: React.ChangeEvent<HTMLInputElement>,+ directoryPath: string+ ) => {this.setState({directoryContextMenuOpened: true,directoryContextMenuAnchorEl: event.currentTarget,@@ -694,7 +698,7 @@ class LocationManager extends React.Component<Props, State> {);};- handleLocationManagerMenu = (event: React.ChangeEvent<HTMLInputElement> ) => {+ handleLocationManagerMenu = (event: React.ChangeEvent<HTMLInputElement>) => {this.setState({locationManagerMenuOpened: true,locationManagerMenuAnchorEl: event.currentTargetdiff --git a/app/components/MobileNavigation.tsx b/app/components/MobileNavigation.tsxindex ee16bf3c2..87dafc5b6 100644--- a/app/components/MobileNavigation.tsx+++ b/app/components/MobileNavigation.tsx@@ -36,7 +36,7 @@ import { withStyles } from '@material-ui/core/styles';// import LogoIcon from '../assets/images/icon100x100.svg';import TagLibrary from '../components/TagLibrary';import Search from '../components/Search';-import PerspectiveManager from '../components/PerspectiveManager';+// import PerspectiveManager from '../components/PerspectiveManager';import LocationManager from '../components/LocationManager';import HelpFeedbackPanel from '../components/HelpFeedbackPanel';import i18n from '../services/i18n';@@ -54,7 +54,7 @@ import {} from '../reducers/app';import { actions as SettingsActions, isFirstRun } from '../reducers/settings';-const styles = theme => ({+const styles: any = (theme: any) => ({bottomToolbar: {textAlign: 'center',backgroundColor: theme.palette.background.default@@ -68,39 +68,39 @@ const styles = theme => ({}});-type Props = {- classes: Object,- isFirstRun: boolean,- setFirstRun: (isFirstRun: boolean) => void,- toggleOnboardingDialog: () => void,- toggleCreateFileDialog: () => void,- toggleAboutDialog: () => void,- toggleKeysDialog: () => void,- toggleSettingsDialog: () => void,- isSettingsDialogOpened: () => void,- isLocationManagerPanelOpened: boolean,- openLocationManagerPanel: () => void,- isTagLibraryPanelOpened: boolean,- openTagLibraryPanel: () => void,- isSearchPanelOpened: boolean,- openSearchPanel: () => void,- isPerspectivesPanelOpened: boolean,+interface Props {+ classes: any;+ isFirstRun: boolean;+ setFirstRun: (isFirstRun: boolean) => void;+ toggleOnboardingDialog: () => void;+ toggleCreateFileDialog: () => void;+ toggleAboutDialog: () => void;+ toggleKeysDialog: () => void;+ toggleSettingsDialog: () => void;+ isSettingsDialogOpened: () => void;+ isLocationManagerPanelOpened: boolean;+ openLocationManagerPanel: () => void;+ isTagLibraryPanelOpened: boolean;+ openTagLibraryPanel: () => void;+ isSearchPanelOpened: boolean;+ openSearchPanel: () => void;+ isPerspectivesPanelOpened: boolean;// openPerspectivesPanel: () => void,- isHelpFeedbackPanelOpened: boolean,- openHelpFeedbackPanel: () => void,- closeAllVerticalPanels: () => void,- openFileNatively: (url: string) => void,- openURLExternally: (url: string) => void,- switchTheme: () => void,- hideDrawer: () => void,- isReadOnlyMode: boolean,- showNotification: (message: string) => void,- directoryPath: string-};+ isHelpFeedbackPanelOpened: boolean;+ openHelpFeedbackPanel: () => void;+ closeAllVerticalPanels: () => void;+ openFileNatively: (url: string) => void;+ openURLExternally: (url: string) => void;+ switchTheme: () => void;+ hideDrawer: () => void;+ isReadOnlyMode: boolean;+ showNotification: (message: string) => void;+ directoryPath: string;+}-type State = {- isProTeaserVisible: boolean-};+interface State {+ isProTeaserVisible: boolean;+}class MobileNavigation extends React.Component<Props, State> {state = {@@ -115,25 +115,18 @@ class MobileNavigation extends React.Component<Props, State> {render() {const {classes,- isFirstRun,isLocationManagerPanelOpened,isTagLibraryPanelOpened,isSearchPanelOpened,- isSettingsDialogOpened,- isPerspectivesPanelOpened,isHelpFeedbackPanelOpened,isReadOnlyMode,toggleCreateFileDialog,- toggleAboutDialog,toggleOnboardingDialog,toggleSettingsDialog,toggleKeysDialog,openLocationManagerPanel,openTagLibraryPanel,openSearchPanel,- openHelpFeedbackPanel,- closeAllVerticalPanels,- switchTheme,showNotification,hideDrawer,openFileNatively,@@ -161,7 +154,7 @@ class MobileNavigation extends React.Component<Props, State> {hideDrawer={hideDrawer}style={{ display: isSearchPanelOpened ? 'block' : 'none' }}/>- {isPerspectivesPanelOpened && <PerspectiveManager />}+ {/* {isPerspectivesPanelOpened && <PerspectiveManager />} */}{isHelpFeedbackPanelOpened && (<HelpFeedbackPanelopenFileNatively={openFileNatively}diff --git a/app/components/PerspectiveManager.tsx b/app/components/PerspectiveManager.tsxindex dbb58e89d..3dcd8366f 100644--- a/app/components/PerspectiveManager.tsx+++ b/app/components/PerspectiveManager.tsx@@ -21,14 +21,12 @@ import { withStyles } from '@material-ui/core/styles';import Typography from '@material-ui/core/Typography';import styles from './SidePanels.css';-type Props = {+interface Props {classes: any;style: any;-};--type State = {};+}-class PerspectiveManager extends React.Component<Props, State> {+class PerspectiveManager extends React.Component<Props> {render() {const classes = this.props.classes;diff --git a/app/components/TagDropContainer.tsx b/app/components/TagDropContainer.tsxindex 0efa98040..015a2a88c 100644--- a/app/components/TagDropContainer.tsx+++ b/app/components/TagDropContainer.tsx@@ -20,12 +20,12 @@ import React from 'react';import { DropTarget } from 'react-dnd';import DragItemTypes from './DragItemTypes';-type Props = {- children: Array<Object>,- canDrop: boolean,- isOver: boolean,- connectDropTarget: (param: Object) => void-};+interface Props {+ children: Array<Object>;+ canDrop: boolean;+ isOver: boolean;+ connectDropTarget: (param: Object) => void;+}const boxTarget = {drop(props) {@@ -66,4 +66,5 @@ export default DropTarget(DragItemTypes.TAG, boxTarget, (connect, monitor) => ({connectDropTarget: connect.dropTarget(),isOver: monitor.isOver(),canDrop: monitor.canDrop()+ // @ts-ignore}))(TagDropContainer);diff --git a/app/components/TagGroupContainer.tsx b/app/components/TagGroupContainer.tsxindex a536ae177..de8026106 100644--- a/app/components/TagGroupContainer.tsx+++ b/app/components/TagGroupContainer.tsx@@ -20,12 +20,12 @@ import React from 'react';import { DropTarget } from 'react-dnd';import DragItemTypes from './DragItemTypes';-type Props = {- children: Array<Object>,- canDrop: boolean,- isOver: boolean,- connectDropTarget: (param: Object) => void-};+interface Props {+ children: Array<Object>;+ canDrop: boolean;+ isOver: boolean;+ connectDropTarget: (param: Object) => void;+}const boxTarget = {drop(props) {@@ -68,4 +68,5 @@ export default DropTarget(DragItemTypes.TAG, boxTarget, (connect, monitor) => ({connectDropTarget: connect.dropTarget(),isOver: monitor.isOver(),canDrop: monitor.canDrop()+ // @ts-ignore}))(TagGroupContainer);diff --git a/app/components/TagLibrary.tsx b/app/components/TagLibrary.tsxindex 1b9ecb4cc..8fd8fb027 100644--- a/app/components/TagLibrary.tsx+++ b/app/components/TagLibrary.tsx@@ -45,398 +45,406 @@ import CustomLogo from './CustomLogo';import TagLibraryMenu from './menus/TagLibraryMenu';import TagGroupMenu from './menus/TagGroupMenu';import {- TagGroup,- Tag,- actions as TagLibraryActions,- getAllTags,- getTagGroups+ TagGroup,+ Tag,+ actions as TagLibraryActions,+ getAllTags,+ getTagGroups} from '../reducers/taglibrary';import TaggingActions from '../reducers/tagging-actions';import i18n from '../services/i18n';import { getTagColor, getTagTextColor } from '../reducers/settings';import {- actions as AppActions,- getSelectedEntries,- isReadOnlyMode+ actions as AppActions,+ getSelectedEntries,+ isReadOnlyMode} from '../reducers/app';import SmartTags from '../reducers/smart-tags';+import { FileSystemEntry } from '-/services/utils-io';const isTagLibraryReadOnly =- window.ExtTagLibrary && window.ExtTagLibrary.length > 0;+ window.ExtTagLibrary && window.ExtTagLibrary.length > 0;-type Props = {- classes: Object;- style: Object;- isReadOnlyMode: boolean;- tagTextColor: string;- tagBackgroundColor: string;- tagGroups: Array<TagGroup>;- allTags: Array<Tag>;- openURLExternally: (path: string) => void;- toggleTagGroup: (expanded: boolean, uuid: string) => void;- removeTagGroup: (uuid: string) => void;- moveTagGroupUp: (uuid: string) => void;- moveTagGroupDown: (uuid: string) => void;- sortTagGroup: (uuid: string) => void;- collectTagsFromLocation: (tagGroup: TagGroup) => void;- addTags: () => void;- importTagGroups: () => void;- exportTagGroups: () => void;- createTagGroup: () => void;- addTag: () => void;- moveTag: () => void;- editTagGroup: () => void;- editTag: () => void;- deleteTag: () => void;- selectedEntries: Array<Object>;-};+interface Props {+ classes: any;+ style: any;+ isReadOnlyMode: boolean;+ tagTextColor: string;+ tagBackgroundColor: string;+ tagGroups: Array<TagGroup>;+ allTags: Array<Tag>;+ openURLExternally: (path: string) => void;+ toggleTagGroup: (expanded: boolean, uuid: string) => void;+ removeTagGroup: (uuid: string) => void;+ moveTagGroupUp: (uuid: string) => void;+ moveTagGroupDown: (uuid: string) => void;+ sortTagGroup: (uuid: string) => void;+ collectTagsFromLocation: (tagGroup: TagGroup) => void;+ addTags: () => void;+ importTagGroups: () => void;+ exportTagGroups: () => void;+ createTagGroup: () => void;+ addTag: () => void;+ moveTag: () => void;+ editTagGroup: () => void;+ editTag: () => void;+ deleteTag: () => void;+ selectedEntries: Array<FileSystemEntry>;+}-type State = {- tagLibraryMenuAnchorEl: Object | null;- tagLibraryMenuOpened: boolean;- tagGroupMenuAnchorEl: Object | null;- tagGroupMenuOpened: boolean;- tagMenuAnchorEl: Object;- tagMenuOpened: boolean;- selectedTagEntry: TagGroup | null;- selectedTag: Tag | null;- selectedTagGroupEntry: TagGroup | null;- isCreateTagGroupDialogOpened: boolean;- isEditTagGroupDialogOpened: boolean;- isDeleteTagGroupDialogOpened: boolean;- isCreateTagDialogOpened: boolean;- isEditTagDialogOpened: boolean;- isDeleteTagDialogOpened: boolean;-};+interface State {+ tagLibraryMenuAnchorEl: Element;+ tagLibraryMenuOpened: boolean;+ tagGroupMenuAnchorEl: Element;+ tagGroupMenuOpened: boolean;+ tagMenuAnchorEl: Element;+ tagMenuOpened: boolean;+ selectedTagEntry: TagGroup;+ selectedTag: Tag;+ selectedTagGroupEntry: TagGroup;+ isCreateTagGroupDialogOpened: boolean;+ isEditTagGroupDialogOpened: boolean;+ isDeleteTagGroupDialogOpened: boolean;+ isCreateTagDialogOpened: boolean;+ isEditTagDialogOpened: boolean;+ isDeleteTagDialogOpened: boolean;+}class TagLibrary extends React.Component<Props, State> {- state = {- tagGroupMenuAnchorEl: null,- tagGroupMenuOpened: false,- tagMenuAnchorEl: null,- tagMenuOpened: false,- tagLibraryMenuAnchorEl: null,- tagLibraryMenuOpened: false,- selectedTagGroupEntry: null,- selectedTagEntry: null,- selectedTag: null,- isCreateTagGroupDialogOpened: false,- isEditTagGroupDialogOpened: false,- isDeleteTagGroupDialogOpened: false,- isCreateTagDialogOpened: false,- isEditTagDialogOpened: false,- isDeleteTagDialogOpened: false- };+ state = {+ tagGroupMenuAnchorEl: null,+ tagGroupMenuOpened: false,+ tagMenuAnchorEl: null,+ tagMenuOpened: false,+ tagLibraryMenuAnchorEl: null,+ tagLibraryMenuOpened: false,+ selectedTagGroupEntry: null,+ selectedTagEntry: null,+ selectedTag: null,+ isCreateTagGroupDialogOpened: false,+ isEditTagGroupDialogOpened: false,+ isDeleteTagGroupDialogOpened: false,+ isCreateTagDialogOpened: false,+ isEditTagDialogOpened: false,+ isDeleteTagDialogOpened: false+ };- handleTagGroupTitleClick = (event: Object, tagGroup) => {- this.props.toggleTagGroup(tagGroup.expanded, tagGroup.uuid);- };+ handleTagGroupTitleClick = (event: Object, tagGroup) => {+ this.props.toggleTagGroup(tagGroup.expanded, tagGroup.uuid);+ };- handleTagGroupMenu = (- event: React.ChangeEvent<HTMLInputElement>,- tagGroup- ) => {- this.setState({- tagGroupMenuOpened: true,- tagGroupMenuAnchorEl: event.currentTarget,- selectedTagGroupEntry: tagGroup- });- };+ handleTagGroupMenu = (+ event: React.ChangeEvent<HTMLInputElement>,+ tagGroup+ ) => {+ this.setState({+ tagGroupMenuOpened: true,+ tagGroupMenuAnchorEl: event.currentTarget,+ selectedTagGroupEntry: tagGroup+ });+ };- handleTagMenu = (- event: React.ChangeEvent<HTMLInputElement>,- tag,- tagGroup: TagGroup- ) => {- this.setState({- tagMenuOpened: true,- tagMenuAnchorEl: event.currentTarget,- selectedTagGroupEntry: tagGroup,- selectedTag: tag- });- };+ handleTagMenu = (+ event: React.ChangeEvent<HTMLInputElement>,+ tag,+ tagGroup: TagGroup+ ) => {+ this.setState({+ tagMenuOpened: true,+ tagMenuAnchorEl: event.currentTarget,+ selectedTagGroupEntry: tagGroup,+ selectedTag: tag+ });+ };- handleTagLibraryMenu = (event: React.ChangeEvent<HTMLInputElement>) => {- this.setState({- tagLibraryMenuOpened: true,- tagLibraryMenuAnchorEl: event.currentTarget- });- };+ handleTagLibraryMenu = (event: any) => {+ this.setState({+ tagLibraryMenuOpened: true,+ tagLibraryMenuAnchorEl: event.currentTarget+ });+ };- showCreateTagGroupDialog = () => {- this.setState({ isCreateTagGroupDialogOpened: true });- };+ showCreateTagGroupDialog = () => {+ this.setState({ isCreateTagGroupDialogOpened: true });+ };- showCreateTagsDialog = () => {- this.setState({ isCreateTagDialogOpened: true });- this.handleCloseTagGroupMenu();- };+ showCreateTagsDialog = () => {+ this.setState({ isCreateTagDialogOpened: true });+ this.handleCloseTagGroupMenu();+ };- showEditTagGroupDialog = () => {- this.setState({ isEditTagGroupDialogOpened: true });- this.handleCloseTagGroupMenu();- };+ showEditTagGroupDialog = () => {+ this.setState({ isEditTagGroupDialogOpened: true });+ this.handleCloseTagGroupMenu();+ };- showDeleteTagGroupDialog = () => {- this.setState({ isDeleteTagGroupDialogOpened: true });- this.handleCloseTagGroupMenu();- };+ showDeleteTagGroupDialog = () => {+ this.setState({ isDeleteTagGroupDialogOpened: true });+ this.handleCloseTagGroupMenu();+ };- handleCloseDialogs = () => {- this.setState({- isCreateTagGroupDialogOpened: false,- isEditTagGroupDialogOpened: false,- isDeleteTagGroupDialogOpened: false,- isCreateTagDialogOpened: false,- isEditTagDialogOpened: false,- isDeleteTagDialogOpened: false- });- };+ handleCloseDialogs = () => {+ this.setState({+ isCreateTagGroupDialogOpened: false,+ isEditTagGroupDialogOpened: false,+ isDeleteTagGroupDialogOpened: false,+ isCreateTagDialogOpened: false,+ isEditTagDialogOpened: false,+ isDeleteTagDialogOpened: false+ });+ };- handleCloseTagGroupMenu = () => {- this.setState({- tagGroupMenuOpened: false- });- };+ handleCloseTagGroupMenu = () => {+ this.setState({+ tagGroupMenuOpened: false+ });+ };- handleCloseTagMenu = () => {- this.setState({- tagMenuOpened: false- });- };+ handleCloseTagMenu = () => {+ this.setState({+ tagMenuOpened: false+ });+ };- handleCloseImportExportMenu = () => {- this.setState({ tagLibraryMenuOpened: false });- };+ handleCloseImportExportMenu = () => {+ this.setState({ tagLibraryMenuOpened: false });+ };- renderTagGroup = tagGroup => {- const isReadOnly = tagGroup.readOnly || isTagLibraryReadOnly;- return (- <div key={tagGroup.uuid}>- <ListItem- data-tid={'tagLibraryTagGroupTitle_' + tagGroup.title}- button- style={{ maxWidth: 250 }}- className={this.props.classes.listItem}- onClick={event => this.handleTagGroupTitleClick(event, tagGroup)}- onContextMenu={event => this.handleTagGroupMenu(event, tagGroup)}- title={- 'Number of tags in this tag group: ' + tagGroup.children.length- }- >- <ListItemIcon style={{ minWidth: 'auto' }}>- {tagGroup.expanded ? <ArrowDownIcon /> : <ArrowRightIcon />}- </ListItemIcon>- <Typography- variant="inherit"- className={this.props.classes.header}- style={{ paddingLeft: 0 }}- data-tid="locationTitleElement"- noWrap- >- {tagGroup.title + ' '}- {!tagGroup.expanded && (- <span className={this.props.classes.badge}>- {tagGroup.children.length}- </span>- )}- </Typography>- {!isReadOnly && (- <ListItemSecondaryAction>- <IconButton- aria-label={i18n.t('core:options')}- aria-haspopup="true"- edge="end"- data-tid={- 'tagLibraryMoreButton_' + tagGroup.title.replace(/ /g, '_')- }- onClick={event => this.handleTagGroupMenu(event, tagGroup)}- onContextMenu={event =>- this.handleTagGroupMenu(event, tagGroup)- }- >- <MoreVertIcon />- </IconButton>- </ListItemSecondaryAction>- )}- </ListItem>- <Collapse in={tagGroup.expanded} unmountOnExit>- <TagGroupContainer- taggroup={tagGroup}- data-tid={'tagGroupContainer_' + tagGroup.title}- >- {tagGroup.children &&- tagGroup.children.map((tag: Tag) => {- if (this.props.isReadOnlyMode) {- return (- <TagContainer- key={tagGroup.uuid + tag.title}- tag={tag}- tagGroup={tagGroup}- handleTagMenu={this.handleTagMenu}- addTags={this.props.addTags}- moveTag={this.props.moveTag}- selectedEntries={this.props.selectedEntries}- />- );- }- return (- <TagContainerDnd- key={tagGroup.uuid + tag.title}- tag={tag}- tagGroup={tagGroup}- handleTagMenu={this.handleTagMenu}- addTags={this.props.addTags}- moveTag={this.props.moveTag}- selectedEntries={this.props.selectedEntries}- />- );- })}- </TagGroupContainer>- </Collapse>- </div>- );- };+ renderTagGroup = tagGroup => {+ const isReadOnly = tagGroup.readOnly || isTagLibraryReadOnly;+ return (+ <div key={tagGroup.uuid}>+ <ListItem+ data-tid={'tagLibraryTagGroupTitle_' + tagGroup.title}+ button+ style={{ maxWidth: 250 }}+ className={this.props.classes.listItem}+ onClick={(event: any) =>+ this.handleTagGroupTitleClick(event, tagGroup)+ }+ onContextMenu={(event: any) =>+ this.handleTagGroupMenu(event, tagGroup)+ }+ title={+ 'Number of tags in this tag group: ' + tagGroup.children.length+ }+ >+ <ListItemIcon style={{ minWidth: 'auto' }}>+ {tagGroup.expanded ? <ArrowDownIcon /> : <ArrowRightIcon />}+ </ListItemIcon>+ <Typography+ variant="inherit"+ className={this.props.classes.header}+ style={{ paddingLeft: 0 }}+ data-tid="locationTitleElement"+ noWrap+ >+ {tagGroup.title + ' '}+ {!tagGroup.expanded && (+ <span className={this.props.classes.badge}>+ {tagGroup.children.length}+ </span>+ )}+ </Typography>+ {!isReadOnly && (+ <ListItemSecondaryAction>+ <IconButton+ aria-label={i18n.t('core:options')}+ aria-haspopup="true"+ edge="end"+ data-tid={+ 'tagLibraryMoreButton_' + tagGroup.title.replace(/ /g, '_')+ }+ onClick={(event: any) =>+ this.handleTagGroupMenu(event, tagGroup)+ }+ onContextMenu={(event: any) =>+ this.handleTagGroupMenu(event, tagGroup)+ }+ >+ <MoreVertIcon />+ </IconButton>+ </ListItemSecondaryAction>+ )}+ </ListItem>+ <Collapse in={tagGroup.expanded} unmountOnExit>+ <TagGroupContainer+ taggroup={tagGroup}+ data-tid={'tagGroupContainer_' + tagGroup.title}+ >+ {tagGroup.children &&+ tagGroup.children.map((tag: Tag) => {+ if (this.props.isReadOnlyMode) {+ return (+ <TagContainer+ key={tagGroup.uuid + tag.title}+ tag={tag}+ tagGroup={tagGroup}+ handleTagMenu={this.handleTagMenu}+ addTags={this.props.addTags}+ moveTag={this.props.moveTag}+ selectedEntries={this.props.selectedEntries}+ />+ );+ }+ return (+ <TagContainerDnd+ key={tagGroup.uuid + tag.title}+ tag={tag}+ tagGroup={tagGroup}+ handleTagMenu={this.handleTagMenu}+ addTags={this.props.addTags}+ moveTag={this.props.moveTag}+ selectedEntries={this.props.selectedEntries}+ />+ );+ })}+ </TagGroupContainer>+ </Collapse>+ </div>+ );+ };- render() {- const { tagGroups, classes, allTags } = this.props;+ render() {+ const { tagGroups, classes, allTags } = this.props;- return (- <div className={classes.panel} style={this.props.style}>- <CustomLogo />- <div className={classes.toolbar}>- <Typography- className={classNames(classes.panelTitle, classes.header)}- title={- 'Your tag library contains ' +- allTags.length +- ' tags \ndistributed in ' +- tagGroups.length +- ' tag groups'- }- type="subtitle1"- >- {i18n.t('core:tagLibrary')}- </Typography>- {!isTagLibraryReadOnly && (- <IconButton- data-tid="tagLibraryMenu"- onClick={this.handleTagLibraryMenu}- >- <MoreVertIcon />- </IconButton>- )}- </div>- <ConfirmDialog- open={this.state.isDeleteTagGroupDialogOpened}- onClose={this.handleCloseDialogs}- title={i18n.t('core:deleteTagGroup')}- content={i18n.t('core:deleteTagGroupContentConfirm', {- tagGroup: this.state.selectedTagGroupEntry- ? this.state.selectedTagGroupEntry.title- : ''- })}- confirmCallback={result => {- if (result && this.state.selectedTagGroupEntry) {- this.props.removeTagGroup(this.state.selectedTagGroupEntry.uuid);- }- }}- cancelDialogTID={'cancelDeleteTagGroupDialog'}- confirmDialogTID={'confirmDeleteTagGroupDialog'}- />- <CreateTagGroupDialog- key={uuidv1()}- open={this.state.isCreateTagGroupDialogOpened}- onClose={this.handleCloseDialogs}- createTagGroup={this.props.createTagGroup}- color={this.props.tagBackgroundColor}- textcolor={this.props.tagTextColor}- />- <CreateTagsDialog- key={uuidv1()}- open={this.state.isCreateTagDialogOpened}- onClose={this.handleCloseDialogs}- addTag={this.props.addTag}- selectedTagGroupEntry={this.state.selectedTagGroupEntry}- />- <EditTagGroupDialog- open={this.state.isEditTagGroupDialogOpened}- onClose={this.handleCloseDialogs}- editTagGroup={this.props.editTagGroup}- selectedTagGroupEntry={this.state.selectedTagGroupEntry}- />- <TagGroupMenu- anchorEl={this.state.tagGroupMenuAnchorEl}- open={this.state.tagGroupMenuOpened}- onClose={this.handleCloseTagGroupMenu}- selectedTagGroupEntry={this.state.selectedTagGroupEntry}- showCreateTagsDialog={this.showCreateTagsDialog}- showDeleteTagGroupDialog={this.showDeleteTagGroupDialog}- handleCloseTagGroupMenu={this.handleCloseTagGroupMenu}- showEditTagGroupDialog={this.showEditTagGroupDialog}- moveTagGroupUp={this.props.moveTagGroupUp}- moveTagGroupDown={this.props.moveTagGroupDown}- sortTagGroup={this.props.sortTagGroup}- collectTagsFromLocation={this.props.collectTagsFromLocation}- />- <TagLibraryMenu- anchorEl={this.state.tagLibraryMenuAnchorEl}- open={this.state.tagLibraryMenuOpened}- onClose={this.handleCloseImportExportMenu}- tagGroups={tagGroups}- importTagGroups={this.props.importTagGroups}- exportTagGroups={this.props.exportTagGroups}- showCreateTagGroupDialog={this.showCreateTagGroupDialog}- openURLExternally={this.props.openURLExternally}- />- <TagMenu- anchorEl={this.state.tagMenuAnchorEl}- open={this.state.tagMenuOpened}- onClose={this.handleCloseTagMenu}- selectedTagGroupEntry={this.state.selectedTagGroupEntry}- selectedTag={this.state.selectedTag}- editTag={this.props.editTag}- deleteTag={this.props.deleteTag}- />- <div- className={classes.taggroupsArea}- data-tid="tagLibraryTagGroupList"- >- <List style={{ paddingTop: 0 }}>- {SmartTags(i18n).map(this.renderTagGroup)}- </List>- <List style={{ paddingTop: 0 }}>- {tagGroups.map(this.renderTagGroup)}- </List>- </div>- </div>- );- }+ return (+ <div className={classes.panel} style={this.props.style}>+ <CustomLogo />+ <div className={classes.toolbar}>+ <Typography+ className={classNames(classes.panelTitle, classes.header)}+ title={+ 'Your tag library contains ' ++ allTags.length ++ ' tags \ndistributed in ' ++ tagGroups.length ++ ' tag groups'+ }+ variant="subtitle1"+ >+ {i18n.t('core:tagLibrary')}+ </Typography>+ {!isTagLibraryReadOnly && (+ <IconButton+ data-tid="tagLibraryMenu"+ onClick={this.handleTagLibraryMenu}+ >+ <MoreVertIcon />+ </IconButton>+ )}+ </div>+ <ConfirmDialog+ open={this.state.isDeleteTagGroupDialogOpened}+ onClose={this.handleCloseDialogs}+ title={i18n.t('core:deleteTagGroup')}+ content={i18n.t('core:deleteTagGroupContentConfirm', {+ tagGroup: this.state.selectedTagGroupEntry+ ? this.state.selectedTagGroupEntry.title+ : ''+ })}+ confirmCallback={result => {+ if (result && this.state.selectedTagGroupEntry) {+ this.props.removeTagGroup(this.state.selectedTagGroupEntry.uuid);+ }+ }}+ cancelDialogTID={'cancelDeleteTagGroupDialog'}+ confirmDialogTID={'confirmDeleteTagGroupDialog'}+ />+ <CreateTagGroupDialog+ key={uuidv1()}+ open={this.state.isCreateTagGroupDialogOpened}+ onClose={this.handleCloseDialogs}+ createTagGroup={this.props.createTagGroup}+ color={this.props.tagBackgroundColor}+ textcolor={this.props.tagTextColor}+ />+ <CreateTagsDialog+ key={uuidv1()}+ open={this.state.isCreateTagDialogOpened}+ onClose={this.handleCloseDialogs}+ addTag={this.props.addTag}+ selectedTagGroupEntry={this.state.selectedTagGroupEntry}+ />+ <EditTagGroupDialog+ open={this.state.isEditTagGroupDialogOpened}+ onClose={this.handleCloseDialogs}+ editTagGroup={this.props.editTagGroup}+ selectedTagGroupEntry={this.state.selectedTagGroupEntry}+ />+ <TagGroupMenu+ anchorEl={this.state.tagGroupMenuAnchorEl}+ open={this.state.tagGroupMenuOpened}+ onClose={this.handleCloseTagGroupMenu}+ selectedTagGroupEntry={this.state.selectedTagGroupEntry}+ showCreateTagsDialog={this.showCreateTagsDialog}+ showDeleteTagGroupDialog={this.showDeleteTagGroupDialog}+ handleCloseTagGroupMenu={this.handleCloseTagGroupMenu}+ showEditTagGroupDialog={this.showEditTagGroupDialog}+ moveTagGroupUp={this.props.moveTagGroupUp}+ moveTagGroupDown={this.props.moveTagGroupDown}+ sortTagGroup={this.props.sortTagGroup}+ collectTagsFromLocation={this.props.collectTagsFromLocation}+ />+ <TagLibraryMenu+ anchorEl={this.state.tagLibraryMenuAnchorEl}+ open={this.state.tagLibraryMenuOpened}+ onClose={this.handleCloseImportExportMenu}+ tagGroups={tagGroups}+ importTagGroups={this.props.importTagGroups}+ exportTagGroups={this.props.exportTagGroups}+ showCreateTagGroupDialog={this.showCreateTagGroupDialog}+ openURLExternally={this.props.openURLExternally}+ />+ <TagMenu+ anchorEl={this.state.tagMenuAnchorEl}+ open={this.state.tagMenuOpened}+ onClose={this.handleCloseTagMenu}+ selectedTagGroupEntry={this.state.selectedTagGroupEntry}+ selectedTag={this.state.selectedTag}+ editTag={this.props.editTag}+ deleteTag={this.props.deleteTag}+ />+ <div+ className={classes.taggroupsArea}+ data-tid="tagLibraryTagGroupList"+ >+ <List style={{ paddingTop: 0 }}>+ {SmartTags(i18n).map(this.renderTagGroup)}+ </List>+ <List style={{ paddingTop: 0 }}>+ {tagGroups.map(this.renderTagGroup)}+ </List>+ </div>+ </div>+ );+ }}function mapStateToProps(state) {- return {- tagGroups: getTagGroups(state),- tagBackgroundColor: getTagColor(state),- tagTextColor: getTagTextColor(state),- selectedEntries: getSelectedEntries(state),- allTags: getAllTags(state),- isReadOnlyMode: isReadOnlyMode(state)- };+ return {+ tagGroups: getTagGroups(state),+ tagBackgroundColor: getTagColor(state),+ tagTextColor: getTagTextColor(state),+ selectedEntries: getSelectedEntries(state),+ allTags: getAllTags(state),+ isReadOnlyMode: isReadOnlyMode(state)+ };}function mapDispatchToProps(dispatch) {- return bindActionCreators(- {- ...TagLibraryActions, // TODO connect only the really needed- addTags: TaggingActions.addTags,- collectTagsFromLocation: TaggingActions.collectTagsFromLocation,- openURLExternally: AppActions.openURLExternally- },- dispatch- );+ return bindActionCreators(+ {+ ...TagLibraryActions, // TODO connect only the really needed+ addTags: TaggingActions.addTags,+ collectTagsFromLocation: TaggingActions.collectTagsFromLocation,+ openURLExternally: AppActions.openURLExternally+ },+ dispatch+ );}export default withStyles(styles)(- connect(mapStateToProps, mapDispatchToProps)(TagLibrary)+ // @ts-ignore+ connect(mapStateToProps, mapDispatchToProps)(TagLibrary));diff --git a/app/components/TargetMoveFileBox.tsx b/app/components/TargetMoveFileBox.tsxindex 0d73d7ac7..929390d2c 100644--- a/app/components/TargetMoveFileBox.tsx+++ b/app/components/TargetMoveFileBox.tsx@@ -21,7 +21,7 @@ import { DropTarget } from 'react-dnd';import { withStyles } from '@material-ui/core/styles/index';import i18n from '../services/i18n';-const styles = theme => ({+const styles: any = () => ({dropzone: {margin: 5,position: 'absolute',@@ -48,13 +48,13 @@ const boxTarget = {}};-type Props = {- classes: Object,- canDrop: boolean,- isOver: boolean,- connectDropTarget: Object,- children: Object-};+interface Props {+ classes?: any;+ canDrop: boolean;+ isOver: boolean;+ connectDropTarget: any;+ children: Object;+}const TargetMoveFileBox = (props: Props) => {const { classes, canDrop, isOver, connectDropTarget, children } = props;diff --git a/app/components/TransparentBackground.tsx b/app/components/TransparentBackground.tsxindex 173f08453..8d763d4f1 100644--- a/app/components/TransparentBackground.tsx+++ b/app/components/TransparentBackground.tsx@@ -17,9 +17,9 @@*/import React from 'react';-type Props = {- children: Object-};+interface Props {+ children: Object;+}const TransparentBackground = (props: Props) => (<spandiff --git a/app/components/VerticalNavigation.tsx b/app/components/VerticalNavigation.tsxindex f385f1136..07a6c4a2b 100644--- a/app/components/VerticalNavigation.tsx+++ b/app/components/VerticalNavigation.tsx@@ -1,3 +1,4 @@+// @ts-nocheck/*** TagSpaces - universal file and folder organizer* Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)@@ -41,248 +42,248 @@ import HelpFeedbackPanel from '../components/HelpFeedbackPanel';import i18n from '../services/i18n';import { Pro } from '../pro';import {- actions as AppActions,- getDirectoryPath,- isSettingsDialogOpened,- isLocationManagerPanelOpened,- isTagLibraryPanelOpened,- isSearchPanelOpened,- isPerspectivesPanelOpened,- isHelpFeedbackPanelOpened,- isReadOnlyMode+ actions as AppActions,+ getDirectoryPath,+ isSettingsDialogOpened,+ isLocationManagerPanelOpened,+ isTagLibraryPanelOpened,+ isSearchPanelOpened,+ isPerspectivesPanelOpened,+ isHelpFeedbackPanelOpened,+ isReadOnlyMode} from '../reducers/app';import { actions as SettingsActions, isFirstRun } from '../reducers/settings';import LoadingLazy from './LoadingLazy';const ProTeaserDialog = React.lazy(() =>- import(/* webpackChunkName: "ProTeaserDialog" */ './dialogs/ProTeaserDialog')+ import(/* webpackChunkName: "ProTeaserDialog" */ './dialogs/ProTeaserDialog'));const ProTeaserDialogAsync = props => (- <React.Suspense fallback={<LoadingLazy />}>- <ProTeaserDialog {...props} />- </React.Suspense>+ <React.Suspense fallback={<LoadingLazy />}>+ <ProTeaserDialog {...props} />+ </React.Suspense>);interface Props {- theme: Object;- isFirstRun: boolean;- directoryPath: string;- setFirstRun: (isFirstRun: boolean) => void;- toggleOnboardingDialog: () => void;- toggleCreateFileDialog: () => void;- toggleAboutDialog: () => void;- toggleKeysDialog: () => void;- toggleSettingsDialog: () => void;- isSettingsDialogOpened: () => void;- isLocationManagerPanelOpened: boolean;- openLocationManagerPanel: () => void;- isTagLibraryPanelOpened: boolean;- openTagLibraryPanel: () => void;- isSearchPanelOpened: boolean;- openSearchPanel: () => void;- isPerspectivesPanelOpened: boolean;- // openPerspectivesPanel: () => void,- isHelpFeedbackPanelOpened: boolean;- openHelpFeedbackPanel: () => void;- closeAllVerticalPanels: () => void;- openFileNatively: (url: string) => void;- openURLExternally: (url: string) => void;- switchTheme: () => void;- showNotification: (message: string) => void;- isReadOnlyMode: boolean;+ theme: any;+ isFirstRun: boolean;+ directoryPath: string;+ setFirstRun: (isFirstRun: boolean) => void;+ toggleOnboardingDialog: () => void;+ toggleCreateFileDialog: () => void;+ toggleAboutDialog: () => void;+ toggleKeysDialog: () => void;+ toggleSettingsDialog: () => void;+ isSettingsDialogOpened: () => void;+ isLocationManagerPanelOpened: boolean;+ openLocationManagerPanel: () => void;+ isTagLibraryPanelOpened: boolean;+ openTagLibraryPanel: () => void;+ isSearchPanelOpened: boolean;+ openSearchPanel: () => void;+ isPerspectivesPanelOpened: boolean;+ // openPerspectivesPanel: () => void,+ isHelpFeedbackPanelOpened: boolean;+ openHelpFeedbackPanel: () => void;+ closeAllVerticalPanels: () => void;+ openFileNatively: (url: string) => void;+ openURLExternally: (url: string) => void;+ switchTheme: () => void;+ showNotification: (message: string) => void;+ isReadOnlyMode: boolean;}interface State {- isProTeaserVisible: boolean; // evtl. redux migration+ isProTeaserVisible: boolean; // evtl. redux migration}class VerticalNavigation extends React.Component<Props, State> {- state = {- isProTeaserVisible: false- };+ state = {+ isProTeaserVisible: false+ };- styles = {- panel: {- height: '100%',- backgroundColor: '#2C001E' // 'rgb(89, 89, 89)' // '#00D1A1' // #008023- },- buttonIcon: {- width: 28,- height: 28,- color: '#d6d6d6' // this.props.theme.palette.text.primary- },- button: {- padding: 8,- width: 44,- height: 44- },- selectedButton: {- borderRadius: 0,- backgroundColor: '#880E4F'- },- settingsButton: {- position: 'absolute',- bottom: 0,- left: 0- },- themingButton: {- position: 'absolute',- bottom: 45,- left: 0- },- upgradeButton: {- position: 'absolute',- bottom: 90,- left: 0- }- };+ styles = {+ panel: {+ height: '100%',+ backgroundColor: '#2C001E' // 'rgb(89, 89, 89)' // '#00D1A1' // #008023+ },+ buttonIcon: {+ width: 28,+ height: 28,+ color: '#d6d6d6' // this.props.theme.palette.text.primary+ },+ button: {+ padding: 8,+ width: 44,+ height: 44+ },+ selectedButton: {+ borderRadius: 0,+ backgroundColor: '#880E4F'+ },+ settingsButton: {+ position: 'absolute',+ bottom: 0,+ left: 0+ },+ themingButton: {+ position: 'absolute',+ bottom: 45,+ left: 0+ },+ upgradeButton: {+ position: 'absolute',+ bottom: 90,+ left: 0+ }+ };- toggleProTeaser = () => {- this.setState({ isProTeaserVisible: !this.state.isProTeaserVisible });- };+ toggleProTeaser = () => {+ this.setState({ isProTeaserVisible: !this.state.isProTeaserVisible });+ };- render() {- const {- isLocationManagerPanelOpened,- isTagLibraryPanelOpened,- isSearchPanelOpened,- isSettingsDialogOpened,- isPerspectivesPanelOpened,- isHelpFeedbackPanelOpened,- isReadOnlyMode,- toggleCreateFileDialog,- toggleAboutDialog,- toggleOnboardingDialog,- toggleSettingsDialog,- toggleKeysDialog,- openLocationManagerPanel,- openTagLibraryPanel,- openSearchPanel,- openHelpFeedbackPanel,- closeAllVerticalPanels,- switchTheme,- openFileNatively,- openURLExternally,- showNotification,- directoryPath,- theme- } = this.props;- return (- <div>- <style>- {`+ render() {+ const {+ isLocationManagerPanelOpened,+ isTagLibraryPanelOpened,+ isSearchPanelOpened,+ isSettingsDialogOpened,+ isPerspectivesPanelOpened,+ isHelpFeedbackPanelOpened,+ isReadOnlyMode,+ toggleCreateFileDialog,+ toggleAboutDialog,+ toggleOnboardingDialog,+ toggleSettingsDialog,+ toggleKeysDialog,+ openLocationManagerPanel,+ openTagLibraryPanel,+ openSearchPanel,+ openHelpFeedbackPanel,+ closeAllVerticalPanels,+ switchTheme,+ openFileNatively,+ openURLExternally,+ showNotification,+ directoryPath,+ theme+ } = this.props;+ return (+ <div>+ <style>+ {`#verticalNavButton:hover {border-radius: 0;background-color: #880E4F;}`}- </style>- {this.state.isProTeaserVisible && (- <ProTeaserDialogAsync- open={this.state.isProTeaserVisible}- onClose={this.toggleProTeaser}- openURLExternally={openURLExternally}- key={uuidv1()}- />- )}- <SplitPane- split="vertical"- minSize={44}- maxSize={44}- defaultSize={44}- resizerStyle={{ backgroundColor: theme.palette.divider }}- >- <div style={this.styles.panel}>- <IconButton- onClick={toggleAboutDialog}- style={{ ...this.styles.button, marginTop: 10, marginBottom: 16 }}- title={i18n.t('core:aboutTitle')}- data-tid="aboutTagSpaces"- >- <img- style={{- ...this.styles.buttonIcon,- color: this.props.theme.palette.text.primary- }}- src={LogoIcon}- alt="TagSpaces Logo"- />- </IconButton>- <IconButton- id="verticalNavButton"- onClick={() => {- if (isReadOnlyMode || !directoryPath) {- showNotification(- 'You are in read-only mode or there is no opened location'- );- } else {- toggleCreateFileDialog();- }- }}- style={{ ...this.styles.button, marginBottom: 20 }}- title={i18n.t('core:createFileTitle')}- data-tid="locationManager"- >- <NewFileIcon style={this.styles.buttonIcon} />- </IconButton>- <IconButton- id="verticalNavButton"- onClick={() => {- if (isLocationManagerPanelOpened) {- closeAllVerticalPanels();- } else {- openLocationManagerPanel();- }- }}- style={- isLocationManagerPanelOpened- ? { ...this.styles.button, ...this.styles.selectedButton }- : this.styles.button- }- title={i18n.t('core:locationManager')}- data-tid="locationManager"- >- <LocationsIcon style={this.styles.buttonIcon} />- </IconButton>- <IconButton- id="verticalNavButton"- title={i18n.t('core:tagGroupOperations')}- data-tid="tagLibrary"- onClick={() => {- if (isTagLibraryPanelOpened) {- closeAllVerticalPanels();- } else {- openTagLibraryPanel();- }- }}- style={- isTagLibraryPanelOpened- ? { ...this.styles.button, ...this.styles.selectedButton }- : this.styles.button- }- >- <TagLibraryIcon style={this.styles.buttonIcon} />- </IconButton>- <IconButton- id="verticalNavButton"- title={i18n.t('core:searchTitle')}- data-tid="search"- onClick={() => {- if (isSearchPanelOpened) {- closeAllVerticalPanels();- } else {- openSearchPanel();- }- }}- style={- isSearchPanelOpened- ? { ...this.styles.button, ...this.styles.selectedButton }- : this.styles.button- }- >- <SearchIcon style={this.styles.buttonIcon} />- </IconButton>- {/* <IconButton+ </style>+ {this.state.isProTeaserVisible && (+ <ProTeaserDialogAsync+ open={this.state.isProTeaserVisible}+ onClose={this.toggleProTeaser}+ openURLExternally={openURLExternally}+ key={uuidv1()}+ />+ )}+ <SplitPane+ split="vertical"+ minSize={44}+ maxSize={44}+ defaultSize={44}+ resizerStyle={{ backgroundColor: theme.palette.divider }}+ >+ <div style={this.styles.panel}>+ <IconButton+ onClick={toggleAboutDialog}+ style={{ ...this.styles.button, marginTop: 10, marginBottom: 16 }}+ title={i18n.t('core:aboutTitle')}+ data-tid="aboutTagSpaces"+ >+ <img+ style={{+ ...this.styles.buttonIcon,+ color: this.props.theme.palette.text.primary+ }}+ src={LogoIcon}+ alt="TagSpaces Logo"+ />+ </IconButton>+ <IconButton+ id="verticalNavButton"+ onClick={() => {+ if (isReadOnlyMode || !directoryPath) {+ showNotification(+ 'You are in read-only mode or there is no opened location'+ );+ } else {+ toggleCreateFileDialog();+ }+ }}+ style={{ ...this.styles.button, marginBottom: 20 }}+ title={i18n.t('core:createFileTitle')}+ data-tid="locationManager"+ >+ <NewFileIcon style={this.styles.buttonIcon} />+ </IconButton>+ <IconButton+ id="verticalNavButton"+ onClick={() => {+ if (isLocationManagerPanelOpened) {+ closeAllVerticalPanels();+ } else {+ openLocationManagerPanel();+ }+ }}+ style={+ isLocationManagerPanelOpened+ ? { ...this.styles.button, ...this.styles.selectedButton }+ : this.styles.button+ }+ title={i18n.t('core:locationManager')}+ data-tid="locationManager"+ >+ <LocationsIcon style={this.styles.buttonIcon} />+ </IconButton>+ <IconButton+ id="verticalNavButton"+ title={i18n.t('core:tagGroupOperations')}+ data-tid="tagLibrary"+ onClick={() => {+ if (isTagLibraryPanelOpened) {+ closeAllVerticalPanels();+ } else {+ openTagLibraryPanel();+ }+ }}+ style={+ isTagLibraryPanelOpened+ ? { ...this.styles.button, ...this.styles.selectedButton }+ : this.styles.button+ }+ >+ <TagLibraryIcon style={this.styles.buttonIcon} />+ </IconButton>+ <IconButton+ id="verticalNavButton"+ title={i18n.t('core:searchTitle')}+ data-tid="search"+ onClick={() => {+ if (isSearchPanelOpened) {+ closeAllVerticalPanels();+ } else {+ openSearchPanel();+ }+ }}+ style={+ isSearchPanelOpened+ ? { ...this.styles.button, ...this.styles.selectedButton }+ : this.styles.button+ }+ >+ <SearchIcon style={this.styles.buttonIcon} />+ </IconButton>+ {/* <IconButtontitle={i18n.t('core:perspectiveManager')}data-tid="perspectiveManager"onClick={() => {@@ -301,138 +302,138 @@ class VerticalNavigation extends React.Component<Props, State> {><PerspectivesIcon style={this.styles.buttonIcon} /></IconButton> */}- <IconButton- id="verticalNavButton"- title={i18n.t('core:helpFeedback')}- data-tid="helpFeedback"- onClick={() => {- if (isHelpFeedbackPanelOpened) {- closeAllVerticalPanels();- } else {- openHelpFeedbackPanel();- }- }}- style={- isHelpFeedbackPanelOpened- ? { ...this.styles.button, ...this.styles.selectedButton }- : this.styles.button- }- >- <HelpIcon style={this.styles.buttonIcon} />- </IconButton>- {!Pro && (- <IconButton- id="verticalNavButton"- title={i18n.t('core:upgradeToPro')}- data-tid="upgradeToPro"- onClick={this.toggleProTeaser}- style={{ ...this.styles.button, ...this.styles.upgradeButton }}- >- <UpgradeIcon- style={{- ...this.styles.buttonIcon- // color: '1DD19F'- }}- />- </IconButton>- )}- <IconButton- id="verticalNavButton"- title={i18n.t('core:switchTheme')}- data-tid="switchTheme"- onClick={switchTheme}- style={{ ...this.styles.button, ...this.styles.themingButton }}- >- <ThemingIcon style={this.styles.buttonIcon} />- </IconButton>- <IconButton- id="verticalNavButton"- title={i18n.t('core:settings')}- data-tid="settings"- onClick={toggleSettingsDialog}- style={- isSettingsDialogOpened- ? {- ...this.styles.button,- ...this.styles.settingsButton,- ...this.styles.selectedButton- }- : {- ...this.styles.button,- ...this.styles.settingsButton- }- }- >- <SettingsIcon style={this.styles.buttonIcon} />- </IconButton>- </div>- <div style={this.styles.panel}>- <LocationManager- style={{- display: isLocationManagerPanelOpened ? 'block' : 'none'- }}- />- {isTagLibraryPanelOpened && <TagLibrary />}- <Search- style={{ display: isSearchPanelOpened ? 'block' : 'none' }}- />- {isPerspectivesPanelOpened && <PerspectiveManager />}- {isHelpFeedbackPanelOpened && (- <HelpFeedbackPanel- openFileNatively={openFileNatively}- openURLExternally={openURLExternally}- toggleAboutDialog={toggleAboutDialog}- toggleKeysDialog={toggleKeysDialog}- toggleOnboardingDialog={toggleOnboardingDialog}- toggleProTeaser={this.toggleProTeaser}- />- )}- </div>- </SplitPane>- </div>- );- }+ <IconButton+ id="verticalNavButton"+ title={i18n.t('core:helpFeedback')}+ data-tid="helpFeedback"+ onClick={() => {+ if (isHelpFeedbackPanelOpened) {+ closeAllVerticalPanels();+ } else {+ openHelpFeedbackPanel();+ }+ }}+ style={+ isHelpFeedbackPanelOpened+ ? { ...this.styles.button, ...this.styles.selectedButton }+ : this.styles.button+ }+ >+ <HelpIcon style={this.styles.buttonIcon} />+ </IconButton>+ {!Pro && (+ <IconButton+ id="verticalNavButton"+ title={i18n.t('core:upgradeToPro')}+ data-tid="upgradeToPro"+ onClick={this.toggleProTeaser}+ style={{ ...this.styles.button, ...this.styles.upgradeButton }}+ >+ <UpgradeIcon+ style={{+ ...this.styles.buttonIcon+ // color: '1DD19F'+ }}+ />+ </IconButton>+ )}+ <IconButton+ id="verticalNavButton"+ title={i18n.t('core:switchTheme')}+ data-tid="switchTheme"+ onClick={switchTheme}+ style={{ ...this.styles.button, ...this.styles.themingButton }}+ >+ <ThemingIcon style={this.styles.buttonIcon} />+ </IconButton>+ <IconButton+ id="verticalNavButton"+ title={i18n.t('core:settings')}+ data-tid="settings"+ onClick={toggleSettingsDialog}+ style={+ isSettingsDialogOpened+ ? {+ ...this.styles.button,+ ...this.styles.settingsButton,+ ...this.styles.selectedButton+ }+ : {+ ...this.styles.button,+ ...this.styles.settingsButton+ }+ }+ >+ <SettingsIcon style={this.styles.buttonIcon} />+ </IconButton>+ </div>+ <div style={this.styles.panel}>+ <LocationManager+ style={{+ display: isLocationManagerPanelOpened ? 'block' : 'none'+ }}+ />+ {isTagLibraryPanelOpened && <TagLibrary />}+ <Search+ style={{ display: isSearchPanelOpened ? 'block' : 'none' }}+ />+ {isPerspectivesPanelOpened && <PerspectiveManager />}+ {isHelpFeedbackPanelOpened && (+ <HelpFeedbackPanel+ openFileNatively={openFileNatively}+ openURLExternally={openURLExternally}+ toggleAboutDialog={toggleAboutDialog}+ toggleKeysDialog={toggleKeysDialog}+ toggleOnboardingDialog={toggleOnboardingDialog}+ toggleProTeaser={this.toggleProTeaser}+ />+ )}+ </div>+ </SplitPane>+ </div>+ );+ }}function mapStateToProps(state) {- return {- isFirstRun: isFirstRun(state),- isSettingsDialogOpened: isSettingsDialogOpened(state),- isLocationManagerPanelOpened: isLocationManagerPanelOpened(state),- isTagLibraryPanelOpened: isTagLibraryPanelOpened(state),- isSearchPanelOpened: isSearchPanelOpened(state),- isPerspectivesPanelOpened: isPerspectivesPanelOpened(state),- isHelpFeedbackPanelOpened: isHelpFeedbackPanelOpened(state),- isReadOnlyMode: isReadOnlyMode(state),- directoryPath: getDirectoryPath(state)- };+ return {+ isFirstRun: isFirstRun(state),+ isSettingsDialogOpened: isSettingsDialogOpened(state),+ isLocationManagerPanelOpened: isLocationManagerPanelOpened(state),+ isTagLibraryPanelOpened: isTagLibraryPanelOpened(state),+ isSearchPanelOpened: isSearchPanelOpened(state),+ isPerspectivesPanelOpened: isPerspectivesPanelOpened(state),+ isHelpFeedbackPanelOpened: isHelpFeedbackPanelOpened(state),+ isReadOnlyMode: isReadOnlyMode(state),+ directoryPath: getDirectoryPath(state)+ };}function mapActionCreatorsToProps(dispatch) {- return bindActionCreators(- {- toggleCreateFileDialog: AppActions.toggleCreateFileDialog,- toggleOnboardingDialog: AppActions.toggleOnboardingDialog,- toggleSettingsDialog: AppActions.toggleSettingsDialog,- toggleAboutDialog: AppActions.toggleAboutDialog,- toggleKeysDialog: AppActions.toggleKeysDialog,- openLocationManagerPanel: AppActions.openLocationManagerPanel,- openTagLibraryPanel: AppActions.openTagLibraryPanel,- openSearchPanel: AppActions.openSearchPanel,- openPerspectivesPanel: AppActions.openPerspectivesPanel,- openHelpFeedbackPanel: AppActions.openHelpFeedbackPanel,- openFileNatively: AppActions.openFileNatively,- openURLExternally: AppActions.openURLExternally,- closeAllVerticalPanels: AppActions.closeAllVerticalPanels,- showNotification: AppActions.showNotification,- switchTheme: SettingsActions.switchTheme,- setFirstRun: SettingsActions.setFirstRun- },- dispatch- );+ return bindActionCreators(+ {+ toggleCreateFileDialog: AppActions.toggleCreateFileDialog,+ toggleOnboardingDialog: AppActions.toggleOnboardingDialog,+ toggleSettingsDialog: AppActions.toggleSettingsDialog,+ toggleAboutDialog: AppActions.toggleAboutDialog,+ toggleKeysDialog: AppActions.toggleKeysDialog,+ openLocationManagerPanel: AppActions.openLocationManagerPanel,+ openTagLibraryPanel: AppActions.openTagLibraryPanel,+ openSearchPanel: AppActions.openSearchPanel,+ openPerspectivesPanel: AppActions.openPerspectivesPanel,+ openHelpFeedbackPanel: AppActions.openHelpFeedbackPanel,+ openFileNatively: AppActions.openFileNatively,+ openURLExternally: AppActions.openURLExternally,+ closeAllVerticalPanels: AppActions.closeAllVerticalPanels,+ showNotification: AppActions.showNotification,+ switchTheme: SettingsActions.switchTheme,+ setFirstRun: SettingsActions.setFirstRun+ },+ dispatch+ );}export default connect(- mapStateToProps,- mapActionCreatorsToProps+ mapStateToProps,+ mapActionCreatorsToProps)(withTheme(VerticalNavigation));diff --git a/app/components/WelcomePanel.tsx b/app/components/WelcomePanel.tsxindex 15b14c1ce..8f9019c51 100644--- a/app/components/WelcomePanel.tsx+++ b/app/components/WelcomePanel.tsx@@ -46,7 +46,7 @@ import {} from '../reducers/settings';import AppConfig from '../config';-const styles = theme => ({+const styles: any = (theme: any) => ({mainPanel: {flex: '1 1 100%',width: '100%',@@ -74,15 +74,14 @@ const styles = theme => ({}});-type Props = {- classes: Object,- toggleKeysDialog: () => void,- openURLExternally: (url: string) => void,- openFileNatively: (url: string) => void,- toggleAboutDialog: () => void,- isDesktopMode: boolean- // locations: Array<Location>-};+interface Props {+ classes: any;+ toggleKeysDialog: () => void;+ openURLExternally: (url: string) => void;+ openFileNatively: (url: string) => void;+ toggleAboutDialog: () => void;+ isDesktopMode: boolean;+}const WelcomePanel = (props: Props) => {const {diff --git a/app/components/dialogs/AboutDialog.tsx b/app/components/dialogs/AboutDialog.tsxindex 44c84f802..ba7b9b994 100644--- a/app/components/dialogs/AboutDialog.tsx+++ b/app/components/dialogs/AboutDialog.tsx@@ -33,13 +33,13 @@ import { Pro } from '../../pro';import { getLastVersionPromise } from '../../reducers/settings';import AppConfig from '../../config';-type Props = {- open: boolean,- fullScreen: boolean,- toggleLicenseDialog: () => void,- toggleThirdPartyLibsDialog: () => void,- onClose: () => void-};+interface Props {+ open: boolean;+ fullScreen: boolean;+ toggleLicenseDialog: () => void;+ toggleThirdPartyLibsDialog: () => void;+ onClose: () => void;+}let buildID = versionMeta.commitId;if (buildID && buildID.length >= 11) {diff --git a/app/components/dialogs/AddRemoveTagsDialog.tsx b/app/components/dialogs/AddRemoveTagsDialog.tsxindex bd91b68eb..91b125db5 100644--- a/app/components/dialogs/AddRemoveTagsDialog.tsx+++ b/app/components/dialogs/AddRemoveTagsDialog.tsx@@ -1,3 +1,4 @@+// @ts-nocheck/*** TagSpaces - universal file and folder organizer* Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)@@ -36,159 +37,159 @@ import i18n from '../../services/i18n';import { extractFileName } from '../../utils/paths';const Transition = React.forwardRef(function Transition(props, ref) {- return <Slide direction="down" ref={ref} {...props} />;+ return <Slide direction="down" ref={ref} {...props} />;});-type Props = {- open: boolean;- fullScreen: boolean;- selectedEntries: Array<any>;- onClose: () => void;- addTags: (paths: Array<string>, tags: Array<Tag>) => void;- removeTags: (paths: Array<string>, tags: Array<Tag>) => void;- removeAllTags: (paths: Array<string>) => void;-};+interface Props {+ open: boolean;+ fullScreen: boolean;+ selectedEntries: Array<any>;+ onClose: () => void;+ addTags: (paths: Array<string>, tags: Array<Tag>) => void;+ removeTags: (paths: Array<string>, tags: Array<Tag>) => void;+ removeAllTags: (paths: Array<string>) => void;+}-type State = {- disableConfirmButton: boolean;- open: boolean;- newlyAddedTags: Array<Tag>;- isConfirmDialogOpened: boolean;-};+interface State {+ disableConfirmButton: boolean;+ open: boolean;+ newlyAddedTags: Array<Tag>;+ isConfirmDialogOpened: boolean;+}class AddRemoveTagsDialog extends React.Component<Props, State> {- state = {- disableConfirmButton: true,- newlyAddedTags: [],- open: false,- isConfirmDialogOpened: false- };+ state = {+ disableConfirmButton: true,+ newlyAddedTags: [],+ open: false,+ isConfirmDialogOpened: false+ };- handleChange = (name, value) => {- this.setState({- newlyAddedTags: value- });- };+ handleChange = (name, value) => {+ this.setState({+ newlyAddedTags: value+ });+ };- onClose = () => {- this.setState({ newlyAddedTags: [] });- this.props.onClose();- };+ onClose = () => {+ this.setState({ newlyAddedTags: [] });+ this.props.onClose();+ };- addTags = () => {- if (this.props.selectedEntries && this.props.selectedEntries.length > 0) {- const paths = [];- this.props.selectedEntries.map(entry => {- paths.push(entry.path);- return true;- });- this.props.addTags(paths, this.state.newlyAddedTags);- }- this.onClose();- };+ addTags = () => {+ if (this.props.selectedEntries && this.props.selectedEntries.length > 0) {+ const paths = [];+ this.props.selectedEntries.map(entry => {+ paths.push(entry.path);+ return true;+ });+ this.props.addTags(paths, this.state.newlyAddedTags);+ }+ this.onClose();+ };- render() {- const {- open,- selectedEntries = [],- removeTags,- removeAllTags,- fullScreen,- onClose- } = this.props;- const { newlyAddedTags = [] } = this.state;+ render() {+ const {+ open,+ selectedEntries = [],+ removeTags,+ removeAllTags,+ fullScreen,+ onClose+ } = this.props;+ const { newlyAddedTags = [] } = this.state;- return (- <Dialog- open={open}- fullScreen={fullScreen}- onClose={onClose}- keepMounted- scroll="paper"- // onEnterKey={(event) => onEnterKeyHandler(event, this.addTags)}- TransitionComponent={Transition}- >- <DialogTitle>{i18n.t('core:tagOperationTitle')}</DialogTitle>- <DialogContent style={{ minHeight: 330 }}>- <TagsSelect- placeholderText={i18n.t('core:selectTags') as string}- tags={newlyAddedTags}- handleChange={this.handleChange}- />- <List dense style={{ width: 550 }}>- {selectedEntries.length > 0 &&- selectedEntries.map(entry => (- <ListItem key={uuidv1()} title={entry.path}>- <ListItemIcon>- <FileIcon />- </ListItemIcon>- <Typography variant="inherit" noWrap>- {extractFileName(entry.path || '')}- </Typography>- </ListItem>- ))}- </List>- </DialogContent>- <DialogActions>- <Button data-tid="cancel" onClick={this.onClose} color="primary">- {i18n.t('core:cancel')}- </Button>- <Button- data-tid="cleanTagsMultipleEntries"- disabled={selectedEntries.length < 1}- color="primary"- onClick={() => {- if (selectedEntries && selectedEntries.length > 0) {- const paths = [];- selectedEntries.map(entry => {- paths.push(entry.path);- return true;- });- removeAllTags(paths);- }- this.onClose();- }}- >- {i18n.t('core:tagOperationCleanTags')}- </Button>- <Button- data-tid="removeTagsMultipleEntries"- disabled={- !newlyAddedTags ||- newlyAddedTags.length < 1 ||- selectedEntries.length < 1- }- color="primary"- onClick={() => {- if (selectedEntries && selectedEntries.length > 0) {- const paths = [];- selectedEntries.map(entry => {- paths.push(entry.path);- return true;- });- removeTags(paths, newlyAddedTags);- }- this.onClose();- }}- >- {i18n.t('core:tagOperationRemoveTag')}- </Button>- <Button- data-tid="addTagsMultipleEntries"- disabled={- !newlyAddedTags ||- newlyAddedTags.length < 1 ||- selectedEntries.length < 1- }- color="primary"- onClick={this.addTags}- >- {i18n.t('core:tagOperationAddTag')}- </Button>- </DialogActions>- </Dialog>- );- }+ return (+ <Dialog+ open={open}+ fullScreen={fullScreen}+ onClose={onClose}+ keepMounted+ scroll="paper"+ // onEnterKey={(event) => onEnterKeyHandler(event, this.addTags)}+ TransitionComponent={Transition}+ >+ <DialogTitle>{i18n.t('core:tagOperationTitle')}</DialogTitle>+ <DialogContent style={{ minHeight: 330 }}>+ <TagsSelect+ placeholderText={i18n.t('core:selectTags') as string}+ tags={newlyAddedTags}+ handleChange={this.handleChange}+ />+ <List dense style={{ width: 550 }}>+ {selectedEntries.length > 0 &&+ selectedEntries.map(entry => (+ <ListItem key={uuidv1()} title={entry.path}>+ <ListItemIcon>+ <FileIcon />+ </ListItemIcon>+ <Typography variant="inherit" noWrap>+ {extractFileName(entry.path || '')}+ </Typography>+ </ListItem>+ ))}+ </List>+ </DialogContent>+ <DialogActions>+ <Button data-tid="cancel" onClick={this.onClose} color="primary">+ {i18n.t('core:cancel')}+ </Button>+ <Button+ data-tid="cleanTagsMultipleEntries"+ disabled={selectedEntries.length < 1}+ color="primary"+ onClick={() => {+ if (selectedEntries && selectedEntries.length > 0) {+ const paths = [];+ selectedEntries.map(entry => {+ paths.push(entry.path);+ return true;+ });+ removeAllTags(paths);+ }+ this.onClose();+ }}+ >+ {i18n.t('core:tagOperationCleanTags')}+ </Button>+ <Button+ data-tid="removeTagsMultipleEntries"+ disabled={+ !newlyAddedTags ||+ newlyAddedTags.length < 1 ||+ selectedEntries.length < 1+ }+ color="primary"+ onClick={() => {+ if (selectedEntries && selectedEntries.length > 0) {+ const paths = [];+ selectedEntries.map(entry => {+ paths.push(entry.path);+ return true;+ });+ removeTags(paths, newlyAddedTags);+ }+ this.onClose();+ }}+ >+ {i18n.t('core:tagOperationRemoveTag')}+ </Button>+ <Button+ data-tid="addTagsMultipleEntries"+ disabled={+ !newlyAddedTags ||+ newlyAddedTags.length < 1 ||+ selectedEntries.length < 1+ }+ color="primary"+ onClick={this.addTags}+ >+ {i18n.t('core:tagOperationAddTag')}+ </Button>+ </DialogActions>+ </Dialog>+ );+ }}export default withMobileDialog()(AddRemoveTagsDialog);diff --git a/app/components/dialogs/ConfirmDialog.tsx b/app/components/dialogs/ConfirmDialog.tsxindex 422cfdb16..394f58dca 100644--- a/app/components/dialogs/ConfirmDialog.tsx+++ b/app/components/dialogs/ConfirmDialog.tsx@@ -27,17 +27,17 @@ import Typography from '@material-ui/core/Typography';import Dialog from '@material-ui/core/Dialog';import i18n from '../../services/i18n';-type Props = {- open: boolean,- title: string,- content: string,- cancelDialogTID?: string,- confirmDialogTID?: string,- confirmDialogContentTID?: string,- list: Array<string>,- confirmCallback: (result: boolean) => void,- onClose: () => void-};+interface Props {+ open: boolean;+ title: string;+ content: string;+ cancelDialogTID?: string;+ confirmDialogTID?: string;+ confirmDialogContentTID?: string;+ list: Array<string>;+ confirmCallback: (result: boolean) => void;+ onClose: () => void;+}const ConfirmDialog = (props: Props) => {const { open, onClose } = props;diff --git a/app/components/dialogs/CreateDialog.tsx b/app/components/dialogs/CreateDialog.tsxindex 2e7fa61f7..ad76b5959 100644--- a/app/components/dialogs/CreateDialog.tsx+++ b/app/components/dialogs/CreateDialog.tsx@@ -64,7 +64,7 @@ const styles: any = () => ({}});-type Props = {+interface Props {open: boolean;classes: any;selectedDirectoryPath: string;@@ -78,7 +78,7 @@ type Props = {fileType: string) => void;onClose: () => void;-};+}const CreateDialog = (props: Props) => {let fileInput: HTMLFormElement;diff --git a/app/components/dialogs/CreateFileDialog.tsx b/app/components/dialogs/CreateFileDialog.tsxindex 868e27380..8ed526e54 100644--- a/app/components/dialogs/CreateFileDialog.tsx+++ b/app/components/dialogs/CreateFileDialog.tsx@@ -1,3 +1,4 @@+// @ts-nocheck/*** TagSpaces - universal file and folder organizer* Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)@@ -44,283 +45,283 @@ import { actions as AppActions } from '../../reducers/app';import PlatformIO from '../../services/platform-io';const styles = theme => ({- root: {- width: 550,- height: '100%',- marginBottom: 30,- background: theme.palette.background.paper- },- form: {- width: '98%',- height: 'auto'- },- formControl: {- margin: theme.spacing(3)- },- group: {- margin: theme.spacing(1, 0)- }+ root: {+ width: 550,+ height: '100%',+ marginBottom: 30,+ background: theme.palette.background.paper+ },+ form: {+ width: '98%',+ height: 'auto'+ },+ formControl: {+ margin: theme.spacing(3)+ },+ group: {+ margin: theme.spacing(1, 0)+ }});interface Props {- open: boolean;- fullScreen: boolean;- onClose: () => void;- selectedDirectoryPath: string | null;- showSelectDirectoryDialog: () => void;- createFileAdvanced: (- targetPath: string,- fileName: string,- content: string,- fileType: string- ) => void;+ open: boolean;+ fullScreen: boolean;+ onClose: () => void;+ selectedDirectoryPath: string | null;+ showSelectDirectoryDialog: () => void;+ createFileAdvanced: (+ targetPath: string,+ fileName: string,+ content: string,+ fileType: string+ ) => void;}interface State {- errorTextName: boolean;- errorTextPath: boolean;- disableConfirmButton: boolean;- selectedDirectoryPath: string | null;- fileName: string;- fileContent: string;- fileType: string;+ errorTextName: boolean;+ errorTextPath: boolean;+ disableConfirmButton: boolean;+ selectedDirectoryPath: string | null;+ fileName: string;+ fileContent: string;+ fileType: string;}class CreateFileDialog extends React.Component<Props, State> {- state = {- errorTextName: false,- errorTextPath: false,- openFolder: false,- disableConfirmButton: !(- this.props.selectedDirectoryPath &&- this.props.selectedDirectoryPath.length > 0- ),- selectedDirectoryPath: this.props.selectedDirectoryPath,- fileName:- 'note' +- AppConfig.beginTagContainer +- formatDateTime4Tag(new Date(), true) +- AppConfig.endTagContainer,- fileContent: '',- fileType: 'txt'- };+ state = {+ errorTextName: false,+ errorTextPath: false,+ openFolder: false,+ disableConfirmButton: !(+ this.props.selectedDirectoryPath &&+ this.props.selectedDirectoryPath.length > 0+ ),+ selectedDirectoryPath: this.props.selectedDirectoryPath,+ fileName:+ 'note' ++ AppConfig.beginTagContainer ++ formatDateTime4Tag(new Date(), true) ++ AppConfig.endTagContainer,+ fileContent: '',+ fileType: 'txt'+ };- fileName;+ fileName;- handleTypeChange = (event: React.ChangeEvent<HTMLInputElement>) => {- const target = event.target;- this.setState({ fileType: target.value });- };+ handleTypeChange = (event: React.ChangeEvent<HTMLInputElement>) => {+ const target = event.target;+ this.setState({ fileType: target.value });+ };- handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {- const target = event.target;- const value = target.type === 'checkbox' ? target.checked : target.value;- const name = target.name;- this.setState(- {- [name]: value- },- this.handleValidation- );- };+ handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {+ const target = event.target;+ const value = target.type === 'checkbox' ? target.checked : target.value;+ const name = target.name;+ this.setState(+ {+ [name]: value+ },+ this.handleValidation+ );+ };- handleValidation() {- if (this.state.fileName && this.state.fileName.length > 0) {- this.setState({ errorTextName: false });- } else {- this.setState({ errorTextName: true });- }+ handleValidation() {+ if (this.state.fileName && this.state.fileName.length > 0) {+ this.setState({ errorTextName: false });+ } else {+ this.setState({ errorTextName: true });+ }- if (- this.state.selectedDirectoryPath &&- this.state.selectedDirectoryPath.length > 0- ) {- this.setState({ errorTextPath: false });- } else {- this.setState({ errorTextPath: true });- }+ if (+ this.state.selectedDirectoryPath &&+ this.state.selectedDirectoryPath.length > 0+ ) {+ this.setState({ errorTextPath: false });+ } else {+ this.setState({ errorTextPath: true });+ }- this.setState({- disableConfirmButton:- !this.state.fileName || !this.state.selectedDirectoryPath- });- }+ this.setState({+ disableConfirmButton:+ !this.state.fileName || !this.state.selectedDirectoryPath+ });+ }- openFolderChooser = () => {- if (AppConfig.isElectron) {- PlatformIO.selectDirectoryDialog()- .then(selectedPaths => {- this.setState(- {- selectedDirectoryPath: selectedPaths[0]- },- this.handleValidation- );- return true;- })- .catch(err => {- console.log('selectDirectoryDialog failed with: ' + err);- });- } else {- this.props.showSelectDirectoryDialog();- }- };+ openFolderChooser = () => {+ if (AppConfig.isElectron) {+ PlatformIO.selectDirectoryDialog()+ .then(selectedPaths => {+ this.setState(+ {+ selectedDirectoryPath: selectedPaths[0]+ },+ this.handleValidation+ );+ return true;+ })+ .catch(err => {+ console.log('selectDirectoryDialog failed with: ' + err);+ });+ } else {+ this.props.showSelectDirectoryDialog();+ }+ };- onConfirm = () => {- if (!this.state.disableConfirmButton) {- const {- fileName,- fileContent,- fileType,- selectedDirectoryPath- } = this.state;- this.props.createFileAdvanced(- selectedDirectoryPath,- fileName,- fileContent,- fileType- );- this.props.onClose();- }- };+ onConfirm = () => {+ if (!this.state.disableConfirmButton) {+ const {+ fileName,+ fileContent,+ fileType,+ selectedDirectoryPath+ } = this.state;+ this.props.createFileAdvanced(+ selectedDirectoryPath,+ fileName,+ fileContent,+ fileType+ );+ this.props.onClose();+ }+ };- handleKeyPress = (event: any) => {- if (event.key === 'Enter' || event.keyCode === 13) {- event.stopPropagation();- }- };+ handleKeyPress = (event: any) => {+ if (event.key === 'Enter' || event.keyCode === 13) {+ event.stopPropagation();+ }+ };- return = () => {- <Dialog- open={open}- onClose={onClose}- fullScreen={fullScreen}- keepMounted- scroll="paper"- // onKeyDown={confirmFunction}- >- <DialogTitle>{i18n.t('core:createFileTitle')}</DialogTitle>- <DialogContent data-tid="createFileDialog">- <FormControl fullWidth={true} error={this.state.errorTextName}>- <TextField- fullWidth={true}- error={this.state.errorTextName}- autoFocus- margin="dense"- name="fileName"- label={i18n.t('core:fileName')}- inputRef={ref => {- this.fileName = ref;- }}- onChange={this.handleInputChange}- value={this.state.fileName}- data-tid="createFileDialog_fileName"- />- {this.state.errorTextName && (- <FormHelperText>{i18n.t('core:fileNameHelp')}</FormHelperText>- )}- </FormControl>- <FormControl fullWidth={true}>- <TextField- id="textarea"- placeholder="Enter the content of your file / note"- multiline- name="fileContent"- value={this.state.fileContent}- onChange={this.handleInputChange}- onKeyDown={this.handleKeyPress}- margin="normal"- fullWidth={true}- rows={4}- rowsMax={10}- />- </FormControl>- <ListItem>- <Radio- checked={this.state.fileType === 'txt'}- onChange={this.handleTypeChange}- value="txt"- name="type"- aria-label={i18n.t('core:createTextFile')}- />- <FormHelperText>{i18n.t('core:createTextFile')}</FormHelperText>- <Radio- checked={this.state.fileType === 'md'}- onChange={this.handleTypeChange}- value="md"- name="type"- aria-label={i18n.t('core:createMarkdown')}- />- <FormHelperText>{i18n.t('core:createMarkdown')}</FormHelperText>- <Radio- checked={this.state.fileType === 'html'}- onChange={this.handleTypeChange}- value="html"- name="html"- aria-label={i18n.t('core:createRichTextFile')}- />- <FormHelperText>{i18n.t('core:createRichTextFile')}</FormHelperText>- </ListItem>- <FormControl fullWidth={true}>- <InputLabel htmlFor="name">{i18n.t('core:filePath')}</InputLabel>- <Input- required- margin="dense"- name="selectedDirectoryPath"- label={i18n.t('core:filePath')}- fullWidth={true}- data-tid="createFileDialog_filePath"- value={this.state.selectedDirectoryPath}- onChange={this.handleInputChange}- endAdornment={- PlatformIO.haveObjectStoreSupport() ? (- undefined- ) : (- <InputAdornment position="end" style={{ height: 32 }}>- <IconButton onClick={this.openFolderChooser}>- <FolderIcon />- </IconButton>- </InputAdornment>- )- }- />- {this.state.errorTextPath && (- <FormHelperText>{i18n.t('core:invalidPath')}</FormHelperText>- )}- </FormControl>- </DialogContent>- <DialogActions>- <Button- data-tid="closeCreateFileDialog"- onClick={this.props.onClose}- color="primary"- >- {i18n.t('core:cancel')}- </Button>- <Button- disabled={this.state.disableConfirmButton}- onClick={this.onConfirm}- data-tid="confirmCreateFileDialog"- color="primary"- >- {i18n.t('core:ok')}- </Button>- </DialogActions>- </Dialog>;- };+ return = () => {+ <Dialog+ open={open}+ onClose={onClose}+ fullScreen={fullScreen}+ keepMounted+ scroll="paper"+ // onKeyDown={confirmFunction}+ >+ <DialogTitle>{i18n.t('core:createFileTitle')}</DialogTitle>+ <DialogContent data-tid="createFileDialog">+ <FormControl fullWidth={true} error={this.state.errorTextName}>+ <TextField+ fullWidth={true}+ error={this.state.errorTextName}+ autoFocus+ margin="dense"+ name="fileName"+ label={i18n.t('core:fileName')}+ inputRef={ref => {+ this.fileName = ref;+ }}+ onChange={this.handleInputChange}+ value={this.state.fileName}+ data-tid="createFileDialog_fileName"+ />+ {this.state.errorTextName && (+ <FormHelperText>{i18n.t('core:fileNameHelp')}</FormHelperText>+ )}+ </FormControl>+ <FormControl fullWidth={true}>+ <TextField+ id="textarea"+ placeholder="Enter the content of your file / note"+ multiline+ name="fileContent"+ value={this.state.fileContent}+ onChange={this.handleInputChange}+ onKeyDown={this.handleKeyPress}+ margin="normal"+ fullWidth={true}+ rows={4}+ rowsMax={10}+ />+ </FormControl>+ <ListItem>+ <Radio+ checked={this.state.fileType === 'txt'}+ onChange={this.handleTypeChange}+ value="txt"+ name="type"+ aria-label={i18n.t('core:createTextFile')}+ />+ <FormHelperText>{i18n.t('core:createTextFile')}</FormHelperText>+ <Radio+ checked={this.state.fileType === 'md'}+ onChange={this.handleTypeChange}+ value="md"+ name="type"+ aria-label={i18n.t('core:createMarkdown')}+ />+ <FormHelperText>{i18n.t('core:createMarkdown')}</FormHelperText>+ <Radio+ checked={this.state.fileType === 'html'}+ onChange={this.handleTypeChange}+ value="html"+ name="html"+ aria-label={i18n.t('core:createRichTextFile')}+ />+ <FormHelperText>{i18n.t('core:createRichTextFile')}</FormHelperText>+ </ListItem>+ <FormControl fullWidth={true}>+ <InputLabel htmlFor="name">{i18n.t('core:filePath')}</InputLabel>+ <Input+ required+ margin="dense"+ name="selectedDirectoryPath"+ label={i18n.t('core:filePath')}+ fullWidth={true}+ data-tid="createFileDialog_filePath"+ value={this.state.selectedDirectoryPath}+ onChange={this.handleInputChange}+ endAdornment={+ PlatformIO.haveObjectStoreSupport() ? (+ undefined+ ) : (+ <InputAdornment position="end" style={{ height: 32 }}>+ <IconButton onClick={this.openFolderChooser}>+ <FolderIcon />+ </IconButton>+ </InputAdornment>+ )+ }+ />+ {this.state.errorTextPath && (+ <FormHelperText>{i18n.t('core:invalidPath')}</FormHelperText>+ )}+ </FormControl>+ </DialogContent>+ <DialogActions>+ <Button+ data-tid="closeCreateFileDialog"+ onClick={this.props.onClose}+ color="primary"+ >+ {i18n.t('core:cancel')}+ </Button>+ <Button+ disabled={this.state.disableConfirmButton}+ onClick={this.onConfirm}+ data-tid="confirmCreateFileDialog"+ color="primary"+ >+ {i18n.t('core:ok')}+ </Button>+ </DialogActions>+ </Dialog>;+ };}function mapActionCreatorsToProps(dispatch) {- return bindActionCreators(- {- createFileAdvanced: AppActions.createFileAdvanced,- showSelectDirectoryDialog: AppActions.showSelectDirectoryDialog,- ...TaggingActions- },- dispatch- );+ return bindActionCreators(+ {+ createFileAdvanced: AppActions.createFileAdvanced,+ showSelectDirectoryDialog: AppActions.showSelectDirectoryDialog,+ ...TaggingActions+ },+ dispatch+ );}export default connect(- undefined,- mapActionCreatorsToProps+ undefined,+ mapActionCreatorsToProps)(withMobileDialog()(withStyles(styles)(CreateFileDialog)));diff --git a/app/components/dialogs/CreateLocationDialog.tsx b/app/components/dialogs/CreateLocationDialog.tsxindex 0aee4564c..33d18ef8b 100644--- a/app/components/dialogs/CreateLocationDialog.tsx+++ b/app/components/dialogs/CreateLocationDialog.tsx@@ -1,3 +1,4 @@+// @ts-nocheck/*** TagSpaces - universal file and folder organizer* Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)@@ -40,436 +41,435 @@ import ObjectStoreForm from './ObjectStoreForm';import LocalForm from './LocalForm';const styles = theme => ({- root: {- display: 'flex'- },- formControl: {- margin: theme.spacing(3)- },- group: {- margin: theme.spacing(1, 0),- display: 'flex',- flexDirection: 'row'- }+ root: {+ display: 'flex'+ },+ formControl: {+ margin: theme.spacing(3)+ },+ group: {+ margin: theme.spacing(1, 0),+ display: 'flex',+ flexDirection: 'row'+ }});interface Props {- // classes: Object,- open: boolean;- onClose: () => void;- fullScreen: boolean;- addLocation: (location: Location) => void;- showSelectDirectoryDialog: () => void;- resetState: () => void;+ open: boolean;+ onClose: () => void;+ fullScreen: boolean;+ addLocation: (location: Location) => void;+ showSelectDirectoryDialog: () => void;+ resetState: () => void;}interface State {- errorTextPath: boolean;- errorTextName: boolean;- disableConfirmButton: boolean;- name: string;- path: string;- perspective?: string;- isDefault: boolean;- isReadOnly: boolean;- watchForChanges: boolean;- persistIndex: boolean;- fullTextIndex: boolean;- type: string;+ errorTextPath: boolean;+ errorTextName: boolean;+ disableConfirmButton: boolean;+ name: string;+ path: string;+ perspective?: string;+ isDefault: boolean;+ isReadOnly: boolean;+ watchForChanges: boolean;+ persistIndex: boolean;+ fullTextIndex: boolean;+ type: string;}class CreateLocationDialog extends React.Component<Props, State> {- state = {- errorTextPath: false,- errorTextName: false,- disableConfirmButton: true,- name: '',- path: '',- perspective: '',- isDefault: false,- isReadOnly: false,- watchForChanges: Pro,- persistIndex: false,- fullTextIndex: false,- type: locationType.TYPE_LOCAL- };+ state = {+ errorTextPath: false,+ errorTextName: false,+ disableConfirmButton: true,+ name: '',+ path: '',+ perspective: '',+ isDefault: false,+ isReadOnly: false,+ watchForChanges: Pro,+ persistIndex: false,+ fullTextIndex: false,+ type: locationType.TYPE_LOCAL+ };- handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {- const target = event.target;- const value = target.type === 'checkbox' ? target.checked : target.value;- const name = target.name;- if (target.type === 'radio') {- // type is changed (skip validation)- this.setState({- [name]: value- });- } else {- this.handleChange(name, value);- }- };+ handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {+ const target = event.target;+ const value = target.type === 'checkbox' ? target.checked : target.value;+ const name = target.name;+ if (target.type === 'radio') {+ // type is changed (skip validation)+ this.setState({+ [name]: value+ });+ } else {+ this.handleChange(name, value);+ }+ };- handleChange = (name, value) => {- this.setState(- {- [name]: value- },- () => {- this.handleValidation(name);- }- );- };+ handleChange = (name, value) => {+ this.setState(+ {+ [name]: value+ },+ () => {+ this.handleValidation(name);+ }+ );+ };- handleValidation(field) {- // const pathRegex = this.state.path.match('^((\.\./|[a-zA-Z0-9_/\-\\])*\.[a-zA-Z0-9]+)$');- // const nameRegex = this.state.name.match('^[A-Z][-a-zA-Z]+$');- if (this.state.type === locationType.TYPE_LOCAL) {- let errorTextName = false;- let errorTextPath = false;- let disableConfirmButton = false;- if (!this.state.name || this.state.name.length === 0) {- errorTextName = true;- disableConfirmButton = true;- } else if (- field === 'name' &&- !this.state.errorTextName &&- !this.state.errorTextPath &&- this.state.disableConfirmButton- ) {- // initial skip validation for other fields- return new Promise(resolve => {- resolve(true);- });- }- if (!this.state.path || this.state.path.length === 0) {- errorTextPath = true; // make it optinal in cloud mode- disableConfirmButton = true;- }- return new Promise(resolve =>- this.setState(- { errorTextName, errorTextPath, disableConfirmButton },- resolve(!disableConfirmButton)- )- );- } else if (this.state.type === locationType.TYPE_CLOUD) {- let cloudErrorTextName = false;- // let cloudErrorTextPath = false;- let cloudErrorAccessKey = false;- let cloudErrorSecretAccessKey = false;- let cloudErrorBucketName = false;- let cloudErrorRegion = false;- let disableConfirmButton = false;- if (!this.state.storeName || this.state.storeName.length === 0) {- cloudErrorTextName = true;- disableConfirmButton = true;- } else if (- field === 'storeName' &&- !this.state.cloudErrorTextName &&- // && !this.state.cloudErrorTextPath- !this.state.cloudErrorAccessKey &&- !this.state.cloudErrorSecretAccessKey &&- !this.state.cloudErrorBucketName &&- !this.state.cloudErrorRegion &&- this.state.disableConfirmButton- ) {- // initial skip validation for other fields- return new Promise(resolve => {- resolve(true);- });- }+ handleValidation(field) {+ // const pathRegex = this.state.path.match('^((\.\./|[a-zA-Z0-9_/\-\\])*\.[a-zA-Z0-9]+)$');+ // const nameRegex = this.state.name.match('^[A-Z][-a-zA-Z]+$');+ if (this.state.type === locationType.TYPE_LOCAL) {+ let errorTextName = false;+ let errorTextPath = false;+ let disableConfirmButton = false;+ if (!this.state.name || this.state.name.length === 0) {+ errorTextName = true;+ disableConfirmButton = true;+ } else if (+ field === 'name' &&+ !this.state.errorTextName &&+ !this.state.errorTextPath &&+ this.state.disableConfirmButton+ ) {+ // initial skip validation for other fields+ return new Promise(resolve => {+ resolve(true);+ });+ }+ if (!this.state.path || this.state.path.length === 0) {+ errorTextPath = true; // make it optinal in cloud mode+ disableConfirmButton = true;+ }+ return new Promise(resolve =>+ this.setState(+ { errorTextName, errorTextPath, disableConfirmButton },+ resolve(!disableConfirmButton)+ )+ );+ } else if (this.state.type === locationType.TYPE_CLOUD) {+ let cloudErrorTextName = false;+ // let cloudErrorTextPath = false;+ let cloudErrorAccessKey = false;+ let cloudErrorSecretAccessKey = false;+ let cloudErrorBucketName = false;+ let cloudErrorRegion = false;+ let disableConfirmButton = false;+ if (!this.state.storeName || this.state.storeName.length === 0) {+ cloudErrorTextName = true;+ disableConfirmButton = true;+ } else if (+ field === 'storeName' &&+ !this.state.cloudErrorTextName &&+ // && !this.state.cloudErrorTextPath+ !this.state.cloudErrorAccessKey &&+ !this.state.cloudErrorSecretAccessKey &&+ !this.state.cloudErrorBucketName &&+ !this.state.cloudErrorRegion &&+ this.state.disableConfirmButton+ ) {+ // initial skip validation for other fields+ return new Promise(resolve => {+ resolve(true);+ });+ }- if (!this.state.accessKeyId || this.state.accessKeyId.length === 0) {- cloudErrorAccessKey = true;- disableConfirmButton = true;- } else if (- field === 'accessKeyId' &&- !this.state.cloudErrorTextName &&- // && !this.state.cloudErrorTextPath- !this.state.cloudErrorAccessKey &&- !this.state.cloudErrorSecretAccessKey &&- !this.state.cloudErrorBucketName &&- !this.state.cloudErrorRegion &&- this.state.disableConfirmButton- ) {- // initial skip validation for other fields- return new Promise(resolve => {- resolve(true);- });- }+ if (!this.state.accessKeyId || this.state.accessKeyId.length === 0) {+ cloudErrorAccessKey = true;+ disableConfirmButton = true;+ } else if (+ field === 'accessKeyId' &&+ !this.state.cloudErrorTextName &&+ // && !this.state.cloudErrorTextPath+ !this.state.cloudErrorAccessKey &&+ !this.state.cloudErrorSecretAccessKey &&+ !this.state.cloudErrorBucketName &&+ !this.state.cloudErrorRegion &&+ this.state.disableConfirmButton+ ) {+ // initial skip validation for other fields+ return new Promise(resolve => {+ resolve(true);+ });+ }- if (- !this.state.secretAccessKey ||- this.state.secretAccessKey.length === 0- ) {- cloudErrorSecretAccessKey = true;- disableConfirmButton = true;- } else if (- field === 'secretAccessKey' &&- !this.state.cloudErrorTextName &&- // && !this.state.cloudErrorTextPath- !this.state.cloudErrorAccessKey &&- !this.state.cloudErrorSecretAccessKey &&- !this.state.cloudErrorBucketName &&- !this.state.cloudErrorRegion &&- this.state.disableConfirmButton- ) {- // initial skip validation for other fields- return new Promise(resolve => {- resolve(true);- });- }+ if (+ !this.state.secretAccessKey ||+ this.state.secretAccessKey.length === 0+ ) {+ cloudErrorSecretAccessKey = true;+ disableConfirmButton = true;+ } else if (+ field === 'secretAccessKey' &&+ !this.state.cloudErrorTextName &&+ // && !this.state.cloudErrorTextPath+ !this.state.cloudErrorAccessKey &&+ !this.state.cloudErrorSecretAccessKey &&+ !this.state.cloudErrorBucketName &&+ !this.state.cloudErrorRegion &&+ this.state.disableConfirmButton+ ) {+ // initial skip validation for other fields+ return new Promise(resolve => {+ resolve(true);+ });+ }- if (!this.state.bucketName || this.state.bucketName.length === 0) {- cloudErrorBucketName = true;- disableConfirmButton = true;- } else if (- field === 'bucketName' &&- !this.state.cloudErrorTextName &&- // && !this.state.cloudErrorTextPath- !this.state.cloudErrorAccessKey &&- !this.state.cloudErrorSecretAccessKey &&- !this.state.cloudErrorBucketName &&- !this.state.cloudErrorRegion &&- this.state.disableConfirmButton- ) {- // initial skip validation for other fields- return new Promise(resolve => {- resolve(true);- });- }+ if (!this.state.bucketName || this.state.bucketName.length === 0) {+ cloudErrorBucketName = true;+ disableConfirmButton = true;+ } else if (+ field === 'bucketName' &&+ !this.state.cloudErrorTextName &&+ // && !this.state.cloudErrorTextPath+ !this.state.cloudErrorAccessKey &&+ !this.state.cloudErrorSecretAccessKey &&+ !this.state.cloudErrorBucketName &&+ !this.state.cloudErrorRegion &&+ this.state.disableConfirmButton+ ) {+ // initial skip validation for other fields+ return new Promise(resolve => {+ resolve(true);+ });+ }- if (!this.state.region) {- cloudErrorRegion = true;- disableConfirmButton = true;- }+ if (!this.state.region) {+ cloudErrorRegion = true;+ disableConfirmButton = true;+ }- return new Promise(resolve =>- this.setState(- {- cloudErrorTextName,- // cloudErrorTextPath,- cloudErrorAccessKey,- cloudErrorSecretAccessKey,- cloudErrorBucketName,- disableConfirmButton,- cloudErrorRegion- },- resolve(!disableConfirmButton)- )- );- }- return new Promise(resolve => {- resolve(true);- });- }+ return new Promise(resolve =>+ this.setState(+ {+ cloudErrorTextName,+ // cloudErrorTextPath,+ cloudErrorAccessKey,+ cloudErrorSecretAccessKey,+ cloudErrorBucketName,+ disableConfirmButton,+ cloudErrorRegion+ },+ resolve(!disableConfirmButton)+ )+ );+ }+ return new Promise(resolve => {+ resolve(true);+ });+ }- onConfirm = () => {- this.handleValidation()- .then(success => {- if (success) {- if (this.state.type === locationType.TYPE_LOCAL) {- this.props.addLocation({- uuid: uuidv1(),- type: locationType.TYPE_LOCAL,- name: this.state.name,- paths: [this.state.path],- perspective: this.state.perspective,- isDefault: this.state.isDefault,- isReadOnly: this.state.isReadOnly,- persistIndex: this.state.persistIndex,- fullTextIndex: this.state.fullTextIndex,- watchForChanges: this.state.watchForChanges- });- } else if (this.state.type === locationType.TYPE_CLOUD) {- this.props.addLocation({- uuid: uuidv1(),- type: locationType.TYPE_CLOUD,- name: this.state.storeName,- paths: [this.state.storePath],- accessKeyId: this.state.accessKeyId,- secretAccessKey: this.state.secretAccessKey,- bucketName: this.state.bucketName,- region: this.state.region.value,- perspective: this.state.perspective,- isDefault: this.state.isDefault,- isReadOnly: this.state.isReadOnly,- persistIndex: this.state.persistIndex,- fullTextIndex: this.state.fullTextIndex,- watchForChanges: false- });- }- this.props.onClose();- this.props.resetState('createLocationDialogKey');- }- return true;- })- .catch(error => {- console.debug('Failed validation', error);- });- };+ onConfirm = () => {+ this.handleValidation()+ .then(success => {+ if (success) {+ if (this.state.type === locationType.TYPE_LOCAL) {+ this.props.addLocation({+ uuid: uuidv1(),+ type: locationType.TYPE_LOCAL,+ name: this.state.name,+ paths: [this.state.path],+ perspective: this.state.perspective,+ isDefault: this.state.isDefault,+ isReadOnly: this.state.isReadOnly,+ persistIndex: this.state.persistIndex,+ fullTextIndex: this.state.fullTextIndex,+ watchForChanges: this.state.watchForChanges+ });+ } else if (this.state.type === locationType.TYPE_CLOUD) {+ this.props.addLocation({+ uuid: uuidv1(),+ type: locationType.TYPE_CLOUD,+ name: this.state.storeName,+ paths: [this.state.storePath],+ accessKeyId: this.state.accessKeyId,+ secretAccessKey: this.state.secretAccessKey,+ bucketName: this.state.bucketName,+ region: this.state.region.value,+ perspective: this.state.perspective,+ isDefault: this.state.isDefault,+ isReadOnly: this.state.isReadOnly,+ persistIndex: this.state.persistIndex,+ fullTextIndex: this.state.fullTextIndex,+ watchForChanges: false+ });+ }+ this.props.onClose();+ this.props.resetState('createLocationDialogKey');+ }+ return true;+ })+ .catch(error => {+ console.debug('Failed validation', error);+ });+ };- onCancel = () => {- this.props.onClose();- this.props.resetState('createLocationDialogKey');- };+ onCancel = () => {+ this.props.onClose();+ this.props.resetState('createLocationDialogKey');+ };- render() {- const { fullScreen, open, onClose } = this.props;+ render() {+ const { fullScreen, open, onClose } = this.props;- // const { classes } = this.props;- let content;- if (this.state.type === locationType.TYPE_CLOUD) {- content = (- <ObjectStoreForm- handleInputChange={this.handleInputChange}- handleChange={this.handleChange}- state={this.state}- />- );- } else {- content = (- <LocalForm- showSelectDirectoryDialog={this.props.showSelectDirectoryDialog}- handleInputChange={this.handleInputChange}- handleChange={this.handleChange}- state={this.state}- />- );- }+ // const { classes } = this.props;+ let content;+ if (this.state.type === locationType.TYPE_CLOUD) {+ content = (+ <ObjectStoreForm+ handleInputChange={this.handleInputChange}+ handleChange={this.handleChange}+ state={this.state}+ />+ );+ } else {+ content = (+ <LocalForm+ showSelectDirectoryDialog={this.props.showSelectDirectoryDialog}+ handleInputChange={this.handleInputChange}+ handleChange={this.handleChange}+ state={this.state}+ />+ );+ }- return (- <Dialog- open={open}- onClose={onClose}- fullScreen={fullScreen}- keepMounted- scroll="paper"- // onKeyDown={confirmFunction}- >- <DialogTitle>{i18n.t('core:createLocationTitle')}</DialogTitle>- <DialogContent>- <Grid container spacing={2}>- <Grid item xs={2} style={{ marginTop: 13, textAlign: 'left' }}>- <Typography>{i18n.t('core:locationType')}</Typography>- </Grid>- <Grid item xs={10}>- <FormControl disabled={!Pro}>- <RadioGroup- title={- Pro ? '' : i18n.t('core:thisFunctionalityIsAvailableInPro')- }- component="label"- aria-label={i18n.t('core:locationType')}- name="type"- value={this.state.type}- onChange={this.handleInputChange}- row- >- <FormControlLabel- value={locationType.TYPE_LOCAL}- control={<Radio />}- label="Local"- />- <FormControlLabel- value={locationType.TYPE_CLOUD}- control={<Radio />}- title="AWS S3 compatible object storage"- label="AWS S3 Object Storage"- />- </RadioGroup>- </FormControl>- </Grid>- </Grid>- {content}- <FormGroup>- <FormControlLabel- control={- <Switch- data-tid="locationIsDefault"- name="isDefault"- checked={this.state.isDefault}- onChange={this.handleInputChange}- />- }- label={i18n.t('core:startupLocation')}- />- <FormControlLabel- control={- <Switch- disabled={!Pro}- data-tid="changeReadOnlyMode"- name="isReadOnly"- checked={this.state.isReadOnly}- onChange={this.handleInputChange}- />- }- label={- i18n.t('core:readonlyModeSwitch') +- (Pro ? '' : ' - ' + i18n.t('core:proFeature'))- }- />- <FormControlLabel- control={- <Switch- disabled={!Pro}- data-tid="changeFullTextIndex"- name="fullTextIndex"- checked={this.state.fullTextIndex}- onChange={this.handleInputChange}- />- }- label={- i18n.t('core:createFullTextIndex') +- (Pro ? '' : ' - ' + i18n.t('core:proFeature'))- }- />- <FormControlLabel- control={- <Switch- disabled={!Pro}- data-tid="changePersistIndex"- name="persistIndex"- checked={this.state.persistIndex}- onChange={this.handleInputChange}- />- }- label={- i18n.t('core:persistIndexSwitch') +- (Pro ? '' : ' - ' + i18n.t('core:proFeature'))- }- />- <FormControlLabel- control={- <Switch- disabled={!Pro || this.state.type === locationType.TYPE_CLOUD}- data-tid="changeWatchForChanges"- name="watchForChanges"- checked={this.state.watchForChanges}- onChange={this.handleInputChange}- />- }- label={- i18n.t('core:watchForChangesInLocation') +- (Pro ? '' : ' - ' + i18n.t('core:proFeature'))- }- />- </FormGroup>- </DialogContent>- <DialogActions>- <Button onClick={this.onCancel} color="primary">- {i18n.t('core:cancel')}- </Button>- <Button- disabled={this.state.disableConfirmButton}- onClick={this.onConfirm}- data-tid="confirmLocationCreation"- color="primary"- >- {i18n.t('core:ok')}- </Button>- </DialogActions>- </Dialog>- );- }+ return (+ <Dialog+ open={open}+ onClose={onClose}+ fullScreen={fullScreen}+ keepMounted+ scroll="paper"+ // onKeyDown={confirmFunction}+ >+ <DialogTitle>{i18n.t('core:createLocationTitle')}</DialogTitle>+ <DialogContent>+ <Grid container spacing={2}>+ <Grid item xs={2} style={{ marginTop: 13, textAlign: 'left' }}>+ <Typography>{i18n.t('core:locationType')}</Typography>+ </Grid>+ <Grid item xs={10}>+ <FormControl disabled={!Pro}>+ <RadioGroup+ title={+ Pro ? '' : i18n.t('core:thisFunctionalityIsAvailableInPro')+ }+ component="label"+ aria-label={i18n.t('core:locationType')}+ name="type"+ value={this.state.type}+ onChange={this.handleInputChange}+ row+ >+ <FormControlLabel+ value={locationType.TYPE_LOCAL}+ control={<Radio />}+ label="Local"+ />+ <FormControlLabel+ value={locationType.TYPE_CLOUD}+ control={<Radio />}+ title="AWS S3 compatible object storage"+ label="AWS S3 Object Storage"+ />+ </RadioGroup>+ </FormControl>+ </Grid>+ </Grid>+ {content}+ <FormGroup>+ <FormControlLabel+ control={+ <Switch+ data-tid="locationIsDefault"+ name="isDefault"+ checked={this.state.isDefault}+ onChange={this.handleInputChange}+ />+ }+ label={i18n.t('core:startupLocation')}+ />+ <FormControlLabel+ control={+ <Switch+ disabled={!Pro}+ data-tid="changeReadOnlyMode"+ name="isReadOnly"+ checked={this.state.isReadOnly}+ onChange={this.handleInputChange}+ />+ }+ label={+ i18n.t('core:readonlyModeSwitch') ++ (Pro ? '' : ' - ' + i18n.t('core:proFeature'))+ }+ />+ <FormControlLabel+ control={+ <Switch+ disabled={!Pro}+ data-tid="changeFullTextIndex"+ name="fullTextIndex"+ checked={this.state.fullTextIndex}+ onChange={this.handleInputChange}+ />+ }+ label={+ i18n.t('core:createFullTextIndex') ++ (Pro ? '' : ' - ' + i18n.t('core:proFeature'))+ }+ />+ <FormControlLabel+ control={+ <Switch+ disabled={!Pro}+ data-tid="changePersistIndex"+ name="persistIndex"+ checked={this.state.persistIndex}+ onChange={this.handleInputChange}+ />+ }+ label={+ i18n.t('core:persistIndexSwitch') ++ (Pro ? '' : ' - ' + i18n.t('core:proFeature'))+ }+ />+ <FormControlLabel+ control={+ <Switch+ disabled={!Pro || this.state.type === locationType.TYPE_CLOUD}+ data-tid="changeWatchForChanges"+ name="watchForChanges"+ checked={this.state.watchForChanges}+ onChange={this.handleInputChange}+ />+ }+ label={+ i18n.t('core:watchForChangesInLocation') ++ (Pro ? '' : ' - ' + i18n.t('core:proFeature'))+ }+ />+ </FormGroup>+ </DialogContent>+ <DialogActions>+ <Button onClick={this.onCancel} color="primary">+ {i18n.t('core:cancel')}+ </Button>+ <Button+ disabled={this.state.disableConfirmButton}+ onClick={this.onConfirm}+ data-tid="confirmLocationCreation"+ color="primary"+ >+ {i18n.t('core:ok')}+ </Button>+ </DialogActions>+ </Dialog>+ );+ }}export default withStyles(styles)(withMobileDialog()(CreateLocationDialog));diff --git a/app/components/dialogs/EditEntryTagDialog.tsx b/app/components/dialogs/EditEntryTagDialog.tsxindex aa89494fa..01576acec 100644--- a/app/components/dialogs/EditEntryTagDialog.tsx+++ b/app/components/dialogs/EditEntryTagDialog.tsx@@ -47,15 +47,15 @@ const styles = () => ({}});-type Props = {- classes: Object;+interface Props {+ classes: any;open: boolean;fullScreen: boolean;onClose: () => void;editTagForEntry: (path: string, tag: Tag, title: string) => void;currentEntryPath: string;selectedTag: Tag;-};+}const GeoTagEditor = Pro && Pro.UI ? Pro.UI.GeoTagEditor : React.Fragment;const DateTagEditor = Pro && Pro.UI ? Pro.UI.DateTagEditor : React.Fragment;diff --git a/app/components/dialogs/EditLocationDialog.tsx b/app/components/dialogs/EditLocationDialog.tsxindex ffd06886a..3ddba5621 100644--- a/app/components/dialogs/EditLocationDialog.tsx+++ b/app/components/dialogs/EditLocationDialog.tsx@@ -1,3 +1,4 @@+// @ts-nocheck/*** TagSpaces - universal file and folder organizer* Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)@@ -39,176 +40,176 @@ import LocalForm from './LocalForm';import { Pro } from '../../pro';interface Props {- open: boolean;- fullScreen: boolean;- resetState: () => void;- onClose: () => void;- location: Location | null;- editLocation: (location: Location) => void;- showSelectDirectoryDialog: () => void;- selectedDirectoryPath: string | null;- onCancel: () => void;+ open: boolean;+ fullScreen: boolean;+ resetState: () => void;+ onClose: () => void;+ location: Location | null;+ editLocation: (location: Location) => void;+ showSelectDirectoryDialog: () => void;+ selectedDirectoryPath: string | null;+ onCancel: () => void;}interface State {- errorTextPath: boolean;- errorTextName: boolean;- disableConfirmButton: boolean;- // openDirectoryButtonDisabled?: boolean,- uuid: string;- name: string;- path: string;- perspective: '';- isDefault: boolean;- isReadOnly: boolean;- watchForChanges: boolean;- fullTextIndex: boolean;- persistIndex: boolean;- type: string;+ errorTextPath: boolean;+ errorTextName: boolean;+ disableConfirmButton: boolean;+ // openDirectoryButtonDisabled?: boolean,+ uuid: string;+ name: string;+ path: string;+ perspective: '';+ isDefault: boolean;+ isReadOnly: boolean;+ watchForChanges: boolean;+ fullTextIndex: boolean;+ persistIndex: boolean;+ type: string;}class EditLocationDialog extends React.Component<Props, State> {- state = {- errorTextPath: false,- errorTextName: false,- disableConfirmButton: true,- // openDirectoryButtonDisabled: false,- uuid: '',- name: '',- path: '',- perspective: '',- isDefault: false,- isReadOnly: false,- watchForChanges: false,- persistIndex: false,- fullTextIndex: false,- type: locationType.TYPE_LOCAL- };+ state = {+ errorTextPath: false,+ errorTextName: false,+ disableConfirmButton: true,+ // openDirectoryButtonDisabled: false,+ uuid: '',+ name: '',+ path: '',+ perspective: '',+ isDefault: false,+ isReadOnly: false,+ watchForChanges: false,+ persistIndex: false,+ fullTextIndex: false,+ type: locationType.TYPE_LOCAL+ };- componentWillReceiveProps = (nextProps: any) => {- if (nextProps.open === true && nextProps.location) {- const dir = nextProps.selectedDirectoryPath;- let properties;- if (nextProps.location.type === locationType.TYPE_CLOUD) {- properties = {- storeName: dir ? extractDirectoryName(dir) : nextProps.location.name,- storePath: dir || nextProps.location.paths[0]- };- } else {- properties = {- // TODO maybe its better to separate name/path keys for different locationTypes ??- name: dir ? extractDirectoryName(dir) : nextProps.location.name,- path: dir || nextProps.location.paths[0]- };- }- this.setState({- ...properties,- uuid: nextProps.location.uuid,- perspective: nextProps.location.perspective,- isDefault: nextProps.location.isDefault,- isReadOnly: nextProps.location.isReadOnly,- watchForChanges: nextProps.location.watchForChanges,- persistIndex: nextProps.location.persistIndex,- fullTextIndex: nextProps.location.fullTextIndex,- type: nextProps.location.type || locationType.TYPE_LOCAL,- accessKeyId: nextProps.location.accessKeyId,- secretAccessKey: nextProps.location.secretAccessKey,- bucketName: nextProps.location.bucketName,- region: suggestions.find(obj => obj.value === nextProps.location.region)- });- }- };+ componentWillReceiveProps = (nextProps: any) => {+ if (nextProps.open === true && nextProps.location) {+ const dir = nextProps.selectedDirectoryPath;+ let properties;+ if (nextProps.location.type === locationType.TYPE_CLOUD) {+ properties = {+ storeName: dir ? extractDirectoryName(dir) : nextProps.location.name,+ storePath: dir || nextProps.location.paths[0]+ };+ } else {+ properties = {+ // TODO maybe its better to separate name/path keys for different locationTypes ??+ name: dir ? extractDirectoryName(dir) : nextProps.location.name,+ path: dir || nextProps.location.paths[0]+ };+ }+ this.setState({+ ...properties,+ uuid: nextProps.location.uuid,+ perspective: nextProps.location.perspective,+ isDefault: nextProps.location.isDefault,+ isReadOnly: nextProps.location.isReadOnly,+ watchForChanges: nextProps.location.watchForChanges,+ persistIndex: nextProps.location.persistIndex,+ fullTextIndex: nextProps.location.fullTextIndex,+ type: nextProps.location.type || locationType.TYPE_LOCAL,+ accessKeyId: nextProps.location.accessKeyId,+ secretAccessKey: nextProps.location.secretAccessKey,+ bucketName: nextProps.location.bucketName,+ region: suggestions.find(obj => obj.value === nextProps.location.region)+ });+ }+ };- handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {- const target = event.target;- const value = target.type === 'checkbox' ? target.checked : target.value;- const name = target.name;- if (target.type === 'radio') {- // type is changed (skip validation)- this.setState({- [name]: value- });- } else {- this.handleChange(name, value);- }- };+ handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {+ const target = event.target;+ const value = target.type === 'checkbox' ? target.checked : target.value;+ const name = target.name;+ if (target.type === 'radio') {+ // type is changed (skip validation)+ this.setState({+ [name]: value+ });+ } else {+ this.handleChange(name, value);+ }+ };- handleChange = (name, value) => {- this.setState(- {- [name]: value- },- this.handleValidation- );- };+ handleChange = (name, value) => {+ this.setState(+ {+ [name]: value+ },+ this.handleValidation+ );+ };- handleValidation() {- // const pathRegex = this.state.path.match('^((\.\./|[a-zA-Z0-9_/\-\\])*\.[a-zA-Z0-9]+)$');- // const nameRegex = this.state.name.match('^[A-Z][-a-zA-Z]+$');- if (this.state.type === locationType.TYPE_CLOUD) {- let cloudErrorTextName = false;- // let cloudErrorTextPath = false;- let cloudErrorAccessKey = false;- let cloudErrorSecretAccessKey = false;- let cloudErrorBucketName = false;- let cloudErrorRegion = false;- let disableConfirmButton = false;- if (!this.state.storeName || this.state.storeName.length === 0) {- cloudErrorTextName = true;- disableConfirmButton = true;- }+ handleValidation() {+ // const pathRegex = this.state.path.match('^((\.\./|[a-zA-Z0-9_/\-\\])*\.[a-zA-Z0-9]+)$');+ // const nameRegex = this.state.name.match('^[A-Z][-a-zA-Z]+$');+ if (this.state.type === locationType.TYPE_CLOUD) {+ let cloudErrorTextName = false;+ // let cloudErrorTextPath = false;+ let cloudErrorAccessKey = false;+ let cloudErrorSecretAccessKey = false;+ let cloudErrorBucketName = false;+ let cloudErrorRegion = false;+ let disableConfirmButton = false;+ if (!this.state.storeName || this.state.storeName.length === 0) {+ cloudErrorTextName = true;+ disableConfirmButton = true;+ }- /* if (!this.state.storePath || this.state.storePath.length === 0) {+ /* if (!this.state.storePath || this.state.storePath.length === 0) {cloudErrorTextPath = true;disableConfirmButton = true;} */- // if (!this.state.accessKeyId || this.state.accessKeyId.length === 0) {- // cloudErrorAccessKey = true;- // disableConfirmButton = true;- // }+ // if (!this.state.accessKeyId || this.state.accessKeyId.length === 0) {+ // cloudErrorAccessKey = true;+ // disableConfirmButton = true;+ // }- // if (!this.state.secretAccessKey || this.state.secretAccessKey.length === 0) {- // cloudErrorSecretAccessKey = true;- // disableConfirmButton = true;- // }+ // if (!this.state.secretAccessKey || this.state.secretAccessKey.length === 0) {+ // cloudErrorSecretAccessKey = true;+ // disableConfirmButton = true;+ // }- if (!this.state.bucketName || this.state.bucketName.length === 0) {- cloudErrorBucketName = true;- disableConfirmButton = true;- }+ if (!this.state.bucketName || this.state.bucketName.length === 0) {+ cloudErrorBucketName = true;+ disableConfirmButton = true;+ }- if (!this.state.region) {- cloudErrorRegion = true;- disableConfirmButton = true;- }+ if (!this.state.region) {+ cloudErrorRegion = true;+ disableConfirmButton = true;+ }- this.setState({- cloudErrorTextName,- // cloudErrorTextPath,- // cloudErrorAccessKey,- // cloudErrorSecretAccessKey,- cloudErrorBucketName,- disableConfirmButton,- cloudErrorRegion- });- } else {- let errorTextName = false;- let errorTextPath = false;- let disableConfirmButton = false;- if (!this.state.name || this.state.name.length === 0) {- errorTextName = true;- disableConfirmButton = true;- }- if (!this.state.path || this.state.path.length === 0) {- errorTextPath = true; // make in optional in cloud mode- disableConfirmButton = true;- }- this.setState({ errorTextName, errorTextPath, disableConfirmButton });- }- }+ this.setState({+ cloudErrorTextName,+ // cloudErrorTextPath,+ // cloudErrorAccessKey,+ // cloudErrorSecretAccessKey,+ cloudErrorBucketName,+ disableConfirmButton,+ cloudErrorRegion+ });+ } else {+ let errorTextName = false;+ let errorTextPath = false;+ let disableConfirmButton = false;+ if (!this.state.name || this.state.name.length === 0) {+ errorTextName = true;+ disableConfirmButton = true;+ }+ if (!this.state.path || this.state.path.length === 0) {+ errorTextPath = true; // make in optional in cloud mode+ disableConfirmButton = true;+ }+ this.setState({ errorTextName, errorTextPath, disableConfirmButton });+ }+ }- /* openDirectory = () => {+ /* openDirectory = () => {if (AppConfig.isElectron) {this.setState({ openDirectoryButtonDisabled: true });PlatformIO.selectDirectoryDialog().then((selectedPaths) => {@@ -229,230 +230,230 @@ class EditLocationDialog extends React.Component<Props, State> {}} */- onConfirm = () => {- if (!this.state.disableConfirmButton) {- if (this.state.type === locationType.TYPE_LOCAL) {- this.props.editLocation({- uuid: this.state.uuid,- type: locationType.TYPE_LOCAL,- name: this.state.name,- paths: [this.state.path],- perspective: this.state.perspective,- isDefault: this.state.isDefault,- isReadOnly: this.state.isReadOnly,- persistIndex: this.state.persistIndex,- fullTextIndex: this.state.fullTextIndex,- watchForChanges: this.state.watchForChanges- });- } else if (this.state.type === locationType.TYPE_CLOUD) {- this.props.editLocation({- uuid: this.state.uuid,- type: locationType.TYPE_CLOUD,- name: this.state.storeName,- paths: [this.state.storePath],- accessKeyId: this.state.accessKeyId,- secretAccessKey: this.state.secretAccessKey,- bucketName: this.state.bucketName,- region: this.state.region.value,- perspective: this.state.perspective,- isDefault: this.state.isDefault,- isReadOnly: this.state.isReadOnly,- persistIndex: this.state.persistIndex,- fullTextIndex: this.state.fullTextIndex,- watchForChanges: false- });- }- this.props.onClose();- this.props.resetState('editLocationDialogKey');- }- };+ onConfirm = () => {+ if (!this.state.disableConfirmButton) {+ if (this.state.type === locationType.TYPE_LOCAL) {+ this.props.editLocation({+ uuid: this.state.uuid,+ type: locationType.TYPE_LOCAL,+ name: this.state.name,+ paths: [this.state.path],+ perspective: this.state.perspective,+ isDefault: this.state.isDefault,+ isReadOnly: this.state.isReadOnly,+ persistIndex: this.state.persistIndex,+ fullTextIndex: this.state.fullTextIndex,+ watchForChanges: this.state.watchForChanges+ });+ } else if (this.state.type === locationType.TYPE_CLOUD) {+ this.props.editLocation({+ uuid: this.state.uuid,+ type: locationType.TYPE_CLOUD,+ name: this.state.storeName,+ paths: [this.state.storePath],+ accessKeyId: this.state.accessKeyId,+ secretAccessKey: this.state.secretAccessKey,+ bucketName: this.state.bucketName,+ region: this.state.region.value,+ perspective: this.state.perspective,+ isDefault: this.state.isDefault,+ isReadOnly: this.state.isReadOnly,+ persistIndex: this.state.persistIndex,+ fullTextIndex: this.state.fullTextIndex,+ watchForChanges: false+ });+ }+ this.props.onClose();+ this.props.resetState('editLocationDialogKey');+ }+ };- onCancel = () => {- this.props.onClose();- this.props.resetState('editLocationDialogKey');- };+ onCancel = () => {+ this.props.onClose();+ this.props.resetState('editLocationDialogKey');+ };- renderTitle = () => (- <DialogTitle>{i18n.t('core:editLocationTitle')}</DialogTitle>- );+ renderTitle = () => (+ <DialogTitle>{i18n.t('core:editLocationTitle')}</DialogTitle>+ );- renderContent = () => {- let content;- if (this.state.type === locationType.TYPE_CLOUD) {- content = (- <ObjectStoreForm- handleInputChange={this.handleInputChange}- handleChange={this.handleChange}- state={this.state}- />- );- } else {- content = (- <LocalForm- showSelectDirectoryDialog={this.props.showSelectDirectoryDialog}- handleInputChange={this.handleInputChange}- handleChange={this.handleChange}- state={this.state}- />- );- }- return (- <DialogContent>- <Grid container spacing={2}>- <Grid item xs={2} style={{ marginTop: 13, textAlign: 'left' }}>- <Typography>{i18n.t('core:locationType')}</Typography>- </Grid>- <Grid item xs={10}>- <FormControl disabled={!Pro}>- <RadioGroup- title={- Pro ? '' : i18n.t('core:thisFunctionalityIsAvailableInPro')- }- component="label"- aria-label={i18n.t('core:locationType')}- name="type"- value={this.state.type}- onChange={this.handleInputChange}- row- >- <FormControlLabel- value={locationType.TYPE_LOCAL}- control={<Radio />}- label="Local"- />- <FormControlLabel- value={locationType.TYPE_CLOUD}- control={<Radio />}- title="AWS S3 compatible object storage"- label="AWS S3 Object Storage"- />- </RadioGroup>- </FormControl>- </Grid>- </Grid>- {content}- <FormControl>- <FormGroup>- <FormControlLabel- control={- <Switch- data-tid="editStartupLocation"- name="isDefault"- checked={this.state.isDefault}- onChange={this.handleInputChange}- />- }- label={i18n.t('core:startupLocation')}- />- <FormControlLabel- control={- <Switch- disabled={!Pro}- data-tid="changeReadOnlyMode"- name="isReadOnly"- checked={this.state.isReadOnly}- onChange={this.handleInputChange}- />- }- label={- i18n.t('core:readonlyModeSwitch') +- (Pro ? '' : ' - ' + i18n.t('core:proFeature'))- }- />- <FormControlLabel- control={- <Switch- disabled={!Pro}- data-tid="changeFullTextIndex"- name="fullTextIndex"- checked={this.state.fullTextIndex}- onChange={this.handleInputChange}- />- }- label={- i18n.t('core:createFullTextIndex') +- (Pro ? '' : ' - ' + i18n.t('core:proFeature'))- }- />- <FormControlLabel- control={- <Switch- disabled={!Pro}- data-tid="changePersistIndex"- name="persistIndex"- checked={this.state.persistIndex}- onChange={this.handleInputChange}- />- }- label={- i18n.t('core:persistIndexSwitch') +- (Pro ? '' : ' - ' + i18n.t('core:proFeature'))- }- />- <FormControlLabel- control={- <Switch- disabled={!Pro || this.state.type === locationType.TYPE_CLOUD}- data-tid="changeWatchForChanges"- name="watchForChanges"- checked={this.state.watchForChanges}- onChange={this.handleInputChange}- />- }- label={- i18n.t('core:watchForChangesInLocation') +- (Pro ? '' : ' - ' + i18n.t('core:proFeature'))- }- />- </FormGroup>- </FormControl>- </DialogContent>- );- };+ renderContent = () => {+ let content;+ if (this.state.type === locationType.TYPE_CLOUD) {+ content = (+ <ObjectStoreForm+ handleInputChange={this.handleInputChange}+ handleChange={this.handleChange}+ state={this.state}+ />+ );+ } else {+ content = (+ <LocalForm+ showSelectDirectoryDialog={this.props.showSelectDirectoryDialog}+ handleInputChange={this.handleInputChange}+ handleChange={this.handleChange}+ state={this.state}+ />+ );+ }+ return (+ <DialogContent>+ <Grid container spacing={2}>+ <Grid item xs={2} style={{ marginTop: 13, textAlign: 'left' }}>+ <Typography>{i18n.t('core:locationType')}</Typography>+ </Grid>+ <Grid item xs={10}>+ <FormControl disabled={!Pro}>+ <RadioGroup+ title={+ Pro ? '' : i18n.t('core:thisFunctionalityIsAvailableInPro')+ }+ component="label"+ aria-label={i18n.t('core:locationType')}+ name="type"+ value={this.state.type}+ onChange={this.handleInputChange}+ row+ >+ <FormControlLabel+ value={locationType.TYPE_LOCAL}+ control={<Radio />}+ label="Local"+ />+ <FormControlLabel+ value={locationType.TYPE_CLOUD}+ control={<Radio />}+ title="AWS S3 compatible object storage"+ label="AWS S3 Object Storage"+ />+ </RadioGroup>+ </FormControl>+ </Grid>+ </Grid>+ {content}+ <FormControl>+ <FormGroup>+ <FormControlLabel+ control={+ <Switch+ data-tid="editStartupLocation"+ name="isDefault"+ checked={this.state.isDefault}+ onChange={this.handleInputChange}+ />+ }+ label={i18n.t('core:startupLocation')}+ />+ <FormControlLabel+ control={+ <Switch+ disabled={!Pro}+ data-tid="changeReadOnlyMode"+ name="isReadOnly"+ checked={this.state.isReadOnly}+ onChange={this.handleInputChange}+ />+ }+ label={+ i18n.t('core:readonlyModeSwitch') ++ (Pro ? '' : ' - ' + i18n.t('core:proFeature'))+ }+ />+ <FormControlLabel+ control={+ <Switch+ disabled={!Pro}+ data-tid="changeFullTextIndex"+ name="fullTextIndex"+ checked={this.state.fullTextIndex}+ onChange={this.handleInputChange}+ />+ }+ label={+ i18n.t('core:createFullTextIndex') ++ (Pro ? '' : ' - ' + i18n.t('core:proFeature'))+ }+ />+ <FormControlLabel+ control={+ <Switch+ disabled={!Pro}+ data-tid="changePersistIndex"+ name="persistIndex"+ checked={this.state.persistIndex}+ onChange={this.handleInputChange}+ />+ }+ label={+ i18n.t('core:persistIndexSwitch') ++ (Pro ? '' : ' - ' + i18n.t('core:proFeature'))+ }+ />+ <FormControlLabel+ control={+ <Switch+ disabled={!Pro || this.state.type === locationType.TYPE_CLOUD}+ data-tid="changeWatchForChanges"+ name="watchForChanges"+ checked={this.state.watchForChanges}+ onChange={this.handleInputChange}+ />+ }+ label={+ i18n.t('core:watchForChangesInLocation') ++ (Pro ? '' : ' - ' + i18n.t('core:proFeature'))+ }+ />+ </FormGroup>+ </FormControl>+ </DialogContent>+ );+ };- renderActions = () => (- <DialogActions>- <Button- data-tid="closeEditLocationDialog"- color="primary"- onClick={() => {- this.props.onClose();- this.props.resetState('editLocationDialogKey');- }}- >- {i18n.t('core:cancel')}- </Button>- <Button- disabled={this.state.disableConfirmButton}- onClick={this.onConfirm}- data-tid="confirmEditLocationDialog"- color="primary"- >- {i18n.t('core:ok')}- </Button>- </DialogActions>- );+ renderActions = () => (+ <DialogActions>+ <Button+ data-tid="closeEditLocationDialog"+ color="primary"+ onClick={() => {+ this.props.onClose();+ this.props.resetState('editLocationDialogKey');+ }}+ >+ {i18n.t('core:cancel')}+ </Button>+ <Button+ disabled={this.state.disableConfirmButton}+ onClick={this.onConfirm}+ data-tid="confirmEditLocationDialog"+ color="primary"+ >+ {i18n.t('core:ok')}+ </Button>+ </DialogActions>+ );- render() {- const {- open,- // onClose,- fullScreen,- onCancel- } = this.props;- return (- <Dialog- open={open}- onClose={onCancel}- fullScreen={fullScreen}- // onEnterKey={(event) => onEnterKeyHandler(event, this.onConfirm)}- >- {this.renderTitle()}- {this.renderContent()}- {this.renderActions()}- </Dialog>- );- }+ render() {+ const {+ open,+ // onClose,+ fullScreen,+ onCancel+ } = this.props;+ return (+ <Dialog+ open={open}+ onClose={onCancel}+ fullScreen={fullScreen}+ // onEnterKey={(event) => onEnterKeyHandler(event, this.onConfirm)}+ >+ {this.renderTitle()}+ {this.renderContent()}+ {this.renderActions()}+ </Dialog>+ );+ }}export default withMobileDialog()(EditLocationDialog);diff --git a/app/components/dialogs/ImportExportTagGroupsDialog.tsx b/app/components/dialogs/ImportExportTagGroupsDialog.tsxindex 2ecc053f2..41adbbae8 100644--- a/app/components/dialogs/ImportExportTagGroupsDialog.tsx+++ b/app/components/dialogs/ImportExportTagGroupsDialog.tsx@@ -33,8 +33,9 @@ import TagContainer from '../TagContainer';import i18n from '../../services/i18n';import { isFunc } from '../../utils/misc';import AppConfig from '../../config';+import { Tag } from '-/reducers/taglibrary';-const styles = {+const styles: any = {root: {width: 400,height: '100%',@@ -43,25 +44,26 @@ const styles = {}};-type Props = {- classes: Object,- open: boolean,- fullScreen: boolean,- onClose: () => void,- dialogModeImport: boolean,- showNotification: (text: string) => void,- importTagGroups: () => void,- exportTagGroups: () => void-};+interface Props {+ classes: any;+ open: boolean;+ tagGroups: Array<any>;+ fullScreen: boolean;+ onClose: () => void;+ dialogModeImport: boolean;+ showNotification?: (text: string) => void;+ importTagGroups: (taggroup: any) => void;+ exportTagGroups: (taggroup: any) => void;+}-type State = {- errorTextName: boolean,- disableConfirmButton: boolean,- open: boolean,- tagGroupList: Array<Object>,- checkedAll: boolean,- selectedAll: boolean-};+interface State {+ errorTextName: boolean;+ disableConfirmButton: boolean;+ open: boolean;+ tagGroupList: Array<Object>;+ checkedAll: boolean;+ selectedAll: boolean;+}class ImportExportTagGroupsDialog extends React.Component<Props, State> {state = {@@ -118,7 +120,8 @@ class ImportExportTagGroupsDialog extends React.Component<Props, State> {);};- handleChange = name => (event: Object, checked: boolean) => {+ handleChange = name => (event: any, checked: boolean) => {+ // @ts-ignorethis.setState({ [name]: !checked });};@@ -137,7 +140,7 @@ class ImportExportTagGroupsDialog extends React.Component<Props, State> {}}- handleTagGroup = (tagGroup: Object, checked: boolean, index) => {+ handleTagGroup = (tagGroup: any, checked: boolean, index) => {const groups = this.state.tagGroupList;if (!checked) {groups[index].selected = true;@@ -203,7 +206,7 @@ class ImportExportTagGroupsDialog extends React.Component<Props, State> {</FormControl><TagGroupContainer taggroup={tagGroup}>{tagGroup.children &&- tagGroup.children.map(tag => (+ tagGroup.children.map((tag: Tag) => (<TagContainer tag={tag} tagMode="display" />))}</TagGroupContainer>diff --git a/app/components/dialogs/LicenseDialog.tsx b/app/components/dialogs/LicenseDialog.tsxindex 8961f03db..d2f94e091 100644--- a/app/components/dialogs/LicenseDialog.tsx+++ b/app/components/dialogs/LicenseDialog.tsx@@ -29,11 +29,11 @@ import AppConfig from '../../config';import LicenseContent from '../../LICENSE.txt';import PlatformIO from '../../services/platform-io';-type Props = {- open: boolean,- fullScreen: boolean,- onClose: () => void-};+interface Props {+ open: boolean;+ fullScreen: boolean;+ onClose: () => void;+}// function printElem(elem) {// const printWin = window.open('', 'PRINT', 'height=400,width=600');diff --git a/app/components/dialogs/LocalForm.tsx b/app/components/dialogs/LocalForm.tsxindex b3921db85..3601b359e 100644--- a/app/components/dialogs/LocalForm.tsx+++ b/app/components/dialogs/LocalForm.tsx@@ -31,12 +31,12 @@ import AppConfig from '../../config';import { extractDirectoryName } from '../../utils/paths';import PlatformIO from '../../services/platform-io';-type Props = {+interface Props {state: any;handleChange: (param1: string, param2: string) => void;handleInputChange: () => void;showSelectDirectoryDialog: () => void;-};+}class LocalForm extends React.Component<Props> {openDirectory = () => {diff --git a/app/components/dialogs/MoveCopyFilesDialog.tsx b/app/components/dialogs/MoveCopyFilesDialog.tsxindex 8f810c1bc..2448e484f 100644--- a/app/components/dialogs/MoveCopyFilesDialog.tsx+++ b/app/components/dialogs/MoveCopyFilesDialog.tsx@@ -43,14 +43,14 @@ import AppConfig from '../../config';import IOActions from '../../reducers/io-actions';import { extractFileName } from '../../utils/paths';-type Props = {- open: boolean,- fullScreen: boolean,- onClose: () => void,- copyFiles: (files: Array<string>, destination: string) => void,- moveFiles: (files: Array<string>, destination: string) => void,- selectedFiles: Array<string>-};+interface Props {+ open: boolean;+ fullScreen: boolean;+ onClose: () => void;+ copyFiles: (files: Array<string>, destination: string) => void;+ moveFiles: (files: Array<string>, destination: string) => void;+ selectedFiles: Array<string>;+}const MoveCopyFilesDialog = (props: Props) => {const [inputError, setInputError] = useState(false);diff --git a/app/components/dialogs/SelectDirectoryDialog.tsx b/app/components/dialogs/SelectDirectoryDialog.tsxindex 447407010..85c9e5e7e 100644--- a/app/components/dialogs/SelectDirectoryDialog.tsx+++ b/app/components/dialogs/SelectDirectoryDialog.tsx@@ -1,3 +1,4 @@+// @ts-nocheck/*** TagSpaces - universal file and folder organizer* Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)@@ -38,275 +39,275 @@ import PlatformIO from '../../services/platform-io';import { loadSubFolders } from '../../services/utils-io';interface Props {- open: boolean;- onClose: () => void;+ open: boolean;+ onClose: () => void;}interface State {- errorTextPath: boolean;- errorTextName: boolean;- open: boolean;- drives: Array<string>;- currentPath: string;- isDefault: boolean;+ errorTextPath: boolean;+ errorTextName: boolean;+ open: boolean;+ drives: Array<string>;+ currentPath: string;+ isDefault: boolean;}const styles = () => ({- buttonContainer: {- color: '#212121',- backgroundColor: '#f5f5f5',- borderColor: '#dddddd',- marginLeft: 4,- marginTop: 4,- marginBottom: 4- },- buttonSuggestion: {- fontSize: 10,- textTransform: 'none',- backgroundColor: '#E5E5E5',- color: '#444444',- textAlign: 'left',- backgroundImage: 'none',- margin: 0,- paddingTop: '0',- paddingBottom: '0',- paddingRight: 0,- borderRadius: 5- },- alertWarning: {- color: '#fff',- backgroundColor: '#ff9800',- margin: 15,- padding: 15- },- folderIcon: {- color: '#ff9800'- },- contentFolder: {- overflowY: 'auto',- maxHeight: '40vh'- }+ buttonContainer: {+ color: '#212121',+ backgroundColor: '#f5f5f5',+ borderColor: '#dddddd',+ marginLeft: 4,+ marginTop: 4,+ marginBottom: 4+ },+ buttonSuggestion: {+ fontSize: 10,+ textTransform: 'none',+ backgroundColor: '#E5E5E5',+ color: '#444444',+ textAlign: 'left',+ backgroundImage: 'none',+ margin: 0,+ paddingTop: '0',+ paddingBottom: '0',+ paddingRight: 0,+ borderRadius: 5+ },+ alertWarning: {+ color: '#fff',+ backgroundColor: '#ff9800',+ margin: 15,+ padding: 15+ },+ folderIcon: {+ color: '#ff9800'+ },+ contentFolder: {+ overflowY: 'auto',+ maxHeight: '40vh'+ }});const drives = [- 'Choose Drive',- 'A:',- 'B:',- 'C:',- 'D:',- 'F:',- 'G:',- 'H:',- 'I:',- 'J:',- 'K:',- 'L:',- 'M:',- 'N:',- 'O:',- 'P:',- 'Q:',- 'R:',- 'S:',- 'T:',- 'U:',- 'V:',- 'W:',- 'X:',- 'Y:',- 'Z:'+ 'Choose Drive',+ 'A:',+ 'B:',+ 'C:',+ 'D:',+ 'F:',+ 'G:',+ 'H:',+ 'I:',+ 'J:',+ 'K:',+ 'L:',+ 'M:',+ 'N:',+ 'O:',+ 'P:',+ 'Q:',+ 'R:',+ 'S:',+ 'T:',+ 'U:',+ 'V:',+ 'W:',+ 'X:',+ 'Y:',+ 'Z:'];class SelectDirectoryDialog extends React.Component<Props, State> {- state = {- errorTextPath: false,- alertSubFolderText: false,- disableConfirmButton: true,- open: false,- currentPath: PlatformIO.getUserHomePath(),- subFolders: [],- choosePath: '',- isDefault: false- };+ state = {+ errorTextPath: false,+ alertSubFolderText: false,+ disableConfirmButton: true,+ open: false,+ currentPath: PlatformIO.getUserHomePath(),+ subFolders: [],+ choosePath: '',+ isDefault: false+ };- componentWillReceiveProps = (nextProps: any) => {- if (nextProps.open === true) {- let currentPath = this.state.currentPath;- if (nextProps.currentPath) {- currentPath = nextProps.currentPath;- }- this.setState({- open: true,- currentPath, // AppConfig.isWin ? drives[3] : AppConfig.dirSeparator,- choosePath: drives[0]- });- this.loadListDirectory(currentPath);- }- };+ componentWillReceiveProps = (nextProps: any) => {+ if (nextProps.open === true) {+ let currentPath = this.state.currentPath;+ if (nextProps.currentPath) {+ currentPath = nextProps.currentPath;+ }+ this.setState({+ open: true,+ currentPath, // AppConfig.isWin ? drives[3] : AppConfig.dirSeparator,+ choosePath: drives[0]+ });+ this.loadListDirectory(currentPath);+ }+ };- loadListDirectory = (path: string) => {- loadSubFolders(path)- .then(rootDirContent => {- this.setState({- subFolders: rootDirContent- });- return true;- })- .catch(error => {- console.log('Error listing directory ' + error);- });- };+ loadListDirectory = (path: string) => {+ loadSubFolders(path)+ .then(rootDirContent => {+ this.setState({+ subFolders: rootDirContent+ });+ return true;+ })+ .catch(error => {+ console.log('Error listing directory ' + error);+ });+ };- onConfirm = () => {- this.props.chooseDirectoryPath(this.state.currentPath);- this.setState({- open: false,- errorTextPath: false- });- this.props.onClose();- };+ onConfirm = () => {+ this.props.chooseDirectoryPath(this.state.currentPath);+ this.setState({+ open: false,+ errorTextPath: false+ });+ this.props.onClose();+ };- handleChooseDrive = (e: Object, selectedPath: string) => {- this.setState({- currentPath: selectedPath- });- this.loadListDirectory(selectedPath);- };+ handleChooseDrive = (e: Object, selectedPath: string) => {+ this.setState({+ currentPath: selectedPath+ });+ this.loadListDirectory(selectedPath);+ };- handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {- const target = event.target;- const value = target.type === 'checkbox' ? target.checked : target.value;- const name = target.name;+ handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {+ const target = event.target;+ const value = target.type === 'checkbox' ? target.checked : target.value;+ const name = target.name;- this.setState({- [name]: value,- currentPath: value- });- this.loadListDirectory(value);- };+ this.setState({+ [name]: value,+ currentPath: value+ });+ this.loadListDirectory(value);+ };- onBackButton = () => {- const lastIndex = this.state.currentPath.lastIndexOf(- AppConfig.dirSeparator- );- const path = this.state.currentPath.slice(0, lastIndex);- this.setState({- currentPath: path- });- this.loadListDirectory(path);- };+ onBackButton = () => {+ const lastIndex = this.state.currentPath.lastIndexOf(+ AppConfig.dirSeparator+ );+ const path = this.state.currentPath.slice(0, lastIndex);+ this.setState({+ currentPath: path+ });+ this.loadListDirectory(path);+ };- createNewFolder = () => {- this.props.createNewDirectoryExt(this.state.currentPath);- this.loadListDirectory(this.state.currentPath);- };+ createNewFolder = () => {+ this.props.createNewDirectoryExt(this.state.currentPath);+ this.loadListDirectory(this.state.currentPath);+ };- renderDriveSuggestions = drive => (- <div className={styles.buttonContainer}>- <Button- key={drive.name}- onClick={e => this.handleChooseDrive(e, drive.path)}- >- <FolderIcon />- <span>{drive.name}</span>- </Button>- </div>- );+ renderDriveSuggestions = drive => (+ <div className={styles.buttonContainer}>+ <Button+ key={drive.name}+ onClick={e => this.handleChooseDrive(e, drive.path)}+ >+ <FolderIcon />+ <span>{drive.name}</span>+ </Button>+ </div>+ );- render() {- const { fullScreen, open, onClose } = this.props;+ render() {+ const { fullScreen, open, onClose } = this.props;- return (- <Dialog- open={open}- onClose={onClose}- fullScreen={fullScreen}- keepMounted- scroll="paper"- // onKeyDown={confirmFunction}- >- <DialogTitle>{i18n.t('core:selectDialogTitle')}</DialogTitle>- <DialogContent>- <FormControl fullWidth={true} error={this.props.errorTextPath}>- <InputLabel htmlFor="name">- {i18n.t('core:selectDialogCurrentPath')}- </InputLabel>- <Input- fullWidth={true}- required- margin="dense"- name="path"- onChange={this.handleInputChange}- label={i18n.t('core:selectDialogCurrentPath')}- data-tid="selectDirectoryDialogInput"- value={this.state.currentPath}- disabled={AppConfig.isWin}- />- {this.state.errorTextPath && (- <FormHelperText>{i18n.t('core:invalidPath')}</FormHelperText>- )}- </FormControl>- {AppConfig.isWin ? (- <FormControl fullWidth={true}>- <Select- data-tid="selectDirectoryDialogSelect"- native- autoWidth- name="choosePath"- value={this.state.choosePath}- onChange={this.handleInputChange}- input={<Input id="choosePath" />}- >- {drives.map(drive => (- <option key={drive} value={drive}>- {drive}- </option>- ))}- </Select>- </FormControl>- ) : null}- <FormControl fullWidth={true}>- <Paper elevation={2}>- <Button- data-tid="onBackButtonSelectDirectoryDialog"- onClick={e => this.onBackButton(e)}- >- <UndoIcon />- </Button>- <Button- data-tid="createNewFolderSelectDirectoryDialog"- onClick={e => this.createNewFolder(e)}- >- <CreateFolderIcon className={this.props.classes.folderIcon} />- {i18n.t('core:createDirectory')}- </Button>- </Paper>- <Paper elevation={2} className={this.props.classes.contentFolder}>- {this.state.subFolders.length === 0 ? (- <div className={this.props.classes.alertWarning}>- {i18n.t('core:noSubfoldersFound')}- </div>- ) : (- this.state.subFolders.map(this.renderDriveSuggestions)- )}- </Paper>- </FormControl>- </DialogContent>- <DialogActions>- <Button onClick={this.props.onClose} color="primary">- {i18n.t('core:cancel')}- </Button>- <Button- onClick={this.onConfirm}- data-tid="confirmSelectDirectoryDialog"- color="primary"- >- {i18n.t('core:ok')}- </Button>- </DialogActions>- </Dialog>- );- }+ return (+ <Dialog+ open={open}+ onClose={onClose}+ fullScreen={fullScreen}+ keepMounted+ scroll="paper"+ // onKeyDown={confirmFunction}+ >+ <DialogTitle>{i18n.t('core:selectDialogTitle')}</DialogTitle>+ <DialogContent>+ <FormControl fullWidth={true} error={this.props.errorTextPath}>+ <InputLabel htmlFor="name">+ {i18n.t('core:selectDialogCurrentPath')}+ </InputLabel>+ <Input+ fullWidth={true}+ required+ margin="dense"+ name="path"+ onChange={this.handleInputChange}+ label={i18n.t('core:selectDialogCurrentPath')}+ data-tid="selectDirectoryDialogInput"+ value={this.state.currentPath}+ disabled={AppConfig.isWin}+ />+ {this.state.errorTextPath && (+ <FormHelperText>{i18n.t('core:invalidPath')}</FormHelperText>+ )}+ </FormControl>+ {AppConfig.isWin ? (+ <FormControl fullWidth={true}>+ <Select+ data-tid="selectDirectoryDialogSelect"+ native+ autoWidth+ name="choosePath"+ value={this.state.choosePath}+ onChange={this.handleInputChange}+ input={<Input id="choosePath" />}+ >+ {drives.map(drive => (+ <option key={drive} value={drive}>+ {drive}+ </option>+ ))}+ </Select>+ </FormControl>+ ) : null}+ <FormControl fullWidth={true}>+ <Paper elevation={2}>+ <Button+ data-tid="onBackButtonSelectDirectoryDialog"+ onClick={e => this.onBackButton(e)}+ >+ <UndoIcon />+ </Button>+ <Button+ data-tid="createNewFolderSelectDirectoryDialog"+ onClick={e => this.createNewFolder(e)}+ >+ <CreateFolderIcon className={this.props.classes.folderIcon} />+ {i18n.t('core:createDirectory')}+ </Button>+ </Paper>+ <Paper elevation={2} className={this.props.classes.contentFolder}>+ {this.state.subFolders.length === 0 ? (+ <div className={this.props.classes.alertWarning}>+ {i18n.t('core:noSubfoldersFound')}+ </div>+ ) : (+ this.state.subFolders.map(this.renderDriveSuggestions)+ )}+ </Paper>+ </FormControl>+ </DialogContent>+ <DialogActions>+ <Button onClick={this.props.onClose} color="primary">+ {i18n.t('core:cancel')}+ </Button>+ <Button+ onClick={this.onConfirm}+ data-tid="confirmSelectDirectoryDialog"+ color="primary"+ >+ {i18n.t('core:ok')}+ </Button>+ </DialogActions>+ </Dialog>+ );+ }}export default withStyles(styles)(SelectDirectoryDialog);diff --git a/app/components/dialogs/ThirdPartyLibsDialog.tsx b/app/components/dialogs/ThirdPartyLibsDialog.tsxindex 807d3dbd0..e4e20a34f 100644--- a/app/components/dialogs/ThirdPartyLibsDialog.tsx+++ b/app/components/dialogs/ThirdPartyLibsDialog.tsx@@ -26,11 +26,11 @@ import Dialog from '@material-ui/core/Dialog';import i18n from '../../services/i18n';import ThirdPartyLibs from '../../third-party.txt';-type Props = {- open: boolean,- onClose: () => void,- fullScreen: boolean-};+interface Props {+ open: boolean;+ onClose: () => void;+ fullScreen: boolean;+}const ThirdPartyLibsDialog = (props: Props) => {const { open, onClose, fullScreen } = props;diff --git a/app/components/dialogs/settings/SettingsDialog.tsx b/app/components/dialogs/settings/SettingsDialog.tsxindex 44c7e665c..af9bb9d3e 100644--- a/app/components/dialogs/settings/SettingsDialog.tsx+++ b/app/components/dialogs/settings/SettingsDialog.tsx@@ -1,3 +1,4 @@+// @ts-nocheck/*** TagSpaces - universal file and folder organizer* Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)@@ -44,23 +45,23 @@ const styles = theme => ({}});-type Props = {- open: boolean,- fullScreen: boolean,- classes: Object,- onClose: () => void,- setSupportedFileTypes: Array<Object>,- supportedFileTypes: Array<Object>,- settings: Array<Object>-};--type State = {- currentTab: number,- items: Array<Object>,- selectedItem: Object,- isValidationInProgress: boolean,- isConfirmDialogOpened: boolean-};+interface Props {+ open: boolean;+ fullScreen: boolean;+ classes: AttestationConveyancePreference;+ onClose: () => void;+ setSupportedFileTypes: Array<Object>;+ supportedFileTypes: Array<Object>;+ settings: Array<Object>;+}++interface State {+ currentTab: number;+ items: Array<Object>;+ selectedItem: any;+ isValidationInProgress: boolean;+ isConfirmDialogOpened: boolean;+}class SettingsDialog extends React.Component<Props, State> {state = {diff --git a/app/components/dialogs/settings/SettingsGeneral.tsx b/app/components/dialogs/settings/SettingsGeneral.tsxindex 0907312e3..7adc27d45 100644--- a/app/components/dialogs/settings/SettingsGeneral.tsx+++ b/app/components/dialogs/settings/SettingsGeneral.tsx@@ -51,30 +51,29 @@ const styles = theme => ({}});-type Props = {- setTagColor: string,- setTagTextColor: string,- classes: Object,- settings: Object,- toggleShowUnixHiddenEntries: () => void,- setCurrentTheme: () => void,- setLanguage: () => void,- // setDesktopMode: () => void,- setCheckForUpdates: () => void,- // setColoredFileExtension: () => void,- setUseTrashCan: () => void,- setPersistTagsInSidecarFile: () => void,- setAddTagsToLibrary: () => void,- setUseGenerateThumbnails: () => void,- setTagDelimiter: () => void,- setMaxSearchResult: () => void,- setDesktopMode: () => void-};+interface Props {+ setTagColor: (tagColor: string) => void;+ setTagTextColor: (tagTextColor: string) => void;+ classes: any;+ settings: any;+ toggleShowUnixHiddenEntries: () => void;+ setCurrentTheme: (theme: string) => void;+ setLanguage: (language: string) => void;+ setCheckForUpdates: (check: boolean) => void;+ setUseTrashCan: (useTrashCan: boolean) => void;+ setPersistTagsInSidecarFile: (tagInSidecar: boolean) => void;+ setAddTagsToLibrary: (addTagsToLibrary: boolean) => void;+ setUseGenerateThumbnails: (useGenerateThumbnails: boolean) => void;+ setTagDelimiter: (tagDelimiter: string) => void;+ setMaxSearchResult: (maxResult: string) => void;+ setDesktopMode: (desktopMode: boolean) => void;+}-type State = {- displayColorPicker: boolean,- displayTextColorPicker: boolean-};+interface State {+ displayColorPicker: boolean;+ displayTextColorPicker: boolean;+ currentTheme?: any;+}class SettingsGeneral extends React.Component<Props, State> {state = {@@ -114,7 +113,9 @@ class SettingsGeneral extends React.Component<Props, State> {<Selectdata-tid="settingsSetLanguage"value={this.props.settings.interfaceLanguage}- onChange={event => this.props.setLanguage(event.target.value)}+ onChange={(event: any) =>+ this.props.setLanguage(event.target.value)+ }input={<Input id="languageSelector" />}>{this.props.settings.supportedLanguages.map(language => (@@ -129,7 +130,9 @@ class SettingsGeneral extends React.Component<Props, State> {<Selectdata-tid="settingsSetCurrentTheme"value={this.props.settings.currentTheme}- onChange={event => this.props.setCurrentTheme(event.target.value)}+ onChange={(event: any) =>+ this.props.setCurrentTheme(event.target.value)+ }input={<Input id="themeSelector" />}>{this.props.settings.supportedThemes.map(theme => (@@ -287,6 +290,7 @@ class SettingsGeneral extends React.Component<Props, State> {style={{ maxWidth: '100px' }}type="number"data-tid="settingsMaxSearchResult"+ // @ts-ignorelabel={i18n.t('core:maxSearchResult')}value={this.props.settings.maxSearchResult}onChange={this.handleMaxSearchResult}@@ -355,4 +359,5 @@ function mapActionCreatorsToProps(dispatch) {export default connect(mapStateToProps,mapActionCreatorsToProps+ // @ts-ignore)(withStyles(styles)(SettingsGeneral));diff --git a/app/components/menus/DirectoryMenu.tsx b/app/components/menus/DirectoryMenu.tsxindex fb4c49444..586970f38 100644--- a/app/components/menus/DirectoryMenu.tsx+++ b/app/components/menus/DirectoryMenu.tsx@@ -50,27 +50,27 @@ import { formatDateTime4Tag } from '../../utils/misc';import { actions as AppActions } from '../../reducers/app';import IOActions from '../../reducers/io-actions';-type Props = {- open: boolean,- onClose: () => void,- anchorEl: Object | null,- directoryPath: string,- loadDirectoryContent: (path: string) => void,- openDirectory: (path: string) => void,- openFile: (path: string, isFile: boolean) => void,- deleteDirectory: (path: string) => void,- reflectCreateEntry: (path: string, isFile: boolean) => void,- toggleCreateFileDialog: () => void,+interface Props {+ open: boolean;+ onClose: () => void;+ anchorEl: Element;+ directoryPath: string;+ loadDirectoryContent: (path: string) => void;+ openDirectory: (path: string) => void;+ openFile: (path: string, isFile: boolean) => void;+ deleteDirectory: (path: string) => void;+ reflectCreateEntry?: (path: string, isFile: boolean) => void;+ toggleCreateFileDialog?: () => void;// extractContent: (config: Object) => void,- switchPerspective: (perspectiveId: string) => void,- perspectiveMode: boolean,- showNotification: (+ switchPerspective?: (perspectiveId: string) => void;+ perspectiveMode?: boolean;+ showNotification?: (text: string,notificationType: string,autohide: boolean- ) => void,- isReadOnlyMode: boolean-};+ ) => void;+ isReadOnlyMode: boolean;+}const DirectoryMenu = (props: Props) => {let fileInput; // Object | null;@@ -207,15 +207,18 @@ const DirectoryMenu = (props: Props) => {function cameraTakePicture() {props.onClose();+ // @ts-ignorenavigator.camera.getPicture(onCameraSuccess, onFail, {// quality: 50,+ // @ts-ignoredestinationType: Camera.DestinationType.FILE_URI, // DATA_URL, // Return base64 encoded string// encodingType: Camera.EncodingType.JPEG,+ // @ts-ignoremediaType: Camera.MediaType.PICTURE // ALLMEDIA});}- function handleFileInputChange(selection: Object) {+ function handleFileInputChange(selection: any) {// console.log("Selected File: "+JSON.stringify(selection.currentTarget.files[0]));const file = selection.currentTarget.files[0];const filePath =@@ -224,7 +227,7 @@ const DirectoryMenu = (props: Props) => {decodeURIComponent(file.name);const reader = new FileReader();- reader.onload = event => {+ reader.onload = (event: any) => {// console.log('Content on file read complete: ' + JSON.stringify(event));// change name for ios fakepath// if (AppConfig.isCordovaiOS) {@@ -282,7 +285,10 @@ const DirectoryMenu = (props: Props) => {}return (- <div style={{ overflowY: 'hidden !important' }}>+ <div+ // @ts-ignore+ style={{ overflowY: 'hidden !important' }}+ ><RenameDirectoryDialogkey={uuidv1()}open={isRenameDirectoryDialogOpened}@@ -309,7 +315,7 @@ const DirectoryMenu = (props: Props) => {props.deleteDirectory(props.directoryPath);}}}- confirmDialogContent={'confirmDialogContent'}+ confirmDialogContentTID={'confirmDialogContent'}cancelDialogTID={'cancelDeleteDirectoryDialog'}confirmDialogTID={'confirmDeleteDirectoryDialog'}/>diff --git a/app/components/menus/EntryTagMenu.tsx b/app/components/menus/EntryTagMenu.tsxindex 261b353ec..4c574edd3 100644--- a/app/components/menus/EntryTagMenu.tsx+++ b/app/components/menus/EntryTagMenu.tsx@@ -34,118 +34,121 @@ import { SearchQuery } from '../../services/search';import { getMaxSearchResults } from '../../reducers/settings';import { actions as AppActions } from '../../reducers/app';-type Props = {- open: boolean;- onClose: () => void;- anchorEl: Object | null;- selectedTag: Tag | null;- currentEntryPath: string;- removeTags: (paths: Array<string>, tags: Array<Tag>) => void;- searchLocationIndex: (searchQuery: SearchQuery) => void;- maxSearchResults: number;- openSearchPanel: () => void;- toggleEditTagDialog: (tag: Tag) => void;- isReadOnlyMode: boolean;-};+interface Props {+ open: boolean;+ onClose: () => void;+ anchorEl: Element | null;+ selectedTag: Tag | null;+ currentEntryPath: string;+ removeTags: (paths: Array<string>, tags: Array<Tag>) => void;+ searchLocationIndex: (searchQuery: SearchQuery) => void;+ maxSearchResults: number;+ openSearchPanel: () => void;+ toggleEditTagDialog: (tag: Tag) => void;+ isReadOnlyMode: boolean;+}const EntryTagMenu = (props: Props) => {- const [isDeleteTagDialogOpened, setIsDeleteTagDialogOpened] = useState(false);+ const [isDeleteTagDialogOpened, setIsDeleteTagDialogOpened] = useState(false);- function showEditTagDialog() {- props.onClose();- // setIsEditTagDialogOpened(true);- const tag = props.selectedTag;- tag.path = props.currentEntryPath;- props.toggleEditTagDialog(tag);- }+ function showEditTagDialog() {+ props.onClose();+ // setIsEditTagDialogOpened(true);+ const tag = props.selectedTag;+ tag.path = props.currentEntryPath;+ props.toggleEditTagDialog(tag);+ }- function showDeleteTagDialog() {- props.onClose();- setIsDeleteTagDialogOpened(true);- }+ function showDeleteTagDialog() {+ props.onClose();+ setIsDeleteTagDialogOpened(true);+ }- function showFilesWithThisTag() {- if (props.selectedTag) {- props.openSearchPanel();- props.searchLocationIndex({- tagsAND: [props.selectedTag],- maxSearchResults: props.maxSearchResults- });- }- props.onClose();- }+ function showFilesWithThisTag() {+ if (props.selectedTag) {+ props.openSearchPanel();+ props.searchLocationIndex({+ tagsAND: [props.selectedTag],+ maxSearchResults: props.maxSearchResults+ });+ }+ props.onClose();+ }- function handleCloseDialogs() {- setIsDeleteTagDialogOpened(false);- }+ function handleCloseDialogs() {+ setIsDeleteTagDialogOpened(false);+ }- function confirmRemoveTag() {- props.removeTags([props.currentEntryPath], [props.selectedTag]);- handleCloseDialogs();- }+ function confirmRemoveTag() {+ props.removeTags([props.currentEntryPath], [props.selectedTag]);+ handleCloseDialogs();+ }- return (- <div style={{ overflowY: 'hidden !important' }}>- <Menu anchorEl={props.anchorEl} open={props.open} onClose={props.onClose}>- <MenuItem- data-tid="showFilesWithThisTag"- onClick={showFilesWithThisTag}- >- <ListItemIcon>- <ShowEntriesWithTagIcon />- </ListItemIcon>- <ListItemText primary={i18n.t('core:showFilesWithThisTag')} />- </MenuItem>- <MenuItem data-tid="editTagDialogMenu" onClick={showEditTagDialog}>- <ListItemIcon>- <EditIcon />- </ListItemIcon>- <ListItemText primary={i18n.t('core:editTagTitle')} />- </MenuItem>- {!props.isReadOnlyMode && (- <div>- <MenuItem data-tid="deleteTagMenu" onClick={showDeleteTagDialog}>- <ListItemIcon>- <DeleteIcon />- </ListItemIcon>- <ListItemText primary={i18n.t('core:removeTag')} />- </MenuItem>- </div>- )}- </Menu>- <ConfirmDialog- open={isDeleteTagDialogOpened}- onClose={handleCloseDialogs}- title={i18n.t('core:removeTag')}- content={i18n.t('core:removeTagTooltip')}- confirmCallback={result => {- if (result) {- confirmRemoveTag();- }- }}- cancelDialogTID={'cancelDeleteTagDialogTagMenu'}- confirmDialogTID={'confirmRemoveTagFromFile'}- confirmDialogContent={'confirmDialogContent'}- />- </div>- );+ return (+ <div+ // @ts-ignore+ style={{ overflowY: 'hidden !important' }}+ >+ <Menu anchorEl={props.anchorEl} open={props.open} onClose={props.onClose}>+ <MenuItem+ data-tid="showFilesWithThisTag"+ onClick={showFilesWithThisTag}+ >+ <ListItemIcon>+ <ShowEntriesWithTagIcon />+ </ListItemIcon>+ <ListItemText primary={i18n.t('core:showFilesWithThisTag')} />+ </MenuItem>+ <MenuItem data-tid="editTagDialogMenu" onClick={showEditTagDialog}>+ <ListItemIcon>+ <EditIcon />+ </ListItemIcon>+ <ListItemText primary={i18n.t('core:editTagTitle')} />+ </MenuItem>+ {!props.isReadOnlyMode && (+ <div>+ <MenuItem data-tid="deleteTagMenu" onClick={showDeleteTagDialog}>+ <ListItemIcon>+ <DeleteIcon />+ </ListItemIcon>+ <ListItemText primary={i18n.t('core:removeTag')} />+ </MenuItem>+ </div>+ )}+ </Menu>+ <ConfirmDialog+ open={isDeleteTagDialogOpened}+ onClose={handleCloseDialogs}+ title={i18n.t('core:removeTag')}+ content={i18n.t('core:removeTagTooltip')}+ confirmCallback={result => {+ if (result) {+ confirmRemoveTag();+ }+ }}+ cancelDialogTID={'cancelDeleteTagDialogTagMenu'}+ confirmDialogTID={'confirmRemoveTagFromFile'}+ confirmDialogContentTID={'confirmDialogContent'}+ />+ </div>+ );};function mapStateToProps(state) {- return {- maxSearchResults: getMaxSearchResults(state)- };+ return {+ maxSearchResults: getMaxSearchResults(state)+ };}function mapDispatchToProps(dispatch) {- return bindActionCreators(- {- searchLocationIndex: LocationIndexActions.searchLocationIndex,- openSearchPanel: AppActions.openSearchPanel,- toggleEditTagDialog: AppActions.toggleEditTagDialog- },- dispatch- );+ return bindActionCreators(+ {+ searchLocationIndex: LocationIndexActions.searchLocationIndex,+ openSearchPanel: AppActions.openSearchPanel,+ toggleEditTagDialog: AppActions.toggleEditTagDialog+ },+ dispatch+ );}export default connect(mapStateToProps, mapDispatchToProps)(EntryTagMenu);diff --git a/app/components/menus/FileMenu.tsx b/app/components/menus/FileMenu.tsxindex 5ddaa728b..52a4d9986 100644--- a/app/components/menus/FileMenu.tsx+++ b/app/components/menus/FileMenu.tsx@@ -32,20 +32,20 @@ import DeleteForever from '@material-ui/icons/DeleteForever';import i18n from '../../services/i18n';import AppConfig from '../../config';-type Props = {- anchorEl?: Object | null,- open?: boolean,- onClose: () => void,- openDeleteFileDialog: () => void,- openRenameFileDialog: () => void,- openMoveCopyFilesDialog: () => void,- openAddRemoveTagsDialog: () => void,- openFile: (path: string) => void,- openFileNatively: (path: string) => void,- showInFileManager: (path: string) => void,- selectedFilePath?: string,- isReadOnlyMode: boolean-};+interface Props {+ anchorEl: Element;+ open: boolean;+ onClose: () => void;+ openDeleteFileDialog: () => void;+ openRenameFileDialog: () => void;+ openMoveCopyFilesDialog: () => void;+ openAddRemoveTagsDialog: () => void;+ openFile: (path: string, isFile: boolean) => void;+ openFileNatively: (path: string) => void;+ showInFileManager: (path: string) => void;+ selectedFilePath?: string;+ isReadOnlyMode: boolean;+}const FileMenu = (props: Props) => {function showDeleteFileDialog() {@@ -85,12 +85,15 @@ const FileMenu = (props: Props) => {function openFile() {props.onClose();if (props.selectedFilePath) {- props.openFile(props.selectedFilePath);+ props.openFile(props.selectedFilePath, true);}}return (- <div style={{ overflowY: 'hidden !important' }}>+ <div+ // @ts-ignore+ style={{ overflowY: 'hidden !important' }}+ ><Menu anchorEl={props.anchorEl} open={props.open} onClose={props.onClose}><MenuItem data-tid="fileMenuOpenFile" onClick={openFile}><ListItemIcon>diff --git a/app/components/menus/LocationManagerMenu.tsx b/app/components/menus/LocationManagerMenu.tsxindex 2829cbdfa..c543805bd 100644--- a/app/components/menus/LocationManagerMenu.tsx+++ b/app/components/menus/LocationManagerMenu.tsx@@ -25,17 +25,20 @@ import HelpIcon from '@material-ui/icons/Help';import i18n from '../../services/i18n';import AppConfig from '../../config';-type Props = {- classes: Object,- open: boolean,- anchorEl: Object,- onClose: () => void,- openURLExternally: (url: string) => void-};+interface Props {+ classes: any;+ open: boolean;+ anchorEl: Element;+ onClose: () => void;+ openURLExternally: (url: string) => void;+}const LocationManagerMenu = (props: Props) => {return (- <div style={{ overflowY: 'hidden !important' }}>+ <div+ // @ts-ignore+ style={{ overflowY: 'hidden !important' }}+ ><Menu anchorEl={props.anchorEl} open={props.open} onClose={props.onClose}><MenuItemdata-tid="locationManagerMenu"diff --git a/app/components/menus/LocationMenu.tsx b/app/components/menus/LocationMenu.tsxindex 52fe92526..c0d908409 100644--- a/app/components/menus/LocationMenu.tsx+++ b/app/components/menus/LocationMenu.tsx@@ -1,3 +1,4 @@+// @ts-nocheck/*** TagSpaces - universal file and folder organizer* Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)@@ -32,146 +33,146 @@ import ArrowDropDownIcon from '@material-ui/icons/ArrowDropDown';import i18n from '../../services/i18n';import { getLocations, Location, locationType } from '../../reducers/locations';import {- actions as AppActions,- getCurrentLocationId+ actions as AppActions,+ getCurrentLocationId} from '../../reducers/app';interface Props {- currentLocationId: string | null;- theme: Object;- locations: Array<Location>;- menuAnchorEl: null | Object;- openLocation: (location: Location) => void;+ currentLocationId: string | null;+ theme: any;+ locations: Array<Location>;+ menuAnchorEl?: Element;+ openLocation: (location: Location) => void;}interface State {- currentLocation: Location | null;- locationChooserMenuOpened: boolean;- locationChooserMenuAnchorEl: null | Object;+ currentLocation: Location | null;+ locationChooserMenuOpened: boolean;+ locationChooserMenuAnchorEl: Element;}class LocationMenu extends React.Component<Props, State> {- state = {- currentLocation: null,- locationChooserMenuOpened: false,- locationChooserMenuAnchorEl: null- };+ state = {+ currentLocation: null,+ locationChooserMenuOpened: false,+ locationChooserMenuAnchorEl: null+ };- static getDerivedStateFromProps(nextProps, prevState) {- let currentLocation;- if (nextProps.currentLocationId && nextProps.locations) {- nextProps.locations.map((location: Location) => {- if (location.uuid === nextProps.currentLocationId) {- currentLocation = location;- }- });- }- return {- ...prevState,- currentLocation- };- }+ static getDerivedStateFromProps(nextProps, prevState) {+ let currentLocation;+ if (nextProps.currentLocationId && nextProps.locations) {+ nextProps.locations.map((location: Location) => {+ if (location.uuid === nextProps.currentLocationId) {+ currentLocation = location;+ }+ });+ }+ return {+ ...prevState,+ currentLocation+ };+ }- openLocation = location => {- this.props.openLocation(location);- this.toggleLocationChooser(undefined);- };+ openLocation = location => {+ this.props.openLocation(location);+ this.toggleLocationChooser(undefined);+ };- toggleLocationChooser = (- event: React.ChangeEvent<HTMLInputElement> | undefined- ) => {- this.setState({- locationChooserMenuOpened: !this.state.locationChooserMenuOpened,- locationChooserMenuAnchorEl: event ? event.currentTarget : null- });- };+ toggleLocationChooser = (+ event: React.ChangeEvent<HTMLInputElement> | undefined+ ) => {+ this.setState({+ locationChooserMenuOpened: !this.state.locationChooserMenuOpened,+ locationChooserMenuAnchorEl: event ? event.currentTarget : null+ });+ };- render() {- const { theme } = this.props;- const { currentLocation } = this.state;- const locationIcon =- currentLocation && currentLocation.type === locationType.TYPE_CLOUD ? (- <CloudLocationIcon />- ) : (- <LocationIcon />- );+ render() {+ const { theme } = this.props;+ const { currentLocation } = this.state;+ const locationIcon =+ currentLocation && currentLocation.type === locationType.TYPE_CLOUD ? (+ <CloudLocationIcon />+ ) : (+ <LocationIcon />+ );- return (- <div- style={{- backgroundColor: theme.palette.background.default- }}- >- <Button- data-tid="folderContainerLocationChooser"- id="locationMenuButton"- onClick={this.toggleLocationChooser}- title={this.state.currentLocation && this.state.currentLocation.name}- style={{ paddingRight: 0, paddingLeft: 11 }}- >- {this.state.currentLocation- ? locationIcon // this.state.currentLocation.name- : i18n.t('core:pleaseOpenLocation')}- <ArrowDropDownIcon />- </Button>- <Menu- id="simple-menu"- open={this.state.locationChooserMenuOpened}- anchorEl={this.state.locationChooserMenuAnchorEl}- onClose={this.toggleLocationChooser}- PaperProps={{- style: {- maxHeight: 48 * 6.5,- width: 300- }- }}- >- <div style={{ display: 'none' }} />- <ListSubHeader>{i18n.t('core:chooseLocation')}</ListSubHeader>- {this.props.locations.map((location: Location) => (- <MenuItem- data-tid="folderContainerMenuOpenLocation"- key={location.uuid}- onClick={() => this.openLocation(location)}- style={- currentLocation && currentLocation.uuid === location.uuid- ? { backgroundColor: theme.palette.primary.light }- : {}- }- >- <ListItemIcon>- {location.type === locationType.TYPE_CLOUD ? (- <CloudLocationIcon />- ) : (- <LocationIcon />- )}- </ListItemIcon>- <ListItemText primary={location.name} />- </MenuItem>- ))}- </Menu>- </div>- );- }+ return (+ <div+ style={{+ backgroundColor: theme.palette.background.default+ }}+ >+ <Button+ data-tid="folderContainerLocationChooser"+ id="locationMenuButton"+ onClick={this.toggleLocationChooser}+ title={this.state.currentLocation && this.state.currentLocation.name}+ style={{ paddingRight: 0, paddingLeft: 11 }}+ >+ {this.state.currentLocation+ ? locationIcon // this.state.currentLocation.name+ : i18n.t('core:pleaseOpenLocation')}+ <ArrowDropDownIcon />+ </Button>+ <Menu+ id="simple-menu"+ open={this.state.locationChooserMenuOpened}+ anchorEl={this.state.locationChooserMenuAnchorEl}+ onClose={this.toggleLocationChooser}+ PaperProps={{+ style: {+ maxHeight: 48 * 6.5,+ width: 300+ }+ }}+ >+ <div style={{ display: 'none' }} />+ <ListSubHeader>{i18n.t('core:chooseLocation')}</ListSubHeader>+ {this.props.locations.map((location: Location) => (+ <MenuItem+ data-tid="folderContainerMenuOpenLocation"+ key={location.uuid}+ onClick={() => this.openLocation(location)}+ style={+ currentLocation && currentLocation.uuid === location.uuid+ ? { backgroundColor: theme.palette.primary.light }+ : {}+ }+ >+ <ListItemIcon>+ {location.type === locationType.TYPE_CLOUD ? (+ <CloudLocationIcon />+ ) : (+ <LocationIcon />+ )}+ </ListItemIcon>+ <ListItemText primary={location.name} />+ </MenuItem>+ ))}+ </Menu>+ </div>+ );+ }}function mapStateToProps(state) {- return {- locations: getLocations(state),- currentLocationId: getCurrentLocationId(state)- };+ return {+ locations: getLocations(state),+ currentLocationId: getCurrentLocationId(state)+ };}function mapActionCreatorsToProps(dispatch) {- return bindActionCreators(- {- openLocation: AppActions.openLocation- },- dispatch- );+ return bindActionCreators(+ {+ openLocation: AppActions.openLocation+ },+ dispatch+ );}export default connect(- mapStateToProps,- mapActionCreatorsToProps+ mapStateToProps,+ mapActionCreatorsToProps)(withTheme(LocationMenu));diff --git a/app/components/menus/SearchMenu.tsx b/app/components/menus/SearchMenu.tsxindex 4d4e4b3b2..c47be8927 100644--- a/app/components/menus/SearchMenu.tsx+++ b/app/components/menus/SearchMenu.tsx@@ -25,17 +25,20 @@ import HelpIcon from '@material-ui/icons/Help';import i18n from '../../services/i18n';import AppConfig from '../../config';-type Props = {- classes: Object,- open: boolean,- anchorEl: Object,- onClose: () => void,- openURLExternally: (url: string) => void-};+interface Props {+ classes?: any;+ open: boolean;+ anchorEl: Element;+ onClose: () => void;+ openURLExternally: (url: string) => void;+}const SearchMenu = (props: Props) => {return (- <div style={{ overflowY: 'hidden !important' }}>+ <div+ // @ts-ignore+ style={{ overflowY: 'hidden !important' }}+ ><Menu anchorEl={props.anchorEl} open={props.open} onClose={props.onClose}><MenuItemdata-tid="searchMenuHelp"diff --git a/app/components/menus/TagGroupMenu.tsx b/app/components/menus/TagGroupMenu.tsxindex 4c6567ec6..cbafc2ec1 100644--- a/app/components/menus/TagGroupMenu.tsx+++ b/app/components/menus/TagGroupMenu.tsx@@ -32,119 +32,122 @@ import { TagGroup } from '../../reducers/taglibrary';import i18n from '../../services/i18n';import { Pro } from '../../pro';-type Props = {- classes: Object;- anchorEl: Object;- open: boolean;- onClose: () => void;- selectedTagGroupEntry: TagGroup;- showCreateTagsDialog: () => void;- showDeleteTagGroupDialog: () => void;- showEditTagGroupDialog: () => void;- moveTagGroupUp: (tagGroupId: string) => void;- moveTagGroupDown: (tagGroupId: string) => void;- sortTagGroup: (tagGroupId: string) => void;- collectTagsFromLocation: (tagGroup: TagGroup) => void;- handleCloseTagGroupMenu: () => void;-};+interface Props {+ classes?: any;+ anchorEl: Element;+ open: boolean;+ onClose: () => void;+ selectedTagGroupEntry: TagGroup;+ showCreateTagsDialog: () => void;+ showDeleteTagGroupDialog: () => void;+ showEditTagGroupDialog: () => void;+ moveTagGroupUp: (tagGroupId: string) => void;+ moveTagGroupDown: (tagGroupId: string) => void;+ sortTagGroup: (tagGroupId: string) => void;+ collectTagsFromLocation: (tagGroup: TagGroup) => void;+ handleCloseTagGroupMenu: () => void;+}const TagLibraryMenu = (props: Props) => {- function handleCollectTags() {- props.onClose();+ function handleCollectTags() {+ props.onClose();- if (props.selectedTagGroupEntry) {- props.collectTagsFromLocation(props.selectedTagGroupEntry);- }- props.handleCloseTagGroupMenu();- }+ if (props.selectedTagGroupEntry) {+ props.collectTagsFromLocation(props.selectedTagGroupEntry);+ }+ props.handleCloseTagGroupMenu();+ }- function moveTagGroupUp() {- if (props.selectedTagGroupEntry) {- props.moveTagGroupUp(props.selectedTagGroupEntry.uuid);- }- props.handleCloseTagGroupMenu();- }+ function moveTagGroupUp() {+ if (props.selectedTagGroupEntry) {+ props.moveTagGroupUp(props.selectedTagGroupEntry.uuid);+ }+ props.handleCloseTagGroupMenu();+ }- function moveTagGroupDown() {- if (props.selectedTagGroupEntry) {- props.moveTagGroupDown(props.selectedTagGroupEntry.uuid);- }- props.handleCloseTagGroupMenu();- }+ function moveTagGroupDown() {+ if (props.selectedTagGroupEntry) {+ props.moveTagGroupDown(props.selectedTagGroupEntry.uuid);+ }+ props.handleCloseTagGroupMenu();+ }- function sortTagGroup() {- if (props.selectedTagGroupEntry) {- props.sortTagGroup(props.selectedTagGroupEntry.uuid);- }- props.handleCloseTagGroupMenu();- }+ function sortTagGroup() {+ if (props.selectedTagGroupEntry) {+ props.sortTagGroup(props.selectedTagGroupEntry.uuid);+ }+ props.handleCloseTagGroupMenu();+ }- return (- <div style={{ overflowY: 'hidden !important' }}>- <Menu- anchorEl={props.anchorEl}- open={props.open}- onClose={props.handleCloseTagGroupMenu}- >- <MenuItem data-tid="createTags" onClick={props.showCreateTagsDialog}>- <ListItemIcon>- <TagIcon />- </ListItemIcon>- <ListItemText primary={i18n.t('core:addTags')} />- </MenuItem>- <MenuItem- data-tid="editTagGroup"- onClick={props.showEditTagGroupDialog}- >- <ListItemIcon>- <Edit />- </ListItemIcon>- <ListItemText primary={i18n.t('core:editTagGroup')} />- </MenuItem>- <MenuItem data-tid="moveTagGroupUp" onClick={moveTagGroupUp}>- <ListItemIcon>- <ArrowUpward />- </ListItemIcon>- <ListItemText primary={i18n.t('core:moveTagGroupUp')} />- </MenuItem>- <MenuItem data-tid="moveTagGroupDown" onClick={moveTagGroupDown}>- <ListItemIcon>- <ArrowDownward />- </ListItemIcon>- <ListItemText primary={i18n.t('core:moveTagGroupDown')} />- </MenuItem>- <MenuItem data-tid="sortTagGroup" onClick={sortTagGroup}>- <ListItemIcon>- <SortTagGroupIcon />- </ListItemIcon>- <ListItemText primary={i18n.t('core:sortTagGroup')} />- </MenuItem>- <MenuItem- data-tid="deleteTagGroup"- onClick={props.showDeleteTagGroupDialog}- >- <ListItemIcon>- <DeleteTagGroupIcon />- </ListItemIcon>- <ListItemText primary={i18n.t('core:deleteTagGroup')} />- </MenuItem>- <MenuItem- data-tid="collectTags"- onClick={handleCollectTags}- title={Pro ? '' : i18n.t('core:needProVersion')}- >- <ListItemIcon>- <CollectTagsIcon />- </ListItemIcon>- <ListItemText- primary={- i18n.t('core:collectTagsFromLocation') + (Pro ? '' : ' PRO')- }- />- </MenuItem>- </Menu>- </div>- );+ return (+ <div+ // @ts-ignore+ style={{ overflowY: 'hidden !important' }}+ >+ <Menu+ anchorEl={props.anchorEl}+ open={props.open}+ onClose={props.handleCloseTagGroupMenu}+ >+ <MenuItem data-tid="createTags" onClick={props.showCreateTagsDialog}>+ <ListItemIcon>+ <TagIcon />+ </ListItemIcon>+ <ListItemText primary={i18n.t('core:addTags')} />+ </MenuItem>+ <MenuItem+ data-tid="editTagGroup"+ onClick={props.showEditTagGroupDialog}+ >+ <ListItemIcon>+ <Edit />+ </ListItemIcon>+ <ListItemText primary={i18n.t('core:editTagGroup')} />+ </MenuItem>+ <MenuItem data-tid="moveTagGroupUp" onClick={moveTagGroupUp}>+ <ListItemIcon>+ <ArrowUpward />+ </ListItemIcon>+ <ListItemText primary={i18n.t('core:moveTagGroupUp')} />+ </MenuItem>+ <MenuItem data-tid="moveTagGroupDown" onClick={moveTagGroupDown}>+ <ListItemIcon>+ <ArrowDownward />+ </ListItemIcon>+ <ListItemText primary={i18n.t('core:moveTagGroupDown')} />+ </MenuItem>+ <MenuItem data-tid="sortTagGroup" onClick={sortTagGroup}>+ <ListItemIcon>+ <SortTagGroupIcon />+ </ListItemIcon>+ <ListItemText primary={i18n.t('core:sortTagGroup')} />+ </MenuItem>+ <MenuItem+ data-tid="deleteTagGroup"+ onClick={props.showDeleteTagGroupDialog}+ >+ <ListItemIcon>+ <DeleteTagGroupIcon />+ </ListItemIcon>+ <ListItemText primary={i18n.t('core:deleteTagGroup')} />+ </MenuItem>+ <MenuItem+ data-tid="collectTags"+ onClick={handleCollectTags}+ title={Pro ? '' : i18n.t('core:needProVersion')}+ >+ <ListItemIcon>+ <CollectTagsIcon />+ </ListItemIcon>+ <ListItemText+ primary={+ i18n.t('core:collectTagsFromLocation') + (Pro ? '' : ' PRO')+ }+ />+ </MenuItem>+ </Menu>+ </div>+ );};export default TagLibraryMenu;diff --git a/app/components/menus/TagLibraryMenu.tsx b/app/components/menus/TagLibraryMenu.tsxindex 931af630b..7eaaf24b8 100644--- a/app/components/menus/TagLibraryMenu.tsx+++ b/app/components/menus/TagLibraryMenu.tsx@@ -29,17 +29,17 @@ import SelectDirectoryDialog from '../dialogs/SelectDirectoryDialog';import i18n from '../../services/i18n';import AppConfig from '../../config';-type Props = {- classes: Object,- anchorEl: Object,- tagGroups: Array<Object>,- openURLExternally: (path: string) => void,- open: boolean,- onClose: () => void,- importTagGroups: () => void,- exportTagGroups: () => void,- showCreateTagGroupDialog: () => void-};+interface Props {+ classes?: any;+ anchorEl: Element;+ tagGroups: Array<Object>;+ openURLExternally: (path: string) => void;+ open: boolean;+ onClose: () => void;+ importTagGroups: () => void;+ exportTagGroups: () => void;+ showCreateTagGroupDialog: () => void;+}const TagLibraryMenu = (props: Props) => {let fileInput;@@ -87,10 +87,10 @@ const TagLibraryMenu = (props: Props) => {}}- function handleFileInputChange(selection: Object) {+ function handleFileInputChange(selection: any) {const target = selection.currentTarget;const file = target.files[0];- const reader = new FileReader();+ const reader: any = new FileReader();reader.onload = () => {try {@@ -117,7 +117,10 @@ const TagLibraryMenu = (props: Props) => {}return (- <div style={{ overflowY: 'hidden !important' }}>+ <div+ // @ts-ignore+ style={{ overflowY: 'hidden !important' }}+ ><ImportExportTagGroupsDialogopen={isImportExportTagGroupDialogOpened}onClose={handleCloseDialogs}diff --git a/app/components/menus/TagMenu.tsx b/app/components/menus/TagMenu.tsxindex d65f6fcd8..ed8504351 100644--- a/app/components/menus/TagMenu.tsx+++ b/app/components/menus/TagMenu.tsx@@ -38,7 +38,7 @@ import { actions as AppActions } from '../../reducers/app';const isTagLibraryReadOnly =window.ExtTagLibrary && window.ExtTagLibrary.length > 0;-type Props = {+interface Props {anchorEl?: Element;open?: boolean;onClose: () => void;@@ -49,7 +49,7 @@ type Props = {editTag: () => void;openSearchPanel: () => void;maxSearchResults: number;-};+}const TagLibraryMenu = (props: Props) => {const [isEditTagDialogOpened, setIsEditTagDialogOpened] = useState(false);diff --git a/app/containers/MainPage.tsx b/app/containers/MainPage.tsxindex f4e42fd6e..d73746c40 100644--- a/app/containers/MainPage.tsx+++ b/app/containers/MainPage.tsx@@ -1,3 +1,4 @@+// @ts-nocheck/*** TagSpaces - universal file and folder organizer* Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)@@ -96,7 +97,7 @@ const bufferedLeftSplitResize = buffer({id: 'buffered-leftsplit-resize'});-const styles = theme => ({+const styles: any = (theme: any) => ({content: {width: '100%',marginLeft: drawerWidth,@@ -126,85 +127,82 @@ const styles = theme => ({}});-type Props = {- isFirstRun: boolean,- setFirstRun: (isFirstRun: boolean) => void,- isDesktopMode: boolean,- isFileOpened: boolean,- isIndexing: boolean,- isGeneratingThumbs: boolean,- setGeneratingThumbnails: (isGenerating: boolean) => void,- isEntryInFullWidth: boolean,- classes: Object,- theme: Object,- notificationStatus: Object,- lastPublishedVersion: string,- isUpdateAvailable: boolean,- isReadOnlyMode: boolean,- isSettingsDialogOpened: boolean,- isCreateFileDialogOpened: boolean,- isCreateDirectoryOpened: boolean,- toggleCreateDirectoryDialog: () => void,- isAboutDialogOpened: boolean,- isCreateDirectoryOpened: boolean,- toggleCreateDirectoryDialog: () => void,- isCreateFileDialogOpened: boolean,- isKeysDialogOpened: boolean,- isLicenseDialogOpened: boolean,- isThirdPartyLibsDialogOpened: boolean,- isOnboardingDialogOpened: boolean,- isSelectDirectoryDialogOpened: boolean,- toggleSelectDirectoryDialog: () => void,- isEditTagDialogOpened: boolean,- keyBindings: Object,- toggleEditTagDialog: () => void,- setEntryFullWidth: (isFullWidth: boolean) => void,- hideNotifications: () => void,- cancelDirectoryIndexing: () => void,- loadParentDirectoryContent: () => void,- setUpdateAvailable: (isUpdateAvailable: boolean) => void,- saveFile: () => void, // needed by electron-menus- setZoomResetApp: () => void, // needed by electron-menus- setZoomInApp: () => void, // needed by electron-menus- setZoomOutApp: () => void, // needed by electron-menus- toggleCreateFileDialog: () => void, // needed by electron-menus- showCreateDirectoryDialog: () => void, // needed by electron-menus- toggleSettingsDialog: () => void, // needed by electron-menus- toggleKeysDialog: () => void, // needed by electron-menus- toggleLicenseDialog: () => void, // needed by electron-menus- toggleThirdPartyLibsDialog: () => void, // neede by electron-menus- toggleAboutDialog: () => void, // needed by electron-menus- toggleOnboardingDialog: () => void, // needed by electron-menus- setLastSelectedEntry: (path: string) => void, // needed by electron-menus- openFile: (path: string) => void, // needed by electron-menus- openFileNatively: (url: string) => void, // needed by electron-menus- openURLExternally: (url: string) => void, // needed by electron-menus- getNextFile: () => void, // needed by electron-menus- getPrevFile: () => void, // needed by electron-menus- openLocationManagerPanel: () => void,- openTagLibraryPanel: () => void,- openSearchPanel: () => void,- openPerspectivesPanel: () => void,- openHelpFeedbackPanel: () => void,- closeAllVerticalPanels: () => void,- leftSplitSize: number,- mainSplitSize: any,- toggleShowUnixHiddenEntries: () => void,- setLeftVerticalSplitSize: (splitSize: number) => void,- setMainVerticalSplitSize: (splitSize: string) => void,- isLocationManagerPanelOpened: boolean,- isTagLibraryPanelOpened: boolean,- isSearchPanelOpened: boolean,- isPerspectivesPanelOpened: boolean,- isHelpFeedbackPanelOpened: boolean,- directoryPath: string,+interface Props {+ isFirstRun: boolean;+ setFirstRun: (isFirstRun: boolean) => void;+ isDesktopMode: boolean;+ isFileOpened: boolean;+ isIndexing: boolean;+ isGeneratingThumbs: boolean;+ setGeneratingThumbnails: (isGenerating: boolean) => void;+ isEntryInFullWidth: boolean;+ classes: any;+ theme: any;+ notificationStatus: any;+ lastPublishedVersion: string;+ isUpdateAvailable: boolean;+ isReadOnlyMode: boolean;+ isSettingsDialogOpened: boolean;+ isCreateFileDialogOpened: boolean;+ isCreateDirectoryOpened: boolean;+ toggleCreateDirectoryDialog: () => void;+ isAboutDialogOpened: boolean;+ isKeysDialogOpened: boolean;+ isLicenseDialogOpened: boolean;+ isThirdPartyLibsDialogOpened: boolean;+ isOnboardingDialogOpened: boolean;+ isSelectDirectoryDialogOpened: boolean;+ toggleSelectDirectoryDialog: () => void;+ isEditTagDialogOpened: boolean;+ keyBindings: any;+ toggleEditTagDialog: () => void;+ setEntryFullWidth: (isFullWidth: boolean) => void;+ hideNotifications: () => void;+ cancelDirectoryIndexing: () => void;+ loadParentDirectoryContent: () => void;+ setUpdateAvailable: (isUpdateAvailable: boolean) => void;+ saveFile: () => void; // needed by electron-menus+ setZoomResetApp: () => void; // needed by electron-menus+ setZoomInApp: () => void; // needed by electron-menus+ setZoomOutApp: () => void; // needed by electron-menus+ toggleCreateFileDialog: () => void; // needed by electron-menus+ showCreateDirectoryDialog: () => void; // needed by electron-menus+ toggleSettingsDialog: () => void; // needed by electron-menus+ toggleKeysDialog: () => void; // needed by electron-menus+ toggleLicenseDialog: () => void; // needed by electron-menus+ toggleThirdPartyLibsDialog: () => void; // neede by electron-menus+ toggleAboutDialog: () => void; // needed by electron-menus+ toggleOnboardingDialog: () => void; // needed by electron-menus+ setLastSelectedEntry: (path: string) => void; // needed by electron-menus+ openFile: (path: string) => void; // needed by electron-menus+ openFileNatively: (url: string) => void; // needed by electron-menus+ openURLExternally: (url: string) => void; // needed by electron-menus+ getNextFile: () => void; // needed by electron-menus+ getPrevFile: () => void; // needed by electron-menus+ openLocationManagerPanel: () => void;+ openTagLibraryPanel: () => void;+ openSearchPanel: () => void;+ openPerspectivesPanel: () => void;+ openHelpFeedbackPanel: () => void;+ closeAllVerticalPanels: () => void;+ leftSplitSize: number;+ mainSplitSize: any;+ toggleShowUnixHiddenEntries: () => void;+ setLeftVerticalSplitSize: (splitSize: number) => void;+ setMainVerticalSplitSize: (splitSize: string) => void;+ isLocationManagerPanelOpened: boolean;+ isTagLibraryPanelOpened: boolean;+ isSearchPanelOpened: boolean;+ isPerspectivesPanelOpened: boolean;+ isHelpFeedbackPanelOpened: boolean;+ directoryPath: string;showNotification: (text: string,notificationType?: string,autohide?: boolean- ) => void,- reflectCreateEntry: (path: string, isFile: boolean) => void-};+ ) => void;+ reflectCreateEntry: (path: string, isFile: boolean) => void;+}const AboutDialog = React.lazy(() =>import(@@ -283,14 +281,14 @@ const SelectDirectoryAsync = props => (</React.Suspense>);-type State = {- selectedDirectoryPath: string,- isManagementPanelVisible: boolean,- mainSplitSize: any,- isDrawerOpened: boolean,- width: number,- height: number-};+interface State {+ selectedDirectoryPath: string;+ isManagementPanelVisible: boolean;+ mainSplitSize: any;+ isDrawerOpened: boolean;+ width: number;+ height: number;+}let showVerticalPanel = true;if (window.ExtDefaultVerticalPanel === 'none') {@@ -509,8 +507,8 @@ class MainPage extends Component<Props, State> {return true;}- const reader = new FileReader();- reader.onload = event => {+ const reader: any = new FileReader();+ reader.onload = (event: any) => {// console.log('Content on file read complete: ' + JSON.stringify(event));// change name for ios fakepath// if (AppConfig.isCordovaiOS) {diff --git a/app/containers/Root.tsx b/app/containers/Root.tsxindex 84fcf0dc0..bd64a9adc 100644--- a/app/containers/Root.tsx+++ b/app/containers/Root.tsx@@ -35,9 +35,9 @@ import PlatformIO from '../services/platform-io';import { getURLParameter } from '../utils/misc';type RootType = {- store: {},- persistor: {},- history: {}+ store: {};+ persistor: {};+ history: {};};function onBeforeLift(store) {@@ -77,7 +77,10 @@ function onBeforeLift(store) {export default function Root({ store, persistor, history }: RootType) {return (- <Provider store={store}>+ <Provider+ // @ts-ignore+ store={store}+ >{/*** PersistGate delays the rendering of the app's UI until the persisted state has been retrieved* and saved to redux.@@ -88,6 +91,7 @@ export default function Root({ store, persistor, history }: RootType) {<PersistGateloading={<LoadingScreen />}onBeforeLift={() => onBeforeLift(store)}+ // @ts-ignorepersistor={persistor}><ConnectedRouter history={history}>diff --git a/app/index.tsx b/app/index.tsxindex b89214149..5e79c1bcb 100644--- a/app/index.tsx+++ b/app/index.tsx@@ -24,16 +24,13 @@ import Root from './containers/Root';import { configureStore, history } from './store/configureStore';import './app.global.css';-const { store, persistor } = configureStore();+const { store, persistor } = configureStore({});document.addEventListener('contextmenu', event => event.preventDefault());if (process.env.NODE_ENV === 'production') {- // $FlowFixMeconsole.log = () => {};- // $FlowFixMeconsole.time = () => {};- // $FlowFixMeconsole.timeEnd = () => {};}diff --git a/app/perspectives/grid-perspective/components/CellContent.tsx b/app/perspectives/grid-perspective/components/CellContent.tsxindex 74501f6e8..1b895d16a 100644--- a/app/perspectives/grid-perspective/components/CellContent.tsx+++ b/app/perspectives/grid-perspective/components/CellContent.tsx@@ -1,3 +1,4 @@+// @ts-nocheck/*** TagSpaces - universal file and folder organizer* Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)@@ -29,8 +30,8 @@ import TagIcon from '@material-ui/icons/LocalOffer';import { formatFileSize, formatDateTime } from '../../../utils/misc';import { extractTitle } from '../../../utils/paths';import {- FileSystemEntry,- findColorForFileEntry+ FileSystemEntry,+ findColorForFileEntry} from '../../../services/utils-io';import TagContainerDnd from '../../../components/TagContainerDnd';import TagContainer from '../../../components/TagContainer';@@ -39,341 +40,343 @@ import { Tag } from '../../../reducers/taglibrary';const maxDescriptionPreviewLength = 100;-type Props = {- selected: boolean;- fsEntry: FileSystemEntry;- entrySize: string;- classes: Object;- theme: Object;- supportedFileTypes: Array<Object>;- thumbnailMode: any;- addTags: () => void;- openFile: (path: string, isFile: boolean) => void;- selectedEntries: Array<Object>;- isReadOnlyMode: boolean;- showTags: boolean;- handleTagMenu: (event: Object, tag: Tag, entryPath: string) => void;- layoutType: string;- handleGridContextMenu: (event: Object, fsEntry: FileSystemEntry) => void;- handleGridCellDblClick: (event: Object, fsEntry: FileSystemEntry) => void;- handleGridCellClick: (event: Object, fsEntry: FileSystemEntry) => void;-};+interface Props {+ selected: boolean;+ fsEntry: FileSystemEntry;+ entrySize: string;+ classes: any;+ theme: any;+ supportedFileTypes: Array<Object>;+ thumbnailMode: any;+ addTags: () => void;+ openFile: (path: string, isFile: boolean) => void;+ selectedEntries: Array<FileSystemEntry>;+ isReadOnlyMode: boolean;+ showTags: boolean;+ handleTagMenu: (event: Object, tag: Tag, entryPath: string) => void;+ layoutType: string;+ handleGridContextMenu: (event: Object, fsEntry: FileSystemEntry) => void;+ handleGridCellDblClick: (event: Object, fsEntry: FileSystemEntry) => void;+ handleGridCellClick: (event: Object, fsEntry: FileSystemEntry) => void;+}const CellContent = (props: Props) => {- const {- selected,- fsEntry,- entrySize,- classes,- theme,- supportedFileTypes,- thumbnailMode,- addTags,- selectedEntries,- isReadOnlyMode,- handleTagMenu,- layoutType,- handleGridContextMenu,- handleGridCellDblClick,- handleGridCellClick,- showTags,- openFile- } = props;- const fsEntryBackgroundColor = fsEntry.color ? fsEntry.color : 'transparent';+ const {+ selected,+ fsEntry,+ entrySize,+ classes,+ theme,+ supportedFileTypes,+ thumbnailMode,+ addTags,+ selectedEntries,+ isReadOnlyMode,+ handleTagMenu,+ layoutType,+ handleGridContextMenu,+ handleGridCellDblClick,+ handleGridCellClick,+ showTags,+ openFile+ } = props;+ const fsEntryBackgroundColor = fsEntry.color ? fsEntry.color : 'transparent';- let description = removeMd(fsEntry.description);- if (description.length > maxDescriptionPreviewLength) {- description = description.substr(0, maxDescriptionPreviewLength) + '...';- }+ let description = removeMd(fsEntry.description);+ if (description.length > maxDescriptionPreviewLength) {+ description = description.substr(0, maxDescriptionPreviewLength) + '...';+ }- const fsEntryColor = findColorForFileEntry(- fsEntry.extension,- fsEntry.isFile,- supportedFileTypes- );+ const fsEntryColor = findColorForFileEntry(+ fsEntry.extension,+ fsEntry.isFile,+ supportedFileTypes+ );- // let thumbPathUrl = fsEntry.thumbPath- // ? 'url("' + fsEntry.thumbPath + '")'- // : '';- // if (AppConfig.isWin) {- // thumbPathUrl = thumbPathUrl.split('\\').join('\\\\');- // }+ // let thumbPathUrl = fsEntry.thumbPath+ // ? 'url("' + fsEntry.thumbPath + '")'+ // : '';+ // if (AppConfig.isWin) {+ // thumbPathUrl = thumbPathUrl.split('\\').join('\\\\');+ // }- let tagTitles = '';- fsEntry.tags.map(tag => {- tagTitles += tag.title + ', ';- return true;- });- tagTitles = tagTitles.substring(0, tagTitles.length - 2);- const tagPlaceholder =- tagTitles.length > 0 ? (- <IconButton- title={tagTitles}- onClick={() => openFile(fsEntry.path, fsEntry.isFile)}- >- <TagIcon />- </IconButton>- ) : null;+ let tagTitles = '';+ fsEntry.tags.map(tag => {+ tagTitles += tag.title + ', ';+ return true;+ });+ tagTitles = tagTitles.substring(0, tagTitles.length - 2);+ const tagPlaceholder =+ tagTitles.length > 0 ? (+ <IconButton+ title={tagTitles}+ onClick={() => openFile(fsEntry.path, fsEntry.isFile)}+ >+ <TagIcon />+ </IconButton>+ ) : null;- function renderGridCell() {- return (- <div- style={{- backgroundColor: fsEntryBackgroundColor- }}- >- <div- className={classes.gridCellThumb}- style={{- position: 'relative',- // zIndex: 1,- height: 150 // fsEntry.isFile ? 150 : 70- }}- >- {fsEntry.thumbPath && (- <img- alt="thumbnail"- className={classes.gridCellThumb}- src={fsEntry.thumbPath}- loading="lazy"- style={{- objectFit: thumbnailMode,- position: 'absolute',- width: '100%',- height: 150- }}- />- )}- <div id="gridCellTags" className={classes.gridCellTags}>- {showTags- ? fsEntry.tags.map(tag => renderTag(tag))- : tagPlaceholder}- </div>- {description.length > 0 && (- <Typography- id="gridCellDescription"- className={classes.gridCellDescription}- title={i18n.t('core:filePropertiesDescription')}- variant="caption"- >- {description}- </Typography>- )}- </div>- <Typography- className={classes.gridCellTitle}- data-tid="fsEntryName"- title={fsEntry.path}- noWrap={true}- variant="body1"- >- {extractTitle(fsEntry.name, !fsEntry.isFile)}- </Typography>- {fsEntry.isFile ? (- <div className={classes.gridDetails}>- <Typography- className={classes.gridFileExtension}- style={{ backgroundColor: fsEntryColor }}- noWrap={true}- variant="button"- title={fsEntry.path}- >- {fsEntry.extension}- </Typography>- <Typography className={classes.gridSizeDate} variant="caption">- <span- title={- i18n.t('core:modifiedDate') +- ': ' +- formatDateTime(fsEntry.lmdt, true)- }- >- {fsEntry.lmdt &&- ' ' +- formatDistance(fsEntry.lmdt, new Date(), {- addSuffix: true- })}- </span>- <span title={fsEntry.size + ' ' + i18n.t('core:sizeInBytes')}>- {' ' + formatFileSize(fsEntry.size)}- </span>- </Typography>- </div>- ) : (- <div className={classes.gridDetails}>- <FolderIcon- className={classes.gridFolder}- style={{ backgroundColor: fsEntryColor }}- title={fsEntry.path}- />- </div>- )}- </div>- );- }+ function renderGridCell() {+ return (+ <div+ style={{+ backgroundColor: fsEntryBackgroundColor+ }}+ >+ <div+ className={classes.gridCellThumb}+ style={{+ position: 'relative',+ // zIndex: 1,+ height: 150 // fsEntry.isFile ? 150 : 70+ }}+ >+ {fsEntry.thumbPath && (+ <img+ alt="thumbnail"+ className={classes.gridCellThumb}+ src={fsEntry.thumbPath}+ // @ts-ignore+ loading="lazy"+ style={{+ objectFit: thumbnailMode,+ position: 'absolute',+ width: '100%',+ height: 150+ }}+ />+ )}+ <div id="gridCellTags" className={classes.gridCellTags}>+ {showTags+ ? fsEntry.tags.map(tag => renderTag(tag))+ : tagPlaceholder}+ </div>+ {description.length > 0 && (+ <Typography+ id="gridCellDescription"+ className={classes.gridCellDescription}+ title={i18n.t('core:filePropertiesDescription')}+ variant="caption"+ >+ {description}+ </Typography>+ )}+ </div>+ <Typography+ className={classes.gridCellTitle}+ data-tid="fsEntryName"+ title={fsEntry.path}+ noWrap={true}+ variant="body1"+ >+ {extractTitle(fsEntry.name, !fsEntry.isFile)}+ </Typography>+ {fsEntry.isFile ? (+ <div className={classes.gridDetails}>+ <Typography+ className={classes.gridFileExtension}+ style={{ backgroundColor: fsEntryColor }}+ noWrap={true}+ variant="button"+ title={fsEntry.path}+ >+ {fsEntry.extension}+ </Typography>+ <Typography className={classes.gridSizeDate} variant="caption">+ <span+ title={+ i18n.t('core:modifiedDate') ++ ': ' ++ formatDateTime(fsEntry.lmdt, true)+ }+ >+ {fsEntry.lmdt &&+ ' ' ++ formatDistance(fsEntry.lmdt, new Date(), {+ addSuffix: true+ })}+ </span>+ <span title={fsEntry.size + ' ' + i18n.t('core:sizeInBytes')}>+ {' ' + formatFileSize(fsEntry.size)}+ </span>+ </Typography>+ </div>+ ) : (+ <div className={classes.gridDetails}>+ <FolderIcon+ className={classes.gridFolder}+ style={{ backgroundColor: fsEntryColor }}+ title={fsEntry.path}+ />+ </div>+ )}+ </div>+ );+ }- function renderRowCell() {- let tmbSize = 85;- if (entrySize === 'small') {- tmbSize = 50;- } else if (entrySize === 'normal') {- tmbSize = 85;- } else if (entrySize === 'big') {- tmbSize = 120;- }- return (- <Grid- container- wrap="nowrap"- style={{- backgroundColor: theme.palette.background.default- }}- >- <Grid- item- style={{- minHeight: entryHeight,- padding: 10,- marginRight: 5,- backgroundColor: fsEntryBackgroundColor- }}- >- {fsEntry.isFile ? (- <div- className={classes.rowFileExtension}- title={fsEntry.path}- style={{ backgroundColor: fsEntryColor }}- >- {fsEntry.extension}- </div>- ) : (- <span className={classes.gridFolder} title={fsEntry.path}>- <FolderIcon- className={classes.rowFolder}- style={{ backgroundColor: fsEntryColor }}- />- </span>- )}- </Grid>- <Grid item xs zeroMinWidth>- <Typography style={{ wordBreak: 'break-all' }}>- {extractTitle(fsEntry.name, !fsEntry.isFile)}- {entrySize === 'small' && tagPlaceholder}- </Typography>- {entrySize !== 'small'- ? showTags- ? fsEntry.tags.map(tag => renderTag(tag))- : tagPlaceholder- : null}- {entrySize !== 'small' && (- <Typography- style={{- color: 'gray',- padding: 5- }}- >- <span title={fsEntry.size + ' ' + i18n.t('core:sizeInBytes')}>- {fsEntry.isFile && formatFileSize(fsEntry.size) + ' - '}- </span>- <span- title={- i18n.t('core:modifiedDate') +- ': ' +- formatDateTime(fsEntry.lmdt, true)- }- >- {fsEntry.isFile &&- fsEntry.lmdt &&- '️ ' +- formatDistance(fsEntry.lmdt, new Date(), {- addSuffix: true- }) +- ' '}- </span>- <span title={i18n.t('core:entryDescription')}>- {description && description}- </span>- </Typography>- )}- </Grid>- {fsEntry.thumbPath && (- <Grid item>- <img- alt="thumbnail"- className={classes.gridCellThumb}- src={fsEntry.thumbPath}- loading="lazy"- style={{- objectFit: thumbnailMode,- height: tmbSize,- width: tmbSize- }}- />- </Grid>- )}- </Grid>- );- }+ function renderRowCell() {+ let tmbSize = 85;+ if (entrySize === 'small') {+ tmbSize = 50;+ } else if (entrySize === 'normal') {+ tmbSize = 85;+ } else if (entrySize === 'big') {+ tmbSize = 120;+ }+ return (+ <Grid+ container+ wrap="nowrap"+ style={{+ backgroundColor: theme.palette.background.default+ }}+ >+ <Grid+ item+ style={{+ minHeight: entryHeight,+ padding: 10,+ marginRight: 5,+ backgroundColor: fsEntryBackgroundColor+ }}+ >+ {fsEntry.isFile ? (+ <div+ className={classes.rowFileExtension}+ title={fsEntry.path}+ style={{ backgroundColor: fsEntryColor }}+ >+ {fsEntry.extension}+ </div>+ ) : (+ <span className={classes.gridFolder} title={fsEntry.path}>+ <FolderIcon+ className={classes.rowFolder}+ style={{ backgroundColor: fsEntryColor }}+ />+ </span>+ )}+ </Grid>+ <Grid item xs zeroMinWidth>+ <Typography style={{ wordBreak: 'break-all' }}>+ {extractTitle(fsEntry.name, !fsEntry.isFile)}+ {entrySize === 'small' && tagPlaceholder}+ </Typography>+ {entrySize !== 'small'+ ? showTags+ ? fsEntry.tags.map(tag => renderTag(tag))+ : tagPlaceholder+ : null}+ {entrySize !== 'small' && (+ <Typography+ style={{+ color: 'gray',+ padding: 5+ }}+ >+ <span title={fsEntry.size + ' ' + i18n.t('core:sizeInBytes')}>+ {fsEntry.isFile && formatFileSize(fsEntry.size) + ' - '}+ </span>+ <span+ title={+ i18n.t('core:modifiedDate') ++ ': ' ++ formatDateTime(fsEntry.lmdt, true)+ }+ >+ {fsEntry.isFile &&+ fsEntry.lmdt &&+ '️ ' ++ formatDistance(fsEntry.lmdt, new Date(), {+ addSuffix: true+ }) ++ ' '}+ </span>+ <span title={i18n.t('core:entryDescription')}>+ {description && description}+ </span>+ </Typography>+ )}+ </Grid>+ {fsEntry.thumbPath && (+ <Grid item>+ <img+ alt="thumbnail"+ className={classes.gridCellThumb}+ src={fsEntry.thumbPath}+ // @ts-ignore+ loading="lazy"+ style={{+ objectFit: thumbnailMode,+ height: tmbSize,+ width: tmbSize+ }}+ />+ </Grid>+ )}+ </Grid>+ );+ }- function renderTag(tag: Object) {- return isReadOnlyMode ? (- <TagContainer- tag={tag}- key={fsEntry.path + tag.title}- entryPath={fsEntry.path}- addTags={addTags}- handleTagMenu={handleTagMenu}- selectedEntries={selectedEntries}- />- ) : (- <TagContainerDnd- tag={tag}- key={fsEntry.path + tag.title}- entryPath={fsEntry.path}- addTags={addTags}- handleTagMenu={handleTagMenu}- selectedEntries={selectedEntries}- />- );- }+ function renderTag(tag: Tag) {+ return isReadOnlyMode ? (+ <TagContainer+ tag={tag}+ key={fsEntry.path + tag.title}+ entryPath={fsEntry.path}+ addTags={addTags}+ handleTagMenu={handleTagMenu}+ selectedEntries={selectedEntries}+ />+ ) : (+ <TagContainerDnd+ tag={tag}+ key={fsEntry.path + tag.title}+ entryPath={fsEntry.path}+ addTags={addTags}+ handleTagMenu={handleTagMenu}+ selectedEntries={selectedEntries}+ />+ );+ }- let entryHeight = 130;- if (entrySize === 'small') {- entryHeight = 50;- } else if (entrySize === 'normal') {- entryHeight = 80;- } else if (entrySize === 'big') {- entryHeight = 130;- }+ let entryHeight = 130;+ if (entrySize === 'small') {+ entryHeight = 50;+ } else if (entrySize === 'normal') {+ entryHeight = 80;+ } else if (entrySize === 'big') {+ entryHeight = 130;+ }- let gridCell = React.Fragment;- if (layoutType === 'grid') {- gridCell = renderGridCell();- } else if (layoutType === 'row') {- gridCell = renderRowCell();- }+ let gridCell = React.Fragment;+ if (layoutType === 'grid') {+ gridCell = renderGridCell();+ } else if (layoutType === 'row') {+ gridCell = renderRowCell();+ }- return (- <Paper- elevation={2}- data-entry-id={fsEntry.uuid}- className={classNames(- layoutType === 'grid' && classes.gridCell,- layoutType === 'row' && classes.rowCell,- selected && layoutType === 'grid' && classes.selectedGridCell,- selected && layoutType === 'row' && classes.selectedRowCell- )}- style={{- minHeight: layoutType === 'row' ? entryHeight : 'auto',- backgroundColor: theme.palette.background.default- }}- onContextMenu={event => handleGridContextMenu(event, fsEntry)}- onDoubleClick={event => handleGridCellDblClick(event, fsEntry)}- onClick={event => handleGridCellClick(event, fsEntry)}- >- {gridCell}- </Paper>- );+ return (+ <Paper+ elevation={2}+ data-entry-id={fsEntry.uuid}+ className={classNames(+ layoutType === 'grid' && classes.gridCell,+ layoutType === 'row' && classes.rowCell,+ selected && layoutType === 'grid' && classes.selectedGridCell,+ selected && layoutType === 'row' && classes.selectedRowCell+ )}+ style={{+ minHeight: layoutType === 'row' ? entryHeight : 'auto',+ backgroundColor: theme.palette.background.default+ }}+ onContextMenu={event => handleGridContextMenu(event, fsEntry)}+ onDoubleClick={event => handleGridCellDblClick(event, fsEntry)}+ onClick={event => handleGridCellClick(event, fsEntry)}+ >+ {gridCell}+ </Paper>+ );};export default CellContent;diff --git a/app/reducers/index.ts b/app/reducers/index.tsindex e2b015f8f..fb1188f54 100644--- a/app/reducers/index.ts+++ b/app/reducers/index.ts@@ -15,7 +15,7 @@* along with this program. If not, see <https://www.gnu.org/licenses/>.**/-import { persistCombineReducers } from 'redux-persist';+import { persistCombineReducers, PersistConfig } from 'redux-persist';import { routerReducer as router } from 'react-router-redux';import getStoredStateMigrateV4 from 'redux-persist/lib/integration/getStoredStateMigrateV4';// import autoMergeLevel2 from 'redux-persist/lib/stateReconciler/autoMergeLevel2';@@ -32,8 +32,8 @@ const externalTagLibrary = window.ExtTagLibrary || false;const blacklist = ['app','locationIndex',- externalLocations ? 'locations' : false,- externalTagLibrary ? 'taglibrary' : false+ externalLocations ? 'locations' : '',+ externalTagLibrary ? 'taglibrary' : ''];// const migrations = {@@ -81,7 +81,7 @@ const blacklist = [// }// };-const rootPersistConfig = {+const rootPersistConfig: PersistConfig = {key: 'root',getStoredState: getStoredStateMigrateV4({ blacklist }),storage,diff --git a/app/store/configureStore.ts b/app/store/configureStore.tsindex a23279dd7..2e12a414f 100644--- a/app/store/configureStore.ts+++ b/app/store/configureStore.ts@@ -15,9 +15,14 @@* along with this program. If not, see <https://www.gnu.org/licenses/>.**/+import configureStoreDev from './configureStore.dev';+import configureStoreProd from './configureStore.prod';-if (process.env.NODE_ENV === 'production') {- module.exports = require('./configureStore.prod'); // eslint-disable-line global-require-} else {- module.exports = require('./configureStore.dev'); // eslint-disable-line global-require-}+const selectedConfigureStore =+ process.env.NODE_ENV === 'production'+ ? configureStoreProd+ : configureStoreDev;++export const { configureStore } = selectedConfigureStore;++export const { history } = selectedConfigureStore;diff --git a/package.json b/package.jsonindex c2f7b9e58..3882fe007 100644--- a/package.json+++ b/package.json@@ -4,7 +4,8 @@"description": "TagSpaces core repository","homepage": "https://www.tagspaces.org","scripts": {- "build": "concurrently 'yarn build-main' 'yarn build-renderer' 'yarn build-worker'",+ "build": "concurrently 'yarn build-main' 'yarn build-renderer'",+ "build-all": "concurrently 'yarn build-main' 'yarn build-renderer' 'yarn build-worker'","build-dll": "cross-env NODE_ENV=development webpack --config ./configs/webpack.config.renderer.dev.dll.babel.js --colors","build-e2e": "cross-env E2E_BUILD=true yarn build","build-main": "cross-env NODE_ENV=production webpack --config ./configs/webpack.config.main.prod.babel.js --colors",diff --git a/tsconfig.json b/tsconfig.jsonindex 634cbf1b8..8500c9079 100644--- a/tsconfig.json+++ b/tsconfig.json@@ -7,10 +7,10 @@"jsx": "react","module": "esnext","moduleResolution": "node",- "noUnusedLocals": true,+ "noUnusedLocals": false,"allowSyntheticDefaultImports": true,"pretty": true,- "sourceMap": false,+ "sourceMap": true,"skipLibCheck": true,"resolveJsonModule": true,"lib": ["es2015", "dom"],