From 74a9c4bdb0a5aa01353e1060644fbd2a323f1e46 Mon Sep 17 00:00:00 2001 From: Rishi Ghan Date: Tue, 7 Nov 2023 12:04:04 -0600 Subject: [PATCH 01/28] =?UTF-8?q?=E2=86=AA=EF=B8=8F=20Removed=20node-sass,?= =?UTF-8?q?=20added=20sass?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- yarn.lock | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 2ecbacf..2c1fc15 100644 --- a/package.json +++ b/package.json @@ -113,7 +113,7 @@ "prettier": "^2.2.1", "react-refresh": "^0.14.0", "rimraf": "^4.1.3", - "sass": "^1.66.1", + "sass": "^1.69.5", "storybook": "^7.3.2", "tui-jsdoc-template": "^1.2.2", "typescript": "^5.1.6" diff --git a/yarn.lock b/yarn.lock index 7f61642..f0ffaf8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9198,7 +9198,7 @@ safe-regex-test@^1.0.0: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -sass@^1.66.1: +sass@^1.69.5: version "1.69.5" resolved "https://registry.yarnpkg.com/sass/-/sass-1.69.5.tgz#23e18d1c757a35f2e52cc81871060b9ad653dfde" integrity sha512-qg2+UCJibLr2LCVOt3OlPhr/dqVHWOa9XtZf2OjbLs/T4VPSJ00udtgJxH3neXZm+QqX8B+3cU7RaLqp1iVfcQ== @@ -9511,6 +9511,7 @@ string-length@^4.0.1: strip-ansi "^6.0.0" "string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: + name string-width-cjs version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -9585,6 +9586,7 @@ string_decoder@~1.1.1: safe-buffer "~5.1.0" "strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: + name strip-ansi-cjs version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -10414,6 +10416,7 @@ wordwrap@^1.0.0: integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== "wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: + name wrap-ansi-cjs version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== -- 2.49.1 From 580307a39b12047728ec32cf798ccb2e12e8fb3b Mon Sep 17 00:00:00 2001 From: Rishi Ghan Date: Tue, 7 Nov 2023 13:41:44 -0600 Subject: [PATCH 02/28] =?UTF-8?q?=F0=9F=8F=97=EF=B8=8F=20Refactoring=20Nav?= =?UTF-8?q?bar=20to=20read=20from=20zustand=20store?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/components/App.tsx | 2 +- .../AirDCPPSettings/AirDCPPSettingsForm.tsx | 3 +- src/client/components/shared/Navbar.tsx | 148 ++++++++++++++++++ src/client/store/index.ts | 19 ++- 4 files changed, 167 insertions(+), 5 deletions(-) diff --git a/src/client/components/App.tsx b/src/client/components/App.tsx index 6eae757..d4a087c 100644 --- a/src/client/components/App.tsx +++ b/src/client/components/App.tsx @@ -46,7 +46,7 @@ export const App = (): ReactElement => { // }); // } // }, []); - return <>{/* The rest of your application */}; + return <>{/* */}; }; export default App; diff --git a/src/client/components/Settings/AirDCPPSettings/AirDCPPSettingsForm.tsx b/src/client/components/Settings/AirDCPPSettings/AirDCPPSettingsForm.tsx index 4f97895..31cd471 100644 --- a/src/client/components/Settings/AirDCPPSettings/AirDCPPSettingsForm.tsx +++ b/src/client/components/Settings/AirDCPPSettings/AirDCPPSettingsForm.tsx @@ -14,6 +14,7 @@ export const AirDCPPSettingsForm = (): ReactElement => { airDCPPDisconnectionInfo, airDCPPSocketConnectionInformation, airDCPPClientConfiguration, + airDCPPSocketInstance, } = useStore( useShallow((state) => ({ airDCPPSocketConnected: state.airDCPPSocketConnected, @@ -21,9 +22,9 @@ export const AirDCPPSettingsForm = (): ReactElement => { airDCPPClientConfiguration: state.airDCPPClientConfiguration, airDCPPSocketConnectionInformation: state.airDCPPSocketConnectionInformation, + airDCPPSocketInstance: state.airDCPPSocketInstance, })), ); - const onSubmit = useCallback(async (values) => { try { // airDCPPSettings.setSettings(values); diff --git a/src/client/components/shared/Navbar.tsx b/src/client/components/shared/Navbar.tsx index f512a61..aba0620 100644 --- a/src/client/components/shared/Navbar.tsx +++ b/src/client/components/shared/Navbar.tsx @@ -2,10 +2,61 @@ import React, { useContext } from "react"; import { SearchBar } from "../GlobalSearchBar/SearchBar"; import { DownloadProgressTick } from "../ComicDetail/DownloadProgressTick"; import { Link } from "react-router-dom"; +import { useSelector } from "react-redux"; import { isUndefined } from "lodash"; import { format, fromUnixTime } from "date-fns"; +import { useStore } from "../../store/index"; +import { useShallow } from "zustand/react/shallow"; const Navbar: React.FunctionComponent = (props) => { + const { + airDCPPSocketConnected, + airDCPPDisconnectionInfo, + airDCPPSocketConnectionInformation, + airDCPPClientConfiguration, + airDCPPSocketInstance, + } = useStore( + useShallow((state) => ({ + airDCPPSocketConnected: state.airDCPPSocketConnected, + airDCPPDisconnectionInfo: state.airDCPPDisconnectionInfo, + airDCPPClientConfiguration: state.airDCPPClientConfiguration, + airDCPPSocketConnectionInformation: + state.airDCPPSocketConnectionInformation, + airDCPPSocketInstance: state.airDCPPSocketInstance, + })), + ); + const downloadProgressTick = useSelector( + (state: RootState) => state.airdcpp.downloadProgressData, + ); + + const airDCPPSocketConnectionStatus = useSelector( + (state: RootState) => state.airdcpp.isAirDCPPSocketConnected, + ); + const airDCPPSessionInfo = useSelector( + (state: RootState) => state.airdcpp.airDCPPSessionInfo, + ); + const socketDisconnectionReason = useSelector( + (state: RootState) => state.airdcpp.socketDisconnectionReason, + ); + + // Import-related selector hooks + const successfulImportJobCount = useSelector( + (state: RootState) => state.fileOps.successfulJobCount, + ); + const failedImportJobCount = useSelector( + (state: RootState) => state.fileOps.failedJobCount, + ); + + const lastQueueJob = useSelector( + (state: RootState) => state.fileOps.lastQueueJob, + ); + const libraryQueueImportStatus = useSelector( + (state: RootState) => state.fileOps.LSQueueImportStatus, + ); + + const allImportJobResults = useSelector( + (state: RootState) => state.fileOps.importJobStatistics, + ); return (