Skip to content

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

TSN805 - Concept for unifying two configs - update misc.js (#1681)

Stanimiref95f9627e59
diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml
index 292636bc2..ecafd461a 100644
--- a/.github/workflows/pull_request.yml
+++ b/.github/workflows/pull_request.yml
@@ -84,7 +84,7 @@ jobs:
- name: Checkout TagspacesPro
uses: actions/checkout@v2
with:
- ref: develop
+ ref: TSN805---Concept-for-unifying-two-configs
repository: tagspaces/tagspacespro
token: ${{ secrets.CHECKOUT_TSPRO }}
path: extensions/tagspacespro
diff --git a/app/components/CustomLogo.tsx b/app/components/CustomLogo.tsx
index 0e2871f19..0060b53a3 100644
--- a/app/components/CustomLogo.tsx
+++ b/app/components/CustomLogo.tsx
@@ -23,6 +23,7 @@ import IconButton from '@material-ui/core/IconButton';
import { withStyles } from '@material-ui/core/styles';
import Badge from '@material-ui/core/Badge';
import Tooltip from '@material-ui/core/Tooltip';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import { Pro } from '../pro';
import TextLogoIcon from '../assets/images/text-logo.svg';
import WebLogoIcon from '../assets/images/text-logo-web.svg';
@@ -30,7 +31,6 @@ import LogoIcon from '../assets/images/icon100x100.svg';
import { actions as AppActions } from '../reducers/app';
import i18n from '../services/i18n';
import versionMeta from '../version.json';
-import AppConfig from '-/config';
const AppVersionBadge = withStyles(theme => ({
badge: {
@@ -59,37 +59,39 @@ if (AppConfig.customLogo) {
logo = AppConfig.customLogo;
}
-const CustomLogo = (props: Props) => (
- <Tooltip title={i18n.t('core:aboutTitle')}>
- <AppVersionBadge badgeContent={'v' + versionMeta.version} color="primary">
- <IconButton
- onClick={props.toggleAboutDialog}
- style={{ padding: 0, paddingLeft: 5, height: 50 }}
- data-tid="aboutTagSpaces"
- >
- <img
- style={{
- width: 40
- // color: props.theme.palette.text.primary
- }}
- src={LogoIcon}
- alt="TagSpaces Logo"
- />
- </IconButton>
- <IconButton
- style={{ height: 50, padding: 0, marginBottom: 15 }}
- data-tid="aboutTagSpaces"
- onClick={props.toggleAboutDialog}
- >
- <img
- style={{ maxHeight: 50, maxWidth: 200 }}
- src={logo}
- alt="TagSpaces"
- />
- </IconButton>
- </AppVersionBadge>
- </Tooltip>
-);
+function CustomLogo(props: Props) {
+ return (
+ <Tooltip title={i18n.t('core:aboutTitle')}>
+ <AppVersionBadge badgeContent={'v' + versionMeta.version} color="primary">
+ <IconButton
+ onClick={props.toggleAboutDialog}
+ style={{ padding: 0, paddingLeft: 5, height: 50 }}
+ data-tid="aboutTagSpaces"
+ >
+ <img
+ style={{
+ width: 40
+ // color: props.theme.palette.text.primary
+ }}
+ src={LogoIcon}
+ alt="TagSpaces Logo"
+ />
+ </IconButton>
+ <IconButton
+ style={{ height: 50, padding: 0, marginBottom: 15 }}
+ data-tid="aboutTagSpaces"
+ onClick={props.toggleAboutDialog}
+ >
+ <img
+ style={{ maxHeight: 50, maxWidth: 200 }}
+ src={logo}
+ alt="TagSpaces"
+ />
+ </IconButton>
+ </AppVersionBadge>
+ </Tooltip>
+ );
+}
function mapActionCreatorsToProps(dispatch) {
return bindActionCreators(
diff --git a/app/components/DirectoryTreeView.tsx b/app/components/DirectoryTreeView.tsx
index 6fbfc8158..7f2a814cb 100644
--- a/app/components/DirectoryTreeView.tsx
+++ b/app/components/DirectoryTreeView.tsx
@@ -19,13 +19,12 @@
import React, { useState, forwardRef, useImperativeHandle, Ref } from 'react';
import Table from 'rc-table';
import FolderIcon from '@material-ui/icons/FolderOpen';
+import { locationType } from '@tagspaces/tagspaces-platforms/misc';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import DragItemTypes from '-/components/DragItemTypes';
-import AppConfig from '-/config';
import PlatformIO from '-/services/platform-facade';
import TargetTableMoveFileBox from '-/components/TargetTableMoveFileBox';
-import { getLocationPath } from '-/utils/paths';
import { TS } from '-/tagspaces.namespace';
-import { locationType } from '-/utils/misc';
interface Props {
classes: any;
@@ -63,19 +62,17 @@ const DirectoryTreeView = forwardRef(
if (isExpanded && data[location.uuid] !== undefined) {
setData(undefined); // comment this to use cached data after expand
setExpanded(false);
- } else {
- if (location.type === locationType.TYPE_CLOUD) {
- PlatformIO.enableObjectStoreSupport(location)
- .then(() => {
- loadSubDirectories(location);
- })
- .catch(error => {
- console.log('enableObjectStoreSupport', error);
- });
- } else if (location.type === locationType.TYPE_LOCAL) {
- PlatformIO.disableObjectStoreSupport();
- loadSubDirectories(location);
- }
+ } else if (location.type === locationType.TYPE_CLOUD) {
+ PlatformIO.enableObjectStoreSupport(location)
+ .then(() => {
+ loadSubDirectories(location);
+ })
+ .catch(error => {
+ console.log('enableObjectStoreSupport', error);
+ });
+ } else if (location.type === locationType.TYPE_LOCAL) {
+ PlatformIO.disableObjectStoreSupport();
+ loadSubDirectories(location);
}
},
closeLocation() {
@@ -84,18 +81,18 @@ const DirectoryTreeView = forwardRef(
setExpanded(false);
}
}
- /*removeLocation() {
+ /* removeLocation() {
setData(undefined);
- }*/
+ } */
}));
- /*const changeLocation = (location: Location) => {
+ /* const changeLocation = (location: Location) => {
const dirsTree = data;
dirsTree[location.uuid] = undefined;
setData(dirsTree);
- };*/
+ }; */
- /*const renderBodyCell = props => (
+ /* const renderBodyCell = props => (
<td {...props}>
<TargetMoveFileBox
// @ts-ignore
@@ -105,7 +102,7 @@ const DirectoryTreeView = forwardRef(
{props.children}
</TargetMoveFileBox>
</td>
- );*/
+ ); */
const renderBodyRow = props => {
if (
@@ -121,9 +118,8 @@ const DirectoryTreeView = forwardRef(
{...props}
/>
);
- } else {
- return <tr {...props} />;
}
+ return <tr {...props} />;
};
const renderNameColumnAction = field => {
@@ -210,7 +206,7 @@ const DirectoryTreeView = forwardRef(
uuid: location.uuid,
name: location.name,
type: location.type,
- path: getLocationPath(location)
+ path: PlatformIO.getLocationPath(location)
};
getDirectoriesTree(subFolder)
.then(children => {
@@ -235,7 +231,7 @@ const DirectoryTreeView = forwardRef(
}
} else if (location.path === undefined) {
// if is Location
- //setData({});
+ // setData({});
}
return true;
})
@@ -257,9 +253,9 @@ const DirectoryTreeView = forwardRef(
children?: Array<SubFolder>;
};
- const getDirectoriesTree = (subFolder: SubFolder) => {
+ const getDirectoriesTree = (subFolder: SubFolder) =>
// const { settings } = getState();
- return new Promise((resolve, reject) => {
+ new Promise((resolve, reject) => {
PlatformIO.listDirectoryPromise(subFolder.path, [])
.then(dirEntries => {
if (dirEntries !== undefined) {
@@ -306,7 +302,6 @@ const DirectoryTreeView = forwardRef(
reject();
});
});
- };
/**
* https://codereview.stackexchange.com/questions/47932/recursion-vs-iteration-of-tree-structure
@@ -402,7 +397,7 @@ const DirectoryTreeView = forwardRef(
data={data[props.location.uuid]}
columns={columns}
indentSize={20}
- expandable={{ onExpand: onExpand }}
+ expandable={{ onExpand }}
// expandIcon={this.CustomExpandIcon}
// expandIconAsCell
// @ts-ignore
diff --git a/app/components/EntryContainer.tsx b/app/components/EntryContainer.tsx
index 070ce60cb..9002cf94b 100644
--- a/app/components/EntryContainer.tsx
+++ b/app/components/EntryContainer.tsx
@@ -47,13 +47,8 @@ import { withStyles } from '@material-ui/core/styles';
import RefreshIcon from '@material-ui/icons/Refresh';
import Box from '@material-ui/core/Box';
import { Split } from 'ts-react-splitter';
-import EntryProperties from '-/components/EntryProperties';
-import TagsPreview from '-/components/TagsPreview';
-import ConfirmDialog from '-/components/dialogs/ConfirmDialog';
-import AppConfig from '-/config';
-import PlatformIO from '-/services/platform-facade';
-import AddRemoveTagsDialog from '-/components/dialogs/AddRemoveTagsDialog';
-import i18n from '-/services/i18n';
+import { buffer } from '@tagspaces/tagspaces-platforms/misc';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import {
extractContainingDirectoryPath,
extractTitle,
@@ -61,8 +56,14 @@ import {
baseName,
extractFileName,
extractDirectoryName
-} from '-/utils/paths';
-// import { buffer } from '-/utils/misc';
+} from '@tagspaces/tagspaces-platforms/paths';
+import EntryProperties from '-/components/EntryProperties';
+import TagsPreview from '-/components/TagsPreview';
+import ConfirmDialog from '-/components/dialogs/ConfirmDialog';
+import PlatformIO from '-/services/platform-facade';
+import AddRemoveTagsDialog from '-/components/dialogs/AddRemoveTagsDialog';
+import i18n from '-/services/i18n';
+// import { buffer } from '@tagspaces/tagspaces-platforms/misc';
import {
actions as SettingsActions,
isDesktopMode,
@@ -79,7 +80,6 @@ import {
import useEventListener from '-/utils/useEventListener';
import { TS } from '-/tagspaces.namespace';
import FileView from '-/components/FileView';
-import { buffer } from '-/utils/misc';
const defaultSplitSize = '7.86%'; // '7.2%'; // 103;
// const openedSplitSize = AppConfig.isElectron ? 560 : 360;
@@ -183,7 +183,7 @@ interface Props {
tileServer: TS.MapTileServer;
}
-const EntryContainer = (props: Props) => {
+function EntryContainer(props: Props) {
// const [percent, setPercent] = React.useState<number | undefined>(undefined);
const percent = useRef<number | undefined>(undefined);
const openedFile = props.openedFiles[0];
@@ -217,7 +217,7 @@ const EntryContainer = (props: Props) => {
HTMLDivElement
>(null);
- const fileChanged = useRef<Boolean>(false);
+ const fileChanged = useRef<boolean>(false);
useEventListener('message', e => {
if (typeof e.data === 'string') {
@@ -1155,7 +1155,7 @@ const EntryContainer = (props: Props) => {
{renderPanels()}
</GlobalHotKeys>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/components/EntryIcon.tsx b/app/components/EntryIcon.tsx
index e28669905..658b803c2 100644
--- a/app/components/EntryIcon.tsx
+++ b/app/components/EntryIcon.tsx
@@ -22,32 +22,34 @@ interface Props {
isFile: boolean;
}
-const EntryIcon = (props: Props) => (
- <svg
- style={{
- // marginTop: 25,
- width: '60%',
- position: 'absolute',
- top: '50%',
- left: '50%',
- transform: 'translate(-50%, -50%)',
- height: 150
- }}
- xmlns="http://www.w3.org/2000/svg"
- viewBox="0 0 32 32"
- width="32"
- height="32"
- fill="none"
- stroke="#bbbbbb22"
- strokeLinecap="round"
- strokeLinejoin="round"
- strokeWidth="2"
- >
- {props.isFile ? (
- <path d="M6 2 L6 30 26 30 26 10 18 2 Z M18 2 L18 10 26 10" />
- ) : (
- <path d="M2 26 L30 26 30 7 14 7 10 4 2 4 Z M30 12 L2 12" />
- )}
- </svg>
-);
+function EntryIcon(props: Props) {
+ return (
+ <svg
+ style={{
+ // marginTop: 25,
+ width: '60%',
+ position: 'absolute',
+ top: '50%',
+ left: '50%',
+ transform: 'translate(-50%, -50%)',
+ height: 150
+ }}
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 32 32"
+ width="32"
+ height="32"
+ fill="none"
+ stroke="#bbbbbb22"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="2"
+ >
+ {props.isFile ? (
+ <path d="M6 2 L6 30 26 30 26 10 18 2 Z M18 2 L18 10 26 10" />
+ ) : (
+ <path d="M2 26 L30 26 30 7 14 7 10 4 2 4 Z M30 12 L2 12" />
+ )}
+ </svg>
+ );
+}
export default EntryIcon;
diff --git a/app/components/EntryProperties.tsx b/app/components/EntryProperties.tsx
index d03f6eec9..4710de964 100644
--- a/app/components/EntryProperties.tsx
+++ b/app/components/EntryProperties.tsx
@@ -45,12 +45,7 @@ import {
withLeaflet
} from 'react-leaflet';
import { IconButton } from '@material-ui/core';
-import TagDropContainer from './TagDropContainer';
-import ColorPickerDialog from './dialogs/ColorPickerDialog';
-import MoveCopyFilesDialog from './dialogs/MoveCopyFilesDialog';
-import i18n from '../services/i18n';
-import { enhanceOpenedEntry, convertMarkDown } from '-/services/utils-io';
-import { formatFileSize, parseGeoLocation } from '-/utils/misc';
+import { formatFileSize } from '@tagspaces/tagspaces-platforms/misc';
import {
extractContainingDirectoryPath,
getThumbFileLocationForFile,
@@ -58,8 +53,14 @@ import {
extractFileName,
extractDirectoryName,
generateSharingLink
-} from '-/utils/paths';
-import AppConfig from '../config';
+} from '@tagspaces/tagspaces-platforms/paths';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
+import TagDropContainer from './TagDropContainer';
+import ColorPickerDialog from './dialogs/ColorPickerDialog';
+import MoveCopyFilesDialog from './dialogs/MoveCopyFilesDialog';
+import i18n from '../services/i18n';
+import { enhanceOpenedEntry, convertMarkDown } from '-/services/utils-io';
+import { parseGeoLocation } from '-/utils/geo';
import { Pro } from '../pro';
import PlatformIO from '../services/platform-facade';
import TagsSelect from './TagsSelect';
@@ -175,12 +176,12 @@ interface Props {
removeTags: (paths: Array<string>, tags: Array<TS.Tag>) => void;
removeAllTags: (paths: Array<string>) => void;
isReadOnlyMode: boolean;
- currentDirectoryPath: string | null;
+ // currentDirectoryPath: string | null;
tagDelimiter: string;
tileServer: TS.MapTileServer;
}
-const EntryProperties = (props: Props) => {
+function EntryProperties(props: Props) {
// const EntryProperties = React.memo((props: Props) => {
const fileNameRef = useRef<HTMLInputElement>(null);
const sharingLinkRef = useRef<HTMLInputElement>(null);
@@ -508,8 +509,6 @@ const EntryProperties = (props: Props) => {
let perspectiveDefault;
if (currentEntry.perspective) {
- perspectiveDefault = currentEntry.perspective;
- } else if (currentEntry.perspective) {
perspectiveDefault = currentEntry.perspective; // props.perspective;
} else {
perspectiveDefault = 'unspecified'; // perspectives.DEFAULT;
@@ -790,7 +789,7 @@ const EntryProperties = (props: Props) => {
</div>
<FormControl fullWidth={true} className={classes.formControl}>
{editDescription !== undefined ? (
- <React.Fragment>
+ <>
<TextField
multiline
inputRef={fileDescriptionRef}
@@ -822,7 +821,7 @@ const EntryProperties = (props: Props) => {
[Link text](http://...)
</span>
</Typography>
- </React.Fragment>
+ </>
) : (
<Typography
style={{
@@ -1221,7 +1220,7 @@ const EntryProperties = (props: Props) => {
className={classes.gridItem}
title={i18n.t('core:changeThumbnail')}
>
- {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events */}
+ {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/control-has-associated-label */}
<div
className={classes.header}
onClick={toggleThumbFilesDialog}
@@ -1261,7 +1260,7 @@ const EntryProperties = (props: Props) => {
)}
</div>
);
-};
+}
export default withLeaflet(
withStyles(styles, { withTheme: true })(EntryProperties)
diff --git a/app/components/FileView.tsx b/app/components/FileView.tsx
index 64dc875dc..ac6eda8ae 100644
--- a/app/components/FileView.tsx
+++ b/app/components/FileView.tsx
@@ -34,7 +34,7 @@ interface Props {
currentTheme: string;
}
-const FileView = (props: Props) => {
+function FileView(props: Props) {
const {
openedFile,
theme,
@@ -135,7 +135,7 @@ const FileView = (props: Props) => {
/>
</div>
);
-};
+}
const areEqual = (prevProp, nextProp) =>
nextProp.openedFile.path === prevProp.openedFile.path &&
diff --git a/app/components/FilesDragPreview.tsx b/app/components/FilesDragPreview.tsx
index bdabb4600..77a861783 100644
--- a/app/components/FilesDragPreview.tsx
+++ b/app/components/FilesDragPreview.tsx
@@ -7,7 +7,7 @@ export interface Props {
path: string;
}
-export const FilesDragPreview = (props: Props) => {
+export function FilesDragPreview(props: Props) {
const { entries, path } = props;
return (
<Chip
@@ -17,6 +17,6 @@ export const FilesDragPreview = (props: Props) => {
color="primary"
/>
);
-};
+}
const areEqual = (prevProp, nextProp) => nextProp.path === prevProp.path;
export default React.memo(FilesDragPreview, areEqual);
diff --git a/app/components/FolderContainer.tsx b/app/components/FolderContainer.tsx
index c256c1897..0c576d980 100644
--- a/app/components/FolderContainer.tsx
+++ b/app/components/FolderContainer.tsx
@@ -33,6 +33,7 @@ import Badge from '@material-ui/core/Badge';
import { withStyles } from '@material-ui/core/styles';
import ToggleButton from '@material-ui/lab/ToggleButton';
import ToggleButtonGroup from '@material-ui/lab/ToggleButtonGroup';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import LocationMenu from './menus/LocationMenu';
import i18n from '../services/i18n';
import {
@@ -58,7 +59,6 @@ import {
import TaggingActions from '../reducers/tagging-actions';
import LoadingLazy from '../components/LoadingLazy';
import { Pro } from '../pro';
-import AppConfig from '-/config';
import RenameEntryDialog from '-/components/dialogs/RenameEntryDialog';
import { TS } from '-/tagspaces.namespace';
import PathBreadcrumbs from './PathBreadcrumbs';
@@ -76,23 +76,27 @@ import MainSearchField from '-/components/MainSearchField';
const GridPerspective = React.lazy(() =>
import(
- /* webpackChunkName: "GridPerspective" */ '../perspectives/grid-perspective/'
+ /* webpackChunkName: "GridPerspective" */ '../perspectives/grid-perspective'
)
);
-const GridPerspectiveAsync = props => (
- <React.Suspense fallback={<LoadingLazy />}>
- <GridPerspective {...props} />
- </React.Suspense>
-);
+function GridPerspectiveAsync(props) {
+ return (
+ <React.Suspense fallback={<LoadingLazy />}>
+ <GridPerspective {...props} />
+ </React.Suspense>
+ );
+}
const ListPerspective = React.lazy(() =>
- import(/* webpackChunkName: "ListPerspective" */ '../perspectives/list/')
-);
-const ListPerspectiveAsync = props => (
- <React.Suspense fallback={<LoadingLazy />}>
- <ListPerspective {...props} />
- </React.Suspense>
+ import(/* webpackChunkName: "ListPerspective" */ '../perspectives/list')
);
+function ListPerspectiveAsync(props) {
+ return (
+ <React.Suspense fallback={<LoadingLazy />}>
+ <ListPerspective {...props} />
+ </React.Suspense>
+ );
+}
let GalleryPerspective = React.Fragment;
if (Pro && Pro.Perspectives && Pro.Perspectives.GalleryPerspective) {
@@ -100,22 +104,26 @@ if (Pro && Pro.Perspectives && Pro.Perspectives.GalleryPerspective) {
GalleryPerspective = Pro.Perspectives.GalleryPerspective;
}
-const GalleryPerspectiveAsync = props => (
- <React.Suspense fallback={<LoadingLazy />}>
- <GalleryPerspective {...props} />
- </React.Suspense>
-);
+function GalleryPerspectiveAsync(props) {
+ return (
+ <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;
}
-const MapiquePerspectiveAsync = props => (
- <React.Suspense fallback={<LoadingLazy />}>
- <MapiquePerspective {...props} />
- </React.Suspense>
-);
+function MapiquePerspectiveAsync(props) {
+ return (
+ <React.Suspense fallback={<LoadingLazy />}>
+ <MapiquePerspective {...props} />
+ </React.Suspense>
+ );
+}
/* let TreeVizPerspective = React.Fragment;
if (Pro && Pro.Perspectives && Pro.Perspectives.TreeVizPerspective) {
@@ -133,30 +141,36 @@ let KanBanPerspective = React.Fragment;
if (Pro && Pro.Perspectives && Pro.Perspectives.KanBanPerspective) {
KanBanPerspective = Pro.Perspectives.KanBanPerspective;
}
-const KanBanPerspectiveAsync = props => (
- <React.Suspense fallback={<LoadingLazy />}>
- <KanBanPerspective {...props} />
- </React.Suspense>
-);
+function KanBanPerspectiveAsync(props) {
+ return (
+ <React.Suspense fallback={<LoadingLazy />}>
+ <KanBanPerspective {...props} />
+ </React.Suspense>
+ );
+}
let WikiPerspective = React.Fragment;
if (Pro && Pro.Perspectives && Pro.Perspectives.WikiPerspective) {
WikiPerspective = Pro.Perspectives.WikiPerspective;
}
-const WikiPerspectiveAsync = props => (
- <React.Suspense fallback={<LoadingLazy />}>
- <WikiPerspective {...props} />
- </React.Suspense>
-);
+function WikiPerspectiveAsync(props) {
+ return (
+ <React.Suspense fallback={<LoadingLazy />}>
+ <WikiPerspective {...props} />
+ </React.Suspense>
+ );
+}
const WelcomePanel = React.lazy(() =>
import(/* webpackChunkName: "WelcomePanel" */ './WelcomePanel')
);
-const WelcomePanelAsync = props => (
- <React.Suspense fallback={<LoadingLazy />}>
- <WelcomePanel {...props} />
- </React.Suspense>
-);
+function WelcomePanelAsync(props) {
+ return (
+ <React.Suspense fallback={<LoadingLazy />}>
+ <WelcomePanel {...props} />
+ </React.Suspense>
+ );
+}
const CounterBadge: any = withStyles(theme => ({
badge: {
@@ -232,7 +246,7 @@ interface Props {
keyBindings: Array<any>;
}
-const FolderContainer = (props: Props) => {
+function FolderContainer(props: Props) {
useEffect(() => {
setSearchVisible(false);
}, [props.currentDirectoryPath]);
@@ -311,11 +325,7 @@ const FolderContainer = (props: Props) => {
const renderPerspective = () => {
if (showWelcomePanel) {
- return AppConfig.showWelcomePanel ? (
- <WelcomePanelAsync />
- ) : (
- <React.Fragment />
- );
+ return AppConfig.showWelcomePanel ? <WelcomePanelAsync /> : <></>;
}
if (currentPerspective === PerspectiveIDs.LIST) {
return (
@@ -722,7 +732,7 @@ const FolderContainer = (props: Props) => {
)}
</div>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/components/HelpFeedbackPanel.tsx b/app/components/HelpFeedbackPanel.tsx
index 8911b6d79..ad0ba286f 100644
--- a/app/components/HelpFeedbackPanel.tsx
+++ b/app/components/HelpFeedbackPanel.tsx
@@ -33,15 +33,14 @@ import EmailIcon from '@material-ui/icons/Email';
import IssueIcon from '@material-ui/icons/BugReport';
import TranslationIcon from '@material-ui/icons/Translate';
import NewFeatureIcon from '@material-ui/icons/Gesture';
-import SocialIcon from '@material-ui/icons/ThumbUp';
+// import SocialIcon from '@material-ui/icons/ThumbUp';
import TwitterIcon from '@material-ui/icons/Twitter';
import KeyShortcutsIcon from '@material-ui/icons/Keyboard';
import ProTeaserIcon from '@material-ui/icons/FlightTakeoff';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import styles from './SidePanels.css';
import i18n from '../services/i18n';
-import { Pro } from '-/pro';
import Links from '-/links';
-import AppConfig from '-/config';
interface Props {
classes?: any;
@@ -55,7 +54,7 @@ interface Props {
reduceHeightBy?: number;
}
-const HelpFeedbackPanel = (props: Props) => {
+function HelpFeedbackPanel(props: Props) {
const {
classes,
openURLExternally,
@@ -235,6 +234,6 @@ const HelpFeedbackPanel = (props: Props) => {
</List>
</div>
);
-};
+}
export default withStyles(styles, { withTheme: true })(HelpFeedbackPanel);
diff --git a/app/components/HelperComponents.tsx b/app/components/HelperComponents.tsx
index 6539a3247..a8a8722f2 100644
--- a/app/components/HelperComponents.tsx
+++ b/app/components/HelperComponents.tsx
@@ -22,30 +22,35 @@ import Typography from '@material-ui/core/Typography';
import i18n from '../services/i18n';
import { Pro } from '-/pro';
-export const BetaLabel = () => (
- <Tooltip arrow placement="top" title={i18n.t('featureInBetaStatus')}>
- <Typography style={{ display: 'initial' }}>
- <sup style={{ marginLeft: 5, textTransform: 'uppercase' }}>
- {i18n.t('betaStatus')}
- </sup>
- </Typography>
- </Tooltip>
-);
-
-export const ProLabel = () =>
- !Pro && (
- <Tooltip
- arrow
- placement="top"
- title={i18n.t('thisFunctionalityIsAvailableInPro')}
- >
+export function BetaLabel() {
+ return (
+ <Tooltip arrow placement="top" title={i18n.t('featureInBetaStatus')}>
<Typography style={{ display: 'initial' }}>
- <sup style={{ marginLeft: 5 }}>PRO</sup>
+ <sup style={{ marginLeft: 5, textTransform: 'uppercase' }}>
+ {i18n.t('betaStatus')}
+ </sup>
</Typography>
</Tooltip>
);
+}
+
+export function ProLabel() {
+ return (
+ !Pro && (
+ <Tooltip
+ arrow
+ placement="top"
+ title={i18n.t('thisFunctionalityIsAvailableInPro')}
+ >
+ <Typography style={{ display: 'initial' }}>
+ <sup style={{ marginLeft: 5 }}>PRO</sup>
+ </Typography>
+ </Tooltip>
+ )
+ );
+}
-export const ProTooltip = props => {
+export function ProTooltip(props) {
const { tooltip } = props;
const proTooltip = tooltip && tooltip;
const noProTooltip = tooltip
@@ -56,4 +61,4 @@ export const ProTooltip = props => {
<span {...props} />
</Tooltip>
);
-};
+}
diff --git a/app/components/InfoIcon.tsx b/app/components/InfoIcon.tsx
index bf3d14cc1..f0da4c577 100644
--- a/app/components/InfoIcon.tsx
+++ b/app/components/InfoIcon.tsx
@@ -25,7 +25,7 @@ interface Props {
tooltip?: string;
}
-const InfoIcon = (props: Props) => {
+function InfoIcon(props: Props) {
const { tooltip } = props;
return (
<Tooltip arrow title={tooltip}>
@@ -34,6 +34,6 @@ const InfoIcon = (props: Props) => {
</IconButton>
</Tooltip>
);
-};
+}
export default InfoIcon;
diff --git a/app/components/LoadingLazy.tsx b/app/components/LoadingLazy.tsx
index e420aaae9..c3c72cf36 100644
--- a/app/components/LoadingLazy.tsx
+++ b/app/components/LoadingLazy.tsx
@@ -21,7 +21,11 @@ import React from 'react';
// {i18n.t('core:loading')}
// <div style={{ padding: 10, backgroundColor: 'transparent' }}>...</div>
-const LoadingLazy = () => (
- <div style={{ width: 1, height: 1, backgroundColor: 'transparent' }}>...</div>
-);
+function LoadingLazy() {
+ return (
+ <div style={{ width: 1, height: 1, backgroundColor: 'transparent' }}>
+ ...
+ </div>
+ );
+}
export default LoadingLazy;
diff --git a/app/components/LoadingScreen.tsx b/app/components/LoadingScreen.tsx
index 9a4437f37..4a3a68472 100644
--- a/app/components/LoadingScreen.tsx
+++ b/app/components/LoadingScreen.tsx
@@ -1,5 +1,7 @@
import React from 'react';
-const LoadingScreen = () => <div id="loadingLogo">Loading ...</div>;
+function LoadingScreen() {
+ return <div id="loadingLogo">Loading ...</div>;
+}
export default LoadingScreen;
diff --git a/app/components/LocationManager.tsx b/app/components/LocationManager.tsx
index f8f080c34..0766b0d17 100644
--- a/app/components/LocationManager.tsx
+++ b/app/components/LocationManager.tsx
@@ -22,6 +22,7 @@ import { connect } from 'react-redux';
import { withStyles } from '@material-ui/core/styles';
import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
import { List } from '@material-ui/core';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import styles from './SidePanels.css';
import LocationManagerMenu from './menus/LocationManagerMenu';
import ConfirmDialog from './dialogs/ConfirmDialog';
@@ -35,7 +36,6 @@ import {
isDesktopMode
} from '-/reducers/settings';
import i18n from '../services/i18n';
-import AppConfig from '../config';
import LoadingLazy from '-/components/LoadingLazy';
import LocationView from '-/components/LocationView';
import { Pro } from '-/pro';
@@ -47,11 +47,13 @@ const CreateEditLocationDialog = React.lazy(() =>
/* webpackChunkName: "CreateEditLocationDialog" */ './dialogs/CreateEditLocationDialog'
)
);
-const CreateEditLocationDialogAsync = props => (
- <React.Suspense fallback={<LoadingLazy />}>
- <CreateEditLocationDialog {...props} />
- </React.Suspense>
-);
+function CreateEditLocationDialogAsync(props) {
+ return (
+ <React.Suspense fallback={<LoadingLazy />}>
+ <CreateEditLocationDialog {...props} />
+ </React.Suspense>
+ );
+}
interface Props {
classes?: any;
@@ -80,7 +82,7 @@ type SubFolder = {
children?: Array<SubFolder>;
};
-const LocationManager = (props: Props) => {
+function LocationManager(props: Props) {
const fileInputRef = useRef<HTMLInputElement>(null);
const [selectedLocation, setSelectedLocation] = useState<TS.Location>(null);
const [isEditLocationDialogOpened, setEditLocationDialogOpened] = useState<
@@ -146,7 +148,7 @@ const LocationManager = (props: Props) => {
// backdropFilter: 'blur(2px)',
// backgroundColor: '#fafafaAA' // red: '#eb585882' '#d9d9d980'
}}
- ></div>
+ />
)}
<LocationManagerMenu
importLocations={() => {
@@ -269,7 +271,7 @@ const LocationManager = (props: Props) => {
)}
</div>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/components/LocationView.tsx b/app/components/LocationView.tsx
index 2a1365b2a..97465eabe 100644
--- a/app/components/LocationView.tsx
+++ b/app/components/LocationView.tsx
@@ -31,6 +31,8 @@ import LocationIcon from '@material-ui/icons/WorkOutline';
import CloudLocationIcon from '@material-ui/icons/CloudQueue';
import DefaultLocationIcon from '@material-ui/icons/Highlight';
import { Progress } from 'aws-sdk/clients/s3';
+import { locationType } from '@tagspaces/tagspaces-platforms/misc';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import styles from './SidePanels.css';
import {
actions as AppActions,
@@ -38,7 +40,6 @@ import {
isReadOnlyMode
} from '../reducers/app';
import i18n from '../services/i18n';
-import AppConfig from '../config';
import PlatformIO from '../services/platform-facade';
import TargetMoveFileBox from './TargetMoveFileBox';
import DragItemTypes from './DragItemTypes';
@@ -48,9 +49,7 @@ import DirectoryTreeView, {
} from '-/components/DirectoryTreeView';
import { getShowUnixHiddenEntries } from '-/reducers/settings';
import LocationContextMenu from '-/components/menus/LocationContextMenu';
-import { getLocationPath } from '-/utils/paths';
import { TS } from '-/tagspaces.namespace';
-import { locationType } from '-/utils/misc';
interface Props {
classes: any;
@@ -88,7 +87,7 @@ interface Props {
changeLocation: (loc: TS.Location) => void;
}
-const LocationView = (props: Props) => {
+function LocationView(props: Props) {
const directoryTreeRef = useRef<DirectoryTreeViewRef>(null);
const [
locationDirectoryContextMenuAnchorEl,
@@ -109,7 +108,7 @@ const LocationView = (props: Props) => {
const handleLocationClick = () => {
if (location.uuid === props.currentLocationId) {
// the same location click
- props.loadDirectoryContent(getLocationPath(location), true); // false);
+ props.loadDirectoryContent(PlatformIO.getLocationPath(location), true); // false);
} else {
// this.directoryTreeRef[location.uuid].loadSubDir(location, 1);
props.setSelectedEntries([]);
@@ -213,7 +212,7 @@ const LocationView = (props: Props) => {
}
};
- let locationNameTitle = getLocationPath(location);
+ let locationNameTitle = PlatformIO.getLocationPath(location);
if (isCloudLocation && location.bucketName) {
if (location.endpointURL) {
locationNameTitle = location.endpointURL + ' - ' + location.bucketName;
@@ -311,7 +310,7 @@ const LocationView = (props: Props) => {
<TargetMoveFileBox
accepts={[DragItemTypes.FILE]}
onDrop={handleFileMoveDrop}
- path={getLocationPath(location)}
+ path={PlatformIO.getLocationPath(location)}
location={location}
>
{LocationTitle}
@@ -347,7 +346,7 @@ const LocationView = (props: Props) => {
/>
</>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/components/MobileNavigation.tsx b/app/components/MobileNavigation.tsx
index 4be119fff..7e8bf06da 100644
--- a/app/components/MobileNavigation.tsx
+++ b/app/components/MobileNavigation.tsx
@@ -41,6 +41,7 @@ import CardActions from '@material-ui/core/CardActions';
import CardContent from '@material-ui/core/CardContent';
import { CognitoUserInterface } from '@aws-amplify/ui-components';
import CloseIcon from '@material-ui/icons/Close';
+import Popover from '@material-ui/core/Popover';
import ProTeaser from '../assets/images/spacerocket_undraw.svg';
import ProTeaserImage from '-/assets/images/pro-teaser.svg';
import ProTextLogo from '../assets/images/text-logo-pro.svg';
@@ -64,7 +65,6 @@ import LoadingLazy from './LoadingLazy';
import { actions as SettingsActions, isFirstRun } from '../reducers/settings';
import Links from '-/links';
import StoredSearches from '-/components/StoredSearches';
-import Popover from '@material-ui/core/Popover';
import UserDetailsPopover from '-/components/UserDetailsPopover';
const styles: any = (theme: any) => ({
@@ -76,11 +76,13 @@ const styles: any = (theme: any) => ({
const ProTeaserDialog = React.lazy(() =>
import(/* webpackChunkName: "ProTeaserDialog" */ './dialogs/ProTeaserDialog')
);
-const ProTeaserDialogAsync = props => (
- <React.Suspense fallback={<LoadingLazy />}>
- <ProTeaserDialog {...props} />
- </React.Suspense>
-);
+function ProTeaserDialogAsync(props) {
+ return (
+ <React.Suspense fallback={<LoadingLazy />}>
+ <ProTeaserDialog {...props} />
+ </React.Suspense>
+ );
+}
interface Props {
classes: any;
@@ -113,7 +115,7 @@ interface Props {
theme: any;
}
-const MobileNavigation = (props: Props) => {
+function MobileNavigation(props: Props) {
const [isProTeaserVisible, setIsProTeaserVisible] = useState<boolean>(false);
const [showTeaserBanner, setShowTeaserBanner] = useState<boolean>(true);
const [anchorUser, setAnchorUser] = useState<HTMLButtonElement | null>(null);
@@ -414,7 +416,7 @@ const MobileNavigation = (props: Props) => {
</div>
</div>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/components/NoTileServer.tsx b/app/components/NoTileServer.tsx
index 1d438c733..be651d8f4 100644
--- a/app/components/NoTileServer.tsx
+++ b/app/components/NoTileServer.tsx
@@ -1,11 +1,13 @@
import React from 'react';
import i18n from '-/services/i18n';
-const NoTileServer = () => (
- <div style={{ textAlign: 'center' }}>
- <h1>{i18n.t('core:noTileServersTitle')}</h1>
- <h3>{i18n.t('core:addTileServersSettings')}</h3>
- </div>
-);
+function NoTileServer() {
+ return (
+ <div style={{ textAlign: 'center' }}>
+ <h1>{i18n.t('core:noTileServersTitle')}</h1>
+ <h3>{i18n.t('core:addTileServersSettings')}</h3>
+ </div>
+ );
+}
export default NoTileServer;
diff --git a/app/components/PathBreadcrumbs.tsx b/app/components/PathBreadcrumbs.tsx
index 658c95885..3bb018e43 100644
--- a/app/components/PathBreadcrumbs.tsx
+++ b/app/components/PathBreadcrumbs.tsx
@@ -23,7 +23,7 @@ import Tooltip from '@material-ui/core/Tooltip';
import Chip from '@material-ui/core/Chip';
import ExpandMoreIcon from '@material-ui/icons/MoreVert';
import PlatformIO from '../services/platform-facade';
-import { normalizePath, extractShortDirectoryName } from '-/utils/paths';
+import { normalizePath, extractShortDirectoryName } from '@tagspaces/tagspaces-platforms/paths';
import i18n from '../services/i18n';
import DirectoryMenu from './menus/DirectoryMenu';
import { TS } from '-/tagspaces.namespace';
@@ -202,7 +202,7 @@ export default function PathBreadcrumbs(props: Props) {
'/'
)}
deleteIcon={<ExpandMoreIcon />}
- //onClick={handleClick}
+ // onClick={handleClick}
onDelete={openDirectoryMenu}
onClick={openDirectoryMenu}
onContextMenu={openDirectoryMenu}
diff --git a/app/components/PerspectiveManager.tsx b/app/components/PerspectiveManager.tsx
index ca4412b76..6e83d235a 100644
--- a/app/components/PerspectiveManager.tsx
+++ b/app/components/PerspectiveManager.tsx
@@ -26,7 +26,7 @@ interface Props {
style: any;
}
-const PerspectiveManager = (props: Props) => {
+function PerspectiveManager(props: Props) {
const { classes } = props;
return (
@@ -35,6 +35,6 @@ const PerspectiveManager = (props: Props) => {
</div>
);
// <Button onClick={() => history.push('/login')}>Login</Button>
-};
+}
export default withStyles(styles)(PerspectiveManager);
diff --git a/app/components/PerspectiveSelector.tsx b/app/components/PerspectiveSelector.tsx
index ac417df2f..cdb6ded5a 100644
--- a/app/components/PerspectiveSelector.tsx
+++ b/app/components/PerspectiveSelector.tsx
@@ -27,7 +27,7 @@ import { AvailablePerspectives, PerspectiveIDs } from '-/perspectives';
import i18n from '../services/i18n';
import { Pro } from '-/pro';
-const PerspectiveSelector = props => {
+function PerspectiveSelector(props) {
const { defaultValue, onChange, testId } = props;
const perspectiveSelectorMenuItems = [];
@@ -78,6 +78,6 @@ const PerspectiveSelector = props => {
{perspectiveSelectorMenuItems}
</Select>
);
-};
+}
export default PerspectiveSelector;
diff --git a/app/components/SearchInline.css.tsx b/app/components/SearchInline.css.tsx
index e750af96d..e1d82ddd4 100644
--- a/app/components/SearchInline.css.tsx
+++ b/app/components/SearchInline.css.tsx
@@ -16,7 +16,7 @@
*
*/
import { BaseCSSProperties } from '@material-ui/core/styles/withStyles';
-import AppConfig from '-/config';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
export interface StyleProps {
panel: BaseCSSProperties;
diff --git a/app/components/SearchInline.tsx b/app/components/SearchInline.tsx
index b3ac83f4e..cbc1a17a4 100644
--- a/app/components/SearchInline.tsx
+++ b/app/components/SearchInline.tsx
@@ -27,6 +27,11 @@ import Tooltip from '@material-ui/core/Tooltip';
import IconButton from '@material-ui/core/IconButton';
import InputAdornment from '@material-ui/core/InputAdornment';
import Typography from '@material-ui/core/Typography';
+import {
+ escapeRegExp,
+ parseTextQuery,
+ removeAllTagsFromSearchQuery
+} from '@tagspaces/tagspaces-platforms/misc';
import { actions as AppActions, getDirectoryPath } from '../reducers/app';
import {
actions as LocationIndexActions,
@@ -43,11 +48,6 @@ import i18n from '-/services/i18n';
import { FileTypeGroups } from '-/services/search';
import { TS } from '-/tagspaces.namespace';
import { Pro } from '../pro';
-import {
- escapeRegExp,
- parseTextQuery,
- removeAllTagsFromSearchQuery
-} from '-/utils/misc';
import useFirstRender from '-/utils/useFirstRender';
import MainSearchField from '-/components/MainSearchField';
@@ -297,48 +297,50 @@ function SearchInline(props: Props) {
};
const classes = useStyles();
- const HelpTooltip = hClasses => (
- <Tooltip
- arrow
- classes={{ tooltip: hClasses.customWidth }}
- interactive
- title={
- <span style={{ fontSize: 14 }}>
- The search query consists of a tag part and a search term. This term
- is optional and can be a single word. The tag part can have one or
- more tags preceded by the following symbols:
- <ul>
- <li>
- + will add only entries having this tag in the search results
- (logical AND)
- </li>
- <li>
- | will include all entries having this tag in the search results
- (logical OR)
- </li>
- <li>
- - will exclude entries having this tags from the search results
- </li>
- </ul>
- Example queries:
- <ul>
- <li>
- "italy +beach -sunset" - will find all files and folders having
- italy in their name and the tag beach but not sunset
- </li>
- <li>
- "|beach |sunset" - will find all files and folder having the tags
- beach or sunset
- </li>
- </ul>
- </span>
- }
- >
- <IconButton size="small" edge="end">
- <HelpOutlineIcon style={{ color: 'lightgray' }} />
- </IconButton>
- </Tooltip>
- );
+ function HelpTooltip(hClasses) {
+ return (
+ <Tooltip
+ arrow
+ classes={{ tooltip: hClasses.customWidth }}
+ interactive
+ title={
+ <span style={{ fontSize: 14 }}>
+ The search query consists of a tag part and a search term. This term
+ is optional and can be a single word. The tag part can have one or
+ more tags preceded by the following symbols:
+ <ul>
+ <li>
+ + will add only entries having this tag in the search results
+ (logical AND)
+ </li>
+ <li>
+ | will include all entries having this tag in the search results
+ (logical OR)
+ </li>
+ <li>
+ - will exclude entries having this tags from the search results
+ </li>
+ </ul>
+ Example queries:
+ <ul>
+ <li>
+ "italy +beach -sunset" - will find all files and folders having
+ italy in their name and the tag beach but not sunset
+ </li>
+ <li>
+ "|beach |sunset" - will find all files and folder having the
+ tags beach or sunset
+ </li>
+ </ul>
+ </span>
+ }
+ >
+ <IconButton size="small" edge="end">
+ <HelpOutlineIcon style={{ color: 'lightgray' }} />
+ </IconButton>
+ </Tooltip>
+ );
+ }
const executeSearch = () => {
let query = textQuery.current;
diff --git a/app/components/SearchPopover.tsx b/app/components/SearchPopover.tsx
index a008d3796..58c0d214f 100644
--- a/app/components/SearchPopover.tsx
+++ b/app/components/SearchPopover.tsx
@@ -49,6 +49,9 @@ import FormControl from '@material-ui/core/FormControl';
import ButtonGroup from '@material-ui/core/ButtonGroup';
import ToggleButton from '@material-ui/lab/ToggleButton';
import ToggleButtonGroup from '@material-ui/lab/ToggleButtonGroup';
+import { mergeWithExtractedTags } from '@tagspaces/tagspaces-platforms/misc';
+import HelpIcon from '@material-ui/icons/Help';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import TagsSelect from './TagsSelect';
import { actions as AppActions, getDirectoryPath } from '../reducers/app';
import {
@@ -66,16 +69,10 @@ import i18n from '../services/i18n';
import { FileTypeGroups } from '-/services/search';
import { Pro } from '../pro';
import { formatDateTime, extractTimePeriod } from '-/utils/dates';
-import {
- mergeWithExtractedTags,
- parseGeoLocation,
- parseLatLon
-} from '-/utils/misc';
-import AppConfig from '-/config';
+import { parseGeoLocation, parseLatLon } from '-/utils/geo';
import { getSearches } from '-/reducers/searches';
import { TS } from '-/tagspaces.namespace';
import { ProLabel, BetaLabel, ProTooltip } from '-/components/HelperComponents';
-import HelpIcon from '@material-ui/icons/Help';
import Links from '-/links';
const SaveSearchDialog = Pro && Pro.UI ? Pro.UI.SaveSearchDialog : false;
@@ -107,7 +104,7 @@ interface Props {
const useStyles = makeStyles<Theme, StyleProps>(styles);
-const SearchPopover = (props: Props) => {
+function SearchPopover(props: Props) {
// @ts-ignore
const classes: PropsClasses = useStyles({} as StyleProps);
const [, forceUpdate] = useReducer(x => x + 1, 0);
@@ -155,7 +152,7 @@ const SearchPopover = (props: Props) => {
useEffect(() => {
textQuery.current = props.searchQuery.textQuery;
- /*if (props.searchQuery.fileTypes) {
+ /* if (props.searchQuery.fileTypes) {
fileTypes.current = props.searchQuery.fileTypes;
}
if (props.searchQuery.searchBoxing) {
@@ -178,7 +175,7 @@ const SearchPopover = (props: Props) => {
}
if (props.searchQuery.fileSize) {
fileSize.current = props.searchQuery.fileSize;
- }*/
+ } */
}, [props.searchQuery]);
const handleFileTypeChange = (event: React.ChangeEvent<HTMLInputElement>) => {
@@ -427,7 +424,7 @@ const SearchPopover = (props: Props) => {
props.onClose();
};
- const saveSearch = (isNew: boolean = true) => {
+ const saveSearch = (isNew = true) => {
const tagsAND = mergeWithExtractedTags(
textQuery.current,
props.searchQuery.tagsAND,
@@ -1028,7 +1025,7 @@ const SearchPopover = (props: Props) => {
</div>
</div>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/components/SidePanels.css.tsx b/app/components/SidePanels.css.tsx
index b0b2028b8..70b405070 100644
--- a/app/components/SidePanels.css.tsx
+++ b/app/components/SidePanels.css.tsx
@@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
-import AppConfig from '../config';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
export default (theme: any) =>
({
diff --git a/app/components/SplitButton.tsx b/app/components/SplitButton.tsx
index d50e0a64e..5b2803311 100644
--- a/app/components/SplitButton.tsx
+++ b/app/components/SplitButton.tsx
@@ -94,7 +94,7 @@ export default function SplitButton(props: Props) {
}}
>
<Paper>
- {/*<ClickAwayListener onClickAway={handleClose}>*/}
+ {/* <ClickAwayListener onClickAway={handleClose}> */}
<MenuList id="split-button-menu">
{options.map((option, index) => (
<MenuItem
@@ -107,7 +107,7 @@ export default function SplitButton(props: Props) {
</MenuItem>
))}
</MenuList>
- {/*</ClickAwayListener>*/}
+ {/* </ClickAwayListener> */}
</Paper>
</Grow>
)}
diff --git a/app/components/StoredSearches.tsx b/app/components/StoredSearches.tsx
index e122ead71..eaac4b3b6 100644
--- a/app/components/StoredSearches.tsx
+++ b/app/components/StoredSearches.tsx
@@ -28,6 +28,7 @@ import SearchIcon from '@material-ui/icons/Search';
import ArrowDownIcon from '@material-ui/icons/KeyboardArrowDown';
import ArrowRightIcon from '@material-ui/icons/KeyboardArrowRight';
import Typography from '@material-ui/core/Typography';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import {
actions as LocationIndexActions,
getSearchQuery
@@ -39,7 +40,6 @@ import { actions as SearchActions, getSearches } from '-/reducers/searches';
import { TS } from '-/tagspaces.namespace';
import SearchMenu from '-/components/menus/SearchMenu';
import { actions as AppActions } from '-/reducers/app';
-import AppConfig from '-/config';
interface Props {
style?: any;
@@ -56,7 +56,7 @@ interface Props {
const SaveSearchDialog = Pro && Pro.UI ? Pro.UI.SaveSearchDialog : false;
-const StoredSearches = (props: Props) => {
+function StoredSearches(props: Props) {
const [saveSearchDialogOpened, setSaveSearchDialogOpened] = useState<
TS.SearchQuery
>(undefined);
@@ -276,7 +276,7 @@ const StoredSearches = (props: Props) => {
)}
</div>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/components/TagContainer.tsx b/app/components/TagContainer.tsx
index c4233a073..ef5a0b559 100644
--- a/app/components/TagContainer.tsx
+++ b/app/components/TagContainer.tsx
@@ -23,9 +23,10 @@ import MoreVertIcon from '@material-ui/icons/MoreVert';
import PlaceIcon from '@material-ui/icons/Place';
import DateIcon from '@material-ui/icons/DateRange';
import RemoveTagIcon from '@material-ui/icons/Close';
+import { formatDateTime } from '@tagspaces/tagspaces-platforms/misc';
import { getAllTags, getTagColors } from '-/reducers/taglibrary';
import { getTagColor, getTagTextColor } from '-/reducers/settings';
-import { isGeoTag, formatDateTime } from '-/utils/misc';
+import { isGeoTag } from '-/utils/geo';
import { isDateTimeTag, convertToDateTime, convertToDate } from '-/utils/dates';
import { TS } from '-/tagspaces.namespace';
@@ -52,7 +53,7 @@ interface Props {
reorderTags?: boolean;
}
-const TagContainer = (props: Props) => {
+function TagContainer(props: Props) {
const {
tag,
deleteIcon,
@@ -241,7 +242,7 @@ const TagContainer = (props: Props) => {
</Button>
</div>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/components/TagContainerDnd.tsx b/app/components/TagContainerDnd.tsx
index 37b094745..5be12fac3 100644
--- a/app/components/TagContainerDnd.tsx
+++ b/app/components/TagContainerDnd.tsx
@@ -26,12 +26,12 @@ import {
} from 'react-dnd';
import { getEmptyImage } from 'react-dnd-html5-backend';
+import { extractTags } from '@tagspaces/tagspaces-platforms/paths';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import DragItemTypes from './DragItemTypes';
import TagContainer from './TagContainer';
import { TS } from '-/tagspaces.namespace';
-import { extractTags } from '-/utils/paths';
import PlatformIO from '-/services/platform-facade';
-import AppConfig from '-/config';
const boxSource = {
// Expected the drag source specification to only have some of the following keys: canDrag, beginDrag, isDragging, endDrag
diff --git a/app/components/TagDragPreview.tsx b/app/components/TagDragPreview.tsx
index 31b9acff1..bc0366f9e 100644
--- a/app/components/TagDragPreview.tsx
+++ b/app/components/TagDragPreview.tsx
@@ -6,10 +6,10 @@ export interface Props {
tag: TS.Tag;
}
-const TagDragPreview = (props: Props) => {
+function TagDragPreview(props: Props) {
const { tag } = props;
return <TagContainer tag={tag} isDragging={true} />;
-};
+}
const areEqual = (prevProp, nextProp) =>
nextProp.tag.title === prevProp.tag.title;
export default React.memo(TagDragPreview, areEqual);
diff --git a/app/components/TagDropContainer.tsx b/app/components/TagDropContainer.tsx
index e84eade9c..cd147fd11 100644
--- a/app/components/TagDropContainer.tsx
+++ b/app/components/TagDropContainer.tsx
@@ -33,7 +33,7 @@ interface DragItem {
tag: TS.Tag;
}
-const TagDropContainer = (props: Props) => {
+function TagDropContainer(props: Props) {
const ref = useRef<HTMLDivElement>(null);
const [collectedProps, drop] = useDrop({
@@ -81,6 +81,6 @@ const TagDropContainer = (props: Props) => {
{props.children}
</div>
);
-};
+}
export default TagDropContainer;
diff --git a/app/components/TagGroupContainer.tsx b/app/components/TagGroupContainer.tsx
index f90204277..7d44cbd74 100644
--- a/app/components/TagGroupContainer.tsx
+++ b/app/components/TagGroupContainer.tsx
@@ -26,7 +26,7 @@ interface Props {
taggroup: TS.TagGroup;
}
-const TagGroupContainer = (props: Props) => {
+function TagGroupContainer(props: Props) {
const ref = useRef<HTMLDivElement>(null);
const [collectedProps, drop] = useDrop({
@@ -76,6 +76,6 @@ const TagGroupContainer = (props: Props) => {
{props.children}
</div>
);
-};
+}
export default TagGroupContainer;
diff --git a/app/components/TagGroupTitleDnD.tsx b/app/components/TagGroupTitleDnD.tsx
index 1557c56fe..e366e8540 100644
--- a/app/components/TagGroupTitleDnD.tsx
+++ b/app/components/TagGroupTitleDnD.tsx
@@ -49,7 +49,7 @@ interface Props {
connectDropTarget: ConnectDropTarget;
}
-const TagGroupTitleDnD = (props: Props) => {
+function TagGroupTitleDnD(props: Props) {
const handleTagGroupTitleClick = (event: Object, tagGroup) => {
props.toggleTagGroup(tagGroup.uuid);
};
@@ -147,7 +147,7 @@ const TagGroupTitleDnD = (props: Props) => {
return tagGroupTitle;
}
return connectDropTarget(connectDragSource(tagGroupTitle));
-};
+}
const boxSource = {
beginDrag(props) {
diff --git a/app/components/TagLibrary.tsx b/app/components/TagLibrary.tsx
index d63b2fcb0..ada46e6e2 100644
--- a/app/components/TagLibrary.tsx
+++ b/app/components/TagLibrary.tsx
@@ -25,6 +25,7 @@ import Typography from '@material-ui/core/Typography';
import IconButton from '@material-ui/core/IconButton';
import Collapse from '@material-ui/core/Collapse';
import MoreVertIcon from '@material-ui/icons/MoreVert';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import TagContainerDnd from './TagContainerDnd';
import TagContainer from './TagContainer';
import ConfirmDialog from './dialogs/ConfirmDialog';
@@ -54,7 +55,6 @@ import {
isReadOnlyMode
} from '../reducers/app';
import SmartTags from '../reducers/smart-tags';
-import AppConfig from '-/config';
import EditTagDialog from '-/components/dialogs/EditTagDialog';
import { TS } from '-/tagspaces.namespace';
import { getLocations } from '-/reducers/locations';
@@ -103,7 +103,7 @@ interface Props {
reduceHeightBy: number;
}
-const TagLibrary = (props: Props) => {
+function TagLibrary(props: Props) {
const tagContainerRef = useRef<HTMLSpanElement>(null);
const [
tagGroupMenuAnchorEl,
@@ -465,7 +465,7 @@ const TagLibrary = (props: Props) => {
</div>
</div>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/components/TagsPreview.tsx b/app/components/TagsPreview.tsx
index 6d3553bd6..7cbc329c1 100644
--- a/app/components/TagsPreview.tsx
+++ b/app/components/TagsPreview.tsx
@@ -31,7 +31,7 @@ interface Props {
defaultBackgroundColor?: string;
}
-const TagsPreview = (props: Props) => {
+function TagsPreview(props: Props) {
const { tags, allTags, defaultBackgroundColor, defaultTextColor } = props;
if (!tags || tags.length < 1) {
return <></>;
@@ -75,7 +75,7 @@ const TagsPreview = (props: Props) => {
</span>
</Tooltip>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/components/TagsSelect.tsx b/app/components/TagsSelect.tsx
index fe8065539..6eeb072d1 100644
--- a/app/components/TagsSelect.tsx
+++ b/app/components/TagsSelect.tsx
@@ -84,7 +84,7 @@ interface Props {
// removeTags: (paths: Array<string>, tags: Array<Tag>) => void;
}
-const TagsSelect = (props: Props) => {
+function TagsSelect(props: Props) {
const [tagMenuAnchorEl, setTagMenuAnchorEl] = useState<null | HTMLElement>(
null
);
@@ -229,7 +229,7 @@ const TagsSelect = (props: Props) => {
)}
</div>
);
-};
+}
const mapStateToProps = state => ({
allTags: getAllTags(state),
diff --git a/app/components/TransparentBackground.tsx b/app/components/TransparentBackground.tsx
index 8d763d4f1..d1347005a 100644
--- a/app/components/TransparentBackground.tsx
+++ b/app/components/TransparentBackground.tsx
@@ -21,15 +21,17 @@ interface Props {
children: Object;
}
-const TransparentBackground = (props: Props) => (
- <span
- style={{
- background:
- 'url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==")'
- }}
- >
- {props.children}
- </span>
-);
+function TransparentBackground(props: Props) {
+ return (
+ <span
+ style={{
+ background:
+ 'url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==")'
+ }}
+ >
+ {props.children}
+ </span>
+ );
+}
export default TransparentBackground;
diff --git a/app/components/UserDetailsPopover.tsx b/app/components/UserDetailsPopover.tsx
index 791ced06c..cf7d0cccc 100644
--- a/app/components/UserDetailsPopover.tsx
+++ b/app/components/UserDetailsPopover.tsx
@@ -29,12 +29,11 @@ import Button from '@material-ui/core/Button';
import Auth from '@aws-amplify/auth';
import ExitToAppIcon from '@material-ui/icons/ExitToApp';
import { withStyles } from '@material-ui/core/styles';
-import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
+import { clearAllURLParams } from '-/utils/dom';
import i18n from '-/services/i18n';
import styles from '-/components/SidePanels.css';
import { Pro } from '-/pro';
-import { clearAllURLParams } from '-/utils/misc';
interface Props {
classes?: any;
@@ -44,7 +43,7 @@ interface Props {
onClose: () => void;
}
-const UserDetailsPopover = (props: Props) => {
+function UserDetailsPopover(props: Props) {
const [isSetupTOTPOpened, setSetupTOTPOpened] = useState<boolean>(false);
const SetupTOTPDialog = Pro && Pro.UI ? Pro.UI.SetupTOTPDialog : false;
@@ -190,7 +189,7 @@ const UserDetailsPopover = (props: Props) => {
</Box>
</div>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/components/WelcomePanel.tsx b/app/components/WelcomePanel.tsx
index a73206fbb..aa080ea7f 100644
--- a/app/components/WelcomePanel.tsx
+++ b/app/components/WelcomePanel.tsx
@@ -82,7 +82,7 @@ interface Props {
isDesktopMode: boolean;
}
-const WelcomePanel = (props: Props) => {
+function WelcomePanel(props: Props) {
const { classes, openURLExternally, toggleKeysDialog, isDesktopMode } = props;
return (
<div className={classes.mainPanel}>
@@ -197,7 +197,7 @@ const WelcomePanel = (props: Props) => {
</List>
</div>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/components/dialogs/AboutDialog.tsx b/app/components/dialogs/AboutDialog.tsx
index 1c9c58d2e..8cedf5d16 100644
--- a/app/components/dialogs/AboutDialog.tsx
+++ b/app/components/dialogs/AboutDialog.tsx
@@ -51,7 +51,7 @@ if (buildID && buildID.length >= 11) {
const productName = versionMeta.name + (Pro ? ' Pro' : '');
document.title = productName + ' ' + versionMeta.version;
-const AboutDialog = (props: Props) => {
+function AboutDialog(props: Props) {
const [updateAvailable, setUpdateAvailable] = useState(false);
const [newVersion, setNewVersion] = useState('');
const { open, onClose, fullScreen } = props;
@@ -235,6 +235,6 @@ const AboutDialog = (props: Props) => {
</DialogActions>
</Dialog>
);
-};
+}
export default withMobileDialog()(AboutDialog);
diff --git a/app/components/dialogs/AddRemoveTagsDialog.tsx b/app/components/dialogs/AddRemoveTagsDialog.tsx
index da1dfaa2b..746b7c988 100644
--- a/app/components/dialogs/AddRemoveTagsDialog.tsx
+++ b/app/components/dialogs/AddRemoveTagsDialog.tsx
@@ -33,7 +33,7 @@ import Typography from '@material-ui/core/Typography';
import Dialog from '@material-ui/core/Dialog';
import TagsSelect from '../TagsSelect';
import i18n from '-/services/i18n';
-import { extractFileName, extractDirectoryName } from '-/utils/paths';
+import { extractFileName, extractDirectoryName } from '@tagspaces/tagspaces-platforms/paths';
import PlatformIO from '-/services/platform-facade';
import { TS } from '-/tagspaces.namespace';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
@@ -59,7 +59,7 @@ function PaperComponent(props: PaperProps) {
);
}
-const AddRemoveTagsDialog = (props: Props) => {
+function AddRemoveTagsDialog(props: Props) {
const [newlyAddedTags, setNewlyAddedTags] = useState<Array<TS.Tag>>([]);
const handleChange = (name: string, value: Array<TS.Tag>, action: string) => {
@@ -193,6 +193,6 @@ const AddRemoveTagsDialog = (props: Props) => {
</DialogActions>
</Dialog>
);
-};
+}
export default withMobileDialog()(AddRemoveTagsDialog);
diff --git a/app/components/dialogs/AddTagToTagGroupDialog.tsx b/app/components/dialogs/AddTagToTagGroupDialog.tsx
index aaf4b4587..e66bedd37 100644
--- a/app/components/dialogs/AddTagToTagGroupDialog.tsx
+++ b/app/components/dialogs/AddTagToTagGroupDialog.tsx
@@ -46,7 +46,7 @@ interface Props {
tagGroups: Array<TS.TagGroup>;
}
-const AddTagToTagGroupDialog = (props: Props) => {
+function AddTagToTagGroupDialog(props: Props) {
const [tagGroup, setTagGroup] = useState<string>(undefined);
const handleTagGroupChange = (event: React.ChangeEvent<HTMLInputElement>) => {
@@ -127,7 +127,7 @@ const AddTagToTagGroupDialog = (props: Props) => {
</DialogActions>
</Dialog>
);
-};
+}
const mapStateToProps = state => ({
tagGroups: getTagGroups(state),
diff --git a/app/components/dialogs/ColorPickerDialog.tsx b/app/components/dialogs/ColorPickerDialog.tsx
index fa72f7762..3cbb35574 100644
--- a/app/components/dialogs/ColorPickerDialog.tsx
+++ b/app/components/dialogs/ColorPickerDialog.tsx
@@ -72,7 +72,7 @@ const styles = {
}
};
-const ColorPickerDialog = (props: Props) => {
+function ColorPickerDialog(props: Props) {
const [color, setColor] = useState(undefined);
const [colorHex, setColorHex] = useState(undefined);
const { open = false, onClose } = props;
@@ -139,6 +139,6 @@ const ColorPickerDialog = (props: Props) => {
</DialogActions>
</Dialog>
);
-};
+}
export default withStyles(styles)(ColorPickerDialog);
diff --git a/app/components/dialogs/ConfirmDialog.tsx b/app/components/dialogs/ConfirmDialog.tsx
index a112fd430..f2699ca9b 100644
--- a/app/components/dialogs/ConfirmDialog.tsx
+++ b/app/components/dialogs/ConfirmDialog.tsx
@@ -43,7 +43,7 @@ interface Props {
onClose: () => void;
}
-const ConfirmDialog = (props: Props) => {
+function ConfirmDialog(props: Props) {
const { open, onClose, confirmCallback } = props;
function onConfirm(result) {
@@ -95,7 +95,7 @@ const ConfirmDialog = (props: Props) => {
</DialogActions>
</Dialog>
);
-};
+}
ConfirmDialog.defaultProps = {
cancelDialogTID: 'confirmDialogCancelButton',
diff --git a/app/components/dialogs/CreateDialog.tsx b/app/components/dialogs/CreateDialog.tsx
index 9fd57bb80..ef602342a 100644
--- a/app/components/dialogs/CreateDialog.tsx
+++ b/app/components/dialogs/CreateDialog.tsx
@@ -34,11 +34,11 @@ import { withStyles } from '@material-ui/core/styles';
import withMobileDialog from '@material-ui/core/withMobileDialog';
import Dialog from '@material-ui/core/Dialog';
import { Progress } from 'aws-sdk/clients/s3';
+import { formatDateTime4Tag } from '@tagspaces/tagspaces-platforms/misc';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import i18n from '-/services/i18n';
import { getKeyBindingObject } from '-/reducers/settings';
import { actions as AppActions } from '-/reducers/app';
-import AppConfig from '-/config';
-import { formatDateTime4Tag } from '-/utils/misc';
import IOActions from '-/reducers/io-actions';
import { TS } from '-/tagspaces.namespace';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
@@ -90,7 +90,7 @@ interface Props {
resetProgress: () => void;
}
-const CreateDialog = (props: Props) => {
+function CreateDialog(props: Props) {
let fileInput: HTMLInputElement;
const fileName =
'note' +
@@ -385,7 +385,7 @@ const CreateDialog = (props: Props) => {
</DialogContent>
</Dialog>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/components/dialogs/CreateDirectoryDialog.tsx b/app/components/dialogs/CreateDirectoryDialog.tsx
index be0068b94..236c3c973 100644
--- a/app/components/dialogs/CreateDirectoryDialog.tsx
+++ b/app/components/dialogs/CreateDirectoryDialog.tsx
@@ -29,7 +29,7 @@ import FormHelperText from '@material-ui/core/FormHelperText';
import Dialog from '@material-ui/core/Dialog';
import i18n from '-/services/i18n';
import { actions as AppActions } from '-/reducers/app';
-import { joinPaths } from '-/utils/paths';
+import { joinPaths } from '@tagspaces/tagspaces-platforms/paths';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
import PlatformIO from '-/services/platform-facade';
@@ -41,7 +41,7 @@ interface Props {
createDirectory: (directoryPath: string) => void;
}
-const CreateDirectoryDialog = (props: Props) => {
+function CreateDirectoryDialog(props: Props) {
const [inputError, setInputError] = useState(false);
const isFirstRun = useRef(true);
const [disableConfirmButton, setDisableConfirmButton] = useState(true);
@@ -149,7 +149,7 @@ const CreateDirectoryDialog = (props: Props) => {
</DialogActions>
</Dialog>
);
-};
+}
function mapActionCreatorsToProps(dispatch) {
return bindActionCreators(
diff --git a/app/components/dialogs/CreateEditLocationDialog.tsx b/app/components/dialogs/CreateEditLocationDialog.tsx
index 6937283bf..4975e9ddf 100644
--- a/app/components/dialogs/CreateEditLocationDialog.tsx
+++ b/app/components/dialogs/CreateEditLocationDialog.tsx
@@ -45,15 +45,14 @@ import CheckIcon from '@material-ui/icons/Check';
import RemoveIcon from '@material-ui/icons/RemoveCircleOutline';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
+import { locationType } from '@tagspaces/tagspaces-platforms/misc';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import i18n from '-/services/i18n';
import { Pro } from '-/pro';
import ObjectStoreForm from './ObjectStoreForm';
import LocalForm from './LocalForm';
import useFirstRender from '-/utils/useFirstRender';
-import AppConfig from '-/config';
import { TS } from '-/tagspaces.namespace';
-import { locationType } from '-/utils/misc';
-import { getLocationPath } from '-/utils/paths';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
import InfoIcon from '-/components/InfoIcon';
import { ProLabel, BetaLabel, ProTooltip } from '-/components/HelperComponents';
@@ -61,6 +60,7 @@ import { actions as LocationActions } from '-/reducers/locations';
import { getPersistTagsInSidecarFile } from '-/reducers/settings';
import ConfirmDialog from '-/components/dialogs/ConfirmDialog';
import { actions as LocationIndexActions } from '-/reducers/location-index';
+import PlatformIO from "-/services/platform-facade";
const styles: any = theme => ({
formControl: {
@@ -81,7 +81,7 @@ interface Props {
createLocationIndex: (location: TS.Location) => void;
}
-const CreateEditLocationDialog = (props: Props) => {
+function CreateEditLocationDialog(props: Props) {
const IgnorePatternDialog =
Pro && Pro.UI ? Pro.UI.IgnorePatternDialog : false;
const { location } = props;
@@ -209,7 +209,7 @@ const CreateEditLocationDialog = (props: Props) => {
* @param checkOnly - switch to set errors or only to check validation
* return true - have errors; false - no errors
*/
- const validateObjectStore = (checkOnly: boolean = false): boolean => {
+ const validateObjectStore = (checkOnly = false): boolean => {
if (!storeName || storeName.length === 0) {
if (checkOnly) return true;
setCloudErrorTextName(true);
@@ -237,7 +237,7 @@ const CreateEditLocationDialog = (props: Props) => {
* @param checkOnly - switch to set errors or only to check validation
* return true - have errors; false - no errors
*/
- const validateLocal = (checkOnly: boolean = false): boolean => {
+ const validateLocal = (checkOnly = false): boolean => {
if (!name || name.length === 0) {
if (checkOnly) return true;
setErrorTextName(true);
@@ -779,7 +779,7 @@ const CreateEditLocationDialog = (props: Props) => {
onClose={() => setIgnorePatternDialogOpen(false)}
ignorePatternPaths={ignorePatternPaths}
setIgnorePatternPaths={setIgnorePatternPaths}
- locationPath={getLocationPath(location)}
+ locationPath={PlatformIO.getLocationPath(location)}
/>
)}
</>
@@ -809,7 +809,7 @@ const CreateEditLocationDialog = (props: Props) => {
</DialogActions>
</Dialog>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/components/dialogs/CreateFileDialog.tsx b/app/components/dialogs/CreateFileDialog.tsx
index 2f41d9de9..4759d7a84 100644
--- a/app/components/dialogs/CreateFileDialog.tsx
+++ b/app/components/dialogs/CreateFileDialog.tsx
@@ -36,9 +36,9 @@ import InputLabel from '@material-ui/core/InputLabel';
import InputAdornment from '@material-ui/core/InputAdornment';
import withMobileDialog from '@material-ui/core/withMobileDialog';
import Dialog from '@material-ui/core/Dialog';
+import { formatDateTime4Tag } from '@tagspaces/tagspaces-platforms/misc';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import i18n from '-/services/i18n';
-import { formatDateTime4Tag } from '-/utils/misc';
-import AppConfig from '-/config';
import TaggingActions from '-/reducers/tagging-actions';
import { actions as AppActions } from '-/reducers/app';
import PlatformIO from '-/services/platform-facade';
@@ -88,7 +88,7 @@ interface Props {
/**
* @deprecated use CreateDialog instead
*/
-const CreateFileDialog = (props: Props) => {
+function CreateFileDialog(props: Props) {
const [errorTextName, setErrorTextName] = useState<boolean>(false);
const [errorTextPath, setErrorTextPath] = useState<boolean>(false);
const [fileName, setFileName] = useState<string>(
@@ -305,7 +305,7 @@ const CreateFileDialog = (props: Props) => {
</DialogActions>
</Dialog>
);
-};
+}
function mapActionCreatorsToProps(dispatch) {
return bindActionCreators(
diff --git a/app/components/dialogs/CreateTagGroupDialog.tsx b/app/components/dialogs/CreateTagGroupDialog.tsx
index 5e0aaff33..01c127b9a 100644
--- a/app/components/dialogs/CreateTagGroupDialog.tsx
+++ b/app/components/dialogs/CreateTagGroupDialog.tsx
@@ -52,7 +52,7 @@ interface Props {
const defaultTagGroupLocation = 'TAG_LIBRARY';
-const CreateTagGroupDialog = (props: Props) => {
+function CreateTagGroupDialog(props: Props) {
const [displayColorPicker, setDisplayColorPicker] = useState<boolean>(false);
const [displayTextColorPicker, setDisplayTextColorPicker] = useState<boolean>(
false
@@ -303,7 +303,7 @@ const CreateTagGroupDialog = (props: Props) => {
</DialogActions>
</Dialog>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/components/dialogs/CreateTagsDialog.tsx b/app/components/dialogs/CreateTagsDialog.tsx
index 9ec99f9ad..00cff2a48 100644
--- a/app/components/dialogs/CreateTagsDialog.tsx
+++ b/app/components/dialogs/CreateTagsDialog.tsx
@@ -38,7 +38,7 @@ interface Props {
selectedTagGroupEntry: TS.TagGroup;
}
-const CreateTagsDialog = (props: Props) => {
+function CreateTagsDialog(props: Props) {
const [inputError, setInputError] = useState<boolean>(false);
const [tagTitle, setTagTitle] = useState<string>('');
@@ -131,6 +131,6 @@ const CreateTagsDialog = (props: Props) => {
</DialogActions>
</Dialog>
);
-};
+}
export default CreateTagsDialog;
diff --git a/app/components/dialogs/DialogCloseButton.tsx b/app/components/dialogs/DialogCloseButton.tsx
index ca6b5a05d..c5c529987 100644
--- a/app/components/dialogs/DialogCloseButton.tsx
+++ b/app/components/dialogs/DialogCloseButton.tsx
@@ -26,7 +26,7 @@ interface Props {
testId?: string; // id used for user interface test automation
}
-const DialogCloseButton = (props: Props) => {
+function DialogCloseButton(props: Props) {
const { onClose, testId } = props;
return (
<IconButton
@@ -43,6 +43,6 @@ const DialogCloseButton = (props: Props) => {
<CloseIcon />
</IconButton>
);
-};
+}
export default DialogCloseButton;
diff --git a/app/components/dialogs/EditEntryTagDialog.tsx b/app/components/dialogs/EditEntryTagDialog.tsx
index 96b53fa44..df7f0dae5 100644
--- a/app/components/dialogs/EditEntryTagDialog.tsx
+++ b/app/components/dialogs/EditEntryTagDialog.tsx
@@ -36,13 +36,13 @@ import FormControl from '@material-ui/core/FormControl';
import FormHelperText from '@material-ui/core/FormHelperText';
import Dialog from '@material-ui/core/Dialog';
import EditIcon from '@material-ui/icons/Edit';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import i18n from '-/services/i18n';
-import { isGeoTag } from '-/utils/misc';
+import { isGeoTag } from '-/utils/geo';
import { Pro } from '-/pro';
import { getSelectedEntries, getSelectedTag } from '-/reducers/app';
import TaggingActions from '-/reducers/tagging-actions';
import { isDateTimeTag } from '-/utils/dates';
-import AppConfig from '-/config';
import { TS } from '-/tagspaces.namespace';
import useValidation from '-/utils/useValidation';
import { getMapTileServer } from '-/reducers/settings';
@@ -71,7 +71,7 @@ interface Props {
const GeoTagEditor = Pro && Pro.UI ? Pro.UI.GeoTagEditor : React.Fragment;
const DateTagEditor = Pro && Pro.UI ? Pro.UI.DateTagEditor : React.Fragment;
-const EditEntryTagDialog = (props: Props) => {
+function EditEntryTagDialog(props: Props) {
const [showAdvancedMode, setShowAdvancedMode] = useState<boolean>(false);
const [title, setTitle] = useState(
props.selectedTag && props.selectedTag.title
@@ -253,7 +253,7 @@ const EditEntryTagDialog = (props: Props) => {
{renderActions()}
</Dialog>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/components/dialogs/EditTagDialog.tsx b/app/components/dialogs/EditTagDialog.tsx
index c946e4b9a..02840f871 100644
--- a/app/components/dialogs/EditTagDialog.tsx
+++ b/app/components/dialogs/EditTagDialog.tsx
@@ -41,7 +41,7 @@ interface Props {
selectedTagGroupEntry: TS.TagGroup;
}
-const EditTagDialog = (props: Props) => {
+function EditTagDialog(props: Props) {
const [displayColorPicker, setDisplayColorPicker] = useState<boolean>(false);
const [displayTextColorPicker, setDisplayTextColorPicker] = useState<boolean>(
false
@@ -252,6 +252,6 @@ const EditTagDialog = (props: Props) => {
</DialogActions>
</Dialog>
);
-};
+}
export default EditTagDialog;
diff --git a/app/components/dialogs/EditTagGroupDialog.tsx b/app/components/dialogs/EditTagGroupDialog.tsx
index 8ecbbdb4a..33ebcac86 100644
--- a/app/components/dialogs/EditTagGroupDialog.tsx
+++ b/app/components/dialogs/EditTagGroupDialog.tsx
@@ -50,7 +50,7 @@ interface Props {
saveTagInLocation: boolean;
}
-const EditTagGroupDialog = (props: Props) => {
+function EditTagGroupDialog(props: Props) {
const [displayColorPicker, setDisplayColorPicker] = useState<boolean>(false);
const [displayTextColorPicker, setDisplayTextColorPicker] = useState<boolean>(
false
@@ -306,7 +306,7 @@ const EditTagGroupDialog = (props: Props) => {
{renderActions()}
</Dialog>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/components/dialogs/FileUploadDialog.tsx b/app/components/dialogs/FileUploadDialog.tsx
index 0d94ac2f2..54a93d410 100644
--- a/app/components/dialogs/FileUploadDialog.tsx
+++ b/app/components/dialogs/FileUploadDialog.tsx
@@ -31,7 +31,7 @@ import { LinearProgress, Grid, Tooltip } from '@material-ui/core';
import WarningIcon from '@material-ui/icons/Warning';
import PlatformIO from '-/services/platform-facade';
import { actions as AppActions, getProgress } from '-/reducers/app';
-import { extractFileName } from '-/utils/paths';
+import { extractFileName } from '@tagspaces/tagspaces-platforms/paths';
import i18n from '-/services/i18n';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
@@ -42,7 +42,7 @@ interface Props {
clearUploadDialog: () => void;
}
-const FileUploadDialog = (props: Props) => {
+function FileUploadDialog(props: Props) {
const { open = false, onClose } = props;
function LinearProgressWithLabel(prop) {
@@ -172,7 +172,7 @@ const FileUploadDialog = (props: Props) => {
</DialogActions>
</Dialog>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/components/dialogs/ImportExportTagGroupsDialog.tsx b/app/components/dialogs/ImportExportTagGroupsDialog.tsx
index 31a5980e6..e9cc8b752 100644
--- a/app/components/dialogs/ImportExportTagGroupsDialog.tsx
+++ b/app/components/dialogs/ImportExportTagGroupsDialog.tsx
@@ -28,11 +28,11 @@ import FormGroup from '@material-ui/core/FormGroup';
import FormControlLabel from '@material-ui/core/FormControlLabel';
import Checkbox from '@material-ui/core/Checkbox';
import Dialog from '@material-ui/core/Dialog';
+import { isFunc } from '@tagspaces/tagspaces-platforms/misc';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import TagGroupContainer from '../TagGroupContainer';
import TagContainer from '../TagContainer';
import i18n from '-/services/i18n';
-import { isFunc } from '-/utils/misc';
-import AppConfig from '-/config';
import { TS } from '-/tagspaces.namespace';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
@@ -57,7 +57,7 @@ interface Props {
exportTagGroups: (taggroup: any) => void;
}
-const ImportExportTagGroupsDialog = (props: Props) => {
+function ImportExportTagGroupsDialog(props: Props) {
// const [selectedAll, setSelectedAll] = useState<boolean>(true);
const selectedAll = useRef(true);
const [tagGroupList, setTagGroupList] = useState<Array<any>>(
@@ -176,7 +176,7 @@ const ImportExportTagGroupsDialog = (props: Props) => {
{renderActions()}
</Dialog>
);
-};
+}
export default withMobileDialog()(
withStyles(styles)(ImportExportTagGroupsDialog)
diff --git a/app/components/dialogs/KeyboardDialog.tsx b/app/components/dialogs/KeyboardDialog.tsx
index 7939c5698..1c877b8d3 100644
--- a/app/components/dialogs/KeyboardDialog.tsx
+++ b/app/components/dialogs/KeyboardDialog.tsx
@@ -29,8 +29,8 @@ import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';
import ListItemText from '@material-ui/core/ListItemText';
import { withStyles } from '@material-ui/core/styles';
import Dialog from '@material-ui/core/Dialog';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import i18n from '-/services/i18n';
-import AppConfig from '-/config';
import { getKeyBindingObject } from '-/reducers/settings';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
@@ -55,7 +55,7 @@ interface Props {
onClose: () => void;
}
-const KeyboardDialog = (props: Props) => {
+function KeyboardDialog(props: Props) {
const { open, onClose, fullScreen } = props;
return (
<Dialog
@@ -97,7 +97,7 @@ const KeyboardDialog = (props: Props) => {
</DialogActions>
</Dialog>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/components/dialogs/LicenseDialog.tsx b/app/components/dialogs/LicenseDialog.tsx
index 186d86ef1..75efe26bc 100644
--- a/app/components/dialogs/LicenseDialog.tsx
+++ b/app/components/dialogs/LicenseDialog.tsx
@@ -23,12 +23,12 @@ import DialogContent from '@material-ui/core/DialogContent';
import DialogTitle from '@material-ui/core/DialogTitle';
import withMobileDialog from '@material-ui/core/withMobileDialog';
import Dialog from '@material-ui/core/Dialog';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import i18n from '-/services/i18n';
import { Pro } from '-/pro';
-import AppConfig from '-/config';
import LicenseContent from '-/LICENSE.txt';
import PlatformIO from '-/services/platform-facade';
-import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
+// import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
interface Props {
open: boolean;
@@ -49,7 +49,7 @@ interface Props {
// return true;
// }
-const LicenseDialog = (props: Props) => {
+function LicenseDialog(props: Props) {
const { fullScreen, open, onClose } = props;
// let licenseElement;
// function printLicense() {
@@ -102,6 +102,6 @@ const LicenseDialog = (props: Props) => {
</DialogActions>
</Dialog>
);
-};
+}
export default withMobileDialog()(LicenseDialog);
diff --git a/app/components/dialogs/LocalForm.tsx b/app/components/dialogs/LocalForm.tsx
index 43c276657..cfb6cd94d 100644
--- a/app/components/dialogs/LocalForm.tsx
+++ b/app/components/dialogs/LocalForm.tsx
@@ -26,10 +26,10 @@ import IconButton from '@material-ui/core/IconButton';
import FolderIcon from '@material-ui/icons/Folder';
import FormHelperText from '@material-ui/core/FormHelperText';
import Grid from '@material-ui/core/Grid';
+import { extractDirectoryName } from '@tagspaces/tagspaces-platforms/paths';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import i18n from '-/services/i18n';
-import { extractDirectoryName } from '-/utils/paths';
import PlatformIO from '-/services/platform-facade';
-import AppConfig from '-/config';
interface Props {
showAdvancedMode: boolean;
@@ -44,7 +44,7 @@ interface Props {
newuuid: string;
}
-const LocalForm = (props: Props) => {
+function LocalForm(props: Props) {
const {
errorTextPath,
errorTextName,
@@ -149,6 +149,6 @@ const LocalForm = (props: Props) => {
)}
</Grid>
);
-};
+}
export default LocalForm;
diff --git a/app/components/dialogs/MoveCopyFilesDialog.tsx b/app/components/dialogs/MoveCopyFilesDialog.tsx
index 57e9560d0..f4d7beffa 100644
--- a/app/components/dialogs/MoveCopyFilesDialog.tsx
+++ b/app/components/dialogs/MoveCopyFilesDialog.tsx
@@ -36,11 +36,11 @@ import FormHelperText from '@material-ui/core/FormHelperText';
import Typography from '@material-ui/core/Typography';
import Dialog from '@material-ui/core/Dialog';
import IconButton from '@material-ui/core/IconButton';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
+import { extractFileName } from '@tagspaces/tagspaces-platforms/paths';
import i18n from '-/services/i18n';
import PlatformIO from '-/services/platform-facade';
-import AppConfig from '-/config';
import IOActions from '-/reducers/io-actions';
-import { extractFileName } from '-/utils/paths';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
interface Props {
@@ -52,7 +52,7 @@ interface Props {
selectedFiles: Array<string>;
}
-const MoveCopyFilesDialog = (props: Props) => {
+function MoveCopyFilesDialog(props: Props) {
const [inputError, setInputError] = useState(false);
const [disableConfirmButton, setDisableConfirmButton] = useState(true);
const [targetPath, setTargetPath] = useState('');
@@ -189,7 +189,7 @@ const MoveCopyFilesDialog = (props: Props) => {
</DialogActions>
</Dialog>
);
-};
+}
function mapActionCreatorsToProps(dispatch) {
return bindActionCreators(
diff --git a/app/components/dialogs/ObjectStoreForm.tsx b/app/components/dialogs/ObjectStoreForm.tsx
index 89ad54d44..8c98616aa 100644
--- a/app/components/dialogs/ObjectStoreForm.tsx
+++ b/app/components/dialogs/ObjectStoreForm.tsx
@@ -111,7 +111,7 @@ interface Props {
setEndpointURL: (string) => void;
setNewUuid: (string) => void;
}
-const ObjectStoreForm = (props: Props) => {
+function ObjectStoreForm(props: Props) {
const {
setShowSecretAccessKey,
cloudErrorTextName,
@@ -349,6 +349,6 @@ const ObjectStoreForm = (props: Props) => {
)}
</Grid>
);
-};
+}
export default withStyles(undefined, { withTheme: true })(ObjectStoreForm);
diff --git a/app/components/dialogs/OnboardingDialog.tsx b/app/components/dialogs/OnboardingDialog.tsx
index 3290ced78..8ac7b0fac 100644
--- a/app/components/dialogs/OnboardingDialog.tsx
+++ b/app/components/dialogs/OnboardingDialog.tsx
@@ -34,6 +34,7 @@ import ToggleButton from '@material-ui/lab/ToggleButton';
import ToggleButtonGroup from '@material-ui/lab/ToggleButtonGroup';
import MobileStepper from '@material-ui/core/MobileStepper';
import Dialog from '@material-ui/core/Dialog';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import NavigationV3 from '-/assets/images/navigation-v3.png';
import BrowserExtension from '-/assets/images/collectcontent.svg';
import WizardFinished from '-/assets/images/computer-desk.svg';
@@ -47,7 +48,6 @@ import {
actions as SettingsActions
} from '-/reducers/settings';
import { actions as AppActions } from '-/reducers/app';
-import AppConfig from '-/config';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
import Links from '-/links';
@@ -64,7 +64,7 @@ interface Props {
onClose: () => void;
}
-const OnboardingDialog = (props: Props) => {
+function OnboardingDialog(props: Props) {
const [activeStep, setActiveStep] = useState(0);
const { fullScreen, open, onClose } = props;
@@ -309,7 +309,7 @@ const OnboardingDialog = (props: Props) => {
</DialogActions>
</Dialog>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/components/dialogs/OpenLinkDialog.tsx b/app/components/dialogs/OpenLinkDialog.tsx
index 1643ee35d..bb114755e 100644
--- a/app/components/dialogs/OpenLinkDialog.tsx
+++ b/app/components/dialogs/OpenLinkDialog.tsx
@@ -37,7 +37,7 @@ interface Props {
openLink: (linkURL: string) => void;
}
-const OpenLinkDialog = (props: Props) => {
+function OpenLinkDialog(props: Props) {
const [inputError, setInputError] = useState(false);
const [disableConfirmButton, setDisableConfirmButton] = useState(true);
const [linkURL, setLinkURL] = useState('');
@@ -134,7 +134,7 @@ const OpenLinkDialog = (props: Props) => {
</DialogActions>
</Dialog>
);
-};
+}
function mapActionCreatorsToProps(dispatch) {
return bindActionCreators(
diff --git a/app/components/dialogs/ProTeaserDialog.tsx b/app/components/dialogs/ProTeaserDialog.tsx
index 24bbad522..ceefdd673 100644
--- a/app/components/dialogs/ProTeaserDialog.tsx
+++ b/app/components/dialogs/ProTeaserDialog.tsx
@@ -26,21 +26,21 @@ import Typography from '@material-ui/core/Typography';
import withMobileDialog from '@material-ui/core/withMobileDialog';
import MobileStepper from '@material-ui/core/MobileStepper';
import Dialog from '@material-ui/core/Dialog';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import ProTeaserImage from '-/assets/images/pro-teaser.svg';
import ThumbsImage from '-/assets/images/thumbnails-undraw.svg';
-import PerspectivesImage from '-/assets/images/perspectives-undraw.svg';
+// import PerspectivesImage from '-/assets/images/perspectives-undraw.svg';
import CloudImage from '-/assets/images/aws-s3-in-tagspaces.png';
import SearchImage from '-/assets/images/search-undraw.svg';
import MapImage from '-/assets/images/mapique-perspective.jpg';
import GalleryImage from '-/assets/images/gallery-perspective.jpg';
import CustomFolderColor from '-/assets/images/custom-folder-color.jpg';
import EntryDescription from '-/assets/images/entry-description.jpg';
-import AnnotateImage from '-/assets/images/annotate-undraw.svg';
+// import AnnotateImage from '-/assets/images/annotate-undraw.svg';
import EnterpriseImage from '-/assets/images/world-undraw.svg';
import i18n from '-/services/i18n';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
import Links from '-/links';
-import AppConfig from '-/config';
interface Props {
open: boolean;
@@ -298,7 +298,7 @@ slidesEN['persistentThumbs'] = {
pictureHeight: 200
};
-const Slide = (props: SlideProps) => {
+function Slide(props: SlideProps) {
const {
title,
description,
@@ -365,7 +365,7 @@ const Slide = (props: SlideProps) => {
loop
controls
style={{ width: '100%', marginBottom: 15 }}
- ></video>
+ />
)}
<br />
{ctaTitle && openURL && (
@@ -382,9 +382,9 @@ const Slide = (props: SlideProps) => {
</div>
</div>
);
-};
+}
-const ProTeaserDialog = (props: Props) => {
+function ProTeaserDialog(props: Props) {
const [activeStep, setActiveStep] = useState<number>(0);
const maxSteps = 8;
@@ -466,6 +466,6 @@ const ProTeaserDialog = (props: Props) => {
</DialogActions>
</Dialog>
);
-};
+}
export default withMobileDialog()(ProTeaserDialog);
diff --git a/app/components/dialogs/ProgressDialog.tsx b/app/components/dialogs/ProgressDialog.tsx
index e21bcec8f..4e4c66358 100644
--- a/app/components/dialogs/ProgressDialog.tsx
+++ b/app/components/dialogs/ProgressDialog.tsx
@@ -28,21 +28,23 @@ interface Props {
onClose: () => void;
}
-const ProgressDialog = (props: Props) => (
- <Dialog open={props.open} onClose={props.onClose}>
- <DialogTitle data-tid="progressDialogTitle">
- <DialogCloseButton onClose={props.onClose} />
- </DialogTitle>
- <DialogContent
- style={{
- marginLeft: 'auto',
- marginRight: 'auto',
- flexGrow: 1
- }}
- >
- <CircularProgress size={24} />
- </DialogContent>
- </Dialog>
-);
+function ProgressDialog(props: Props) {
+ return (
+ <Dialog open={props.open} onClose={props.onClose}>
+ <DialogTitle data-tid="progressDialogTitle">
+ <DialogCloseButton onClose={props.onClose} />
+ </DialogTitle>
+ <DialogContent
+ style={{
+ marginLeft: 'auto',
+ marginRight: 'auto',
+ flexGrow: 1
+ }}
+ >
+ <CircularProgress size={24} />
+ </DialogContent>
+ </Dialog>
+ );
+}
export default ProgressDialog;
diff --git a/app/components/dialogs/RenameEntryDialog.tsx b/app/components/dialogs/RenameEntryDialog.tsx
index 2d8db3433..a5701f77d 100644
--- a/app/components/dialogs/RenameEntryDialog.tsx
+++ b/app/components/dialogs/RenameEntryDialog.tsx
@@ -27,15 +27,15 @@ import DialogTitle from '@material-ui/core/DialogTitle';
import FormControl from '@material-ui/core/FormControl';
import FormHelperText from '@material-ui/core/FormHelperText';
import Dialog from '@material-ui/core/Dialog';
-import i18n from '-/services/i18n';
import {
extractContainingDirectoryPath,
extractDirectoryName,
extractFileName
-} from '-/utils/paths';
+} from '@tagspaces/tagspaces-platforms/paths';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
+import i18n from '-/services/i18n';
import { actions as AppActions, getLastSelectedEntry } from '-/reducers/app';
import PlatformIO from '-/services/platform-facade';
-import AppConfig from '-/config';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
interface Props {
@@ -47,7 +47,7 @@ interface Props {
renameDirectory: (directoryPath: string, newDirectoryName: string) => void;
}
-const RenameEntryDialog = (props: Props) => {
+function RenameEntryDialog(props: Props) {
const [inputError, setInputError] = useState<boolean>(false);
const disableConfirmButton = useRef<boolean>(true);
@@ -218,7 +218,7 @@ const RenameEntryDialog = (props: Props) => {
</DialogActions>
</Dialog>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/components/dialogs/ThirdPartyLibsDialog.tsx b/app/components/dialogs/ThirdPartyLibsDialog.tsx
index 318a8e69c..326a975a9 100644
--- a/app/components/dialogs/ThirdPartyLibsDialog.tsx
+++ b/app/components/dialogs/ThirdPartyLibsDialog.tsx
@@ -33,7 +33,7 @@ interface Props {
fullScreen: boolean;
}
-const ThirdPartyLibsDialog = (props: Props) => {
+function ThirdPartyLibsDialog(props: Props) {
const { open, onClose, fullScreen } = props;
return (
<Dialog
@@ -62,6 +62,6 @@ const ThirdPartyLibsDialog = (props: Props) => {
</DialogActions>
</Dialog>
);
-};
+}
export default withMobileDialog()(ThirdPartyLibsDialog);
diff --git a/app/components/dialogs/settings/MapTileServerDialog.tsx b/app/components/dialogs/settings/MapTileServerDialog.tsx
index bb99d028e..e7c6a7468 100644
--- a/app/components/dialogs/settings/MapTileServerDialog.tsx
+++ b/app/components/dialogs/settings/MapTileServerDialog.tsx
@@ -44,7 +44,7 @@ interface Props {
deleteTileServer: (uuid: string) => void;
}
-const MapTileServerDialog = (props: Props) => {
+function MapTileServerDialog(props: Props) {
const name = useRef<string>(props.tileServer.name);
const serverURL = useRef<string>(props.tileServer.serverURL);
const serverInfo = useRef<string>(props.tileServer.serverInfo);
@@ -206,7 +206,7 @@ const MapTileServerDialog = (props: Props) => {
{renderActions()}
</Dialog>
);
-};
+}
function mapActionCreatorsToProps(dispatch) {
return bindActionCreators(
diff --git a/app/components/dialogs/settings/SettingsAdvanced.tsx b/app/components/dialogs/settings/SettingsAdvanced.tsx
index d4e2f9515..d634d9250 100644
--- a/app/components/dialogs/settings/SettingsAdvanced.tsx
+++ b/app/components/dialogs/settings/SettingsAdvanced.tsx
@@ -33,6 +33,7 @@ import Switch from '@material-ui/core/Switch';
import Select from '@material-ui/core/Select';
import Input from '@material-ui/core/Input';
import MenuItem from '@material-ui/core/MenuItem';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import i18n from '-/services/i18n';
import {
actions as SettingsActions,
@@ -45,7 +46,6 @@ import MapTileServerDialog from '-/components/dialogs/settings/MapTileServerDial
import { Pro } from '-/pro';
import { ProLabel } from '-/components/HelperComponents';
import InfoIcon from '-/components/InfoIcon';
-import AppConfig from '-/config';
const styles: any = {
root: {
@@ -78,7 +78,7 @@ interface Props {
setGeoTaggingFormat: (geoTaggingFormat: string) => void;
}
-const SettingsAdvanced = (props: Props) => {
+function SettingsAdvanced(props: Props) {
const [tileServerDialog, setTileServerDialog] = useState<any>(undefined);
const handleEditTileServerClick = (
@@ -263,7 +263,7 @@ const SettingsAdvanced = (props: Props) => {
)}
</div>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/components/dialogs/settings/SettingsDialog.tsx b/app/components/dialogs/settings/SettingsDialog.tsx
index dadf7750d..c777adad8 100644
--- a/app/components/dialogs/settings/SettingsDialog.tsx
+++ b/app/components/dialogs/settings/SettingsDialog.tsx
@@ -30,14 +30,15 @@ import DialogTitle from '@material-ui/core/DialogTitle';
import withMobileDialog from '@material-ui/core/withMobileDialog';
import { v1 as uuidv1 } from 'uuid';
import { useStateWithCallbackLazy } from 'use-state-with-callback';
+import { extend } from '@tagspaces/tagspaces-platforms/misc';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import ConfirmDialog from '../ConfirmDialog';
import SettingsGeneral from '../settings/SettingsGeneral';
import SettingsKeyBindings from '../settings/SettingsKeyBindings';
import SettingsFileTypes from '../settings/SettingsFileTypes';
import i18n from '-/services/i18n';
import { actions, getSupportedFileTypes } from '-/reducers/settings';
-import { clearAllURLParams, extend } from '-/utils/misc';
-import AppConfig from '-/config';
+import { clearAllURLParams } from '-/utils/dom';
import SettingsAdvanced from '-/components/dialogs/settings/SettingsAdvanced';
import DialogCloseButton from '-/components/dialogs/DialogCloseButton';
@@ -56,7 +57,7 @@ interface Props {
supportedFileTypes?: Array<any>;
}
-const SettingsDialog = (props: Props) => {
+function SettingsDialog(props: Props) {
const [items, setItems] = useStateWithCallbackLazy<Array<any>>([]);
const [currentTab, setCurrentTab] = useState<number>(0);
const [selectedItem, setSelectedItem] = useState<any>({});
@@ -337,7 +338,7 @@ const SettingsDialog = (props: Props) => {
{renderActions()}
</Dialog>
);
-};
+}
const mapStateToProps = state => ({
supportedFileTypes: getSupportedFileTypes(state)
diff --git a/app/components/dialogs/settings/SettingsFileTypes.tsx b/app/components/dialogs/settings/SettingsFileTypes.tsx
index 4e55b827e..0ff5b781d 100644
--- a/app/components/dialogs/settings/SettingsFileTypes.tsx
+++ b/app/components/dialogs/settings/SettingsFileTypes.tsx
@@ -29,7 +29,7 @@ import Button from '@material-ui/core/Button';
import Select from '@material-ui/core/Select';
import ColorPickerDialog from '../ColorPickerDialog';
import { findAvailableExtensions } from '-/reducers/settings-default';
-// import { sortBy } from '-/utils/misc';
+// import { sortBy } from '@tagspaces/tagspaces-platforms/misc';
import i18n from '-/services/i18n';
import TransparentBackground from '../../TransparentBackground';
@@ -69,7 +69,7 @@ interface Props {
onRemoveItem: Function;
}
-const SettingsFileTypes = (props: Props) => {
+function SettingsFileTypes(props: Props) {
const [isColorPickerVisible, setColorPickerVisible] = useState<boolean>(
false
);
@@ -242,6 +242,6 @@ const SettingsFileTypes = (props: Props) => {
))}
</div>
);
-};
+}
export default withStyles(styles)(SettingsFileTypes);
diff --git a/app/components/dialogs/settings/SettingsGeneral.tsx b/app/components/dialogs/settings/SettingsGeneral.tsx
index 54fc1dd3b..97b68674f 100644
--- a/app/components/dialogs/settings/SettingsGeneral.tsx
+++ b/app/components/dialogs/settings/SettingsGeneral.tsx
@@ -34,6 +34,7 @@ import InfoIcon from '@material-ui/icons/InfoOutlined';
import CheckIcon from '@material-ui/icons/Check';
import ToggleButton from '@material-ui/lab/ToggleButton';
import ToggleButtonGroup from '@material-ui/lab/ToggleButtonGroup';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import i18n from '-/services/i18n';
import {
actions as SettingsActions,
@@ -44,7 +45,6 @@ import ColorPickerDialog from '-/components/dialogs/ColorPickerDialog';
import PerspectiveSelector from '-/components/PerspectiveSelector';
import TransparentBackground from '-/components/TransparentBackground';
import { BetaLabel } from '-/components/HelperComponents';
-import AppConfig from '-/config';
import PlatformIO from '-/services/platform-facade';
import { PerspectiveIDs } from '-/perspectives';
@@ -85,7 +85,7 @@ interface Props {
setMaxSearchResult: (maxResult: string) => void;
}
-const SettingsGeneral = (props: Props) => {
+function SettingsGeneral(props: Props) {
const [displayColorPicker, setDisplayColorPicker] = useState<boolean>(false);
const [displayTextColorPicker, setDisplayTextColorPicker] = useState<boolean>(
false
@@ -124,241 +124,240 @@ const SettingsGeneral = (props: Props) => {
const { classes, persistTagsInSidecarFile } = props;
return (
- <>
- <List className={classes.root}>
- <ListItem className={classes.listItem}>
- <ListItemText primary={i18n.t('core:interfaceLanguage')} />
- <Select
- data-tid="settingsSetLanguage"
- value={props.settings.interfaceLanguage}
- onChange={(event: any) => {
- props.setLanguage(event.target.value);
- PlatformIO.setLanguage(event.target.value);
- // TODO remove
- const { currentTheme } = props.settings;
- const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
- props.setCurrentTheme(newTheme);
- setTimeout(() => {
- props.setCurrentTheme(currentTheme);
- }, 500);
- }}
- input={<Input id="languageSelector" />}
- >
- {props.settings.supportedLanguages.map(language => (
- <MenuItem key={language.iso} value={language.iso}>
- {language.title}
- </MenuItem>
- ))}
- </Select>
- </ListItem>
- <ListItem className={classes.listItem}>
- <ListItemText primary={i18n.t('core:themeSelector')} />
- <Select
- data-tid="settingsSetCurrentTheme"
- value={props.settings.currentTheme}
- onChange={(event: any) => props.setCurrentTheme(event.target.value)}
- input={<Input id="themeSelector" />}
- >
- {props.settings.supportedThemes.map(theme => (
- <MenuItem key={theme} value={theme}>
- {theme}
- </MenuItem>
- ))}
- </Select>
- </ListItem>
- <ListItem className={classes.listItem}>
- <ListItemText primary={i18n.t('Default Perspective')} />
- <PerspectiveSelector
- onChange={changePerspective}
- defaultValue={defaultPerspective}
- testId="changePerspectiveInSettingsTID"
- />
- </ListItem>
- <ListItem
- className={classes.listItem}
- title={
- AppConfig.useSidecarsForFileTaggingDisableSetting
- ? i18n.t('core:settingExternallyConfigured')
- : ''
- }
+ <List className={classes.root}>
+ <ListItem className={classes.listItem}>
+ <ListItemText primary={i18n.t('core:interfaceLanguage')} />
+ <Select
+ data-tid="settingsSetLanguage"
+ value={props.settings.interfaceLanguage}
+ onChange={(event: any) => {
+ props.setLanguage(event.target.value);
+ PlatformIO.setLanguage(event.target.value);
+ // TODO remove
+ const { currentTheme } = props.settings;
+ const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
+ props.setCurrentTheme(newTheme);
+ setTimeout(() => {
+ props.setCurrentTheme(currentTheme);
+ }, 500);
+ }}
+ input={<Input id="languageSelector" />}
>
- <ListItemText primary={i18n.t('core:fileTaggingSetting')} />
- {AppConfig.useSidecarsForFileTaggingDisableSetting ? (
- <Button size="small" variant="outlined" disabled>
- {persistTagsInSidecarFile
- ? i18n.t('core:useSidecarFile')
- : i18n.t('core:renameFile')}
- </Button>
- ) : (
- <ToggleButtonGroup
- value={persistTagsInSidecarFile}
- size="small"
- exclusive
+ {props.settings.supportedLanguages.map(language => (
+ <MenuItem key={language.iso} value={language.iso}>
+ {language.title}
+ </MenuItem>
+ ))}
+ </Select>
+ </ListItem>
+ <ListItem className={classes.listItem}>
+ <ListItemText primary={i18n.t('core:themeSelector')} />
+ <Select
+ data-tid="settingsSetCurrentTheme"
+ value={props.settings.currentTheme}
+ onChange={(event: any) => props.setCurrentTheme(event.target.value)}
+ input={<Input id="themeSelector" />}
+ >
+ {props.settings.supportedThemes.map(theme => (
+ <MenuItem key={theme} value={theme}>
+ {theme}
+ </MenuItem>
+ ))}
+ </Select>
+ </ListItem>
+ <ListItem className={classes.listItem}>
+ <ListItemText primary={i18n.t('Default Perspective')} />
+ <PerspectiveSelector
+ onChange={changePerspective}
+ defaultValue={defaultPerspective}
+ testId="changePerspectiveInSettingsTID"
+ />
+ </ListItem>
+ <ListItem
+ className={classes.listItem}
+ title={
+ AppConfig.useSidecarsForFileTaggingDisableSetting
+ ? i18n.t('core:settingExternallyConfigured')
+ : ''
+ }
+ >
+ <ListItemText primary={i18n.t('core:fileTaggingSetting')} />
+ {AppConfig.useSidecarsForFileTaggingDisableSetting ? (
+ <Button size="small" variant="outlined" disabled>
+ {persistTagsInSidecarFile
+ ? i18n.t('core:useSidecarFile')
+ : i18n.t('core:renameFile')}
+ </Button>
+ ) : (
+ <ToggleButtonGroup
+ value={persistTagsInSidecarFile}
+ size="small"
+ exclusive
+ >
+ <ToggleButton
+ value={false}
+ data-tid="settingsSetPersistTagsInFileName"
+ onClick={() => props.setPersistTagsInSidecarFile(false)}
>
- <ToggleButton
- value={false}
- data-tid="settingsSetPersistTagsInFileName"
- onClick={() => props.setPersistTagsInSidecarFile(false)}
+ <Tooltip
+ arrow
+ title={
+ <Typography color="inherit">
+ {i18n.t('core:tagsInFilenameExplanation')}
+ </Typography>
+ }
>
- <Tooltip
- arrow
- title={
- <Typography color="inherit">
- {i18n.t('core:tagsInFilenameExplanation')}
- </Typography>
- }
- >
- <div style={{ display: 'flex' }}>
- {!persistTagsInSidecarFile && <CheckIcon />}
- &nbsp;{i18n.t('core:renameFile')}&nbsp;&nbsp;
- <InfoIcon />
- </div>
- </Tooltip>
- </ToggleButton>
- <ToggleButton
- value={true}
- data-tid="settingsSetPersistTagsInSidecarFile"
- onClick={() => props.setPersistTagsInSidecarFile(true)}
+ <div style={{ display: 'flex' }}>
+ {!persistTagsInSidecarFile && <CheckIcon />}
+ &nbsp;{i18n.t('core:renameFile')}&nbsp;&nbsp;
+ <InfoIcon />
+ </div>
+ </Tooltip>
+ </ToggleButton>
+ <ToggleButton
+ value={true}
+ data-tid="settingsSetPersistTagsInSidecarFile"
+ onClick={() => props.setPersistTagsInSidecarFile(true)}
+ >
+ <Tooltip
+ arrow
+ title={
+ <Typography color="inherit">
+ {i18n.t('core:tagsInSidecarFileExplanation')}
+ </Typography>
+ }
>
- <Tooltip
- arrow
- title={
- <Typography color="inherit">
- {i18n.t('core:tagsInSidecarFileExplanation')}
- </Typography>
- }
- >
- <div style={{ display: 'flex' }}>
- {persistTagsInSidecarFile && <CheckIcon />}
- &nbsp;{i18n.t('core:useSidecarFile')}&nbsp;&nbsp;
- <InfoIcon />
- </div>
- </Tooltip>
- </ToggleButton>
- </ToggleButtonGroup>
- )}
- </ListItem>
- <ListItem className={classes.listItem}>
- <ListItemText primary={i18n.t('core:checkForNewVersionOnStartup')} />
- <Switch
- data-tid="settingsSetCheckForUpdates"
- onClick={() =>
- props.setCheckForUpdates(!props.settings.checkForUpdates)
- }
- checked={props.settings.checkForUpdates}
- />
- </ListItem>
- <ListItem className={classes.listItem}>
- <ListItemText
- primary={
- <>
- {i18n.t('core:reorderTags')}
- <BetaLabel />
- </>
- }
- />
- <Switch
- data-tid="reorderTagsTID"
- onClick={() => props.reorderTags(!props.settings.reorderTags)}
- checked={props.settings.reorderTags}
- />
- </ListItem>
- <ListItem className={classes.listItem}>
- <ListItemText primary={i18n.t('core:addTagsToLibrary')} />
- <Switch
- data-tid="settingsSetAddTagsToLibrary"
- onClick={() =>
- props.setAddTagsToLibrary(!props.settings.addTagsToLibrary)
- }
- checked={props.settings.addTagsToLibrary}
+ <div style={{ display: 'flex' }}>
+ {persistTagsInSidecarFile && <CheckIcon />}
+ &nbsp;{i18n.t('core:useSidecarFile')}&nbsp;&nbsp;
+ <InfoIcon />
+ </div>
+ </Tooltip>
+ </ToggleButton>
+ </ToggleButtonGroup>
+ )}
+ </ListItem>
+ <ListItem className={classes.listItem}>
+ <ListItemText primary={i18n.t('core:checkForNewVersionOnStartup')} />
+ <Switch
+ data-tid="settingsSetCheckForUpdates"
+ onClick={() =>
+ props.setCheckForUpdates(!props.settings.checkForUpdates)
+ }
+ checked={props.settings.checkForUpdates}
+ />
+ </ListItem>
+ <ListItem className={classes.listItem}>
+ <ListItemText
+ primary={
+ <>
+ {i18n.t('core:reorderTags')}
+ <BetaLabel />
+ </>
+ }
+ />
+ <Switch
+ data-tid="reorderTagsTID"
+ onClick={() => props.reorderTags(!props.settings.reorderTags)}
+ checked={props.settings.reorderTags}
+ />
+ </ListItem>
+ <ListItem className={classes.listItem}>
+ <ListItemText primary={i18n.t('core:addTagsToLibrary')} />
+ <Switch
+ data-tid="settingsSetAddTagsToLibrary"
+ onClick={() =>
+ props.setAddTagsToLibrary(!props.settings.addTagsToLibrary)
+ }
+ checked={props.settings.addTagsToLibrary}
+ />
+ </ListItem>
+ <ListItem className={classes.listItem}>
+ <ListItemText primary={i18n.t('core:useGenerateThumbnails')} />
+ <Switch
+ disabled={AppConfig.useGenerateThumbnails !== undefined}
+ data-tid="settingsUseGenerateThumbnails"
+ onClick={() =>
+ props.setUseGenerateThumbnails(
+ !props.settings.useGenerateThumbnails
+ )
+ }
+ checked={
+ AppConfig.useGenerateThumbnails !== undefined
+ ? AppConfig.useGenerateThumbnails
+ : props.settings.useGenerateThumbnails
+ }
+ />
+ </ListItem>
+ <ListItem className={classes.listItem}>
+ <ListItemText primary={i18n.t('core:tagBackgroundColor')} />
+ <TransparentBackground>
+ <Button
+ data-tid="settingsToggleDefaultTagBackgroundColor"
+ className={classes.colorChooserButton}
+ size="small"
+ style={{
+ backgroundColor: props.settings.tagBackgroundColor
+ }}
+ onClick={toggleDefaultTagBackgroundColorPicker}
+ >
+ &nbsp;
+ </Button>
+ </TransparentBackground>
+ {displayColorPicker && (
+ <ColorPickerDialog
+ open={displayColorPicker}
+ setColor={color => {
+ props.setTagColor(color);
+ }}
+ onClose={toggleDefaultTagBackgroundColorPicker}
+ color={props.settings.tagBackgroundColor}
/>
- </ListItem>
- <ListItem className={classes.listItem}>
- <ListItemText primary={i18n.t('core:useGenerateThumbnails')} />
- <Switch
- disabled={AppConfig.useGenerateThumbnails !== undefined}
- data-tid="settingsUseGenerateThumbnails"
- onClick={() =>
- props.setUseGenerateThumbnails(
- !props.settings.useGenerateThumbnails
- )
- }
- checked={
- AppConfig.useGenerateThumbnails !== undefined
- ? AppConfig.useGenerateThumbnails
- : props.settings.useGenerateThumbnails
- }
+ )}
+ </ListItem>
+ <ListItem className={classes.listItem}>
+ <ListItemText primary={i18n.t('core:tagForegroundColor')} />
+ <TransparentBackground>
+ <Button
+ data-tid="settingsToggleDefaultTagForegroundColor"
+ className={classes.colorChooserButton}
+ size="small"
+ style={{ backgroundColor: props.settings.tagTextColor }}
+ onClick={toggleDefaultTagTextColorPicker}
+ >
+ &nbsp;
+ </Button>
+ </TransparentBackground>
+ {displayTextColorPicker && (
+ <ColorPickerDialog
+ open={displayTextColorPicker}
+ setColor={color => {
+ props.setTagTextColor(color);
+ }}
+ onClose={toggleDefaultTagTextColorPicker}
+ color={props.settings.tagTextColor}
/>
- </ListItem>
- <ListItem className={classes.listItem}>
- <ListItemText primary={i18n.t('core:tagBackgroundColor')} />
- <TransparentBackground>
- <Button
- data-tid="settingsToggleDefaultTagBackgroundColor"
- className={classes.colorChooserButton}
- size="small"
- style={{
- backgroundColor: props.settings.tagBackgroundColor
- }}
- onClick={toggleDefaultTagBackgroundColorPicker}
- >
- &nbsp;
- </Button>
- </TransparentBackground>
- {displayColorPicker && (
- <ColorPickerDialog
- open={displayColorPicker}
- setColor={color => {
- props.setTagColor(color);
- }}
- onClose={toggleDefaultTagBackgroundColorPicker}
- color={props.settings.tagBackgroundColor}
- />
- )}
- </ListItem>
- <ListItem className={classes.listItem}>
- <ListItemText primary={i18n.t('core:tagForegroundColor')} />
- <TransparentBackground>
- <Button
- data-tid="settingsToggleDefaultTagForegroundColor"
- className={classes.colorChooserButton}
- size="small"
- style={{ backgroundColor: props.settings.tagTextColor }}
- onClick={toggleDefaultTagTextColorPicker}
- >
- &nbsp;
- </Button>
- </TransparentBackground>
- {displayTextColorPicker && (
- <ColorPickerDialog
- open={displayTextColorPicker}
- setColor={color => {
- props.setTagTextColor(color);
- }}
- onClose={toggleDefaultTagTextColorPicker}
- color={props.settings.tagTextColor}
- />
- )}
- </ListItem>
- {AppConfig.isElectron && (
- <ListItem className={classes.listItem}>
- <ListItemText primary={i18n.t('core:useTrashCan')} />
- <Switch
- data-tid="settingsSetUseTrashCan"
- onClick={() => props.setUseTrashCan(!props.settings.useTrashCan)}
- checked={props.settings.useTrashCan}
- />
- </ListItem>
)}
+ </ListItem>
+ {AppConfig.isElectron && (
<ListItem className={classes.listItem}>
- <ListItemText primary={i18n.t('core:showUnixHiddenFiles')} />
+ <ListItemText primary={i18n.t('core:useTrashCan')} />
<Switch
- data-tid="settingsSetShowUnixHiddenEntries"
- onClick={props.toggleShowUnixHiddenEntries}
- checked={props.settings.showUnixHiddenEntries}
+ data-tid="settingsSetUseTrashCan"
+ onClick={() => props.setUseTrashCan(!props.settings.useTrashCan)}
+ checked={props.settings.useTrashCan}
/>
</ListItem>
- {/* <ListItem className={classes.listItem}>
+ )}
+ <ListItem className={classes.listItem}>
+ <ListItemText primary={i18n.t('core:showUnixHiddenFiles')} />
+ <Switch
+ data-tid="settingsSetShowUnixHiddenEntries"
+ onClick={props.toggleShowUnixHiddenEntries}
+ checked={props.settings.showUnixHiddenEntries}
+ />
+ </ListItem>
+ {/* <ListItem className={classes.listItem}>
<ListItemText style={{ maxWidth: '300px' }} primary={i18n.t('core:tagDelimiterChoose')} />
<Select
style={{ minWidth: '170px' }}
@@ -375,20 +374,19 @@ const SettingsGeneral = (props: Props) => {
<MenuItem value=",">{i18n.t('core:tagDelimiterComma')}</MenuItem>
</Select>
</ListItem> */}
- <ListItem className={classes.listItem}>
- <ListItemText primary={i18n.t('core:maxSearchResultChoose')} />
- <Input
- style={{ maxWidth: '100px' }}
- type="number"
- data-tid="settingsMaxSearchResult"
- value={props.settings.maxSearchResult}
- onChange={handleMaxSearchResult}
- />
- </ListItem>
- </List>
- </>
+ <ListItem className={classes.listItem}>
+ <ListItemText primary={i18n.t('core:maxSearchResultChoose')} />
+ <Input
+ style={{ maxWidth: '100px' }}
+ type="number"
+ data-tid="settingsMaxSearchResult"
+ value={props.settings.maxSearchResult}
+ onChange={handleMaxSearchResult}
+ />
+ </ListItem>
+ </List>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/components/dialogs/settings/SettingsKeyBindings.tsx b/app/components/dialogs/settings/SettingsKeyBindings.tsx
index b2b33b509..76beb2ab3 100644
--- a/app/components/dialogs/settings/SettingsKeyBindings.tsx
+++ b/app/components/dialogs/settings/SettingsKeyBindings.tsx
@@ -24,6 +24,7 @@ import TextField from '@material-ui/core/TextField';
import Switch from '@material-ui/core/Switch';
import ListItem from '@material-ui/core/ListItem';
import ListItemText from '@material-ui/core/ListItemText';
+import { isStr } from '@tagspaces/tagspaces-platforms/misc';
import PlatformIO from '-/services/platform-facade';
import i18n from '-/services/i18n';
import {
@@ -32,7 +33,6 @@ import {
isGlobalKeyBindingEnabled
} from '-/reducers/settings';
import DefaultSettings from '-/reducers/settings-default';
-import { isStr } from '-/utils/misc';
const styles: any = (theme: any) => ({
root: {
@@ -56,7 +56,7 @@ interface Props {
globalKeyBindingEnabled: boolean;
}
-const SettingsKeyBindings = (props: Props) => {
+function SettingsKeyBindings(props: Props) {
const {
keyBindings,
classes,
@@ -98,7 +98,7 @@ const SettingsKeyBindings = (props: Props) => {
})}
</form>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/components/menus/DirectoryMenu.tsx b/app/components/menus/DirectoryMenu.tsx
index 75c1cefe3..f74c5217e 100644
--- a/app/components/menus/DirectoryMenu.tsx
+++ b/app/components/menus/DirectoryMenu.tsx
@@ -38,20 +38,20 @@ import NewFolderIcon from '@material-ui/icons/CreateNewFolder';
import PropertiesIcon from '@material-ui/icons/Info';
import { Progress } from 'aws-sdk/clients/s3';
import ImageIcon from '@material-ui/icons/Image';
-import { Pro } from '../../pro';
-import CreateDirectoryDialog from '../dialogs/CreateDirectoryDialog';
-// import RenameDirectoryDialog from '../dialogs/RenameDirectoryDialog';
-import AppConfig from '-/config';
-import i18n from '-/services/i18n';
+import { formatDateTime4Tag } from '@tagspaces/tagspaces-platforms/misc';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import {
extractContainingDirectoryPath,
extractDirectoryName,
getThumbFileLocationForDirectory,
normalizePath,
generateSharingLink
-} from '-/utils/paths';
+} from '@tagspaces/tagspaces-platforms/paths';
+import { Pro } from '../../pro';
+import CreateDirectoryDialog from '../dialogs/CreateDirectoryDialog';
+// import RenameDirectoryDialog from '../dialogs/RenameDirectoryDialog';
+import i18n from '-/services/i18n';
import PlatformIO from '-/services/platform-facade';
-import { formatDateTime4Tag } from '-/utils/misc';
import { actions as AppActions, getSelectedEntries } from '-/reducers/app';
import IOActions from '-/reducers/io-actions';
import TaggingActions from '-/reducers/tagging-actions';
@@ -114,7 +114,7 @@ interface Props {
locations?: Array<TS.Location>;
}
-const DirectoryMenu = (props: Props) => {
+function DirectoryMenu(props: Props) {
const fileUploadContainerRef = useRef<FileUploadContainerRef>(null);
const {
@@ -709,7 +709,7 @@ Do you want to continue?`)
/>
</div>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/components/menus/EntryTagMenu.tsx b/app/components/menus/EntryTagMenu.tsx
index 888a548bd..57f6d952c 100644
--- a/app/components/menus/EntryTagMenu.tsx
+++ b/app/components/menus/EntryTagMenu.tsx
@@ -48,7 +48,7 @@ interface Props {
isReadOnlyMode?: boolean;
}
-const EntryTagMenu = (props: Props) => {
+function EntryTagMenu(props: Props) {
const [isDeleteTagDialogOpened, setIsDeleteTagDialogOpened] = useState(false);
function showEditTagDialog() {
@@ -162,7 +162,7 @@ const EntryTagMenu = (props: Props) => {
/>
</div>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/components/menus/FileMenu.tsx b/app/components/menus/FileMenu.tsx
index a3acedb69..bdd349666 100644
--- a/app/components/menus/FileMenu.tsx
+++ b/app/components/menus/FileMenu.tsx
@@ -33,8 +33,16 @@ import ImageIcon from '@material-ui/icons/Image';
import ShareIcon from '@material-ui/icons/Link';
import RenameFile from '@material-ui/icons/FormatTextdirectionLToR';
import DeleteForever from '@material-ui/icons/DeleteForever';
+import { formatDateTime4Tag } from '@tagspaces/tagspaces-platforms/misc';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
+import {
+ extractContainingDirectoryPath,
+ extractFileName,
+ extractParentDirectoryPath,
+ extractTags,
+ generateSharingLink
+} from '@tagspaces/tagspaces-platforms/paths';
import i18n from '-/services/i18n';
-import AppConfig from '-/config';
import PlatformIO from '-/services/platform-facade';
import {
generateFileName,
@@ -42,15 +50,7 @@ import {
setFolderThumbnailPromise
} from '-/services/utils-io';
import { Pro } from '-/pro';
-import {
- extractContainingDirectoryPath,
- extractFileName,
- extractParentDirectoryPath,
- extractTags,
- generateSharingLink
-} from '-/utils/paths';
import { TS } from '-/tagspaces.namespace';
-import { formatDateTime4Tag } from '-/utils/misc';
// import AddIcon from '@material-ui/icons/Add';
interface Props {
@@ -83,7 +83,7 @@ interface Props {
locations: Array<TS.Location>;
}
-const FileMenu = (props: Props) => {
+function FileMenu(props: Props) {
const {
selectedEntries,
isReadOnlyMode,
@@ -411,6 +411,6 @@ const FileMenu = (props: Props) => {
</Menu>
</div>
);
-};
+}
export default FileMenu;
diff --git a/app/components/menus/LocationContextMenu.tsx b/app/components/menus/LocationContextMenu.tsx
index 69639855d..35d00aa15 100644
--- a/app/components/menus/LocationContextMenu.tsx
+++ b/app/components/menus/LocationContextMenu.tsx
@@ -30,14 +30,14 @@ import OpenFolderNativelyIcon from '@material-ui/icons/Launch';
import CloseIcon from '@material-ui/icons/Close';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
+import { locationType } from '@tagspaces/tagspaces-platforms/misc';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import { actions as LocationActions } from '-/reducers/locations';
import { actions as LocationIndexActions } from '-/reducers/location-index';
import i18n from '-/services/i18n';
import { actions as AppActions } from '-/reducers/app';
-import { getLocationPath } from '-/utils/paths';
-import AppConfig from '-/config';
import { TS } from '-/tagspaces.namespace';
-import { locationType } from '-/utils/misc';
+import PlatformIO from "-/services/platform-facade";
interface Props {
setEditLocationDialogOpened: (open: boolean) => void;
@@ -53,7 +53,7 @@ interface Props {
setLocationDirectoryContextMenuAnchorEl: (el: HTMLElement) => void;
}
-const LocationContextMenu = (props: Props) => {
+function LocationContextMenu(props: Props) {
const indexLocation = () => {
props.setLocationDirectoryContextMenuAnchorEl(null);
props.createLocationIndex(props.selectedLocation);
@@ -87,7 +87,7 @@ const LocationContextMenu = (props: Props) => {
const showInFileManager = () => {
props.setLocationDirectoryContextMenuAnchorEl(null);
- props.showInFileManager(getLocationPath(props.selectedLocation));
+ props.showInFileManager(PlatformIO.getLocationPath(props.selectedLocation));
// props.openDirectory(selectedLocation.path || selectedLocation.paths[0]);
};
@@ -200,7 +200,7 @@ const LocationContextMenu = (props: Props) => {
{menuItems}
</Menu>
);
-};
+}
function mapDispatchToProps(dispatch) {
return bindActionCreators(
diff --git a/app/components/menus/LocationManagerMenu.tsx b/app/components/menus/LocationManagerMenu.tsx
index 172c6ae8f..a0ec44247 100644
--- a/app/components/menus/LocationManagerMenu.tsx
+++ b/app/components/menus/LocationManagerMenu.tsx
@@ -33,7 +33,7 @@ import IconButton from '@material-ui/core/IconButton';
import MoreVertIcon from '@material-ui/icons/MoreVert';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
-import AppConfig from '-/config';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import i18n from '-/services/i18n';
import { Pro } from '../../pro';
import { actions as AppActions } from '-/reducers/app';
@@ -52,7 +52,7 @@ interface Props {
createLocationsIndexes: () => void;
}
-const LocationManagerMenu = (props: Props) => {
+function LocationManagerMenu(props: Props) {
const [
locationManagerMenuAnchorEl,
setLocationManagerMenuAnchorEl
@@ -218,7 +218,7 @@ const LocationManagerMenu = (props: Props) => {
</Menu>
</>
);
-};
+}
function mapDispatchToProps(dispatch) {
return bindActionCreators(
diff --git a/app/components/menus/LocationMenu.tsx b/app/components/menus/LocationMenu.tsx
index 7f1f735b5..50cf56264 100644
--- a/app/components/menus/LocationMenu.tsx
+++ b/app/components/menus/LocationMenu.tsx
@@ -30,11 +30,11 @@ import Tooltip from '@material-ui/core/Tooltip';
import { withTheme } from '@material-ui/core/styles';
import IconButton from '@material-ui/core/IconButton';
import ArrowDropDownIcon from '@material-ui/icons/ArrowDropDown';
+import { locationType } from '@tagspaces/tagspaces-platforms/misc';
import i18n from '-/services/i18n';
import { getLocations } from '-/reducers/locations';
import { actions as AppActions, getCurrentLocationId } from '-/reducers/app';
import { TS } from '-/tagspaces.namespace';
-import { locationType } from '-/utils/misc';
interface Props {
currentLocationId: string | null;
@@ -44,7 +44,7 @@ interface Props {
openLocation: (location: TS.Location) => void;
}
-const LocationMenu = (props: Props) => {
+function LocationMenu(props: Props) {
const [
locationChooserMenuAnchorEl,
setLocationChooserMenuAnchorEl
@@ -146,7 +146,7 @@ const LocationMenu = (props: Props) => {
)}
</div>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/components/menus/SearchMenu.tsx b/app/components/menus/SearchMenu.tsx
index 14b281e6e..08346c1c1 100644
--- a/app/components/menus/SearchMenu.tsx
+++ b/app/components/menus/SearchMenu.tsx
@@ -38,7 +38,7 @@ interface Props {
exportSearches: () => void;
}
-const SearchMenu = (props: Props) => {
+function SearchMenu(props: Props) {
const menuItems = [];
menuItems.push(
<MenuItem
@@ -109,6 +109,6 @@ const SearchMenu = (props: Props) => {
</Menu>
</div>
);
-};
+}
export default SearchMenu;
diff --git a/app/components/menus/TagGroupMenu.tsx b/app/components/menus/TagGroupMenu.tsx
index cbac83b97..e9633ddd0 100644
--- a/app/components/menus/TagGroupMenu.tsx
+++ b/app/components/menus/TagGroupMenu.tsx
@@ -57,7 +57,7 @@ interface Props {
maxSearchResults: number;
}
-const TagGroupMenu = (props: Props) => {
+function TagGroupMenu(props: Props) {
function handleCollectTags() {
props.onClose();
@@ -172,7 +172,7 @@ const TagGroupMenu = (props: Props) => {
</Menu>
</div>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/components/menus/TagLibraryMenu.tsx b/app/components/menus/TagLibraryMenu.tsx
index 1730a10de..d6af2a3ed 100644
--- a/app/components/menus/TagLibraryMenu.tsx
+++ b/app/components/menus/TagLibraryMenu.tsx
@@ -25,9 +25,9 @@ import ImportExportIcon from '@material-ui/icons/ImportExport';
import HelpIcon from '@material-ui/icons/Help';
import AddIcon from '@material-ui/icons/Add';
import ReloadIcon from '@material-ui/icons/Sync';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import ImportExportTagGroupsDialog from '../dialogs/ImportExportTagGroupsDialog';
import i18n from '-/services/i18n';
-import AppConfig from '-/config';
import { TS } from '-/tagspaces.namespace';
import Links from '-/links';
import { ProLabel, ProTooltip } from '-/components/HelperComponents';
@@ -52,7 +52,7 @@ interface Props {
refreshTagsFromLocation: () => void;
}
-const TagLibraryMenu = (props: Props) => {
+function TagLibraryMenu(props: Props) {
const fileInput = useRef<HTMLInputElement>(null);
const tagGroupsImported = useRef([]);
// const [tagGroups, setTagGroups] = useState(null);
@@ -194,6 +194,6 @@ const TagLibraryMenu = (props: Props) => {
/>
</div>
);
-};
+}
export default TagLibraryMenu;
diff --git a/app/components/menus/TagMenu.tsx b/app/components/menus/TagMenu.tsx
index 2371f6f9a..5d7765870 100644
--- a/app/components/menus/TagMenu.tsx
+++ b/app/components/menus/TagMenu.tsx
@@ -55,7 +55,7 @@ interface Props {
) => void;
}
-const TagMenu = (props: Props) => {
+function TagMenu(props: Props) {
const {
isReadOnlyMode,
selectedTag,
@@ -74,7 +74,7 @@ const TagMenu = (props: Props) => {
if (selectedTag) {
setSearchQuery({
tagsAND: [selectedTag],
- maxSearchResults: maxSearchResults
+ maxSearchResults
});
}
onClose();
@@ -135,7 +135,7 @@ const TagMenu = (props: Props) => {
</Menu>
</div>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/config.ts b/app/config.ts
deleted file mode 100644
index 8c4f01fd2..000000000
--- a/app/config.ts
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * TagSpaces - universal file and folder organizer
- * Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License (version 3) as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- *
- */
-const isCordovaiOS =
- /^file:\/{3}[^\/]/i.test(window.location.href) &&
- /ios|iphone|ipod|ipad/i.test(navigator.userAgent);
-const isCordovaAndroid = document.URL.indexOf('file:///android_asset') === 0;
-const iOSMatcher = navigator.userAgent.match(/(iPad|iPhone|iPod)/i);
-const isIOS = iOSMatcher && iOSMatcher.length > 0;
-const isAndroid = navigator.userAgent.toLowerCase().includes('android');
-
-const AppConfig = {
- tagspacesAppPath: '/tagspaces/',
- metaFolder: '.ts',
- metaFolderFile: 'tsm.json',
- folderLocationsFile: 'tsl.json',
- folderIndexFile: 'tsi.json',
- folderThumbFile: 'tst.jpg',
- metaFileExt: '.json',
- thumbFileExt: '.jpg',
- thumbType: 'image/jpeg',
- contentFileExt: '.txt',
- beginTagContainer: '[',
- endTagContainer: ']',
- tagDelimiter: ' ',
- prefixTagContainer: '',
- maxCollectedTag: 500,
- maxThumbSize: 400,
- thumbBgColor: '#FFFFFF',
- indexerLimit: 200000,
- mainToolbarHeight: 105,
- maxIndexAge: 10 * 60 * 1000, // 10 minutes
- // maxSearchResult: 1000,
- defaultFileColor: '#808080',
- defaultFolderColor: '#582727', // 555 transparent #FDEEBD #ff791b #2c001e #880e4f
- isElectron: navigator.userAgent.toLowerCase().includes(' electron/'),
- isFirefox: navigator.userAgent.toLowerCase().includes('firefox'), // typeof InstallTrigger !== 'undefined';
- isWin: navigator.userAgent.toLowerCase().includes('win'),
- isLinux: navigator.userAgent.toLowerCase().includes('linux'),
- isMacLike: navigator.userAgent.match(/(Mac|iPhone|iPod|iPad)/i),
- isIOS,
- isAndroid,
- isWeb:
- document.URL.startsWith('http') &&
- !document.URL.startsWith('http://localhost:1212/'),
- isCordovaiOS,
- isCordovaAndroid,
- isCordova: isCordovaiOS || isCordovaAndroid,
- isMobile: isCordovaiOS || isCordovaAndroid || isIOS || isAndroid,
- isAmplify: window.ExtIsAmplify !== undefined ? window.ExtIsAmplify : false,
- saveLocationsInBrowser:
- window.ExtSaveLocationsInBrowser !== undefined
- ? window.ExtSaveLocationsInBrowser
- : false,
- useSidecarsForFileTagging:
- window.ExtUseSidecarsForFileTagging !== undefined
- ? window.ExtUseSidecarsForFileTagging
- : false,
- useSidecarsForFileTaggingDisableSetting:
- window.ExtUseSidecarsForFileTagging !== undefined,
- useGenerateThumbnails: window.ExtUseGenerateThumbnails,
- geoTaggingFormat:
- window.ExtGeoTaggingFormat &&
- window.ExtGeoTaggingFormat.toLocaleLowerCase(),
- customLogo: window.ExtLogoURL || false,
- showAdvancedSearch:
- window.ExtShowAdvancedSearch !== undefined
- ? window.ExtShowAdvancedSearch
- : true,
- showSmartTags:
- window.ExtShowSmartTags !== undefined ? window.ExtShowSmartTags : true,
- showWelcomePanel:
- window.ExtShowWelcomePanel !== undefined
- ? window.ExtShowWelcomePanel
- : true,
- locationsReadOnly: window.ExtLocations !== undefined,
- mapTileServers: window.ExtMapTileServers || false,
- lightThemeLightColor: window.ExtLightThemeLightColor || '#dcf3ec',
- lightThemeMainColor: window.ExtLightThemeMainColor || '#1dd19f',
- darkThemeLightColor: window.ExtDarkThemeLightColor || '#56454e',
- darkThemeMainColor: window.ExtDarkThemeMainColor || '#ff9abe',
- dirSeparator:
- navigator.appVersion.includes('Win') && !document.URL.startsWith('http')
- ? '\\'
- : '/'
-};
-
-export default AppConfig;
diff --git a/app/containers/App.tsx b/app/containers/App.tsx
index 4b24c7485..037a91b35 100644
--- a/app/containers/App.tsx
+++ b/app/containers/App.tsx
@@ -20,9 +20,9 @@ import React from 'react';
import { connect } from 'react-redux';
import { I18nextProvider } from 'react-i18next'; // as we build ourself via webpack
import { createTheme, ThemeProvider } from '@material-ui/core/styles';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import i18n from '../services/i18n';
import { getCurrentTheme } from '-/reducers/settings';
-import AppConfig from '-/config';
const lightTheme = createTheme({
palette: {
@@ -79,7 +79,7 @@ interface Props {
children: Object;
currentTheme: string;
}
-const App = (props: Props) => {
+function App(props: Props) {
let theme;
switch (props.currentTheme) {
case 'light': {
@@ -101,7 +101,7 @@ const App = (props: Props) => {
<I18nextProvider i18n={i18n}>{props.children}</I18nextProvider>
</ThemeProvider>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/containers/MainPage.tsx b/app/containers/MainPage.tsx
index 1468b8620..3f7eb2ec9 100644
--- a/app/containers/MainPage.tsx
+++ b/app/containers/MainPage.tsx
@@ -29,6 +29,8 @@ import { NativeTypes } from 'react-dnd-html5-backend';
import { Progress } from 'aws-sdk/clients/s3';
import { CognitoUserInterface } from '@aws-amplify/ui-components';
import { Split } from 'ts-react-splitter';
+import { buffer } from '@tagspaces/tagspaces-platforms/misc';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import MobileNavigation from '../components/MobileNavigation';
import FolderContainer from '../components/FolderContainer';
import EntryContainer from '../components/EntryContainer';
@@ -70,9 +72,7 @@ import {
currentUser,
isLocationDialogOpened
} from '../reducers/app';
-import { buffer } from '-/utils/misc';
import TargetFileBox from '../components/TargetFileBox';
-import AppConfig from '../config';
import i18n from '../services/i18n';
import LoadingLazy from '../components/LoadingLazy';
import withDnDContext from '-/containers/withDnDContext';
diff --git a/app/containers/PageNotification.tsx b/app/containers/PageNotification.tsx
index c703fb82e..8da5435f3 100644
--- a/app/containers/PageNotification.tsx
+++ b/app/containers/PageNotification.tsx
@@ -67,7 +67,7 @@ const TSNotification = withStyles((theme: Theme) =>
})
)(Snackbar);
-const PageNotification = (props: Props) => {
+function PageNotification(props: Props) {
const skipRelease = () => {
props.setUpdateAvailable(false);
};
@@ -179,7 +179,7 @@ const PageNotification = (props: Props) => {
/>
</>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/containers/RendererListener.ts b/app/containers/RendererListener.ts
index 63e213c13..d120b6816 100644
--- a/app/containers/RendererListener.ts
+++ b/app/containers/RendererListener.ts
@@ -16,7 +16,7 @@
*
*/
-import AppConfig from '-/config';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
export default function listen(props) {
let ipcRenderer;
diff --git a/app/containers/Root.tsx b/app/containers/Root.tsx
index 08d0f9b38..f23d4171e 100644
--- a/app/containers/Root.tsx
+++ b/app/containers/Root.tsx
@@ -20,9 +20,9 @@ import React from 'react';
import { Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/integration/react';
import { Store } from 'redux';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import LoadingScreen from '../components/LoadingScreen';
import { actions as AppActions } from '../reducers/app';
-import AppConfig from '-/config';
import App from '-/containers/App';
import MainPage from '-/containers/MainPage';
import TsAuth from '-/containers/TsAuth';
diff --git a/app/containers/withDnDContext.tsx b/app/containers/withDnDContext.tsx
index 4d3029553..9cc780323 100644
--- a/app/containers/withDnDContext.tsx
+++ b/app/containers/withDnDContext.tsx
@@ -2,10 +2,11 @@ import * as React from 'react';
import { DndProvider } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend';
-export default Component => {
- return props => (
- <DndProvider backend={HTML5Backend}>
- <Component {...props} />
- </DndProvider>
- );
-};
+export default Component =>
+ function(props) {
+ return (
+ <DndProvider backend={HTML5Backend}>
+ <Component {...props} />
+ </DndProvider>
+ );
+ };
diff --git a/app/perspectives/grid-perspective/components/CellContent.tsx b/app/perspectives/grid-perspective/components/CellContent.tsx
index dabb08528..cc97f0cfb 100644
--- a/app/perspectives/grid-perspective/components/CellContent.tsx
+++ b/app/perspectives/grid-perspective/components/CellContent.tsx
@@ -27,8 +27,12 @@ import SelectedIcon from '@material-ui/icons/CheckBox';
import UnSelectedIcon from '@material-ui/icons/CheckBoxOutlineBlank';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
-import { formatFileSize, formatDateTime } from '-/utils/misc';
-import { extractTagsAsObjects, extractTitle } from '-/utils/paths';
+import {
+ formatFileSize,
+ formatDateTime
+} from '@tagspaces/tagspaces-platforms/misc';
+import { extractTagsAsObjects, extractTitle } from '@tagspaces/tagspaces-platforms/paths';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import {
findBackgroundColorForFolder,
findColorForEntry,
@@ -39,11 +43,10 @@ import TagContainer from '-/components/TagContainer';
import TagsPreview from '-/components/TagsPreview';
import i18n from '-/services/i18n';
import PlatformIO from '-/services/platform-facade';
-import AppConfig from '-/config';
import EntryIcon from '-/components/EntryIcon';
import { TS } from '-/tagspaces.namespace';
import TaggingActions from '-/reducers/tagging-actions';
-import { getTagColor } from '-/reducers/settings';
+// import { getTagColor } from '-/reducers/settings';
const maxDescriptionPreviewLength = 100;
@@ -74,7 +77,7 @@ interface Props {
reorderTags: boolean;
}
-const CellContent = (props: Props) => {
+function CellContent(props: Props) {
const {
selected,
fsEntry,
@@ -265,7 +268,7 @@ const CellContent = (props: Props) => {
title={fsEntry.isIgnored && i18n.t('core:ignoredFolder')}
style={{
opacity: fsEntry.isIgnored ? 0.3 : 1,
- backgroundColor: backgroundColor,
+ backgroundColor,
borderRadius: 5
}}
>
@@ -462,7 +465,7 @@ const CellContent = (props: Props) => {
{gridCell}
</Paper>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/perspectives/grid-perspective/components/GridOptionsMenu.tsx b/app/perspectives/grid-perspective/components/GridOptionsMenu.tsx
index e8378b9b1..4c6edd680 100644
--- a/app/perspectives/grid-perspective/components/GridOptionsMenu.tsx
+++ b/app/perspectives/grid-perspective/components/GridOptionsMenu.tsx
@@ -50,7 +50,7 @@ interface Props {
openSettings: () => void;
}
-const GridOptionsMenu = (props: Props) => {
+function GridOptionsMenu(props: Props) {
const {
open,
onClose,
@@ -223,6 +223,6 @@ const GridOptionsMenu = (props: Props) => {
</MenuItem>
</Menu>
);
-};
+}
export default GridOptionsMenu;
diff --git a/app/perspectives/grid-perspective/components/GridPagination.tsx b/app/perspectives/grid-perspective/components/GridPagination.tsx
index 465105cbb..90895d08b 100644
--- a/app/perspectives/grid-perspective/components/GridPagination.tsx
+++ b/app/perspectives/grid-perspective/components/GridPagination.tsx
@@ -22,6 +22,13 @@ import Typography from '@material-ui/core/Typography';
import Tooltip from '@material-ui/core/Tooltip';
import Pagination from '@material-ui/lab/Pagination';
import { bindActionCreators } from 'redux';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
+import {
+ getMetaFileLocationForDir,
+ getMetaFileLocationForFile,
+ getThumbFileLocationForDirectory,
+ getThumbFileLocationForFile
+} from '@tagspaces/tagspaces-platforms/paths';
import i18n from '-/services/i18n';
import {
actions as AppActions,
@@ -31,15 +38,8 @@ import {
isLoading
} from '-/reducers/app';
import EntryIcon from '-/components/EntryIcon';
-import AppConfig from '-/config';
import { TS } from '-/tagspaces.namespace';
import { getMetaForEntry } from '-/services/utils-io';
-import {
- getMetaFileLocationForDir,
- getMetaFileLocationForFile,
- getThumbFileLocationForDirectory,
- getThumbFileLocationForFile
-} from '-/utils/paths';
import PlatformIO from '-/services/platform-facade';
interface Props {
diff --git a/app/perspectives/grid-perspective/components/GridSettingsDialog.tsx b/app/perspectives/grid-perspective/components/GridSettingsDialog.tsx
index 1c9736f74..0d4826912 100644
--- a/app/perspectives/grid-perspective/components/GridSettingsDialog.tsx
+++ b/app/perspectives/grid-perspective/components/GridSettingsDialog.tsx
@@ -80,7 +80,7 @@ interface Props {
// setShowDirectories: (check: boolean) => void;
}
-const GridSettingsDialog = (props: Props) => {
+function GridSettingsDialog(props: Props) {
const {
open,
onClose,
@@ -302,6 +302,6 @@ const GridSettingsDialog = (props: Props) => {
</DialogActions>
</Dialog>
);
-};
+}
export default withStyles(styles, { withTheme: true })(GridSettingsDialog);
diff --git a/app/perspectives/grid-perspective/components/MainContainer.tsx b/app/perspectives/grid-perspective/components/MainContainer.tsx
index 6dd096e39..69b0643cf 100644
--- a/app/perspectives/grid-perspective/components/MainContainer.tsx
+++ b/app/perspectives/grid-perspective/components/MainContainer.tsx
@@ -21,6 +21,13 @@ import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { GlobalHotKeys } from 'react-hotkeys';
import { withStyles } from '@material-ui/core/styles';
+import {
+ isObj,
+ locationType,
+ sortByCriteria
+} from '@tagspaces/tagspaces-platforms/misc';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
+import { isVisibleOnScreen } from '-/utils/dom';
import { actions as TagLibraryActions } from '-/reducers/taglibrary';
import {
getSupportedFileTypes,
@@ -28,12 +35,6 @@ import {
getKeyBindingObject
// isDesktopMode
} from '-/reducers/settings';
-import {
- isObj,
- isVisibleOnScreen,
- locationType,
- sortByCriteria
-} from '-/utils/misc';
import styles from './styles.css';
import FileMenu from '-/components/menus/FileMenu';
import DirectoryMenu from '-/components/menus/DirectoryMenu';
@@ -43,7 +44,6 @@ import AddRemoveTagsDialog from '-/components/dialogs/AddRemoveTagsDialog';
import MoveCopyFilesDialog from '-/components/dialogs/MoveCopyFilesDialog';
import TargetMoveFileBox from '-/components/TargetMoveFileBox';
import FileSourceDnd from '-/components/FileSourceDnd';
-import AppConfig from '-/config';
import DragItemTypes from '-/components/DragItemTypes';
import TagDropContainer from '-/components/TagDropContainer';
import IOActions from '-/reducers/io-actions';
@@ -61,7 +61,6 @@ import SortingMenu from './SortingMenu';
import GridOptionsMenu from './GridOptionsMenu';
import { getLocation, getLocations } from '-/reducers/locations';
import PlatformIO from '-/services/platform-facade';
-import { getLocationPath } from '-/utils/paths';
import GridPagination from '-/perspectives/grid-perspective/components/GridPagination';
import GridSettingsDialog from '-/perspectives/grid-perspective/components/GridSettingsDialog';
import AddTagToTagGroupDialog from '-/components/dialogs/AddTagToTagGroupDialog';
@@ -718,7 +717,7 @@ function GridPerspective(props: Props) {
);
const sortedFiles = sortedDirContentMemoized.filter(entry => entry.isFile);
const locationPath = props.currentLocation
- ? getLocationPath(props.currentLocation)
+ ? PlatformIO.getLocationPath(props.currentLocation)
: '';
let entryWidth = 200;
if (entrySize === 'small') {
diff --git a/app/perspectives/grid-perspective/components/MainToolbar.tsx b/app/perspectives/grid-perspective/components/MainToolbar.tsx
index d555afca0..d8368e640 100644
--- a/app/perspectives/grid-perspective/components/MainToolbar.tsx
+++ b/app/perspectives/grid-perspective/components/MainToolbar.tsx
@@ -34,9 +34,9 @@ import PropertiesIcon from '@material-ui/icons/Info';
import ExportIcon from '@material-ui/icons/AssignmentReturn';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import i18n from '-/services/i18n';
import { Pro } from '-/pro';
-import AppConfig from '-/config';
import {
actions as LocationIndexActions,
getSearchQuery
@@ -70,7 +70,7 @@ interface Props {
keyBindings: Array<any>;
}
-const MainToolbar = (props: Props) => {
+function MainToolbar(props: Props) {
const {
classes,
selectedEntries,
@@ -266,7 +266,7 @@ const MainToolbar = (props: Props) => {
</Tooltip>
</Toolbar>
);
-};
+}
function mapStateToProps(state) {
return {
diff --git a/app/perspectives/grid-perspective/components/SortingMenu.tsx b/app/perspectives/grid-perspective/components/SortingMenu.tsx
index 914bc739f..51c14a93d 100644
--- a/app/perspectives/grid-perspective/components/SortingMenu.tsx
+++ b/app/perspectives/grid-perspective/components/SortingMenu.tsx
@@ -34,7 +34,7 @@ interface Props {
orderBy: null | boolean;
}
-const SortingMenu = (props: Props) => {
+function SortingMenu(props: Props) {
const { open, onClose, sortBy, orderBy, handleSortBy, anchorEl } = props;
return (
@@ -113,6 +113,6 @@ const SortingMenu = (props: Props) => {
</MenuItem>
</Menu>
);
-};
+}
export default SortingMenu;
diff --git a/app/perspectives/grid-perspective/components/styles.css.tsx b/app/perspectives/grid-perspective/components/styles.css.tsx
index dff8b8821..0acc555fb 100644
--- a/app/perspectives/grid-perspective/components/styles.css.tsx
+++ b/app/perspectives/grid-perspective/components/styles.css.tsx
@@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
-import AppConfig from '-/config';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
export default (theme: any): any => ({
gridContainer: {
diff --git a/app/perspectives/list/components/MainContainer.tsx b/app/perspectives/list/components/MainContainer.tsx
index 27a4ccf0d..6e47f99ff 100644
--- a/app/perspectives/list/components/MainContainer.tsx
+++ b/app/perspectives/list/components/MainContainer.tsx
@@ -21,6 +21,12 @@ import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { GlobalHotKeys } from 'react-hotkeys';
import { withStyles } from '@material-ui/core/styles';
+import {
+ isObj,
+ locationType,
+ sortByCriteria
+} from '@tagspaces/tagspaces-platforms/misc';
+import { isVisibleOnScreen } from '-/utils/dom';
import { actions as TagLibraryActions } from '-/reducers/taglibrary';
import {
getSupportedFileTypes,
@@ -28,12 +34,6 @@ import {
getKeyBindingObject
// isDesktopMode
} from '-/reducers/settings';
-import {
- isObj,
- isVisibleOnScreen,
- locationType,
- sortByCriteria
-} from '-/utils/misc';
import styles from '-/perspectives/grid-perspective/components/styles.css';
import FileMenu from '-/components/menus/FileMenu';
import DirectoryMenu from '-/components/menus/DirectoryMenu';
@@ -43,7 +43,7 @@ import AddRemoveTagsDialog from '-/components/dialogs/AddRemoveTagsDialog';
import MoveCopyFilesDialog from '-/components/dialogs/MoveCopyFilesDialog';
import TargetMoveFileBox from '-/components/TargetMoveFileBox';
import FileSourceDnd from '-/components/FileSourceDnd';
-import AppConfig from '-/config';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import DragItemTypes from '-/components/DragItemTypes';
import TagDropContainer from '-/components/TagDropContainer';
import IOActions from '-/reducers/io-actions';
@@ -61,7 +61,6 @@ import SortingMenu from '-/perspectives/grid-perspective/components/SortingMenu'
import GridOptionsMenu from '-/perspectives/grid-perspective/components/GridOptionsMenu';
import { getLocation, getLocations } from '-/reducers/locations';
import PlatformIO from '-/services/platform-facade';
-import { getLocationPath } from '-/utils/paths';
import GridPagination from '-/perspectives/grid-perspective/components/GridPagination';
import GridSettingsDialog from '-/perspectives/grid-perspective/components/GridSettingsDialog';
import AddTagToTagGroupDialog from '-/components/dialogs/AddTagToTagGroupDialog';
@@ -112,7 +111,7 @@ interface Props {
toggleDeleteMultipleEntriesDialog: () => void;
}
-const GridPerspective = (props: Props) => {
+function GridPerspective(props: Props) {
let settings = JSON.parse(localStorage.getItem(defaultSettings.settingsKey)); // loading settings
const [mouseX, setMouseX] = useState<number>(undefined);
@@ -719,7 +718,7 @@ const GridPerspective = (props: Props) => {
);
const sortedFiles = sortedDirContentMemoized.filter(entry => entry.isFile);
const locationPath = props.currentLocation
- ? getLocationPath(props.currentLocation)
+ ? PlatformIO.getLocationPath(props.currentLocation)
: '';
let entryWidth = 200;
if (entrySize === 'small') {
@@ -916,7 +915,7 @@ const GridPerspective = (props: Props) => {
)}
</div>
);
-};
+}
function mapActionCreatorsToProps(dispatch) {
return bindActionCreators(
diff --git a/app/pro/index.ts b/app/pro/index.ts
index 16a1cee82..3575af260 100644
--- a/app/pro/index.ts
+++ b/app/pro/index.ts
@@ -16,7 +16,7 @@
*
*/
-import AppConfig from '-/config';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
let tsPro;
diff --git a/app/reducers/app.ts b/app/reducers/app.ts
index 3fc04b211..ba7d49c9b 100644
--- a/app/reducers/app.ts
+++ b/app/reducers/app.ts
@@ -17,20 +17,11 @@
*/
import { v1 as uuidv1 } from 'uuid';
-import { getLocation, getDefaultLocationId } from './locations';
-import PlatformIO from '../services/platform-facade';
-import AppConfig from '../config';
import {
- deleteFilesPromise,
- loadMetaDataPromise,
- renameFilesPromise,
- getAllPropertiesPromise,
- prepareDirectoryContent,
- findExtensionsForEntry,
- getNextFile,
- getPrevFile,
- loadJSONFile
-} from '-/services/utils-io';
+ formatDateTime4Tag,
+ locationType
+} from '@tagspaces/tagspaces-platforms/misc';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import {
extractFileExtension,
extractDirectoryName,
@@ -41,17 +32,26 @@ import {
extractTagsAsObjects,
normalizePath,
extractContainingDirectoryPath,
- getLocationPath,
getMetaFileLocationForDir
-} from '-/utils/paths';
+} from '@tagspaces/tagspaces-platforms/paths';
import {
- formatDateTime4Tag,
getURLParameter,
clearURLParam,
updateHistory,
- clearAllURLParams,
- locationType
-} from '-/utils/misc';
+ clearAllURLParams
+} from '-/utils/dom';
+import { getLocation, getDefaultLocationId } from './locations';
+import PlatformIO from '../services/platform-facade';
+import {
+ deleteFilesPromise,
+ renameFilesPromise,
+ getAllPropertiesPromise,
+ prepareDirectoryContent,
+ findExtensionsForEntry,
+ getNextFile,
+ getPrevFile,
+ loadJSONFile
+} from '-/services/utils-io';
import i18n from '../services/i18n';
import { Pro } from '../pro';
import { actions as LocationIndexActions } from './location-index';
@@ -224,13 +224,16 @@ export const initialState = {
user: window.ExtDemoUser
? {
attributes: window.ExtDemoUser,
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
associateSoftwareToken: () => {},
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
verifySoftwareToken: () => {}
}
: undefined
};
// The state described here will not be persisted
+// eslint-disable-next-line default-param-last
export default (state: any = initialState, action: any) => {
switch (action.type) {
case types.LOGIN_SUCCESS: {
@@ -494,6 +497,7 @@ export default (state: any = initialState, action: any) => {
const dirEntries = [...state.currentDirectoryEntries];
dirEntries.map(entry => {
if (entry.path === action.filePath) {
+ // eslint-disable-next-line no-param-reassign
entry.thumbPath = action.thumbUrl;
}
return true;
@@ -781,7 +785,7 @@ function disableBackGestureMac() {
export const actions = {
loggedIn: user => ({ type: types.LOGIN_SUCCESS, user }),
- initApp: () => (dispatch: (actions: Object) => void, getState: () => any) => {
+ initApp: () => (dispatch: (action) => void, getState: () => any) => {
disableBackGestureMac();
dispatch(SettingsActions.setZoomRestoreApp());
@@ -841,9 +845,7 @@ export const actions = {
abort
}),
resetProgress: () => ({ type: types.RESET_PROGRESS }),
- onUploadProgress: (progress, abort) => (
- dispatch: (actions: Object) => void
- ) => {
+ onUploadProgress: (progress, abort) => (dispatch: (action) => void) => {
const progressPercentage = Math.round(
(progress.loaded / progress.total) * 100
);
@@ -852,7 +854,7 @@ export const actions = {
dispatch(actions.setProgress(progress.key, progressPercentage, abort));
},
showCreateDirectoryDialog: () => (
- dispatch: (actions: Object) => void,
+ dispatch: (action) => void,
getState: () => any
) => {
const { app } = getState();
@@ -869,7 +871,7 @@ export const actions = {
}
},
showCreateFileDialog: () => (
- dispatch: (actions: Object) => void,
+ dispatch: (action) => void,
getState: () => any
) => {
const { app } = getState();
@@ -910,7 +912,7 @@ export const actions = {
type: types.TOGGLE_UPLOAD_DIALOG
}),
clearUploadDialog: () => (
- dispatch: (actions: Object) => void,
+ dispatch: (action) => void,
getState: () => any
) => {
// const currentLocation: Location = getState().locations.find(location => location.uuid === getCurrentLocationId(getState()))
@@ -979,7 +981,7 @@ export const actions = {
}
}, */
loadParentDirectoryContent: () => (
- dispatch: (actions: Object) => void,
+ dispatch: (action) => void,
getState: () => any
) => {
const state = getState();
@@ -1021,7 +1023,7 @@ export const actions = {
directoryPath: string,
generateThumbnails: boolean,
fsEntryMeta?: TS.FileSystemEntryMeta
- ) => (dispatch: (actions: Object) => void, getState: () => any) => {
+ ) => (dispatch: (action) => void, getState: () => any) => {
const { settings } = getState();
/* const { currentDirectoryPath } = getState().app;
if (currentDirectoryPath !== directoryPath) {
@@ -1073,7 +1075,7 @@ export const actions = {
directoryPath: string,
generateThumbnails: boolean,
loadDirMeta = false
- ) => async (dispatch: (action: any) => void, getState: () => any) => {
+ ) => async (dispatch: (action) => void, getState: () => any) => {
// console.debug('loadDirectoryContent:' + directoryPath);
window.walkCanceled = false;
@@ -1116,9 +1118,9 @@ export const actions = {
},
loadDirectorySuccess: (
directoryPath: string,
- directoryContent: Array<Object>,
+ directoryContent: Array<any>,
directoryMeta?: TS.FileSystemEntryMeta
- ) => (dispatch: (actions: Object) => void) => {
+ ) => (dispatch: (action) => void) => {
// const currentLocation: Location = getLocation(
// getState(),
// getState().app.currentLocationId
@@ -1153,7 +1155,7 @@ export const actions = {
},
loadDirectorySuccessInt: (
directoryPath: string,
- directoryContent: Array<Object>,
+ directoryContent: Array<any>,
showIsLoading?: boolean,
directoryMeta?: TS.FileSystemEntryMeta
) => ({
@@ -1164,7 +1166,7 @@ export const actions = {
showIsLoading
}),
loadDirectoryFailure: (directoryPath: string, error?: any) => (
- dispatch: (actions: Object) => void
+ dispatch: (action) => void
) => {
console.warn('Error loading directory: ' + error);
dispatch(actions.hideNotifications());
@@ -1243,7 +1245,7 @@ export const actions = {
selectedEntries
}),
deleteDirectory: (directoryPath: string) => (
- dispatch: (actions: Object) => void,
+ dispatch: (action) => void,
getState: () => any
) => {
const { settings } = getState();
@@ -1310,7 +1312,7 @@ export const actions = {
PlatformIO.showInFileManager(filePath);
},
renameDirectory: (directoryPath: string, newDirectoryName: string) => (
- dispatch: (actions: Object) => void,
+ dispatch: (action) => void,
getState: () => any
) =>
PlatformIO.renameDirectoryPromise(directoryPath, newDirectoryName)
@@ -1358,9 +1360,7 @@ export const actions = {
);
throw error;
}),
- createDirectory: (directoryPath: string) => (
- dispatch: (actions: Object) => void
- ) => {
+ createDirectory: (directoryPath: string) => (dispatch: (action) => void) => {
PlatformIO.createDirectoryPromise(directoryPath)
.then(result => {
if (result !== undefined && result.dirPath !== undefined) {
@@ -1396,10 +1396,7 @@ export const actions = {
// dispatch stopLoadingAnimation
});
},
- createFile: () => (
- dispatch: (actions: Object) => void,
- getState: () => any
- ) => {
+ createFile: () => (dispatch: (action) => void, getState: () => any) => {
const { app } = getState();
if (app.currentDirectoryPath) {
const filePath =
@@ -1461,7 +1458,7 @@ export const actions = {
fileName: string,
content: string,
fileType: 'md' | 'txt' | 'html'
- ) => (dispatch: (actions: Object) => void, getState: () => any) => {
+ ) => (dispatch: (action) => void, getState: () => any) => {
const fileNameAndExt = fileName + '.' + fileType;
const filePath =
normalizePath(targetPath) + PlatformIO.getDirSeparator() + fileNameAndExt;
@@ -1501,11 +1498,11 @@ export const actions = {
);
});
},
- setSearchResults: (searchResults: Array<Object> | []) => ({
+ setSearchResults: (searchResults: Array<any> | []) => ({
type: types.SET_SEARCH_RESULTS,
searchResults
}),
- appendSearchResults: (searchResults: Array<Object> | []) => ({
+ appendSearchResults: (searchResults: Array<any> | []) => ({
type: types.APPEND_SEARCH_RESULTS,
searchResults
}),
@@ -1514,7 +1511,7 @@ export const actions = {
locationId
}),
changeLocation: (location: TS.Location) => (
- dispatch: (actions: Object) => void,
+ dispatch: (action) => void,
getState: () => any
) => {
const { currentLocationId } = getState().app;
@@ -1524,7 +1521,7 @@ export const actions = {
}
},
openLocationById: (locationId: string) => (
- dispatch: (actions: Object) => void,
+ dispatch: (action) => void,
getState: () => any
) => {
const { locations } = getState();
@@ -1536,7 +1533,7 @@ export const actions = {
});
},
openLocation: (location: TS.Location) => (
- dispatch: (actions: Object) => void,
+ dispatch: (action) => void,
getState: () => any
) => {
if (Pro && Pro.Watcher) {
@@ -1565,7 +1562,10 @@ export const actions = {
dispatch(actions.setReadOnlyMode(location.isReadOnly || false));
dispatch(actions.changeLocation(location));
dispatch(
- actions.loadDirectoryContent(getLocationPath(location), false)
+ actions.loadDirectoryContent(
+ PlatformIO.getLocationPath(location),
+ false
+ )
);
return true;
})
@@ -1584,12 +1584,14 @@ export const actions = {
PlatformIO.disableObjectStoreSupport();
dispatch(actions.setReadOnlyMode(location.isReadOnly || false));
dispatch(actions.changeLocation(location));
- dispatch(actions.loadDirectoryContent(getLocationPath(location), true));
+ dispatch(
+ actions.loadDirectoryContent(PlatformIO.getLocationPath(location), true)
+ );
if (Pro && Pro.Watcher && location.watchForChanges) {
const perspective = getCurrentDirectoryPerspective(getState());
const depth = perspective === PerspectiveIDs.KANBAN ? 3 : 1;
Pro.Watcher.watchFolder(
- getLocationPath(location),
+ PlatformIO.getLocationPath(location),
dispatch,
actions,
depth
@@ -1598,7 +1600,7 @@ export const actions = {
}
},
closeLocation: (locationId: string) => (
- dispatch: (actions: Object) => void,
+ dispatch: (action) => void,
getState: () => any
) => {
const { locations } = getState();
@@ -1619,7 +1621,7 @@ export const actions = {
});
}
},
- closeAllLocations: () => (dispatch: (actions: Object) => void) => {
+ closeAllLocations: () => (dispatch: (action) => void) => {
// location needed evtl. to unwatch many loc. root folders if available
dispatch(actions.setCurrentLocationId(null));
dispatch(actions.clearDirectoryContent());
@@ -1666,7 +1668,7 @@ export const actions = {
isReadOnlyMode
}),
reflectUpdateOpenedFileContent: (entryPath: string) => (
- dispatch: (actions: Object) => void,
+ dispatch: (action) => void,
getState: () => any
) => {
const { openedFiles } = getState().app;
@@ -1684,7 +1686,7 @@ export const actions = {
entryPath: string,
fsEntryMeta: any // FileSystemEntryMeta,
// isFile: boolean = true
- ) => (dispatch: (actions: Object) => void, getState: () => any) => {
+ ) => (dispatch: (action) => void, getState: () => any) => {
const { openedFiles } = getState().app;
if (openedFiles && openedFiles.length > 0) {
PlatformIO.getPropertiesPromise(entryPath)
@@ -1738,7 +1740,7 @@ export const actions = {
}
},
openFsEntry: (fsEntry?: TS.FileSystemEntry) => (
- dispatch: (actions: Object) => void,
+ dispatch: (action) => void,
getState: () => any
) => {
if (fsEntry === undefined) {
@@ -1832,7 +1834,7 @@ export const actions = {
isFullWidth
}),
openNextFile: (path?: string) => (
- dispatch: (actions: Object) => void,
+ dispatch: (action) => void,
getState: () => any
) => {
const lastSelectedEntry = getLastSelectedEntry(getState());
@@ -1849,7 +1851,7 @@ export const actions = {
}
},
openPrevFile: (path?: string) => (
- dispatch: (actions: Object) => void,
+ dispatch: (action) => void,
getState: () => any
) => {
const lastSelectedEntry = getLastSelectedEntry(getState());
@@ -1869,9 +1871,7 @@ export const actions = {
type: types.REFLECT_DELETE_ENTRY,
path
}),
- reflectDeleteEntry: (path: string) => (
- dispatch: (actions: Object) => void
- ) => {
+ reflectDeleteEntry: (path: string) => (dispatch: (action) => void) => {
dispatch(actions.reflectDeleteEntryInt(path));
dispatch(LocationIndexActions.reflectDeleteEntry(path));
},
@@ -1880,13 +1880,13 @@ export const actions = {
newEntry
}),
reflectCreateEntries: (fsEntries: Array<TS.FileSystemEntry>) => (
- dispatch: (actions: Object) => void
+ dispatch: (action) => void
) => {
fsEntries.map(entry => dispatch(actions.reflectCreateEntryInt(entry))); // TODO remove map and set state once
dispatch(actions.setSelectedEntries(fsEntries));
},
reflectCreateEntry: (path: string, isFile: boolean) => (
- dispatch: (actions: Object) => void
+ dispatch: (action) => void
) => {
const newEntry = {
uuid: uuidv1(),
@@ -1911,13 +1911,13 @@ export const actions = {
newPath
}),
reflectRenameEntry: (path: string, newPath: string) => (
- dispatch: (actions: Object) => void
+ dispatch: (action) => void
) => {
dispatch(actions.reflectRenameEntryInt(path, newPath));
dispatch(LocationIndexActions.reflectRenameEntry(path, newPath));
dispatch(actions.setSelectedEntries([]));
},
- updateCurrentDirEntry: (path: string, entry: Object) => ({
+ updateCurrentDirEntry: (path: string, entry: any) => ({
type: types.UPDATE_CURRENTDIR_ENTRY,
path,
entry
@@ -1935,7 +1935,7 @@ export const actions = {
path: string,
tags: Array<TS.Tag>,
updateIndex = true
- ) => (dispatch: (actions: Object) => void, getState: () => any) => {
+ ) => (dispatch: (action) => void, getState: () => any) => {
const { openedFiles, selectedEntries } = getState().app;
/**
* if its have openedFiles updateCurrentDirEntry is called from FolderContainer (useEffect -> ... if (openedFile.changed)
@@ -1952,7 +1952,7 @@ export const actions = {
}
},
deleteFile: (filePath: string) => (
- dispatch: (actions: Object) => void,
+ dispatch: (action) => void,
getState: () => any
) => {
const { settings } = getState();
@@ -2070,7 +2070,7 @@ export const actions = {
// throw error;
}),
openFileNatively: (selectedFile?: string) => (
- dispatch: (actions: Object) => void,
+ dispatch: (action) => void,
getState: () => any
) => {
if (selectedFile === undefined) {
@@ -2091,7 +2091,7 @@ export const actions = {
}
},
openLink: (url: string) => (
- dispatch: (actions: Object) => void,
+ dispatch: (action) => void,
getState: () => any
) => {
const decodedURI = decodeURI(url);
@@ -2163,7 +2163,7 @@ export const actions = {
}
} else {
// local files case
- const locationPath = getLocationPath(targetLocation);
+ const locationPath = PlatformIO.getLocationPath(targetLocation);
if (directoryPath && directoryPath.length > 0) {
if (
directoryPath.includes('../') ||
@@ -2241,7 +2241,7 @@ export const actions = {
PlatformIO.openUrl(url);
}
},
- saveFile: () => (dispatch: (actions: Object) => void) => {
+ saveFile: () => (dispatch: (action) => void) => {
dispatch(
actions.showNotification(
i18n.t('core:notImplementedYet'),
@@ -2251,14 +2251,14 @@ export const actions = {
);
},
isCurrentLocation: (uuid: string) => (
- dispatch: (actions: Object) => void,
+ dispatch: (action) => void,
getState: () => any
) => {
const { currentLocationId } = getState().app;
return currentLocationId === uuid;
},
openCurrentDirectory: () => (
- dispatch: (actions: Object) => void,
+ dispatch: (action) => void,
getState: () => any
) => {
const { currentDirectoryPath } = getState().app;
@@ -2298,7 +2298,7 @@ export const getCurrentLocationPath = (state: any) => {
state.app.currentLocationId &&
location.uuid === state.app.currentLocationId
) {
- return getLocationPath(location);
+ return PlatformIO.getLocationPath(location);
}
}
}
diff --git a/app/reducers/index.ts b/app/reducers/index.ts
index 824ea566f..5b5f768b6 100644
--- a/app/reducers/index.ts
+++ b/app/reducers/index.ts
@@ -19,13 +19,13 @@ import { persistCombineReducers, PersistConfig } from 'redux-persist';
import getStoredStateMigrateV4 from 'redux-persist/lib/integration/getStoredStateMigrateV4';
// import autoMergeLevel2 from 'redux-persist/lib/stateReconciler/autoMergeLevel2';
import storage from 'redux-persist/lib/storage';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import settings from './settings';
import app from './app';
import locations from './locations';
import taglibrary from './taglibrary';
import locationIndex from './location-index';
import searches from './searches';
-import AppConfig from '-/config';
const externalLocations = window.ExtLocations || false;
const externalTagLibrary = window.ExtTagLibrary || false;
diff --git a/app/reducers/io-actions.ts b/app/reducers/io-actions.ts
index 19ef19e74..229f1ca48 100644
--- a/app/reducers/io-actions.ts
+++ b/app/reducers/io-actions.ts
@@ -17,24 +17,23 @@
*/
import { Progress } from 'aws-sdk/clients/s3';
-import { actions as AppActions } from './app';
+import {
+ enhanceEntry,
+ loadJSONString
+} from '@tagspaces/tagspaces-platforms/utils-common';
import {
extractFileName,
getMetaFileLocationForFile,
getThumbFileLocationForFile,
normalizePath
-} from '-/utils/paths';
-import {
- copyFilesPromise,
- enhanceEntry,
- loadJSONString,
- renameFilesPromise
-} from '-/services/utils-io';
+} from '@tagspaces/tagspaces-platforms/paths';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
+import { actions as AppActions } from './app';
+import { copyFilesPromise, renameFilesPromise } from '-/services/utils-io';
import i18n from '../services/i18n';
import { Pro } from '../pro';
import TaggingActions from './tagging-actions';
import PlatformIO from '-/services/platform-facade';
-import AppConfig from '-/config';
import { TS } from '-/tagspaces.namespace';
const actions = {
@@ -474,7 +473,11 @@ const actions = {
}
}
if (file.meta) {
- return enhanceEntry(file);
+ return enhanceEntry(
+ file,
+ AppConfig.tagDelimiter,
+ PlatformIO.getDirSeparator()
+ );
}
return file;
})
diff --git a/app/reducers/location-index.ts b/app/reducers/location-index.ts
index 1f7409100..ff3c94433 100644
--- a/app/reducers/location-index.ts
+++ b/app/reducers/location-index.ts
@@ -17,23 +17,22 @@
*/
import { loadIndex, hasIndex } from '@tagspaces/tagspaces-platforms/indexer';
-import { getLocation, getLocationByPath, getLocations } from './locations';
-import { createDirectoryIndex } from '-/services/utils-io';
+import { locationType } from '@tagspaces/tagspaces-platforms/misc';
import {
extractFileExtension,
extractFileName,
extractTagsAsObjects,
- getLocationPath,
getThumbFileLocationForFile
-} from '-/utils/paths';
+} from '@tagspaces/tagspaces-platforms/paths';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
+import { getLocation, getLocationByPath, getLocations } from './locations';
+import { createDirectoryIndex } from '-/services/utils-io';
import Search from '../services/search';
import { actions as AppActions } from './app';
import i18n from '../services/i18n';
import PlatformIO from '../services/platform-facade';
import GlobalSearch from '../services/search-index';
-import AppConfig from '-/config';
import { TS } from '-/tagspaces.namespace';
-import { locationType } from '-/utils/misc';
export const types = {
SET_SEARCH_QUERY: 'SET_SEARCH_QUERY',
@@ -187,7 +186,7 @@ export const actions = {
createDirectoryIndex: (
directoryPath: string,
extractText: boolean,
- isCurrentLocation: boolean = true,
+ isCurrentLocation = true,
locationID: string = undefined,
ignorePatterns: Array<string> = []
) => (dispatch: (actions: Object) => void, getState: () => any) => {
@@ -230,7 +229,7 @@ export const actions = {
.then(() => {
dispatch(
actions.createDirectoryIndex(
- getLocationPath(location),
+ PlatformIO.getLocationPath(location),
location.fullTextIndex,
isCurrentLocation,
location.uuid
@@ -245,7 +244,7 @@ export const actions = {
PlatformIO.disableObjectStoreSupport();
dispatch(
actions.createDirectoryIndex(
- getLocationPath(location),
+ PlatformIO.getLocationPath(location),
location.fullTextIndex,
isCurrentLocation,
location.uuid
@@ -254,7 +253,7 @@ export const actions = {
}
}
},
- createLocationsIndexes: (extractText: boolean = true) => (
+ createLocationsIndexes: (extractText = true) => (
dispatch: (actions: Object) => void,
getState: () => any
) => {
@@ -263,7 +262,7 @@ export const actions = {
const allLocations = getLocations(state);
const promises = allLocations.map((location: TS.Location) => {
- const nextPath = getLocationPath(location);
+ const nextPath = PlatformIO.getLocationPath(location);
return (
createDirectoryIndex(
{ path: nextPath, location: location.uuid },
@@ -354,7 +353,7 @@ export const actions = {
GlobalSearch.index.length < 1 ||
indexAge > maxIndexAge))
) {
- const currentPath = getLocationPath(currentLocation);
+ const currentPath = PlatformIO.getLocationPath(currentLocation);
console.log('Start creating index for : ' + currentPath);
GlobalSearch.index = await createDirectoryIndex(
{
@@ -377,7 +376,7 @@ export const actions = {
) {
GlobalSearch.index = await loadIndex(
{
- path: getLocationPath(currentLocation),
+ path: PlatformIO.getLocationPath(currentLocation),
locationID: currentLocation.uuid,
...(isCloudLocation && { bucketName: currentLocation.bucketName })
},
@@ -462,7 +461,7 @@ export const actions = {
maxSearchResultReached = true;
return Promise.resolve();
}
- const nextPath = getLocationPath(location);
+ const nextPath = PlatformIO.getLocationPath(location);
let directoryIndex = [];
let indexExist = false;
const isCloudLocation = location.type === locationType.TYPE_CLOUD;
diff --git a/app/reducers/locations.ts b/app/reducers/locations.ts
index b4b606538..65032d877 100644
--- a/app/reducers/locations.ts
+++ b/app/reducers/locations.ts
@@ -17,7 +17,10 @@
*/
import { v1 as uuidv1 } from 'uuid';
-import { immutablySwapItems, locationType } from '-/utils/misc';
+import {
+ immutablySwapItems,
+ locationType
+} from '@tagspaces/tagspaces-platforms/misc';
import { actions as AppActions } from '-/reducers/app';
import i18n from '-/services/i18n';
import PlatformIO from '-/services/platform-facade';
@@ -169,7 +172,7 @@ export const actions = {
})
.catch(ex => console.error(ex));
},
- addLocation: (location: TS.Location, openAfterCreate: boolean = true) => (
+ addLocation: (location: TS.Location, openAfterCreate = true) => (
dispatch: (actions: Object) => void
) => {
dispatch(actions.createLocation(location));
@@ -181,10 +184,10 @@ export const actions = {
* @param arrLocations
* @param override = true - if location exist override else skip
*/
- addLocations: (
- arrLocations: Array<TS.Location>,
- override: boolean = true
- ) => (dispatch: (actions: Object) => void, getState: () => any) => {
+ addLocations: (arrLocations: Array<TS.Location>, override = true) => (
+ dispatch: (actions: Object) => void,
+ getState: () => any
+ ) => {
arrLocations.forEach((newLocation: TS.Location, idx, array) => {
const { locations } = getState();
const locationExist: boolean = locations.some(
@@ -212,7 +215,7 @@ export const actions = {
type: types.MOVE_DOWN_LOCATION,
uuid
}),
- editLocation: (location: TS.Location, openAfterEdit: boolean = true) => (
+ editLocation: (location: TS.Location, openAfterEdit = true) => (
dispatch: (actions: Object) => void
) => {
dispatch(actions.changeLocation(location));
diff --git a/app/reducers/searches.ts b/app/reducers/searches.ts
index 87c8fc179..375116288 100644
--- a/app/reducers/searches.ts
+++ b/app/reducers/searches.ts
@@ -16,7 +16,7 @@
*
*/
-import { immutablySwapItems } from '-/utils/misc';
+import { immutablySwapItems } from '@tagspaces/tagspaces-platforms/misc';
import { TS } from '-/tagspaces.namespace';
export const initialState = [];
@@ -103,10 +103,10 @@ export const actions = {
type: types.ADD_SEARCH,
search
}),
- addSearches: (
- arrSearches: Array<TS.SearchQuery>,
- override: boolean = true
- ) => (dispatch: (actions: Object) => void, getState: () => any) => {
+ addSearches: (arrSearches: Array<TS.SearchQuery>, override = true) => (
+ dispatch: (actions: Object) => void,
+ getState: () => any
+ ) => {
arrSearches.forEach((newSearch: TS.SearchQuery) => {
const { searches } = getState();
const searchExist: boolean = searches.some(
diff --git a/app/reducers/settings-default.ts b/app/reducers/settings-default.ts
index 4c3894374..0c2e35fa3 100644
--- a/app/reducers/settings-default.ts
+++ b/app/reducers/settings-default.ts
@@ -16,7 +16,7 @@
*
*/
-import AppConfig from '../config';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import keyBindings from '-/reducers/keybindings-default';
import { PerspectiveIDs } from '-/perspectives';
diff --git a/app/reducers/settings.ts b/app/reducers/settings.ts
index a6f5ec16f..b595f2f99 100644
--- a/app/reducers/settings.ts
+++ b/app/reducers/settings.ts
@@ -18,10 +18,10 @@
import semver from 'semver';
import { v1 as uuidv1 } from 'uuid';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import i18n from '-/services/i18n';
import defaultSettings from './settings-default';
import PlatformIO from '-/services/platform-facade';
-import AppConfig from '-/config';
import Links from '-/links';
import versionMeta from '-/version.json';
import { actions as AppActions } from './app';
@@ -404,18 +404,12 @@ export default (state: any = defaultSettings, action: any) => {
};
export const actions = {
- addTileServers: (
- tileServer: TS.MapTileServer,
- isDefault: boolean = false
- ) => ({
+ addTileServers: (tileServer: TS.MapTileServer, isDefault = false) => ({
type: types.ADD_MAPTILE_SERVER,
tileServer,
isDefault
}),
- editTileServers: (
- tileServer: TS.MapTileServer,
- isDefault: boolean = false
- ) => ({
+ editTileServers: (tileServer: TS.MapTileServer, isDefault = false) => ({
type: types.EDIT_MAPTILE_SERVER,
tileServer,
isDefault
@@ -698,9 +692,9 @@ export const getKeyBindings = (state: any) => state.settings.keyBindings;
export const getKeyBindingObject = (state: any) =>
generateKeyBindingObject(state.settings.keyBindings);
export const getSupportedFileTypes = (state: any) =>
- state.settings.supportedFileTypes.sort((a, b) => {
- return a.type > b.type ? 1 : a.type < b.type ? -1 : 0;
- });
+ state.settings.supportedFileTypes.sort((a, b) =>
+ a.type > b.type ? 1 : a.type < b.type ? -1 : 0
+ );
export const getTagColor = (state: any) => state.settings.tagBackgroundColor;
export const getTagTextColor = (state: any) => state.settings.tagTextColor;
export const getCurrentTheme = (state: any) => state.settings.currentTheme;
diff --git a/app/reducers/tagging-actions.ts b/app/reducers/tagging-actions.ts
index b94d67bc0..31ef2d4c7 100644
--- a/app/reducers/tagging-actions.ts
+++ b/app/reducers/tagging-actions.ts
@@ -17,6 +17,7 @@
*/
import OpenLocationCode from 'open-location-code-typescript';
import mgrs from 'mgrs';
+import { formatDateTime4Tag } from '@tagspaces/tagspaces-platforms/misc';
import i18n from '../services/i18n';
import {
actions as AppActions,
@@ -29,13 +30,13 @@ import {
extractTags,
extractTitle,
extractContainingDirectoryPath
-} from '-/utils/paths';
+} from '@tagspaces/tagspaces-platforms/paths';
import {
loadMetaDataPromise,
saveMetaDataPromise,
generateFileName
} from '-/services/utils-io';
-import { formatDateTime4Tag, isGeoTag } from '-/utils/misc';
+import { isGeoTag } from '-/utils/geo';
import PlatformIO from '../services/platform-facade';
import { Pro } from '../pro';
import GlobalSearch from '../services/search-index';
diff --git a/app/reducers/taglibrary.ts b/app/reducers/taglibrary.ts
index ec03e0637..e25d2b5a8 100644
--- a/app/reducers/taglibrary.ts
+++ b/app/reducers/taglibrary.ts
@@ -21,11 +21,11 @@ import {
formatDateTime4Tag,
extend,
prepareTagGroupForExport
-} from '-/utils/misc';
+} from '@tagspaces/tagspaces-platforms/misc';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import { parseNewTags, saveAsTextFile } from '-/services/utils-io';
import versionMeta from '../version.json';
import defaultTagLibrary from './taglibrary-default';
-import AppConfig from '../config';
import { TS } from '-/tagspaces.namespace';
import { Pro } from '-/pro';
@@ -708,7 +708,7 @@ export const actions = {
fromIndex,
toIndex
}),
- importTagGroups: (entries: Array<TS.TagGroup>, replace: boolean = false) => ({
+ importTagGroups: (entries: Array<TS.TagGroup>, replace = false) => ({
type: types.IMPORT_TAGGROUP,
entries,
replace
diff --git a/app/services/platform-facade.ts b/app/services/platform-facade.ts
index e8f815fc5..af35782d5 100644
--- a/app/services/platform-facade.ts
+++ b/app/services/platform-facade.ts
@@ -25,6 +25,7 @@ import {
platformEnableWebdavSupport,
platformDisableWebdavSupport,
platformWatchDirectory,
+ platformGetLocationPath,
platformSetLanguage,
platformIsWorkerAvailable,
platformSetZoomFactorElectron,
@@ -62,9 +63,9 @@ import {
platformShareFiles,
platformCreateIndex
} from '@tagspaces/tagspaces-platforms/platform-io';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
import { Pro } from '../pro';
import { TS } from '-/tagspaces.namespace';
-import AppConfig from '-/config';
let token: string;
@@ -87,6 +88,9 @@ export default class PlatformFacade {
static getDirSeparator = (): string => platformGetDirSeparator();
+ static getLocationPath = (location: TS.Location): string =>
+ platformGetLocationPath(location);
+
static setLanguage = (language: string): void => {
platformSetLanguage(language);
};
diff --git a/app/services/search.ts b/app/services/search.ts
index 1096aad27..a67699eb4 100644
--- a/app/services/search.ts
+++ b/app/services/search.ts
@@ -19,9 +19,8 @@
import Fuse from 'fuse.js';
import jmespath from '@gorillastack/jmespath';
-import OpenLocationCode from 'open-location-code-typescript';
import i18n from 'i18next';
-import { isGeoTag, parseGeoLocation } from '-/utils/misc';
+import { parseGeoLocation } from '-/utils/geo';
import { extractTimePeriod } from '-/utils/dates';
import { Pro } from '../pro';
import { TS } from '-/tagspaces.namespace';
diff --git a/app/services/thumbsgenerator.ts b/app/services/thumbsgenerator.ts
index 63711fd49..cc8f0ea01 100644
--- a/app/services/thumbsgenerator.ts
+++ b/app/services/thumbsgenerator.ts
@@ -24,9 +24,9 @@ import {
normalizePath,
getMetaDirectoryPath,
encodeFileName
-} from '-/utils/paths';
-import { base64ToArrayBuffer } from '-/utils/misc';
-import AppConfig from '../config';
+} from '@tagspaces/tagspaces-platforms/paths';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
+import { base64ToArrayBuffer } from '-/utils/dom';
import PlatformIO from '../services/platform-facade';
import { Pro } from '../pro';
@@ -100,25 +100,23 @@ export const supportedVideos = ['ogv', 'mp4', 'webm', 'm4v', 'mkv', 'lrv'];
const maxFileSize = 30 * 1024 * 1024;
function saveThumbnailPromise(filePath, dataURL) {
- return new Promise((resolve, reject) => {
- if (!dataURL || dataURL.length < 7) {
- // data:,
- return reject('Invalid dataURL');
- }
- const baseString = dataURL.split(',').pop();
- const content = base64ToArrayBuffer(baseString);
- PlatformIO.saveBinaryFilePromise(filePath, content, true)
- .then(() => resolve(filePath))
- .catch(error => {
- console.warn(
- 'Saving thumbnail for ' +
- filePath +
- ' failed with ' +
- JSON.stringify(error)
- );
- return reject('Saving tmb failed for: ' + filePath);
- });
- });
+ if (!dataURL || dataURL.length < 7) {
+ // data:,
+ return Promise.reject(new Error('Invalid dataURL'));
+ }
+ const baseString = dataURL.split(',').pop();
+ const content = base64ToArrayBuffer(baseString);
+ return PlatformIO.saveBinaryFilePromise(filePath, content, true)
+ .then(() => filePath)
+ .catch(error => {
+ console.warn(
+ 'Saving thumbnail for ' +
+ filePath +
+ ' failed with ' +
+ JSON.stringify(error)
+ );
+ return Promise.reject(new Error('Saving tmb failed for: ' + filePath));
+ });
}
function getThumbFileLocation(filePath: string) {
diff --git a/app/services/utils-io.ts b/app/services/utils-io.ts
index b2c9107c9..d3f859dba 100644
--- a/app/services/utils-io.ts
+++ b/app/services/utils-io.ts
@@ -24,10 +24,15 @@ import {
enhanceDirectoryIndex,
getMetaIndexFilePath
} from '@tagspaces/tagspaces-platforms/indexer';
+import {
+ enhanceEntry,
+ loadJSONString
+} from '@tagspaces/tagspaces-platforms/utils-common';
import { saveAs } from 'file-saver';
-import micromatch from 'micromatch';
-import PlatformIO from './platform-facade';
-import AppConfig from '../config';
+import {
+ locationType,
+ prepareTagForExport
+} from '@tagspaces/tagspaces-platforms/misc';
import {
extractTagsAsObjects,
extractFileExtension,
@@ -39,13 +44,14 @@ import {
extractDirectoryName,
getThumbFileLocationForFile,
getThumbFileLocationForDirectory
-} from '-/utils/paths';
+} from '@tagspaces/tagspaces-platforms/paths';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
+import PlatformIO from './platform-facade';
import i18n from '../services/i18n';
import versionMeta from '../version.json';
import { OpenedEntry, actions as AppActions } from '-/reducers/app';
import { getLocation } from '-/reducers/locations';
import { TS } from '-/tagspaces.namespace';
-import { locationType, prepareTagForExport } from '-/utils/misc';
import {
getThumbnailURLPromise,
supportedContainers,
@@ -98,7 +104,11 @@ export function enhanceDirectoryContent(
return true;
}
- const enhancedEntry = enhanceEntry(entry);
+ const enhancedEntry = enhanceEntry(
+ entry,
+ AppConfig.tagDelimiter,
+ PlatformIO.getDirSeparator()
+ );
directoryContent.push(enhancedEntry);
if (
// Enable thumb generation by
@@ -144,72 +154,14 @@ export async function getMetaForEntry(
): Promise<any> {
const meta: TS.FileSystemEntryMeta = await loadJSONFile(metaFilePath);
if (meta) {
- const entryEnhanced = enhanceEntry({ ...entry, meta });
- return { [entry.path]: entryEnhanced };
- }
- return Promise.resolve({ [entry.path]: undefined });
-}
-
-/**
- * TODO enhance only entries from the current page
- * @param entry
- */
-export function enhanceEntry(entry: any): TS.FileSystemEntry {
- let fileNameTags = [];
- if (entry.isFile) {
- fileNameTags = extractTagsAsObjects(
- entry.name,
+ const entryEnhanced = enhanceEntry(
+ { ...entry, meta },
AppConfig.tagDelimiter,
PlatformIO.getDirSeparator()
);
+ return { [entry.path]: entryEnhanced };
}
- let sidecarDescription;
- let sidecarColor;
- let sidecarPerspective;
- let sidecarTags = [];
- if (entry.meta) {
- sidecarDescription = entry.meta.description;
- sidecarColor = entry.meta.color;
- sidecarPerspective = entry.meta.perspective;
- sidecarTags = entry.meta.tags || [];
- sidecarTags.map(tag => {
- tag.type = 'sidecar';
- if (tag.id) {
- delete tag.id;
- }
- return true;
- });
- }
- const enhancedEntry: TS.FileSystemEntry = {
- uuid: uuidv1(),
- name: entry.name,
- isFile: entry.isFile,
- extension: entry.isFile
- ? extractFileExtension(entry.name, PlatformIO.getDirSeparator())
- : '',
- tags: [...sidecarTags, ...fileNameTags],
- size: entry.size,
- lmdt: entry.lmdt,
- path: entry.path,
- isIgnored: entry.isIgnored
- };
- if (sidecarDescription) {
- enhancedEntry.description = sidecarDescription;
- }
- if (entry && entry.thumbPath) {
- enhancedEntry.thumbPath = entry.thumbPath;
- }
- if (entry && entry.textContent) {
- enhancedEntry.textContent = entry.textContent;
- }
- if (sidecarColor) {
- enhancedEntry.color = sidecarColor;
- }
- if (sidecarPerspective) {
- enhancedEntry.perspective = sidecarPerspective;
- }
- // console.log('Enhancing ' + entry.path + ':' + JSON.stringify(enhancedEntry));
- return enhancedEntry;
+ return Promise.resolve({ [entry.path]: undefined });
}
export function enhanceOpenedEntry(
@@ -613,98 +565,6 @@ export function createDirectoryIndex(
});
}
-export function walkDirectory(
- path: string,
- options: Object = {},
- fileCallback: any,
- dirCallback: any,
- ignorePatterns: Array<string> = []
-) {
- if (ignorePatterns.length > 0 && micromatch.isMatch(path, ignorePatterns)) {
- return;
- }
- const mergedOptions = {
- recursive: false,
- skipMetaFolder: true,
- skipDotHiddenFolder: false,
- skipDotHiddenFiles: false,
- loadMetaDate: true,
- ...options
- };
- return (
- PlatformIO.listDirectoryPromise(path, [])
- // @ts-ignore
- .then(entries => {
- if (window.walkCanceled || entries === undefined) {
- return false;
- }
-
- return Promise.all(
- entries.map(entry => {
- if (window.walkCanceled) {
- return false;
- }
-
- if (
- ignorePatterns.length > 0 &&
- micromatch.isMatch(entry.path, ignorePatterns)
- ) {
- return false;
- }
-
- if (entry.isFile) {
- if (
- fileCallback &&
- (!mergedOptions.skipDotHiddenFiles ||
- !entry.name.startsWith('.'))
- ) {
- fileCallback(entry);
- }
- return entry;
- }
-
- if (
- dirCallback &&
- (!mergedOptions.skipDotHiddenFolder ||
- !entry.name.startsWith('.')) &&
- (!mergedOptions.skipMetaFolder ||
- entry.name !== AppConfig.metaFolder)
- ) {
- dirCallback(entry);
- }
-
- if (mergedOptions.recursive) {
- if (
- mergedOptions.skipDotHiddenFolder &&
- entry.name.startsWith('.')
- ) {
- return entry;
- }
- if (
- mergedOptions.skipMetaFolder &&
- entry.name === AppConfig.metaFolder
- ) {
- return entry;
- }
- return walkDirectory(
- entry.path,
- mergedOptions,
- fileCallback,
- dirCallback,
- ignorePatterns
- );
- }
- return entry;
- })
- );
- })
- .catch(err => {
- console.warn('Error walking directory ' + err);
- return err;
- })
- );
-}
-
export async function getAllPropertiesPromise(
entryPath: string
): Promise<TS.FileSystemEntry> {
@@ -719,7 +579,11 @@ export async function getAllPropertiesPromise(
if (metaFileProps.isFile) {
entryProps.meta = await loadJSONFile(metaFilePath);
}
- return enhanceEntry(entryProps);
+ return enhanceEntry(
+ entryProps,
+ AppConfig.tagDelimiter,
+ PlatformIO.getDirSeparator()
+ );
}
console.warn('Error getting props for ' + entryPath);
return entryProps;
@@ -729,36 +593,6 @@ export async function loadJSONFile(filePath: string) {
// console.debug('loadJSONFile:' + filePath);
const jsonContent = await PlatformIO.loadTextFilePromise(filePath);
return loadJSONString(jsonContent);
- /* const UTF8_BOM = '\ufeff';
- if (jsonContent.indexOf(UTF8_BOM) === 0) {
- jsonContent = jsonContent.substring(1, jsonContent.length);
- }
- try {
- jsonObject = JSON.parse(jsonContent);
- } catch (err) {
- console.warn('Error parsing meta json file for ' + filePath + ' - ' + err);
- }
- return jsonObject; */
-}
-
-export function loadJSONString(jsonContent: string) {
- let jsonObject;
- let json;
- if (!jsonContent) {
- return;
- }
- const UTF8_BOM = '\ufeff';
- if (jsonContent.indexOf(UTF8_BOM) === 0) {
- json = jsonContent.substring(1, jsonContent.length);
- } else {
- json = jsonContent;
- }
- try {
- jsonObject = JSON.parse(json);
- } catch (err) {
- console.log('Error parsing meta json file: ' + json, err);
- }
- return jsonObject;
}
export function saveAsTextFile(blob: any, filename: string) {
@@ -1127,9 +961,7 @@ export async function saveMetaDataPromise(
const content = JSON.stringify(cleanedMetaData);
return PlatformIO.saveTextFilePromise(metaFilePath, content, true);
}
- return new Promise((resolve, reject) =>
- reject(new Error('file not found' + path))
- );
+ return Promise.reject(new Error('file not found' + path));
}
/**
@@ -1197,7 +1029,7 @@ export function loadFileContentPromise(
if (response) {
resolve(response);
} else {
- reject('loadFileContentPromise error');
+ reject(new Error('loadFileContentPromise error'));
}
};
xhr.send();
diff --git a/app/services/webdav-io.ts b/app/services/webdav-io.ts
index d968e35dd..4f8eea145 100644
--- a/app/services/webdav-io.ts
+++ b/app/services/webdav-io.ts
@@ -22,7 +22,7 @@ import {
getMetaFileLocationForDir,
extractFileName,
extractFileExtension
-} from '-/utils/paths';
+} from '@tagspaces/tagspaces-platforms/paths';
import AppConfig from '../config';
import { TS } from '-/tagspaces.namespace';
diff --git a/app/utils/HandleAuth.tsx b/app/utils/HandleAuth.tsx
index 7d1a03a9d..45ac162be 100644
--- a/app/utils/HandleAuth.tsx
+++ b/app/utils/HandleAuth.tsx
@@ -18,7 +18,7 @@ interface Props {
addLocations: (locations: Array<TS.Location>, override: boolean) => void;
importTagGroups: (tagGroups: Array<TS.TagGroup>, replace: boolean) => void;
}
-const HandleAuth = (props: Props) => {
+function HandleAuth(props: Props) {
const username = useRef(undefined);
React.useEffect(() => {
@@ -116,7 +116,7 @@ const HandleAuth = (props: Props) => {
});
return null;
-};
+}
function mapDispatchToProps(dispatch) {
return bindActionCreators(
diff --git a/app/utils/dom.ts b/app/utils/dom.ts
new file mode 100644
index 000000000..17eeb5ad3
--- /dev/null
+++ b/app/utils/dom.ts
@@ -0,0 +1,114 @@
+import { locationType } from '@tagspaces/tagspaces-platforms/misc';
+import { TS } from '-/tagspaces.namespace';
+import PlatformIO from "-/services/platform-facade";
+
+export function isVisibleOnScreen(element: any) {
+ const rectangle = element.getBoundingClientRect();
+ const isVisible =
+ rectangle.top >= 0 &&
+ rectangle.left >= 0 &&
+ rectangle.bottom <=
+ (window.innerHeight || document.documentElement.clientHeight) &&
+ rectangle.right <=
+ (window.innerWidth || document.documentElement.clientWidth);
+ return isVisible;
+}
+
+export function getURLParameter(paramName: string, url?: string): string {
+ const intUrl = url || window.location.href;
+ const params = new URL(intUrl).searchParams;
+ return params.get(paramName);
+}
+
+export function clearAllURLParams() {
+ window.history.pushState('', document.title, window.location.pathname);
+ // console.log(window.location.href);
+}
+
+export function clearURLParam(paramName) {
+ const url = new URL(window.location.href);
+ const params = new URLSearchParams(url.search);
+
+ // Delete the foo parameter.
+ params.delete(paramName);
+ window.history.pushState(
+ '',
+ document.title,
+ window.location.pathname + '?' + params
+ );
+ // console.log(window.location.href);
+}
+
+export function updateHistory(
+ currentLocation: TS.Location,
+ currentDirectory: string,
+ entryPath?: string
+) {
+ if (currentLocation) {
+ // const isCloudLocation = currentLocation.type === locationType.TYPE_CLOUD;
+ let urlParams = '?';
+ let currentLocationPath = '';
+ const isCloudLocation = currentLocation.type === locationType.TYPE_CLOUD;
+
+ if (currentLocation && currentLocation.uuid) {
+ urlParams += 'tslid=' + encodeURIComponent(currentLocation.uuid);
+ currentLocationPath = PlatformIO.getLocationPath(currentLocation);
+ }
+
+ if (currentDirectory && currentDirectory.length > 0) {
+ const currentDir = isCloudLocation
+ ? currentDirectory
+ : currentDirectory.replace(currentLocationPath, '');
+ urlParams += '&tsdpath=' + encodeURIComponent(currentDir);
+ }
+
+ if (entryPath && entryPath.length > 0) {
+ const ePath = isCloudLocation
+ ? entryPath
+ : entryPath.replace(currentLocationPath, '');
+ urlParams += '&tsepath=' + encodeURIComponent(ePath);
+ }
+
+ const localePar = getURLParameter('locale');
+ if (localePar && localePar.length > 1) {
+ urlParams += '&locale=' + localePar;
+ }
+
+ window.history.pushState('', document.title, urlParams);
+ // console.log(window.location.href);
+ }
+}
+
+export function getBase64Image(imgURL: string) {
+ const canvas = document.createElement('canvas');
+ const img = new Image();
+ img.crossOrigin = 'anonymous';
+ img.src = imgURL;
+ canvas.width = img.width;
+ canvas.height = img.height;
+ const ctx = canvas.getContext('2d');
+ ctx.drawImage(img, 0, 0);
+ return canvas.toDataURL('image/png');
+}
+
+export function arrayBufferToDataURL(arrayBuffer: any, mime: string) {
+ const blob = new Blob([arrayBuffer], { type: mime });
+ const url = window.URL || window.webkitURL;
+ return url.createObjectURL(blob);
+}
+
+export function dataURLtoBlob(dataURI) {
+ const arr = dataURI.split(',');
+ const mime = arr[0].match(/:(.*?);/)[1];
+ const arrBuff = base64ToArrayBuffer(arr[1]);
+ return new window.Blob([arrBuff], { type: mime });
+}
+
+export function base64ToArrayBuffer(base64) {
+ const bstr = window.atob(base64);
+ const bytes = new Uint8Array(bstr.length);
+ for (let i = 0; i < bstr.length; i += 1) {
+ bytes[i] = bstr.charCodeAt(i);
+ }
+ return bytes.buffer;
+}
diff --git a/app/utils/geo.ts b/app/utils/geo.ts
new file mode 100644
index 000000000..e4c7f36da
--- /dev/null
+++ b/app/utils/geo.ts
@@ -0,0 +1,89 @@
+/**
+ * TagSpaces - universal file and folder organizer
+ * Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License (version 3) as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+import mgrs from 'mgrs';
+import OpenLocationCode from 'open-location-code-typescript';
+
+export function parseGeoLocation(code: string): any {
+ if (isPlusCode(code)) {
+ const coord = OpenLocationCode.decode(code);
+ const lat = Number(coord.latitudeLo.toFixed(7)); // latitudeCenter.toFixed(7));
+ const lng = Number(coord.longitudeLo.toFixed(7));
+ return { lat, lng };
+ }
+ if (isMgrsString(code)) {
+ try {
+ const [lng, lat] = mgrs.toPoint(code);
+ return { lat, lng };
+ } catch (e) {
+ console.error('parseGeoLocation', e);
+ }
+ }
+ return undefined;
+}
+
+export function isGeoTag(code: string): boolean {
+ return isPlusCode(code) || isMgrsString(code);
+}
+
+/** Returns true is a string is plus code e.g. 8FWH4HVG+3V 8FWH4HVG+ 8FWH4H+ */
+export function isPlusCode(plusCode: string): boolean {
+ if (!plusCode) {
+ return false;
+ }
+ const upperCasedPlusCode = plusCode.toUpperCase(); // needed only lowercased index
+ return /(^|\s)([23456789C][23456789CFGHJMPQRV][23456789CFGHJMPQRVWX]{6}\+[23456789CFGHJMPQRVWX]{2,3})(\s|$)/.test(
+ upperCasedPlusCode
+ );
+}
+
+/** Returns true is a string is MGRS code e.g. 18SUJ7082315291 18SUJ70821529 18SUJ708152 */
+export function isMgrsString(c) {
+ if (!c) {
+ return false;
+ }
+ const coord = c.replace(/\s+/g, '');
+ const MGRS = /^(\d{1,2})([C-HJ-NP-X])\s*([A-HJ-NP-Z])([A-HJ-NP-V])\s*(\d{1,5}\s*\d{1,5})$/i;
+ return MGRS.test(coord);
+}
+
+/**
+ * @deprecated use coordinate-parser lib instead
+ * @param latLongInput
+ */
+export function parseLatLon(
+ latLongInput: string
+): { lat: number; lon: number } | false {
+ const cleanedInput = latLongInput.replace(/\s+/g, ''); // cleaning spaces
+ if (
+ !/^[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?),\s*[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)$/.test(
+ cleanedInput
+ )
+ ) {
+ return false;
+ }
+ const latLongArray = cleanedInput.split(',');
+ const lat = parseFloat(latLongArray[0]);
+ const lon = parseFloat(latLongArray[1]);
+ if (!isNaN(lat) && !isNaN(lon)) {
+ return {
+ lat,
+ lon
+ };
+ }
+ return false;
+}
diff --git a/app/utils/misc.ts b/app/utils/misc.ts
deleted file mode 100644
index cd6850817..000000000
--- a/app/utils/misc.ts
+++ /dev/null
@@ -1,1104 +0,0 @@
-/**
- * TagSpaces - universal file and folder organizer
- * Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License (version 3) as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- *
- */
-import mgrs from 'mgrs';
-import OpenLocationCode from 'open-location-code-typescript';
-import { cleanFileName, getLocationPath } from '-/utils/paths';
-import { TS } from '-/tagspaces.namespace';
-
-export const locationType = {
- TYPE_LOCAL: '0',
- TYPE_CLOUD: '1',
- TYPE_AMPLIFY: '2',
- TYPE_WEBDAV: '3'
-};
-
-export function prepareTagGroupForExport(tagGroup: TS.TagGroup): TS.TagGroup {
- const preparedTagGroup: TS.TagGroup = {
- title: tagGroup.title,
- uuid: tagGroup.uuid,
- children: []
- };
- if (tagGroup.created_date) {
- preparedTagGroup.created_date = tagGroup.created_date;
- }
- if (tagGroup.color) {
- preparedTagGroup.color = tagGroup.color;
- }
- if (tagGroup.textcolor) {
- preparedTagGroup.textcolor = tagGroup.textcolor;
- }
- if (tagGroup.modified_date) {
- preparedTagGroup.modified_date = tagGroup.modified_date;
- }
- if (tagGroup.expanded) {
- preparedTagGroup.expanded = tagGroup.expanded;
- }
- if (tagGroup.children && tagGroup.children.length > 0) {
- tagGroup.children.forEach(tag => {
- const cleanedTag = prepareTagForExport(tag);
- if (cleanedTag.title) {
- preparedTagGroup.children.push(prepareTagForExport(cleanedTag));
- }
- });
- }
- return preparedTagGroup;
-}
-
-export function prepareTagForExport(tag: TS.Tag): TS.Tag {
- const preparedTag: TS.Tag = {
- title: tag.title
- };
- if (tag.color) {
- preparedTag.color = tag.color;
- }
- if (tag.textcolor) {
- preparedTag.textcolor = tag.textcolor;
- }
- if (tag.type) {
- preparedTag.type = tag.type;
- }
- if (tag.description) {
- preparedTag.description = tag.description;
- }
- return preparedTag;
-}
-
-export function escapeRegExp(string) {
- return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
-}
-
-export function parseTextQuery(textQuery: string, identifier: string) {
- const extractedTags = [];
- let query = textQuery;
- if (query && query.length > 0) {
- query = query
- .trim()
- .replace(new RegExp(escapeRegExp(identifier) + '\\s+', 'g'), identifier);
- const textQueryParts = query.split(' ');
- if (textQueryParts) {
- // && textQueryParts.length > 1) {
- textQueryParts.forEach(part => {
- const trimmedPart = part.trim();
- if (trimmedPart.startsWith(identifier)) {
- const tagTitle = trimmedPart.substr(1).trim();
- extractedTags.push({
- title: tagTitle
- });
- }
- });
- }
- }
- return extractedTags;
-}
-
-export function removeAllTagsFromSearchQuery(query: string) {
- if (!query) {
- return '';
- }
- // return query.replace(/([+-?]\S+)/g, '').trim();
- const queryArray = query.split(' ');
- const returnArray = queryArray.filter(
- q => !q.startsWith('+') && !q.startsWith('-') && !q.startsWith('|')
- );
- return returnArray.join(' ').trim();
-}
-
-export function mergeWithExtractedTags(
- textQuery: string,
- tags: Array<TS.Tag>,
- identifier: string
-) {
- const extractedTags = parseTextQuery(textQuery, identifier);
- if (tags) {
- if (extractedTags.length > 0) {
- return getUniqueTags(tags, extractedTags);
- }
- return tags;
- }
- if (extractedTags.length > 0) {
- return extractedTags;
- }
- return undefined;
-}
-
-function getUniqueTags(tags1: Array<TS.Tag>, tags2: Array<TS.Tag>) {
- const mergedArray = [...tags1, ...tags2];
- // mergedArray have duplicates, lets remove the duplicates using Set
- const set = new Set();
- return mergedArray.filter(tag => {
- if (!set.has(tag.title)) {
- set.add(tag.title);
- return true;
- }
- return false;
- }, set);
-}
-
-export function parseGeoLocation(code: string): any {
- if (isPlusCode(code)) {
- const coord = OpenLocationCode.decode(code);
- const lat = Number(coord.latitudeLo.toFixed(7)); // latitudeCenter.toFixed(7));
- const lng = Number(coord.longitudeLo.toFixed(7));
- return { lat, lng };
- }
- if (isMgrsString(code)) {
- try {
- const [lng, lat] = mgrs.toPoint(code);
- return { lat, lng };
- } catch (e) {
- console.error('parseGeoLocation', e);
- }
- }
- return undefined;
-}
-
-export function isGeoTag(code: string): boolean {
- return isPlusCode(code) || isMgrsString(code);
-}
-
-/** Returns true is a string is plus code e.g. 8FWH4HVG+3V 8FWH4HVG+ 8FWH4H+ */
-export function isPlusCode(plusCode: string): boolean {
- if (!plusCode) {
- return false;
- }
- const upperCasedPlusCode = plusCode.toUpperCase(); // needed only lowercased index
- return /(^|\s)([23456789C][23456789CFGHJMPQRV][23456789CFGHJMPQRVWX]{6}\+[23456789CFGHJMPQRVWX]{2,3})(\s|$)/.test(
- upperCasedPlusCode
- );
-}
-
-/** Returns true is a string is MGRS code e.g. 18SUJ7082315291 18SUJ70821529 18SUJ708152 */
-export function isMgrsString(c) {
- if (!c) {
- return false;
- }
- const coord = c.replace(/\s+/g, '');
- const MGRS = /^(\d{1,2})([C-HJ-NP-X])\s*([A-HJ-NP-Z])([A-HJ-NP-V])\s*(\d{1,5}\s*\d{1,5})$/i;
- return MGRS.test(coord);
-}
-
-/**
- * @deprecated use coordinate-parser lib instead
- * @param latLongInput
- */
-export function parseLatLon(
- latLongInput: string
-): { lat: number; lon: number } | false {
- const cleanedInput = latLongInput.replace(/\s+/g, ''); // cleaning spaces
- if (
- !/^[-+]?([1-8]?\d(\.\d+)?|90(\.0+)?),\s*[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)$/.test(
- cleanedInput
- )
- ) {
- return false;
- }
- const latLongArray = cleanedInput.split(',');
- const lat = parseFloat(latLongArray[0]);
- const lon = parseFloat(latLongArray[1]);
- if (!isNaN(lat) && !isNaN(lon)) {
- return {
- lat,
- lon
- };
- }
- return false;
-}
-
-export function traverse(objArr: Array<Object>, func: any) {
- objArr.forEach(obj => {
- Object.keys(obj).map(objKey => {
- func.apply(this, [obj, objKey]);
- if (objKey === 'subPages' && typeof Array.isArray(obj[objKey])) {
- traverse(obj[objKey], func);
- }
- return true;
- });
- });
-}
-
-export function immutablySwapItems(
- items: any,
- firstIndex: number,
- secondIndex: number
-) {
- const results = items.slice();
- const firstItem = items[firstIndex];
- results[firstIndex] = items[secondIndex];
- results[secondIndex] = firstItem;
- return results;
-}
-
-export function arrayBufferToDataURL(arrayBuffer: any, mime: string) {
- const blob = new Blob([arrayBuffer], { type: mime });
- const url = window.URL || window.webkitURL;
- return url.createObjectURL(blob);
-}
-
-/**
- * Convert 64bit url string to Blob
- * @name b64toBlob
- * @method
- * @param {string} b64Data - the 64bit url string which should be converted to Blob
- * @param {string} contentType - content type of blob
- * @param {int} sliceSize - optional size of slices if omited 512 is used as default
- * @returns {Blob}
- */
-export function b64toBlob(
- b64Data: any,
- contentType: string = '',
- sliceSize: number = 512
-) {
- const byteCharacters = atob(b64Data);
- const byteArrays = [];
-
- for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
- const slice = byteCharacters.slice(offset, offset + sliceSize);
- const byteNumbers = new Array(slice.length);
- for (let i = 0; i < slice.length; i += 1) {
- byteNumbers[i] = slice.charCodeAt(i);
- }
- const byteArray = new Uint8Array(byteNumbers);
- byteArrays.push(byteArray);
- }
- const blob = new Blob(byteArrays, { type: contentType });
- return blob;
-}
-
-export function getRandomInt(min: number, max: number) {
- return Math.floor(Math.random() * (max - min + 1)) + min;
-}
-
-export function isVisibleOnScreen(element: any) {
- const rectangle = element.getBoundingClientRect();
- const isVisible =
- rectangle.top >= 0 &&
- rectangle.left >= 0 &&
- rectangle.bottom <=
- (window.innerHeight || document.documentElement.clientHeight) &&
- rectangle.right <=
- (window.innerWidth || document.documentElement.clientWidth);
- return isVisible;
-}
-
-export function getURLParameter(paramName: string, url?: string): string {
- const intUrl = url || window.location.href;
- const params = new URL(intUrl).searchParams;
- return params.get(paramName);
-}
-
-export function clearAllURLParams() {
- window.history.pushState('', document.title, window.location.pathname);
- // console.log(window.location.href);
-}
-
-export function clearURLParam(paramName) {
- const url = new URL(window.location.href);
- const params = new URLSearchParams(url.search);
-
- // Delete the foo parameter.
- params.delete(paramName);
- window.history.pushState(
- '',
- document.title,
- window.location.pathname + '?' + params
- );
- // console.log(window.location.href);
-}
-
-export function updateHistory(
- currentLocation: TS.Location,
- currentDirectory: string,
- entryPath?: string
-) {
- if (currentLocation) {
- // const isCloudLocation = currentLocation.type === locationType.TYPE_CLOUD;
- let urlParams = '?';
- let currentLocationPath = '';
- const isCloudLocation = currentLocation.type === locationType.TYPE_CLOUD;
-
- if (currentLocation && currentLocation.uuid) {
- urlParams += 'tslid=' + encodeURIComponent(currentLocation.uuid);
- currentLocationPath = getLocationPath(currentLocation);
- }
-
- if (currentDirectory && currentDirectory.length > 0) {
- const currentDir = isCloudLocation
- ? currentDirectory
- : currentDirectory.replace(currentLocationPath, '');
- urlParams += '&tsdpath=' + encodeURIComponent(currentDir);
- }
-
- if (entryPath && entryPath.length > 0) {
- const ePath = isCloudLocation
- ? entryPath
- : entryPath.replace(currentLocationPath, '');
- urlParams += '&tsepath=' + encodeURIComponent(ePath);
- }
-
- const localePar = getURLParameter('locale');
- if (localePar && localePar.length > 1) {
- urlParams += '&locale=' + localePar;
- }
-
- window.history.pushState('', document.title, urlParams);
- // console.log(window.location.href);
- }
-}
-
-export function dataURLtoBlob(dataURI) {
- const arr = dataURI.split(',');
- const mime = arr[0].match(/:(.*?);/)[1];
- const arrBuff = base64ToArrayBuffer(arr[1]);
- return new window.Blob([arrBuff], { type: mime });
-}
-
-export function base64ToArrayBuffer(base64) {
- const bstr = window.atob(base64);
- const bytes = new Uint8Array(bstr.length);
- for (let i = 0; i < bstr.length; i += 1) {
- bytes[i] = bstr.charCodeAt(i);
- }
- return bytes.buffer;
-}
-
-export function arrayBufferToBuffer(content: any) {
- const buffer = new Buffer(content.byteLength);
- const view = new Uint8Array(content);
- for (let i = 0; i < buffer.length; ++i) {
- buffer[i] = view[i];
- }
- return buffer;
-}
-
-export function getBase64Image(imgURL: string) {
- const canvas = document.createElement('canvas');
- const img = new Image();
- img.crossOrigin = 'anonymous';
- img.src = imgURL;
- canvas.width = img.width;
- canvas.height = img.height;
- const ctx = canvas.getContext('2d');
- ctx.drawImage(img, 0, 0);
- return canvas.toDataURL('image/png');
-}
-
-export function formatFileSize(sizeInBytes: number): string {
- const kilobyte = 1024;
- const megabyte = kilobyte * kilobyte;
- const gigabyte = megabyte * kilobyte;
- const terabyte = gigabyte * kilobyte;
- const precision = 2;
-
- if (sizeInBytes >= 0 && sizeInBytes < kilobyte) {
- return sizeInBytes + ' B';
- }
- if (sizeInBytes >= kilobyte && sizeInBytes < megabyte) {
- return (sizeInBytes / kilobyte).toFixed(precision) + ' KB';
- }
- if (sizeInBytes >= megabyte && sizeInBytes < gigabyte) {
- return (sizeInBytes / megabyte).toFixed(precision) + ' MB';
- }
- if (sizeInBytes >= gigabyte && sizeInBytes < terabyte) {
- return (sizeInBytes / gigabyte).toFixed(precision) + ' GB';
- }
- if (sizeInBytes >= terabyte) {
- return (sizeInBytes / terabyte).toFixed(precision) + ' TB';
- }
- return sizeInBytes + '';
-}
-
-export function formatFileSize2(
- sizeInBytes: number,
- siSystem: boolean
-): string {
- const threshold = siSystem ? 1000 : 1024;
- if (!sizeInBytes) {
- return '';
- }
- if (sizeInBytes < threshold) {
- return sizeInBytes + ' B';
- }
- const units = siSystem
- ? ['kB', 'MB', 'GB', 'TB', 'PB', 'EB']
- : ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB'];
- let cUnit = -1;
- do {
- sizeInBytes /= threshold;
- ++cUnit;
- } while (sizeInBytes >= threshold);
- return sizeInBytes.toFixed(1) + ' ' + units[cUnit];
-}
-
-export function formatDateTime(date: string | number, includeTime: boolean) {
- if (date === undefined || date === '') {
- return '';
- }
- const d = new Date(date);
- let cDate: string = '' + d.getDate();
- cDate += '';
- if (cDate.length === 1) {
- cDate = '0' + cDate;
- }
- let cMonth: string = '' + (d.getMonth() + 1);
- cMonth += '';
- if (cMonth.length === 1) {
- cMonth = '0' + cMonth;
- }
- const cYear: string = '' + d.getFullYear();
- let cHour: string = '' + d.getHours();
- cHour += '';
- if (cHour.length === 1) {
- cHour = '0' + cHour;
- }
- let cMinute: string = '' + d.getMinutes();
- cMinute += '';
- if (cMinute.length === 1) {
- cMinute = '0' + cMinute;
- }
- let cSecond: string = '' + d.getSeconds();
- cSecond += '';
- if (cSecond.length === 1) {
- cSecond = '0' + cSecond;
- }
- let time = '';
- if (includeTime) {
- time = ' - ' + cHour + ':' + cMinute + ':' + cSecond;
- }
- return cYear + '-' + cMonth + '-' + cDate + time;
-}
-
-/** Convert a date in the following format 20191204 or 20191204T124532
- * https://en.wikipedia.org/wiki/ISO_8601
- */
-export function formatDateTime4Tag(
- date: string | Date,
- includeTime: boolean,
- includeMS?: boolean
-): string {
- if (date === undefined || date === '' || date.toString() === 'Invalid Date') {
- return '';
- }
- const d = new Date(date);
- let cDate: string = '' + d.getDate();
- cDate += '';
- if (cDate.length === 1) {
- cDate = '0' + cDate;
- }
- let cMonth: string = '' + (d.getMonth() + 1);
- cMonth += '';
- if (cMonth.length === 1) {
- cMonth = '0' + cMonth;
- }
- const cYear = d.getFullYear();
-
- let time = '';
- if (includeTime) {
- let cHour: string = '' + d.getHours();
- cHour += '';
- if (cHour.length === 1) {
- cHour = '0' + cHour;
- }
- let cMinute: string = '' + d.getMinutes();
- cMinute += '';
- if (cMinute.length === 1) {
- cMinute = '0' + cMinute;
- }
- let cSecond: string = '' + d.getSeconds();
- cSecond += '';
- if (cSecond.length === 1) {
- cSecond = '0' + cSecond;
- }
- time = 'T' + cHour + '' + cMinute + '' + cSecond;
- }
-
- let milliseconds = '';
- if (includeMS) {
- milliseconds = '.' + d.getMilliseconds();
- }
- return cYear + '' + cMonth + '' + cDate + time + milliseconds;
-}
-
-export function convertStringToDate(dateString: string) {
- if (dateString === undefined || dateString === '') {
- return false;
- }
- if (dateString.length === 8) {
- return new Date(
- dateString.substring(0, 4) +
- '-' +
- dateString.substring(4, 6) +
- '-' +
- dateString.substring(6, 8)
- );
- }
- return false;
-}
-
-export function sortAlphaNum(a: TS.FileSystemEntry, b: TS.FileSystemEntry) {
- // Regular expression to separate the digit string from the non-digit strings.
- const reParts = /\d+|\D+/g;
-
- // Regular expression to test if the string has a digit.
- const reDigit = /\d/;
-
- // Get rid of casing issues && remove tags for files only (folders dont have tags in name)
- const cleanedA = a.isFile
- ? cleanFileName(a.name.toLowerCase())
- : a.name.toLowerCase();
- const cleanedB = b.isFile
- ? cleanFileName(b.name.toLowerCase())
- : b.name.toLowerCase();
-
- // Separates the strings into substrings that have only digits and those
- // that have no digits.
- const aParts = cleanedA.match(reParts);
- const bParts = cleanedB.match(reParts);
-
- // Used to determine if aPart and bPart are digits.
- let isDigitPart;
-
- // If `a` and `b` are strings with substring parts that match...
- if (
- aParts &&
- bParts &&
- (isDigitPart = reDigit.test(aParts[0])) === reDigit.test(bParts[0])
- ) {
- // Loop through each substring part to compare the overall strings.
- const len = Math.min(aParts.length, bParts.length);
- for (let i = 0; i < len; i += 1) {
- let aPart: any = aParts[i];
- let bPart: any = bParts[i];
-
- // If comparing digits, convert them to numbers (assuming base 10).
- if (isDigitPart) {
- aPart = parseInt(aPart, 10);
- bPart = parseInt(bPart, 10);
- }
-
- // If the substrings aren't equal, return either -1 or 1.
- if (aPart !== bPart) {
- return aPart < bPart ? -1 : 1;
- }
-
- // Toggle the value of isDigitPart since the parts will alternate.
- isDigitPart = !isDigitPart;
- }
- }
-
- // Use normal comparison.
- // @ts-ignore
- return (a >= b) - (a <= b);
-}
-
-// Sorting functionality
-export function sortByName(a: TS.FileSystemEntry, b: TS.FileSystemEntry) {
- // @ts-ignore
- return !b.isFile - !a.isFile || sortAlphaNum(a, b);
-}
-
-export function sortBySize(a: TS.FileSystemEntry, b: TS.FileSystemEntry) {
- return a.size - b.size;
-}
-
-export function sortByDateModified(
- a: TS.FileSystemEntry,
- b: TS.FileSystemEntry
-) {
- return a.lmdt - b.lmdt;
-}
-
-export function sortByExtension(a: TS.FileSystemEntry, b: TS.FileSystemEntry) {
- return a.extension.toString().localeCompare(b.extension);
-}
-
-export function sortByFirstTag(a: TS.FileSystemEntry, b: TS.FileSystemEntry) {
- if ((!a.tags && !b.tags) || (a.tags.length < 1 && b.tags.length < 1)) {
- return 0;
- }
- if (!a.tags || a.tags.length < 1) {
- return -1;
- }
- if (!b.tags || b.tags.length < 1) {
- return 1;
- }
- return a.tags[0].title.localeCompare(b.tags[0].title);
-}
-
-export function shuffleArray(array: Array<any>) {
- // Durstenfeld shuffle
- for (let i = array.length - 1; i > 0; i--) {
- const j = Math.floor(Math.random() * (i + 1));
- [array[i], array[j]] = [array[j], array[i]];
- }
- return array;
-}
-
-export function sortByCriteria(data: any, criteria: string, order: boolean) {
- switch (criteria) {
- case 'byName':
- if (order) {
- return data.sort(sortByName);
- }
- return data.sort((a, b) => -1 * sortByName(a, b));
- case 'byFileSize':
- if (order) {
- return data.sort(sortBySize);
- }
- return data.sort((a, b) => -1 * sortBySize(a, b));
- case 'byDateModified':
- if (order) {
- return data.sort(sortByDateModified);
- }
- return data.sort((a, b) => -1 * sortByDateModified(a, b));
- case 'byExtension':
- if (order) {
- return data.sort(sortByExtension);
- }
- return data.sort((a, b) => -1 * sortByExtension(a, b));
- case 'byFirstTag':
- if (order) {
- return data.sort(sortByFirstTag);
- }
- return data.sort((a, b) => -1 * sortByFirstTag(a, b));
- case 'random':
- return shuffleArray(data);
- default:
- return data.sort(sortByName);
- }
-}
-
-/**
- * @description Check if value is of type 'object'
- * @param val
- * @returns {boolean}
- */
-export const isObj = (val: any) =>
- typeof val === 'object' && !isArr(val) && !isNull(val);
-
-/**
- * @description Check if value is of type 'null'
- * @param val
- * @returns {boolean}
- */
-export const isNull = (val: any) => val === null;
-
-/**
- * @description Check if value is of type 'number'
- * @param val
- * @returns {boolean}
- */
-export const isNum = (val: any) => typeof val === 'number' && !isNaN(val);
-
-/**
- * @description Check if value is of type 'function'
- * @param val
- * @returns {boolean}
- */
-export const isFunc = (val: any) => typeof val === 'function';
-
-/**
- * @description Check if value is of type 'array'
- * @param val
- * @returns {boolean}
- */
-export const isArr = (val: any) => Array.isArray(val);
-
-/**
- * @description Check if value is of type 'string'
- * @param val
- * @returns {boolean}
- */
-export const isStr = (val: any) => typeof val === 'string';
-
-/**
- * Check if value is of type 'undefined'
- */
-export const isUndef = (val: any): boolean => typeof val === 'undefined';
-
-/**
- * Check if value is of type 'boolean'
- */
-export const isBool = (val: any) => typeof val === 'boolean';
-
-/**
- * Check if object has property
- */
-export const hasProp = (obj: Object, prop: any): boolean =>
- obj.hasOwnProperty(prop);
-
-/**
- * Check if object has method
- */
-export const hasMethod = (obj: Object, method: any): boolean =>
- hasProp(obj, method) && isFunc(obj[method]);
-
-/**
- * Check if object has key
- */
-export const hasKey = (obj: Object, key: any): boolean =>
- getKeys(obj).indexOf(key) > -1;
-
-/**
- * @description Get object keys
- * @param obj
- * @returns {Array}
- */
-export const getKeys = (obj: Object) => Object.keys(obj);
-
-/**
- * @description Iterate over each key of an object
- * @param obj
- * @param callback
- */
-export const eachKey = (obj, callback) => {
- Object.keys(obj).forEach((key, index) => callback(key, obj[key], index));
-};
-
-/**
- * @description Linear iterator for object properties
- * @param obj
- * @param callback
- */
-export const eachProp = (obj, callback) => {
- eachKey(obj, (key, prop, index) => callback(prop, key, index));
-};
-
-/**
- * @description Extend
- * @param baseObject
- * @param restObjects
- * @returns {object}
- */
-export const extend = (baseObject, ...restObjects) => {
- const { assign } = Object;
- const modifiedObject = assign({}, baseObject);
-
- restObjects.map(obj => assign(modifiedObject, obj));
- return modifiedObject;
-};
-
-/**
- * @description Iterate recursively
- * @param handler
- * @param complete
- * @param index
- * @returns {*}
- */
-export const recurIter = (handler, complete, index = 0) => {
- handler(canRecur => {
- if (!canRecur) {
- return complete();
- }
- const nextIndex = index + 1;
- recurIter(handler, complete, nextIndex);
- }, index);
-};
-
-/**
- * @description Poll over an interval of time
- * @param handler
- * @param complete
- * @param interval
- */
-export const poll = (handler, complete, interval) => {
- setTimeout(() => {
- handler(canPoll => {
- if (canPoll) {
- return poll(handler, complete, interval);
- }
- complete();
- });
- }, interval);
-};
-
-/**
- * @description Buffer high-frequency events
- * @returns {function(*=, *=, *=)}
- */
-export const buffer = ({ timeout, id }) => {
- const timers = {};
-
- return callback => {
- if (!id) {
- timers[id] = '0';
- }
- if (timers[id]) {
- clearTimeout(timers[id]);
- }
- timers[id] = setTimeout(callback, timeout);
- };
-};
-
-/**
- * @description Determine type checker
- * @param type
- * @returns {*}
- */
-export const determineTypeChecker = type => {
- switch (type) {
- case 'number':
- return isNum;
- case 'object':
- return isObj;
- case 'null':
- return isNull;
- case 'function':
- return isFunc;
- case 'array':
- return isArr;
- case 'string':
- return isStr;
- case 'bool':
- case 'boolean':
- return isBool;
- case 'undefined':
- default:
- return isUndef;
- }
-};
-
-/**
- * @description Filter object data
- * @param objectData
- * @param requiredKeys
- */
-export const filterObjectData = (objectData, requiredKeys) => {
- const filteredObject = {};
- eachKey(objectData, (key, value) => {
- if (requiredKeys.indexOf(key) === -1) {
- return false;
- }
- filteredObject[key] = value;
- });
- return filteredObject;
-};
-
-/**
- * @description Filter array of objects data
- * @param arrayData
- * @param requiredKeys
- */
-export const filterArrayOfObjectsData = (arrayData, requiredKeys) =>
- arrayData.reduce((accumulator, item) => {
- const filteredObject = filterObjectData(item, requiredKeys);
- accumulator.push(filteredObject);
- return accumulator;
- }, []);
-
-/**
- * @description Pluck object data to array
- * @param objectData
- * @param requiredKey
- */
-export const pluckObjectDataToArray = (objectData, requiredKey) => {
- const filteredArray = [];
- eachKey(objectData, (key, value) => {
- if (requiredKey !== key) {
- return false;
- }
- filteredArray.push(value);
- });
- return filteredArray;
-};
-
-/**
- * @description Pluck array of objects data to array
- * @param arrayData
- * @param requiredKey
- */
-export const pluckArrayOfObjectsDataToArray = (arrayData, requiredKey) =>
- arrayData.reduce((accumulator, item) => {
- const filteredArray = pluckObjectDataToArray(item, requiredKey);
- return [...accumulator, ...filteredArray];
- }, []);
-
-/**
- * @description Extract nexted prop
- * @param obj
- * @param keysText
- * @returns {*}
- */
-export const extractNestedProp = (obj, keysText) => {
- const keys = keysText.split('.');
- const keysLength = keys.length - 1;
- let keysIndex = 0;
- let isValidKey = true;
- let targetObj = Object.assign({}, obj);
- let targetProp;
- let nextTarget;
-
- if (keys.length > 0) {
- while (isValidKey) {
- nextTarget = targetObj[keys[keysIndex]];
-
- // ... check if final target is reached ...
- if (keysIndex === keysLength) {
- // ... extract target prop
- targetProp =
- !isUndef(nextTarget) && !isNull(nextTarget) ? nextTarget : undefined;
- break;
- }
-
- // ... check if next target is not an object ...
- if (!isObj(nextTarget)) {
- // ... cancel sequence
- isValidKey = false;
- break;
- }
-
- targetObj = nextTarget;
- keysIndex++;
- }
- }
-
- return targetProp;
-};
-
-/**
- * @description Sort by
- * @param items
- * @param keysText
- * @param type
- * @param direction
- */
-export const sortBy = (
- items: any,
- keysText: any,
- type: string = 'string',
- direction: string = 'asc'
-) =>
- items.sort((a, b) => {
- const aVal: any = extractNestedProp(a, keysText);
- const bVal: any = extractNestedProp(b, keysText);
-
- if (isUndef(aVal) || isNull(aVal)) {
- return direction === 'asc' ? -1 : 1;
- }
-
- if (isUndef(bVal) || isNull(bVal)) {
- return direction === 'asc' ? 1 : -1;
- }
-
- if (type === 'string' || type === 'email') {
- if (aVal.toLowerCase() > bVal.toLowerCase()) {
- return direction === 'asc' ? 1 : -1;
- }
- if (aVal.toLowerCase() < bVal.toLowerCase()) {
- return direction === 'asc' ? -1 : 1;
- }
- return 0;
- }
- if (type === 'number' || type === 'integer' || type === 'float') {
- if (aVal > bVal) {
- return direction === 'asc' ? 1 : -1;
- }
- if (aVal < bVal) {
- return direction === 'asc' ? -1 : 1;
- }
- return 0;
- }
- if (type === 'date') {
- // @ts-ignore
- const res1 = new Date(aVal) - new Date(bVal);
- // @ts-ignore
- const res2 = new Date(bVal) - new Date(aVal);
- return direction === 'asc' ? res1 : res2;
- }
- });
-
-/**
- * @description Shape
- * @param items
- * @returns {*}
- */
-export const shape = items => {
- let shapeItems = [...items];
-
- return {
- fetch: () => shapeItems,
- filterByUnique(key) {
- shapeItems = filterByUnique(shapeItems, key);
- return this;
- },
- filterByDuplicate(key, length = 2) {
- shapeItems = filterByDuplicate(shapeItems, key, length);
- return this;
- },
- sortBy({ key, type = 'string', direction = 'asc' }) {
- shapeItems = sortBy(shapeItems, key, type, direction);
- return this;
- },
- reduceTo(key) {
- shapeItems = shapeItems.reduce((accumulator, item) => {
- const prop = extractNestedProp(item, key);
- if (isArr(prop)) {
- return [...accumulator, ...prop];
- }
- if (!isUndef(prop) && !isNull(prop)) {
- return [...accumulator, prop];
- }
- }, []);
- return this;
- }
- };
-};
-
-/**
- * @description Filter by unique
- * @param items
- * @param key
- * @returns {*}
- */
-export const filterByUnique = (items, key) =>
- items.reduce((accumulator, item) => {
- const itemProp = extractNestedProp(item, key);
-
- const isDuplicate =
- accumulator.filter(filteredItem => {
- const prop = extractNestedProp(filteredItem, key);
- return prop === itemProp;
- }).length > 0;
-
- if (isDuplicate) {
- return accumulator;
- }
-
- const modifiedItem = extend({}, item);
- accumulator.push(modifiedItem);
- return accumulator;
- }, []);
-
-/**
- * @description Filter by duplicate
- * @param items
- * @param key
- * @param duplicateLength
- * @returns {*}
- */
-export const filterByDuplicate = (items, key, duplicateLength = 2) =>
- items.filter(item => {
- const itemProp = extractNestedProp(item, key);
- const duplicatesCount = duplicateLength - 1;
-
- return (
- items.filter(innerItem => {
- const prop = extractNestedProp(innerItem, key);
- return prop === itemProp;
- }).length > duplicatesCount
- );
- });
diff --git a/app/utils/paths.ts b/app/utils/paths.ts
deleted file mode 100644
index 866c681f9..000000000
--- a/app/utils/paths.ts
+++ /dev/null
@@ -1,525 +0,0 @@
-/**
- * TagSpaces - universal file and folder organizer
- * Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License (version 3) as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- *
- */
-
-import pathLib from 'path';
-import AppConfig from '../config';
-import { TS } from '-/tagspaces.namespace';
-
-export function baseName(
- dirPath: string,
- dirSeparator: string // = AppConfig.dirSeparator
-) {
- const fileName = dirPath.substring(
- dirPath.lastIndexOf(dirSeparator) + 1,
- dirPath.length
- );
- return fileName || dirPath;
-}
-
-export function extractFileExtension(
- filePath: string,
- dirSeparator: string // = AppConfig.dirSeparator
-) {
- const lastindexDirSeparator = filePath.lastIndexOf(dirSeparator);
- const lastIndexEndTagContainer = filePath.lastIndexOf(
- AppConfig.endTagContainer
- );
- const lastindexDot = filePath.lastIndexOf('.');
- if (lastindexDot < 0) {
- return '';
- }
- if (lastindexDot < lastindexDirSeparator) {
- // case: "../remote.php/webdav/somefilename"
- return '';
- }
- if (lastindexDot < lastIndexEndTagContainer) {
- // case: "[20120125 89.4kg 19.5% 60.5% 39.8% 2.6kg]"
- return '';
- }
- let extension = filePath
- .substring(lastindexDot + 1, filePath.length)
- .toLowerCase()
- .trim();
- const lastindexQuestionMark = extension.lastIndexOf('?');
- if (lastindexQuestionMark > 0) {
- // Removing everything after ? in URLs .png?queryParam1=2342
- extension = extension.substring(0, lastindexQuestionMark);
- }
- return extension;
-}
-
-export function getMetaDirectoryPath(
- directoryPath: string,
- dirSeparator: string // = AppConfig.dirSeparator
-) {
- if (directoryPath.endsWith(AppConfig.metaFolder + dirSeparator)) {
- return directoryPath;
- }
- return (
- (directoryPath ? normalizePath(directoryPath) + dirSeparator : '') +
- AppConfig.metaFolder
- );
-}
-
-export function getMetaFileLocationForFile(
- entryPath: string,
- dirSeparator: string // = AppConfig.dirSeparator
-) {
- const containingFolder = extractContainingDirectoryPath(
- entryPath,
- dirSeparator
- );
- const metaFolder = getMetaDirectoryPath(containingFolder, dirSeparator);
- return (
- metaFolder +
- dirSeparator +
- extractFileName(entryPath, dirSeparator) +
- AppConfig.metaFileExt
- );
-}
-
-export function getFileLocationFromMetaFile(
- entryPath: string,
- dirSeparator: string // = AppConfig.dirSeparator
-) {
- let containingFolder = extractContainingDirectoryPath(
- entryPath,
- dirSeparator
- );
- containingFolder = containingFolder.replace(
- dirSeparator + AppConfig.metaFolder,
- ''
- );
- const fileName = extractFileName(entryPath, dirSeparator).replace(
- AppConfig.metaFileExt,
- ''
- );
- return containingFolder + dirSeparator + fileName;
-}
-
-export function getThumbFileLocationForFile(
- entryPath: string,
- dirSeparator: string, // = AppConfig.dirSeparator
- encode: boolean = true
-) {
- if (entryPath.indexOf(dirSeparator + AppConfig.metaFolder) > -1) {
- // entryPath is in .ts folder - no thumb file location exist
- return undefined;
- }
- const containingFolder = extractContainingDirectoryPath(
- entryPath,
- dirSeparator
- );
- const fileName = extractFileName(entryPath, dirSeparator);
- const metaFolder = getMetaDirectoryPath(containingFolder, dirSeparator);
- return (
- metaFolder +
- dirSeparator +
- (encode
- ? encodeURIComponent(fileName)
- .replace(/%5B/g, '[')
- .replace(/%5D/g, ']')
- : fileName) +
- AppConfig.thumbFileExt
- );
-}
-
-export function getThumbFileLocationForDirectory(
- entryPath: string,
- dirSeparator: string // = AppConfig.dirSeparator
-) {
- return (
- entryPath +
- (entryPath.endsWith(dirSeparator) ? '' : dirSeparator) +
- AppConfig.metaFolder +
- dirSeparator +
- AppConfig.folderThumbFile
- );
-}
-
-export function getMetaFileLocationForDir(
- entryPath: string,
- dirSeparator: string, // = AppConfig.dirSeparator
- metaFile: string = AppConfig.metaFolderFile
-) {
- const metaFolder = getMetaDirectoryPath(entryPath, dirSeparator);
- return (
- metaFolder +
- (metaFolder.endsWith(dirSeparator) ? '' : dirSeparator) +
- metaFile
- );
-}
-
-export function extractFileName(
- filePath: string,
- dirSeparator: string // = AppConfig.dirSeparator
-): string {
- if (filePath) {
- const path = filePath;
- if (filePath.endsWith(dirSeparator)) {
- return '';
- // path = filePath.substring(0, filePath.length - dirSeparator.length);
- }
- return path.substring(path.lastIndexOf(dirSeparator) + 1, path.length);
- }
- return filePath;
-}
-
-export function encodeFileName(
- filePath: string,
- dirSeparator: string // = AppConfig.dirSeparator
-): string {
- if (filePath) {
- const path = filePath;
- if (filePath.endsWith(dirSeparator)) {
- return '';
- }
- const lastDirSeparator = path.lastIndexOf(dirSeparator) + 1;
- return (
- path.substring(0, lastDirSeparator) +
- encodeURIComponent(path.substring(lastDirSeparator, path.length))
- );
- }
- return filePath;
-}
-
-export function cleanTrailingDirSeparator(dirPath: string): string {
- if (dirPath) {
- if (dirPath.lastIndexOf('\\') === dirPath.length - 1) {
- return dirPath.substring(0, dirPath.length - 1);
- }
- if (dirPath.lastIndexOf('/') === dirPath.length - 1) {
- return dirPath.substring(0, dirPath.length - 1);
- }
- return dirPath;
- }
- // console.log('Directory Path ' + dirPath + ' undefined');
- return '';
-}
-
-/**
- *
- * @param path -> root//subFolder/
- * @returns {string} -> root/subFolder
- */
-export function normalizePath(path: string): string {
- if (!path) return '';
- return cleanTrailingDirSeparator(path.replace(/\/\//g, '/'));
-}
-
-export function extractFileNameWithoutExt(
- filePath: string,
- dirSeparator: string // = AppConfig.dirSeparator
-): string {
- const fileName = extractFileName(filePath, dirSeparator);
- const indexOfDot = fileName.lastIndexOf('.');
- const lastIndexBeginTagContainer = fileName.lastIndexOf(
- AppConfig.beginTagContainer
- );
- const lastIndexEndTagContainer = fileName.lastIndexOf(
- AppConfig.endTagContainer
- );
- if (
- lastIndexBeginTagContainer === 0 &&
- lastIndexEndTagContainer + 1 === fileName.length
- ) {
- // case: "[tag1 tag.2]"
- return '';
- }
- if (indexOfDot > 0) {
- // case: regular
- return fileName.substring(0, indexOfDot);
- }
- if (indexOfDot === 0) {
- // case ".txt"
- return '';
- }
- return fileName;
-}
-
-export function extractContainingDirectoryPath(
- filePath: string,
- dirSeparator: string // = AppConfig.dirSeparator
-) {
- return filePath.substring(0, filePath.lastIndexOf(dirSeparator));
-}
-
-export function extractParentDirectoryPath(
- dirPath: string,
- dirSeparator: string // = AppConfig.dirSeparator
-) {
- if (!dirPath) return;
- let path = dirPath;
- if (path.endsWith(dirSeparator)) {
- path = path.substring(0, path.lastIndexOf(dirSeparator));
- }
- const lastIndex = path.lastIndexOf(dirSeparator);
- if (lastIndex !== -1) {
- return path.substring(0, lastIndex);
- }
- // return root dir in cases that dirPath not start with dirSeparator (AWS)
- return '';
-}
-
-export function extractDirectoryName(
- dirPath: string,
- dirSeparator: string // = AppConfig.dirSeparator
-): string {
- if (!dirPath) return '';
- let directoryName = dirPath;
- if (dirPath.indexOf(dirSeparator) !== -1) {
- if (dirPath.endsWith(dirSeparator)) {
- directoryName = directoryName.substring(
- 0,
- dirPath.lastIndexOf(dirSeparator)
- );
- }
- const lastDirSeparator = directoryName.lastIndexOf(dirSeparator);
- if (lastDirSeparator !== -1) {
- directoryName = directoryName.substring(
- lastDirSeparator + 1,
- directoryName.length
- );
- }
- }
- return directoryName;
-}
-
-export function extractShortDirectoryName(
- dirPath: string,
- dirSeparator: string // = AppConfig.dirSeparator
-) {
- let shortDirName: string = extractDirectoryName(dirPath, dirSeparator);
- if (shortDirName.length > 20) {
- shortDirName = shortDirName.substr(0, 20) + '...';
- }
- return shortDirName;
-}
-
-export function extractContainingDirectoryName(
- filePath: string,
- dirSeparator: string
-) {
- const tmpStr = filePath.substring(0, filePath.lastIndexOf(dirSeparator));
- return tmpStr.substring(tmpStr.lastIndexOf(dirSeparator) + 1, tmpStr.length);
-}
-
-export function extractTitle(
- entryPath: string,
- isDirectory: boolean = false,
- dirSeparator: string // = AppConfig.dirSeparator
-) {
- let title;
- if (isDirectory) {
- title = extractDirectoryName(entryPath, dirSeparator); // .replace(/(^\/)|(\/$)/g, '');
- return title;
- }
- title = extractFileNameWithoutExt(entryPath, dirSeparator);
-
- const beginTagContainer = title.indexOf(AppConfig.beginTagContainer);
- const endTagContainer = title.lastIndexOf(AppConfig.endTagContainer);
- /* cases like "", "t", "["
- if( fileName.length <= 1) {
- // cases like "asd ] asd ["
- else if (beginTagContainer > endTagContainer) {
- // case: [ not found in the filename
- else if ( beginTagContainer < 0 )
- else if ( endTagContainer < 0 ) */
- if (beginTagContainer >= 0 && beginTagContainer < endTagContainer) {
- if (beginTagContainer === 0 && endTagContainer === title.trim().length) {
- // case: "[tag1, tag2]"
- return '';
- }
- if (endTagContainer === title.trim().length) {
- // case: "asd[tag1, tag2]"
- return title.slice(0, beginTagContainer);
- }
- // case: "title1 [tag1 tag2] title2"
- return (
- title.slice(0, beginTagContainer) +
- title.slice(endTagContainer + 1, title.length)
- );
- }
- try {
- title = decodeURIComponent(title);
- } catch (e) {
- console.warn('Decoding URI failed on: ' + title + ' with ' + e);
- }
- return title;
-}
-
-/**
- * Remove Tags from fileName
- * @param fileName
- */
-export function cleanFileName(fileName: string) {
- const beginTagContainer = fileName.indexOf(AppConfig.beginTagContainer);
- const endTagContainer = fileName.lastIndexOf(AppConfig.endTagContainer);
- if (beginTagContainer >= 0 && beginTagContainer < endTagContainer) {
- return (
- fileName.slice(0, beginTagContainer) +
- fileName.slice(endTagContainer + 1, fileName.length)
- );
- }
- return fileName;
-}
-
-export function extractTagsAsObjects(
- filePath: string,
- tagDelimiter: string = AppConfig.tagDelimiter,
- dirSeparator: string // = AppConfig.dirSeparator
-): Array<TS.Tag> {
- const tagsInFileName = extractTags(filePath, tagDelimiter, dirSeparator);
- return tagsAsObjects(tagsInFileName);
-}
-
-export function tagsAsObjects(tags: Array<string>): Array<TS.Tag> {
- return tags.map(tag => ({
- title: '' + tag,
- type: 'plain'
- }));
-}
-
-export function extractTags(
- filePath: string,
- tagDelimiter: string = AppConfig.tagDelimiter,
- dirSeparator: string // = AppConfig.dirSeparator
-): Array<string> {
- // console.log('Extracting tags from: ' + filePath);
- const fileName = extractFileName(filePath, dirSeparator);
- // WithoutExt
- let tags = [];
- const beginTagContainer = fileName.indexOf(AppConfig.beginTagContainer);
- const endTagContainer = fileName.indexOf(AppConfig.endTagContainer);
- if (
- beginTagContainer < 0 ||
- endTagContainer < 0 ||
- beginTagContainer >= endTagContainer
- ) {
- // console.log('Filename does not contains tags. Aborting extraction.');
- return tags;
- }
- const cleanedTags = [];
- const tagContainer = fileName
- .slice(beginTagContainer + 1, endTagContainer)
- .trim();
- tags = tagContainer.split(tagDelimiter);
- for (let i = 0; i < tags.length; i += 1) {
- // Min tag length set to 1 character
- if (tags[i].trim().length > 0) {
- cleanedTags.push(tags[i]);
- }
- }
- return cleanedTags;
-}
-
-export function getLocationPath(location: TS.Location) {
- let locationPath = '';
- if (location) {
- if (location.path) {
- locationPath = location.path;
- }
- if (location.paths && location.paths[0]) {
- // eslint-disable-next-line prefer-destructuring
- locationPath = location.paths[0];
- }
-
- if (AppConfig.isElectron && locationPath && locationPath.startsWith('./')) {
- // TODO test relative path (Directory Back) with other platforms
- // relative paths
- return pathLib.resolve(locationPath);
- }
- }
-
- return locationPath;
-}
-
-/**
- * @deprecated fail on S3 locations
- * @param filePath
- * @param locations
- */
-export function extractLocation(
- filePath: string,
- locations: Array<TS.Location>
-) {
- let currentLocation;
- const path = filePath.replace(/[/\\]/g, '');
- for (let i = 0; i < locations.length; i += 1) {
- const locationPath = getLocationPath(locations[i]).replace(/[/\\]/g, '');
-
- // Handle S3 empty location
- if (locationPath.length === 0) {
- if (currentLocation === undefined) {
- currentLocation = locations[i];
- }
- } else if (path.startsWith(locationPath)) {
- currentLocation = locations[i];
- }
- }
- return currentLocation;
-}
-
-/**
- * @param paths -the first is DirSeparator
- */
-export function joinPaths(...paths) {
- let result = '';
- const dirSeparator = paths[0];
- if (dirSeparator) {
- for (let i = 1; i < paths.length; i += 1) {
- result =
- result +
- (result.endsWith(dirSeparator) || paths[i].startsWith(dirSeparator)
- ? ''
- : dirSeparator) +
- paths[i];
- }
- }
- if (AppConfig.isWin && result.startsWith(dirSeparator)) {
- // trim dirSeparator in windows paths like \C:\
- return result.substr(dirSeparator.length);
- }
- return result;
-}
-
-// Generates sharing links
-// for files ts:?tslid=53ea7417-6267-4f7c-9c25-dc44aa41f6c8&tsepath=%2FSelect-Dion%5B20210901%5D.jpeg
-// for folders ts:?tslid=53ea7417-6267-4f7c-9c25-dc44aa41f6c8&tsepath=%2FMath
-export function generateSharingLink(
- locationID: string,
- entryPath?: string,
- directoryPath?: string,
- entryID?: string
-) {
- const escapedEntryPath = entryPath && encodeURIComponent(entryPath);
- const escapedDirPath = directoryPath && encodeURIComponent(directoryPath);
- let tsepath = '';
- if (escapedEntryPath) {
- tsepath = '&tsepath=' + escapedEntryPath;
- }
- let tsdpath = '';
- if (escapedDirPath) {
- tsdpath = '&tsdpath=' + escapedDirPath;
- }
- let tseid = '';
- if (entryID) {
- tseid = '&tseid=' + entryID;
- }
- return 'ts:?tslid=' + locationID + tsepath + tsdpath + tseid;
-}
diff --git a/app/utils/useValidation.ts b/app/utils/useValidation.ts
index f5328cf28..bcf8d19cc 100644
--- a/app/utils/useValidation.ts
+++ b/app/utils/useValidation.ts
@@ -7,7 +7,7 @@ export default function useValidation() {
* @param errorKey
* @param add; if false = remove it
*/
- const setError = (errorKey: string, add: boolean = true): void => {
+ const setError = (errorKey: string, add = true): void => {
if (add) {
if (errorInput.length === 0) {
setErrorInput([errorKey]);
diff --git a/configs/webpack.config.base.js b/configs/webpack.config.base.js
index 7c40463cb..c93bb197d 100644
--- a/configs/webpack.config.base.js
+++ b/configs/webpack.config.base.js
@@ -4,6 +4,7 @@
import path from 'path';
import webpack from 'webpack';
+const Dotenv = require('dotenv-webpack');
// import { dependencies } from '../package.json';
export default {
@@ -60,8 +61,15 @@ export default {
plugins: [
new webpack.EnvironmentPlugin({
NODE_ENV: 'production'
+ }),
+ new Dotenv({
+ path: path.join(
+ __dirname,
+ '..',
+ 'node_modules',
+ '@tagspaces/tagspaces-platforms/node_modules/@tagspaces/tagspaces-common/default.env'
+ )
})
-
// new webpack.NamedModulesPlugin()
]
};
diff --git a/package.json b/package.json
index 36267d51f..c8b975791 100644
--- a/package.json
+++ b/package.json
@@ -148,7 +148,7 @@
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.60",
"@material-ui/pickers": "^3.3.10",
- "@tagspaces/tagspaces-platforms": "1.3.18",
+ "@tagspaces/tagspaces-platforms": "1.3.23",
"aws-amplify": "^4.3.8",
"aws-sdk": "^2.1036.0",
"babel-polyfill": "^6.26.0",
@@ -275,6 +275,7 @@
"current-git-branch": "^1.1.0",
"detect-port": "^1.3.0",
"devtron": "^1.4.0",
+ "dotenv-webpack": "^7.1.0",
"electron": "17.4.3",
"electron-builder": "^23.0.9",
"electron-devtools-installer": "^3.2.0",
diff --git a/tests/unit/paths.test.js b/tests/unit/paths.test.js
index 8194936ce..b536a60a2 100644
--- a/tests/unit/paths.test.js
+++ b/tests/unit/paths.test.js
@@ -1,11 +1,11 @@
-import AppConfig from '../../app/config';
+import AppConfig from '@tagspaces/tagspaces-platforms/AppConfig';
const {
baseName,
extractFileExtension,
getMetaDirectoryPath,
getMetaFileLocationForFile
-} = require('../../app/utils/paths');
+} = require('@tagspaces/tagspaces-platforms/paths');
const dirSeparatorUnix = '/';
const dirSeparatorWin = '\\';
diff --git a/tests/unit/search.test.js b/tests/unit/search.disabledtest.js
similarity index 98%
rename from tests/unit/search.test.js
rename to tests/unit/search.disabledtest.js
index d32c796aa..9432a8690 100644
--- a/tests/unit/search.test.js
+++ b/tests/unit/search.disabledtest.js
@@ -1,5 +1,5 @@
import Search from '../../app/services/search';
-import { FileTypeGroups } from '../../app/services/search';
+// import { FileTypeGroups } from '../../app/services/search';
const testEntries = require('./tsi.json');
diff --git a/yarn.lock b/yarn.lock
index 6b4f599f3..79c70e185 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -5764,10 +5764,10 @@
dependencies:
defer-to-connect "^1.0.1"
-"@tagspaces/[email protected]":
- version "1.3.18"
- resolved "https://registry.yarnpkg.com/@tagspaces/tagspaces-platforms/-/tagspaces-platforms-1.3.18.tgz#355a23984a46177d44609732dd3bd23559801e2c"
- integrity sha512-qHGqhjVMEVzP2nHp1mzrRU2DF7G2RKCtjByi0wMysKZtS3UVDqM/NUoUoArrGpkm4IWX4aIOlFlQ9oR0k1iqYw==
+"@tagspaces/[email protected]":
+ version "1.3.23"
+ resolved "https://registry.yarnpkg.com/@tagspaces/tagspaces-platforms/-/tagspaces-platforms-1.3.23.tgz#b11b14706d1528eeed54b67b207e1cc7ad5ed5ca"
+ integrity sha512-tFiqv9JpKx/Vbt0XknxedHKzAKWtR5wnr1dDdzSOPnUN2HgYzYitVfxChLH6ThyfIFC2KrjCUOYi4LsSRkkQQA==
"@testim/chrome-version@^1.0.7":
version "1.0.7"
@@ -10500,16 +10500,35 @@ dot-prop@^5.2.0:
dependencies:
is-obj "^2.0.0"
+dotenv-defaults@^2.0.2:
+ version "2.0.2"
+ resolved "https://registry.yarnpkg.com/dotenv-defaults/-/dotenv-defaults-2.0.2.tgz#6b3ec2e4319aafb70940abda72d3856770ee77ac"
+ integrity sha512-iOIzovWfsUHU91L5i8bJce3NYK5JXeAwH50Jh6+ARUdLiiGlYWfGw6UkzsYqaXZH/hjE/eCd/PlfM/qqyK0AMg==
+ dependencies:
+ dotenv "^8.2.0"
+
dotenv-expand@^5.1.0:
version "5.1.0"
resolved "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-5.1.0.tgz"
integrity sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==
+dotenv-webpack@^7.1.0:
+ version "7.1.0"
+ resolved "https://registry.yarnpkg.com/dotenv-webpack/-/dotenv-webpack-7.1.0.tgz#211fefac6bf500bf3bb66b286e1b12a23a2a70c0"
+ integrity sha512-+aUOe+nqgLerA/n611oyC15fY79BIkGm2fOxJAcHDonMZ7AtDpnzv/Oe591eHAenIE0t6w03UyxDnLs/YUxx5Q==
+ dependencies:
+ dotenv-defaults "^2.0.2"
+
dotenv@^5.0.1:
version "5.0.1"
resolved "https://registry.npmjs.org/dotenv/-/dotenv-5.0.1.tgz"
integrity sha512-4As8uPrjfwb7VXC+WnLCbXK7y+Ueb2B3zgNCePYfhxS1PYeaO1YTeplffTEcbfLhvFNGLAz90VvJs9yomG7bow==
+dotenv@^8.2.0:
+ version "8.6.0"
+ resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.6.0.tgz#061af664d19f7f4d8fc6e4ff9b584ce237adcb8b"
+ integrity sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==
+
dotenv@^9.0.2:
version "9.0.2"
resolved "https://registry.npmjs.org/dotenv/-/dotenv-9.0.2.tgz"