Skip to content

Commit

Permalink
Introduce React Toolkit. (#113)
Browse files Browse the repository at this point in the history
* Add Redux Toolkit.

* Migrate Redux store setup to RTK.

* Use React Toolkit imports (almost) everywhere.
  • Loading branch information
tdilauro authored May 30, 2024
1 parent 268e02e commit 542a0b9
Show file tree
Hide file tree
Showing 36 changed files with 115 additions and 59 deletions.
72 changes: 70 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
},
"dependencies": {
"@nypl/dgx-svg-icons": "0.3.4",
"@reduxjs/toolkit": "^2.2.5",
"@tanstack/react-query": "^4.36.1",
"@thepalaceproject/web-opds-client": "^1.0.1",
"bootstrap": "^3.3.6",
Expand All @@ -57,7 +58,7 @@
"react-dnd": "^14.0.5",
"react-dnd-html5-backend": "^14.0.5",
"react-dom": "^16.8.6",
"react-redux": "^7.1.0",
"react-redux": "^7.2.9",
"react-router": "^3.2.0",
"recharts": "^1.8.6",
"redux": "^4.0.1",
Expand All @@ -80,7 +81,8 @@
"@types/prop-types": "^15.7.3",
"@types/react": "^16.14.6",
"@types/react-dom": "^16.9.8",
"@types/react-redux": "^7.1.16",
"@types/react-redux": "^7.1.33",
"@types/react-router": "^3.0.28",
"@types/recharts": "^1.8.28",
"@types/redux-mock-store": "^1.0.3",
"@typescript-eslint/eslint-plugin": "^5.46.0",
Expand Down
2 changes: 1 addition & 1 deletion src/components/AccountPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import * as PropTypes from "prop-types";
import ChangePasswordForm from "./ChangePasswordForm";
import { RootState } from "../store";
Expand Down
2 changes: 1 addition & 1 deletion src/components/BookCoverEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import { connect } from "react-redux";
import editorAdapter from "../editorAdapter";
import DataFetcher from "@thepalaceproject/web-opds-client/lib/DataFetcher";
Expand Down
2 changes: 1 addition & 1 deletion src/components/BookDetailsContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import * as PropTypes from "prop-types";

import BookDetailsTabContainer from "./BookDetailsTabContainer";
Expand Down
2 changes: 1 addition & 1 deletion src/components/BookDetailsEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import { connect } from "react-redux";
import DataFetcher from "@thepalaceproject/web-opds-client/lib/DataFetcher";
import ActionCreator from "../actions";
Expand Down
2 changes: 1 addition & 1 deletion src/components/ChangePasswordForm.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import { FetchErrorData } from "@thepalaceproject/web-opds-client/lib/interfaces";
import { RootState } from "../store";
import { connect } from "react-redux";
Expand Down
2 changes: 1 addition & 1 deletion src/components/CirculationEvents.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import { connect } from "react-redux";
import ActionCreator from "../actions";
import ErrorMessage from "./ErrorMessage";
Expand Down
2 changes: 1 addition & 1 deletion src/components/Classifications.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import { connect } from "react-redux";
import editorAdapter from "../editorAdapter";
import DataFetcher from "@thepalaceproject/web-opds-client/lib/DataFetcher";
Expand Down
2 changes: 1 addition & 1 deletion src/components/Complaints.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import { connect } from "react-redux";
import DataFetcher from "@thepalaceproject/web-opds-client/lib/DataFetcher";
import ActionCreator from "../actions";
Expand Down
2 changes: 1 addition & 1 deletion src/components/ConfigPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import * as PropTypes from "prop-types";
import Header from "./Header";
import Footer from "./Footer";
Expand Down
2 changes: 1 addition & 1 deletion src/components/ContextProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import * as PropTypes from "prop-types";
import buildStore, { RootState } from "../store";
import { FeatureFlags, PathFor } from "../interfaces";
Expand Down
2 changes: 1 addition & 1 deletion src/components/CustomListPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import * as PropTypes from "prop-types";
import Header from "./Header";
import Footer from "./Footer";
Expand Down
2 changes: 1 addition & 1 deletion src/components/CustomLists.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable react/no-deprecated */
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import { connect } from "react-redux";
import * as PropTypes from "prop-types";
import { RootState } from "../store";
Expand Down
2 changes: 1 addition & 1 deletion src/components/CustomListsForBook.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import { connect } from "react-redux";
import DataFetcher from "@thepalaceproject/web-opds-client/lib/DataFetcher";
import ActionCreator from "../actions";
Expand Down
2 changes: 1 addition & 1 deletion src/components/DashboardPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import { RootState } from "../store";
import * as PropTypes from "prop-types";
import Header from "./Header";
Expand Down
2 changes: 1 addition & 1 deletion src/components/DiagnosticsTabContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import { connect } from "react-redux";
import ActionCreator from "../actions";
import { DiagnosticsData } from "../interfaces";
Expand Down
2 changes: 1 addition & 1 deletion src/components/EditableConfigList.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import { FetchErrorData } from "@thepalaceproject/web-opds-client/lib/interfaces";
import { SettingData } from "../interfaces";
import { Alert } from "react-bootstrap";
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable */
import * as React from "react";
import { connect } from "react-redux";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import * as PropTypes from "prop-types";
import { RootState } from "../store";
import ActionCreator from "../actions";
Expand Down
2 changes: 1 addition & 1 deletion src/components/LanePage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import * as PropTypes from "prop-types";
import Header from "./Header";
import Footer from "./Footer";
Expand Down
2 changes: 1 addition & 1 deletion src/components/Lanes.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable react/no-deprecated */
import * as React from "react";
import { Link } from "react-router";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import { connect } from "react-redux";
import { RootState } from "../store";
import ActionCreator from "../actions";
Expand Down
2 changes: 1 addition & 1 deletion src/components/ManagePatrons.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import { connect } from "react-redux";
import * as PropTypes from "prop-types";
import { RootState } from "../store";
Expand Down
2 changes: 1 addition & 1 deletion src/components/ManagePatronsForm.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import { connect } from "react-redux";
import { RootState } from "../store";
import ActionCreator from "../actions";
Expand Down
2 changes: 1 addition & 1 deletion src/components/ManagePatronsTabContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import { connect } from "react-redux";
import * as PropTypes from "prop-types";
import { RootState } from "../store";
Expand Down
2 changes: 1 addition & 1 deletion src/components/QuicksightDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
LibrariesData,
LibraryData,
} from "../interfaces";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import { RootState } from "../store";
import { connect } from "react-redux";
import ActionCreator from "../actions";
Expand Down
2 changes: 1 addition & 1 deletion src/components/QuicksightDashboardPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import { RootState } from "../store";
import * as PropTypes from "prop-types";
import Header from "./Header";
Expand Down
2 changes: 1 addition & 1 deletion src/components/ResetAdobeId.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import { connect } from "react-redux";
import { RootState } from "../store";
import ActionCreator from "../actions";
Expand Down
2 changes: 1 addition & 1 deletion src/components/SelfTests.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable react/no-deprecated */
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import { connect } from "react-redux";
import { RootState } from "../store";
import ActionCreator from "../actions";
Expand Down
2 changes: 1 addition & 1 deletion src/components/SelfTestsCategory.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import { RootState } from "../store";
import SelfTests from "./SelfTests";
import {
Expand Down
2 changes: 1 addition & 1 deletion src/components/SelfTestsTabContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/no-empty-interface */
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import { connect } from "react-redux";
import ActionCreator from "../actions";
import { CollectionsData, PatronAuthServicesData } from "../interfaces";
Expand Down
2 changes: 1 addition & 1 deletion src/components/SetupPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import * as PropTypes from "prop-types";
import IndividualAdmins from "./IndividualAdmins";
import { RootState } from "../store";
Expand Down
2 changes: 1 addition & 1 deletion src/components/TabContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import * as PropTypes from "prop-types";
import { Navigate, PathFor } from "../interfaces";
import { RootState } from "../store";
Expand Down
2 changes: 1 addition & 1 deletion src/components/TroubleshootingCategoryPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import * as PropTypes from "prop-types";
import { RootState } from "../store";
import DiagnosticsTabContainer from "./DiagnosticsTabContainer";
Expand Down
2 changes: 1 addition & 1 deletion src/components/TroubleshootingPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import * as PropTypes from "prop-types";
import Header from "./Header";
import Footer from "./Footer";
Expand Down
2 changes: 1 addition & 1 deletion src/components/TroubleshootingTabContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import { Store } from "redux";
import { Store } from "@reduxjs/toolkit";
import * as PropTypes from "prop-types";
import { State } from "../reducers/index";
import {
Expand Down
Loading

0 comments on commit 542a0b9

Please sign in to comment.