Skip to content
This repository has been archived by the owner on Dec 9, 2021. It is now read-only.

Ts/mobx/classes #23

Open
wants to merge 16 commits into
base: TypeScript
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion craco.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = function({ env, paths }) {
return {
babel: {
presets: [],
plugins: ['@babel/plugin-proposal-optional-chaining', '@babel/plugin-proposal-nullish-coalescing-operator'],
plugins: [['@babel/plugin-proposal-decorators', { legacy: true }]],
// loaderOptions: { /* Any babel-loader configuration options: https://github.com/babel/babel-loader. */ },
// loaderOptions: (babelLoaderOptions, { env, paths }) => { return babelLoaderOptions; }
},
Expand Down
46 changes: 21 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,51 +44,47 @@
"dependencies": {
"axios": "0.19.0",
"classnames": "2.2.6",
"connected-react-router": "6.5.2",
"connected-react-router": "6.6.1",
"dayjs": "1.8.17",
"history": "4.10.1",
"lodash.groupby": "4.6.0",
"react": "16.11.0",
"react-dom": "16.11.0",
"react-redux": "7.1.3",
"mobx": "5.15.0",
"mobx-react": "6.1.4",
"mobx-react-router": "4.1.0",
"react": "16.12.0",
"react-dom": "16.12.0",
"react-router-dom": "5.1.2",
"redux": "4.0.4",
"redux-devtools-extension": "2.13.8",
"redux-freeze": "0.1.7",
"redux-thunk": "2.3.0",
"reselect": "4.0.0",
"semantic-ui-css": "2.4.1",
"semantic-ui-react": "0.88.1",
"semantic-ui-react": "0.88.2",
"sjs-base-model": "1.9.0",
"uuid": "3.3.3"
},
"devDependencies": {
"@babel/plugin-proposal-nullish-coalescing-operator": "7.4.4",
"@babel/plugin-proposal-optional-chaining": "7.6.0",
"@craco/craco": "5.6.1",
"@babel/plugin-proposal-decorators": "7.7.4",
"@craco/craco": "5.6.2",
"@types/classnames": "2.2.9",
"@types/history": "4.7.3",
"@types/jest": "24.0.22",
"@types/node": "12.12.7",
"@types/react": "16.9.11",
"@types/jest": "24.0.23",
"@types/node": "12.12.17",
"@types/react": "16.9.16",
"@types/react-dom": "16.9.4",
"@types/react-redux": "7.1.5",
"@types/react-router-dom": "5.1.2",
"@types/react-router-dom": "5.1.3",
"@types/uuid": "3.4.6",
"@typescript-eslint/eslint-plugin": "2.7.0",
"@typescript-eslint/parser": "2.7.0",
"@typescript-eslint/eslint-plugin": "2.11.0",
"@typescript-eslint/parser": "2.11.0",
"cross-env": "6.0.3",
"eslint": "6.6.0",
"eslint-config-prettier": "6.5.0",
"eslint": "6.7.2",
"eslint-config-prettier": "6.7.0",
"eslint-plugin-prettier": "3.1.1",
"eslint-plugin-react": "7.16.0",
"eslint-plugin-react": "7.17.0",
"generate-template-files": "2.2.0",
"gh-pages": "2.1.1",
"husky": "3.0.9",
"husky": "3.1.0",
"node-sass": "4.13.0",
"prettier": "1.19.1",
"pretty-quick": "2.0.1",
"react-scripts": "3.2.0",
"typescript": "3.7.2"
"react-scripts": "3.3.0",
"typescript": "3.7.3"
}
}
20 changes: 11 additions & 9 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,27 @@ import './index.scss';

import React from 'react';
import ReactDOM from 'react-dom';
import { Store } from 'redux';
import { Provider } from 'react-redux';
import { createBrowserHistory, History } from 'history';
import IStore from './models/IStore';
import rootStore from './stores/rootStore';
import App from './views/App';
import environment from 'environment';
import { Provider } from 'mobx-react';
import { syncHistoryWithStore } from 'mobx-react-router';
import { rootStore } from './stores/rootStore';
import { configure } from 'mobx';

configure({ enforceActions: 'always' }); // https://mobx.js.org/refguide/api.html#enforceactions

(async (window: Window): Promise<void> => {
const initialState: Partial<IStore> = {};
const history: History = createBrowserHistory({ basename: environment.route.baseRoute });
const store: Store<IStore> = rootStore(initialState, history);
// const initialState: Partial<unknown> = {};
const browserHistory: History = createBrowserHistory({ basename: environment.route.baseRoute });
const history = syncHistoryWithStore(browserHistory, rootStore.routingStore);

const rootEl: HTMLElement | null = document.getElementById('root');

const render = (Component: typeof App, el: HTMLElement | null): void => {
ReactDOM.render(
<Provider store={store}>
<Component history={history} dispatch={store.dispatch} />
<Provider {...rootStore}>
<Component history={history} />
</Provider>,
el
);
Expand Down
18 changes: 0 additions & 18 deletions src/middlewares/errorToastMiddleware.ts

This file was deleted.

37 changes: 0 additions & 37 deletions src/models/IAction.ts

This file was deleted.

15 changes: 15 additions & 0 deletions src/models/IRequestStatus.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import HttpErrorResponseModel from './HttpErrorResponseModel';

export interface IRequestStatus<T> {
isRequesting: boolean;
data: T;
error: HttpErrorResponseModel | null;
meta: any;
}

export const initialRequestStatus = <T>(defaultValue: T): IRequestStatus<T> => ({
isRequesting: false,
error: null,
data: defaultValue,
meta: null,
});
13 changes: 0 additions & 13 deletions src/models/IStore.ts

This file was deleted.

10 changes: 0 additions & 10 deletions src/models/ReduxProps.ts

This file was deleted.

38 changes: 0 additions & 38 deletions src/selectors/episodes/EpisodesSelector.ts

This file was deleted.

71 changes: 0 additions & 71 deletions src/selectors/error/ErrorSelector.spec.ts

This file was deleted.

69 changes: 0 additions & 69 deletions src/selectors/error/ErrorSelector.ts

This file was deleted.

Loading