mirror of
https://github.com/plankanban/planka.git
synced 2025-07-19 05:09:43 +02:00
chore: Update dependencies
This commit is contained in:
parent
14434b81fe
commit
fa8afd7b6e
22 changed files with 12561 additions and 15980 deletions
|
@ -1,8 +1,8 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Provider } from 'react-redux';
|
||||
import { Route, Switch } from 'react-router-dom';
|
||||
import { ConnectedRouter } from 'connected-react-router';
|
||||
import { Route, Routes } from 'react-router-dom';
|
||||
import { HistoryRouter as Router } from 'redux-first-history/rr6';
|
||||
|
||||
import Paths from '../constants/Paths';
|
||||
import LoginContainer from '../containers/LoginContainer';
|
||||
|
@ -19,16 +19,16 @@ import '../styles.module.scss';
|
|||
function Root({ store, history }) {
|
||||
return (
|
||||
<Provider store={store}>
|
||||
<ConnectedRouter history={history}>
|
||||
<Switch>
|
||||
<Route exact path={Paths.LOGIN} component={LoginContainer} />
|
||||
<Route exact path={Paths.ROOT} component={CoreWrapperContainer} />
|
||||
<Route exact path={Paths.PROJECTS} component={CoreWrapperContainer} />
|
||||
<Route exact path={Paths.BOARDS} component={CoreWrapperContainer} />
|
||||
<Route exact path={Paths.CARDS} component={CoreWrapperContainer} />
|
||||
<Route path="*" component={NotFound} />
|
||||
</Switch>
|
||||
</ConnectedRouter>
|
||||
<Router history={history}>
|
||||
<Routes>
|
||||
<Route path={Paths.LOGIN} element={<LoginContainer />} />
|
||||
<Route path={Paths.ROOT} element={<CoreWrapperContainer />} />
|
||||
<Route path={Paths.PROJECTS} element={<CoreWrapperContainer />} />
|
||||
<Route path={Paths.BOARDS} element={<CoreWrapperContainer />} />
|
||||
<Route path={Paths.CARDS} element={<CoreWrapperContainer />} />
|
||||
<Route path="*" element={<NotFound />} />
|
||||
</Routes>
|
||||
</Router>
|
||||
</Provider>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { bindActionCreators } from 'redux';
|
||||
import { connect } from 'react-redux';
|
||||
import { push } from 'connected-react-router';
|
||||
import { push } from 'redux-first-history';
|
||||
import omit from 'lodash/omit';
|
||||
|
||||
import selectors from '../selectors';
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
import { createBrowserHistory } from 'history';
|
||||
|
||||
export default createBrowserHistory();
|
|
@ -1,10 +1,10 @@
|
|||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { createRoot } from 'react-dom/client';
|
||||
|
||||
import store from './store';
|
||||
import history from './history';
|
||||
import store, { history } from './store';
|
||||
import Root from './components/Root';
|
||||
|
||||
import './i18n';
|
||||
|
||||
ReactDOM.render(React.createElement(Root, { store, history }), document.getElementById('root'));
|
||||
const root = createRoot(document.getElementById('root'));
|
||||
root.render(React.createElement(Root, { store, history }));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { LOCATION_CHANGE } from 'connected-react-router';
|
||||
import { LOCATION_CHANGE } from 'redux-first-history';
|
||||
|
||||
import ActionTypes from '../constants/ActionTypes';
|
||||
import ModalTypes from '../constants/ModalTypes';
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import { connectRouter } from 'connected-react-router';
|
||||
import { routerReducer } from '../redux-history-context';
|
||||
|
||||
import history from '../history';
|
||||
|
||||
export default connectRouter(history);
|
||||
export default routerReducer;
|
||||
|
|
6
client/src/redux-history-context.js
Executable file
6
client/src/redux-history-context.js
Executable file
|
@ -0,0 +1,6 @@
|
|||
import { createBrowserHistory } from 'history';
|
||||
import { createReduxHistoryContext } from 'redux-first-history';
|
||||
|
||||
export const { createReduxHistory, routerMiddleware, routerReducer } = createReduxHistoryContext({
|
||||
history: createBrowserHistory(),
|
||||
});
|
|
@ -23,9 +23,9 @@ export function* fetchBoardByCurrentPath() {
|
|||
|
||||
if (pathsMatch) {
|
||||
let boardId;
|
||||
if (pathsMatch.path === Paths.BOARDS) {
|
||||
if (pathsMatch.pattern.path === Paths.BOARDS) {
|
||||
boardId = pathsMatch.params.id;
|
||||
} else if (pathsMatch.path === Paths.CARDS) {
|
||||
} else if (pathsMatch.pattern.path === Paths.CARDS) {
|
||||
({
|
||||
item: card,
|
||||
item: { boardId },
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { call, put, select, take } from 'redux-saga/effects';
|
||||
import { push } from 'connected-react-router';
|
||||
import { push } from 'redux-first-history';
|
||||
|
||||
import request from '../request';
|
||||
import selectors from '../../../selectors';
|
||||
|
@ -31,7 +31,7 @@ export function* handleLocationChange() {
|
|||
return;
|
||||
}
|
||||
|
||||
switch (pathsMatch.path) {
|
||||
switch (pathsMatch.pattern.path) {
|
||||
case Paths.LOGIN:
|
||||
yield call(goToRoot);
|
||||
|
||||
|
@ -58,7 +58,7 @@ export function* handleLocationChange() {
|
|||
let attachments;
|
||||
let deletedNotifications;
|
||||
|
||||
switch (pathsMatch.path) {
|
||||
switch (pathsMatch.pattern.path) {
|
||||
case Paths.BOARDS:
|
||||
case Paths.CARDS: {
|
||||
const currentBoard = yield select(selectors.selectCurrentBoard);
|
||||
|
@ -85,7 +85,7 @@ export function* handleLocationChange() {
|
|||
} catch (error) {} // eslint-disable-line no-empty
|
||||
}
|
||||
|
||||
if (pathsMatch.path === Paths.CARDS) {
|
||||
if (pathsMatch.pattern.path === Paths.CARDS) {
|
||||
const notificationIds = yield select(selectors.selectNotificationIdsForCurrentCard);
|
||||
|
||||
if (notificationIds && notificationIds.length > 0) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { takeEvery } from 'redux-saga/effects';
|
||||
import { LOCATION_CHANGE } from 'connected-react-router';
|
||||
import { LOCATION_CHANGE } from 'redux-first-history';
|
||||
|
||||
import services from '../services';
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { call, put, select } from 'redux-saga/effects';
|
||||
import { push } from 'connected-react-router';
|
||||
import { push } from 'redux-first-history';
|
||||
|
||||
import selectors from '../../../selectors';
|
||||
import Paths from '../../../constants/Paths';
|
||||
|
@ -19,7 +19,7 @@ export function* handleLocationChange() {
|
|||
return;
|
||||
}
|
||||
|
||||
switch (pathsMatch.path) {
|
||||
switch (pathsMatch.pattern.path) {
|
||||
case Paths.ROOT:
|
||||
case Paths.PROJECTS:
|
||||
case Paths.BOARDS:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { takeEvery } from 'redux-saga/effects';
|
||||
import { LOCATION_CHANGE } from 'connected-react-router';
|
||||
import { LOCATION_CHANGE } from 'redux-first-history';
|
||||
|
||||
import services from '../services';
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ export const selectPath = createReduxOrmSelector(
|
|||
(state) => selectCurrentUserId(state),
|
||||
({ Project, Board, Card }, pathsMatch, currentUserId) => {
|
||||
if (pathsMatch) {
|
||||
switch (pathsMatch.path) {
|
||||
switch (pathsMatch.pattern.path) {
|
||||
case Paths.PROJECTS: {
|
||||
const projectModel = Project.withId(pathsMatch.params.id);
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { configure } from 'enzyme';
|
||||
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
|
||||
|
||||
import 'jest-enzyme';
|
||||
|
||||
configure({ adapter: new Adapter() });
|
||||
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
||||
// allows you to do things like:
|
||||
// expect(element).toHaveTextContent(/react/i)
|
||||
// learn more: https://github.com/testing-library/jest-dom
|
||||
import '@testing-library/jest-dom';
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
import { applyMiddleware, legacy_createStore as createStore, compose as reduxCompose } from 'redux';
|
||||
import createSagaMiddleware from 'redux-saga';
|
||||
import { routerMiddleware } from 'connected-react-router';
|
||||
|
||||
import rootReducer from './reducers';
|
||||
import rootSaga from './sagas';
|
||||
import history from './history';
|
||||
import { createReduxHistory, routerMiddleware } from './redux-history-context';
|
||||
|
||||
const sagaMiddleware = createSagaMiddleware();
|
||||
|
||||
const middlewares = [sagaMiddleware, routerMiddleware(history)];
|
||||
const middlewares = [sagaMiddleware, routerMiddleware];
|
||||
|
||||
let compose = reduxCompose;
|
||||
|
||||
|
@ -23,6 +22,10 @@ if (process.env.NODE_ENV !== 'production') {
|
|||
}
|
||||
}
|
||||
|
||||
export default createStore(rootReducer, compose(applyMiddleware(...middlewares)));
|
||||
const store = createStore(rootReducer, compose(applyMiddleware(...middlewares)));
|
||||
|
||||
sagaMiddleware.run(rootSaga);
|
||||
|
||||
export default store;
|
||||
|
||||
export const history = createReduxHistory(store);
|
||||
|
|
|
@ -2,10 +2,13 @@ import { matchPath } from 'react-router-dom';
|
|||
|
||||
export default (pathname, paths) => {
|
||||
for (let i = 0; i < paths.length; i += 1) {
|
||||
const match = matchPath(pathname, {
|
||||
path: paths[i],
|
||||
exact: true,
|
||||
});
|
||||
const match = matchPath(
|
||||
{
|
||||
path: paths[i],
|
||||
end: true,
|
||||
},
|
||||
pathname,
|
||||
);
|
||||
|
||||
if (match) {
|
||||
return match;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue