Update react, typescript recompose and etc.

master
Tom Hacohen 6 years ago
parent 01b9921b2a
commit ae26e34eb4

@ -10,17 +10,17 @@
"material-ui": "^0.20.0", "material-ui": "^0.20.0",
"moment": "^2.19.3", "moment": "^2.19.3",
"node-rsa": "^0.4.2", "node-rsa": "^0.4.2",
"react": "^16.2.0", "react": "^16.5.2",
"react-big-calendar": "^0.18.0", "react-big-calendar": "^0.20.1",
"react-datetime": "^2.11.1", "react-datetime": "^2.11.1",
"react-dom": "^16.2.0", "react-dom": "^16.4.0",
"react-redux": "^5.0.6", "react-redux": "^5.0.6",
"react-router": "^4.2.0", "react-router": "^4.2.0",
"react-router-dom": "^4.2.2", "react-router-dom": "^4.2.2",
"react-scripts-ts": "2.13.0", "react-scripts-ts": "2.17.0",
"recompose": "^0.26.0", "recompose": "^0.30.0",
"redux": "^3.7.2", "redux": "^4.0.0",
"redux-actions": "^2.2.1", "redux-actions": "^2.6.1",
"redux-logger": "^3.0.6", "redux-logger": "^3.0.6",
"redux-persist": "^5.4.0", "redux-persist": "^5.4.0",
"redux-thunk": "^2.2.0", "redux-thunk": "^2.2.0",
@ -41,18 +41,19 @@
"@types/material-ui": "^0.18.5", "@types/material-ui": "^0.18.5",
"@types/node": "^8.0.53", "@types/node": "^8.0.53",
"@types/node-rsa": "^0.4.1", "@types/node-rsa": "^0.4.1",
"@types/react": "^16.0.25", "@types/react": "^16.4.14",
"@types/react-big-calendar": "^0.18.0", "@types/react-big-calendar": "^0.20.0",
"@types/react-dom": "^16.0.3", "@types/react-dom": "^16.0.8",
"@types/react-redux": "^5.0.14", "@types/react-redux": "^5.0.14",
"@types/react-router": "^4.0.19", "@types/react-router": "^4.0.19",
"@types/react-router-dom": "^4.2.3", "@types/react-router-dom": "^4.2.3",
"@types/recompose": "^0.24.4", "@types/recompose": "^0.27.0",
"@types/redux": "^3.6.0",
"@types/redux-actions": "^2.2.3", "@types/redux-actions": "^2.2.3",
"@types/redux-logger": "^3.0.5", "@types/redux-logger": "^3.0.5",
"@types/sjcl": "^1.0.28", "@types/sjcl": "^1.0.28",
"@types/urijs": "^1.15.34", "@types/urijs": "^1.15.34",
"@types/uuid": "^3.4.3", "@types/uuid": "^3.4.3",
"typescript": "^2.7.2" "typescript": "2.9.2"
} }
} }

@ -163,7 +163,7 @@ class App extends React.PureComponent {
} }
refresh() { refresh() {
store.store.dispatch(actions.fetchAll(this.props.credentials.value!, this.props.entries)); store.store.dispatch<any>(actions.fetchAll(this.props.credentials.value!, this.props.entries));
} }
render() { render() {

@ -26,7 +26,7 @@ class LoginGate extends React.Component {
onFormSubmit(username: string, password: string, encryptionPassword: string, serviceApiUrl?: string) { onFormSubmit(username: string, password: string, encryptionPassword: string, serviceApiUrl?: string) {
serviceApiUrl = serviceApiUrl ? serviceApiUrl : C.serviceApiBase; serviceApiUrl = serviceApiUrl ? serviceApiUrl : C.serviceApiBase;
store.dispatch(login(username, password, encryptionPassword, serviceApiUrl)); store.dispatch<any>(login(username, password, encryptionPassword, serviceApiUrl));
} }
onEncryptionFormSubmit(encryptionPassword: string) { onEncryptionFormSubmit(encryptionPassword: string) {

@ -4,7 +4,7 @@ import RaisedButton from 'material-ui/RaisedButton';
import IconEdit from 'material-ui/svg-icons/editor/mode-edit'; import IconEdit from 'material-ui/svg-icons/editor/mode-edit';
import IconChangeHistory from 'material-ui/svg-icons/action/change-history'; import IconChangeHistory from 'material-ui/svg-icons/action/change-history';
import { withRouter } from 'react-router'; import { RouteComponentProps, withRouter } from 'react-router';
import * as EteSync from '../api/EteSync'; import * as EteSync from '../api/EteSync';
@ -86,20 +86,20 @@ const ItemChangeLog = pure((props: any) => {
); );
}); });
const CollectionRoutes = withRouter( type CollectionRoutesPropsType = RouteComponentProps<{}> & {
class CollectionRoutesInner extends React.PureComponent { syncInfo: SyncInfo,
props: { routePrefix: string,
syncInfo: SyncInfo, collections: Array<EteSync.CollectionInfo>,
routePrefix: string, componentEdit: any,
collections: Array<EteSync.CollectionInfo>, componentView: any,
componentEdit: any, items: {[key: string]: PimType},
componentView: any, onItemSave: (item: PimType, journalUid: string, originalContact?: PimType) => void;
items: {[key: string]: PimType}, onItemDelete: (item: PimType, journalUid: string) => void;
onItemSave: (item: PimType, journalUid: string, originalContact?: PimType) => void; onItemCancel: () => void;
onItemDelete: (item: PimType, journalUid: string) => void; };
onItemCancel: () => void;
};
const CollectionRoutes = withRouter(
class CollectionRoutesInner extends React.PureComponent<CollectionRoutesPropsType> {
render() { render() {
const props = this.props; const props = this.props;
const ComponentEdit = props.componentEdit; const ComponentEdit = props.componentEdit;

@ -1,6 +1,6 @@
import * as React from 'react'; import * as React from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { withRouter } from 'react-router'; import { RouteComponentProps, withRouter } from 'react-router';
import { List, ListItem, ListSubheader, ListDivider } from '../widgets/List'; import { List, ListItem, ListSubheader, ListDivider } from '../widgets/List';
import ActionCode from 'material-ui/svg-icons/action/code'; import ActionCode from 'material-ui/svg-icons/action/code';
import ActionHome from 'material-ui/svg-icons/action/home'; import ActionHome from 'material-ui/svg-icons/action/home';
@ -10,8 +10,6 @@ import LogoutIcon from 'material-ui/svg-icons/action/power-settings-new';
const logo = require('../images/logo.svg'); const logo = require('../images/logo.svg');
import { History } from 'history';
import SideMenuJournals from './SideMenuJournals'; import SideMenuJournals from './SideMenuJournals';
import ErrorBoundary from '../components/ErrorBoundary'; import ErrorBoundary from '../components/ErrorBoundary';
@ -27,16 +25,13 @@ interface PropsType {
onCloseDrawerRequest: () => void; onCloseDrawerRequest: () => void;
} }
interface PropsTypeInner extends PropsType { type PropsTypeInner = RouteComponentProps<{}> & PropsType & {
journals: JournalsType; journals: JournalsType;
userInfo: UserInfoData; userInfo: UserInfoData;
history: History; };
}
class SideMenu extends React.PureComponent {
props: PropsTypeInner;
constructor(props: any) { class SideMenu extends React.PureComponent<PropsTypeInner> {
constructor(props: PropsTypeInner) {
super(props); super(props);
this.logout = this.logout.bind(this); this.logout = this.logout.bind(this);
this.journalClicked = this.journalClicked.bind(this); this.journalClicked = this.journalClicked.bind(this);

@ -1,6 +1,6 @@
import * as React from 'react'; import * as React from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Route, Switch, Redirect, withRouter } from 'react-router'; import { Route, Switch, Redirect, RouteComponentProps, withRouter } from 'react-router';
import { List, Map } from 'immutable'; import { List, Map } from 'immutable';
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
@ -32,11 +32,11 @@ interface PropsType {
etesync: CredentialsData; etesync: CredentialsData;
} }
interface PropsTypeInner extends PropsType { type PropsTypeInner = RouteComponentProps<{}> & PropsType & {
journals: JournalsType; journals: JournalsType;
entries: EntriesType; entries: EntriesType;
userInfo: UserInfoType; userInfo: UserInfoType;
} };
const syncInfoSelector = createSelector( const syncInfoSelector = createSelector(
(props: PropsTypeInner) => props.etesync, (props: PropsTypeInner) => props.etesync,
@ -91,10 +91,8 @@ const syncInfoSelector = createSelector(
const PimRouter = withRouter(Pim); const PimRouter = withRouter(Pim);
const JournalRouter = withRouter(Journal); const JournalRouter = withRouter(Journal);
class SyncGate extends React.PureComponent { class SyncGate extends React.PureComponent<PropsTypeInner> {
props: PropsTypeInner; constructor(props: PropsTypeInner) {
constructor(props: any) {
super(props); super(props);
} }

@ -9,7 +9,7 @@ import { EventType } from '../pim-types';
import './Calendar.css'; import './Calendar.css';
moment.locale('en-gb'); moment.locale('en-gb');
BigCalendar.momentLocalizer(moment); const calendarLocalizer = BigCalendar.momentLocalizer(moment);
function eventPropGetter(event: EventType) { function eventPropGetter(event: EventType) {
return { return {
@ -64,6 +64,7 @@ class Calendar extends React.PureComponent {
<div style={{width: '100%', height: 'calc(100vh - 230px)', minHeight: 500}}> <div style={{width: '100%', height: 'calc(100vh - 230px)', minHeight: 500}}>
<BigCalendar <BigCalendar
defaultDate={new Date()} defaultDate={new Date()}
localizer={calendarLocalizer}
events={this.props.entries} events={this.props.entries}
selectable={true} selectable={true}
onSelectEvent={this.props.onItemClick as any} onSelectEvent={this.props.onItemClick as any}

@ -319,12 +319,12 @@ class ContactEdit extends React.PureComponent {
}, },
fullWidth: { fullWidth: {
width: '100%', width: '100%',
boxSizing: 'border-box', boxSizing: 'border-box' as any,
}, },
submit: { submit: {
marginTop: 40, marginTop: 40,
marginBottom: 20, marginBottom: 20,
textAlign: 'right', textAlign: 'right' as any,
}, },
}; };

@ -63,7 +63,7 @@ class EncryptionLoginForm extends React.PureComponent {
}, },
submit: { submit: {
marginTop: 40, marginTop: 40,
textAlign: 'right', textAlign: 'right' as any,
}, },
}; };

@ -196,12 +196,12 @@ class EventEdit extends React.PureComponent {
}, },
fullWidth: { fullWidth: {
width: '100%', width: '100%',
boxSizing: 'border-box', boxSizing: 'border-box' as any,
}, },
submit: { submit: {
marginTop: 40, marginTop: 40,
marginBottom: 20, marginBottom: 20,
textAlign: 'right', textAlign: 'right' as any,
}, },
}; };

@ -125,7 +125,7 @@ class LoginForm extends React.PureComponent {
}, },
submit: { submit: {
marginTop: 40, marginTop: 40,
textAlign: 'right', textAlign: 'right' as any,
}, },
}; };

@ -39,7 +39,7 @@ class SearchableAddressBook extends React.PureComponent {
render() { render() {
const { const {
entries, entries,
...rest, ...rest
} = this.props; } = this.props;
const reg = new RegExp(this.state.searchQuery, 'i'); const reg = new RegExp(this.state.searchQuery, 'i');

@ -8,7 +8,7 @@ export default (props: {text: string}) => {
backgroundColor: getPalette('primary1Color'), backgroundColor: getPalette('primary1Color'),
color: getPalette('alternateTextColor'), color: getPalette('alternateTextColor'),
padding: 15, padding: 15,
textAlign: 'center', textAlign: 'center' as any,
}, },
headerText: { headerText: {
margin: 0, margin: 0,

@ -22,7 +22,7 @@ export function createJournalEntry(
let prevUid: string | null = null; let prevUid: string | null = null;
const entries = existingEntries; const entries = existingEntries;
const last = entries.last(); const last = entries.last() as EteSync.Entry;
if (last) { if (last) {
prevUid = last.uid; prevUid = last.uid;
} }

@ -131,7 +131,7 @@ export function fetchAll(etesync: CredentialsData, currentEntries: EntriesType)
let prevUid: string | null = null; let prevUid: string | null = null;
const entries = currentEntries.get(journal.uid); const entries = currentEntries.get(journal.uid);
if (entries && entries.value) { if (entries && entries.value) {
const last = entries.value.last(); const last = entries.value.last() as EteSync.Entry;
prevUid = (last) ? last.uid : null; prevUid = (last) ? last.uid : null;
} }

@ -1,6 +0,0 @@
import * as React from 'react';
declare module 'react' {
export class Fragment extends React.Component {
}
}

@ -10,7 +10,7 @@ export default pure((_props: any) => {
onCancel, onCancel,
onOk, onOk,
labelOk, labelOk,
...props, ...props
} = _props; } = _props;
const actions = [ const actions = [
( (

@ -65,7 +65,7 @@ export const ListSubheader = pure((props: any) => (
export const ListDivider = pure((_props: any) => { export const ListDivider = pure((_props: any) => {
const { const {
inset, inset,
...props, ...props
} = _props; } = _props;
return ( return (
<li> <li>

@ -7,7 +7,7 @@ const withSpin = (Component: any) => {
return pure((_props: any) => { return pure((_props: any) => {
const { const {
spin, spin,
...props, ...props
} = _props; } = _props;
return ( return (
<Component {...props} className={spin ? 'withSpin-spin' : ''} /> <Component {...props} className={spin ? 'withSpin-spin' : ''} />

@ -0,0 +1,3 @@
{
"extends": "./tsconfig.json"
}

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save