Skip to content

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

fixing flow issues

Ilian Sapundshiev86352f088d02
diff --git a/app/components/dialogs/GenericDialog.js b/app/components/dialogs/GenericDialog.js
index f98af092a..1f0e667fb 100644
--- a/app/components/dialogs/GenericDialog.js
+++ b/app/components/dialogs/GenericDialog.js
@@ -21,16 +21,16 @@ import React from 'react';
import Dialog from '@material-ui/core/Dialog';
import Slide from '@material-ui/core/Slide';
-export function DialogTransition(props) {
+export function DialogTransition(props: Object) {
return <Slide direction="down" {...props} />;
}
type Props = {
open: boolean,
- fullScreen: boolean,
+ fullScreen?: boolean,
onClose: () => void,
- onBackdropClick: () => void,
- onEnterKey: () => void,
+ onBackdropClick?: () => void,
+ onEnterKey?: () => void,
renderTitle: () => Object,
renderContent: () => Object,
renderActions: () => Object
diff --git a/app/components/dialogs/ImportExportTagGroupsDialog.js b/app/components/dialogs/ImportExportTagGroupsDialog.js
index 8e5cb005e..0ff5587c9 100644
--- a/app/components/dialogs/ImportExportTagGroupsDialog.js
+++ b/app/components/dialogs/ImportExportTagGroupsDialog.js
@@ -44,17 +44,20 @@ const styles = {
};
type Props = {
+ classes: Object,
open: boolean,
onClose: () => void,
dialogModeImport: boolean,
- showNotification: (text: string, notificationType: string, autohide: boolean) => void
+ showNotification: (text: string) => void,
+ importTagGroups: () => void,
+ exportTagGroups: () => void
};
type State = {
errorTextName: boolean,
disableConfirmButton: boolean,
open: boolean,
- tagGroupList: null | Array,
+ tagGroupList: Array<Object>,
checkedAll: boolean,
selectedAll: boolean
};
@@ -65,10 +68,11 @@ class ImportExportTagGroupsDialog extends React.Component<Props, State> {
disableConfirmButton: true,
open: false,
selectedAll: false,
+ checkedAll: false,
tagGroupList: []
};
- componentWillReceiveProps = (nextProps: any) => {
+ componentWillReceiveProps = (nextProps: Props) => {
if (nextProps.open === true) {
const tagGroupList = [];
const tagGroups = nextProps.tagGroups;
@@ -100,6 +104,7 @@ class ImportExportTagGroupsDialog extends React.Component<Props, State> {
expanded: entry.expanded,
selected: !this.state.selectedAll
});
+ return true;
});
this.setState({ tagGroupList, selectedAll: !this.state.selectedAll }, this.handleValidation);
};
@@ -114,6 +119,7 @@ class ImportExportTagGroupsDialog extends React.Component<Props, State> {
if (n.selected === true) {
selected = true;
}
+ return true;
});
if (selected) {
this.setState({ disableConfirmButton: false });
@@ -137,7 +143,7 @@ class ImportExportTagGroupsDialog extends React.Component<Props, State> {
const { showNotification } = this.props;
const groupList = [];
const selectedTagGroup = this.state.tagGroupList;
- selectedTagGroup.map((tagGroup, i) => {
+ selectedTagGroup.map((tagGroup) => {
if (tagGroup.selected) {
groupList.push({
uuid: tagGroup.uuid || tagGroup.key,
@@ -148,6 +154,7 @@ class ImportExportTagGroupsDialog extends React.Component<Props, State> {
expanded: tagGroup.expanded
});
}
+ return true;
});
this.props.onClose();
if (this.props.dialogModeImport) {
diff --git a/app/reducers/settings.js b/app/reducers/settings.js
index 46a189075..ca4048132 100644
--- a/app/reducers/settings.js
+++ b/app/reducers/settings.js
@@ -363,7 +363,7 @@ export const actions = {
console.log('Last version on server: ' + lastVersion);
const newVersion = semver.coerce(lastVersion); // lastVersion '3.0.5' ;
const currentVersion = semver.coerce(versionMeta.version);
- const lastPublishedVersion = semver.coerce(settings.lastPublishedVersion);
+ // const lastPublishedVersion = semver.coerce(settings.lastPublishedVersion);
if (semver.valid(newVersion) && semver.gt(newVersion, currentVersion)) {
console.log('New version available: ' + newVersion.version + '!');
dispatch(actions.setLastPublishedVersion(newVersion.version));
diff --git a/app/utils/dates.js b/app/utils/dates.js
index 837eb6377..100a8263b 100644
--- a/app/utils/dates.js
+++ b/app/utils/dates.js
@@ -237,7 +237,7 @@ export function formatDateTime(date: Date): string {
}
/** Converts 'Sun May 11, 2014' to 2014-05 */
-export function parseDateMonth(date) {
+export function parseDateMonth(date: string) {
const d = new Date(date);
let month = '' + (d.getMonth() + 1);
const year = d.getFullYear();
@@ -249,7 +249,7 @@ export function parseDateMonth(date) {
}
/** Converts 'Sun May 11, 2014' to 2014-05-11 */
-export function parseDate(date) {
+export function parseDate(date: string) {
const d = new Date(date);
let month = '' + (d.getMonth() + 1);
let day = '' + d.getDate();
@@ -320,13 +320,13 @@ export function formatDate(date) {
return [year, month, day].join('-');
}
-export function toHHMMSS(time) {
+export function toHHMMSS(time: string): string {
const match = time.match(/(\d{2})(\d{2})(\d{2})/);
return match[1] + ':' + match[2] + ':' + match[3];
}
-export function convertToDate(date) {
- const d = new Date(date);
+export function convertToDate(date: string) {
+ const d: Date = new Date(date);
// missing radix parameter to parseInt
const parseToInt = parseInt(date, 10);
let dateStr;
@@ -362,7 +362,7 @@ export function convertToDate(date) {
}
}
-export function convertToDateTime(dateTime) {
+export function convertToDateTime(dateTime: string) {
const dateTimeRegExp = /^\d\d\d\d-(00|[0-9]|1[0-9]|2[0-3]):([0-9]|[0-5][0-9]):([0-9]|[0-5][0-9])$/g;
const dateTimeWinRegExp = /^(([0-1]?[0-9])|([2][0-3]))!([0-5]?[0-9])(!([0-5]?[0-9]))?$/g;
const dateTimeWin1RegExp = /^(([0-1]?[0-9])|([2][0-3]))~([0-5]?[0-9])(!([0-5]?[0-9]))?$/g;
@@ -408,7 +408,7 @@ export function convertToDateTime(dateTime) {
}
}
-export function convertToDateRange(dateRange) {
+export function convertToDateRange(dateRange: string) {
const dateRangeRegExp = /^([0]?[1-9]|[1|2][0-9]|[3][0|1])[-]([0]?[1-9]|[1][0-2])$/g;
if (dateRange.match(dateRangeRegExp) || dateRange.search('-')) {
const range = dateRange.split('-');
@@ -418,7 +418,7 @@ export function convertToDateRange(dateRange) {
}
}
-export function splitValue(value, index) {
+export function splitValue(value: string, index: number) {
const currentLat = value.substring(0, index);
const currentLng = value.substring(index);