From 5c164f807d5527931fe7edf2f59f43c9dfaad4fb Mon Sep 17 00:00:00 2001 From: Dave Richer Date: Wed, 6 Dec 2023 17:35:27 -0500 Subject: [PATCH] Progress --- client/package-lock.json | 254 ++++++++---------- client/package.json | 16 +- client/src/App/App.jsx | 2 +- .../bill-detail-edit-return.component.jsx | 4 +- .../bill-detail-edit.container.jsx | 4 +- .../bills-vendors-list.component.jsx | 4 +- .../contract-convert-to-ro.component.jsx | 4 +- .../contracts-list.component.jsx | 4 +- .../courtesy-car-contract-list.component.jsx | 4 +- .../csi-response-list-paginated.component.jsx | 4 +- .../form-fields-changed-alert.component.jsx | 3 +- .../global-search-os.component.jsx | 4 +- .../global-search/global-search.component.jsx | 4 +- .../inventory-list.component.jsx | 4 +- .../schedule-event.component.jsx | 4 +- .../job-checklist-form.component.jsx | 4 +- .../job-create-iou.component.jsx | 4 +- .../job-detail-cards.component.jsx | 4 +- .../job-sync-button.component.jsx | 4 +- .../jobs-available-table.container.jsx | 4 +- .../jobs-close-export-button.component.jsx | 4 +- .../jobs-detail-header-actions.component.jsx | 4 +- .../jobs-detail-pli.container.jsx | 4 +- .../jobs-list-paginated.component.jsx | 4 +- .../jobs-list/jobs-list.component.jsx | 4 +- .../jobs-ready-list.component.jsx | 4 +- .../owner-detail-form.container.jsx | 4 +- .../owners-list/owners-list.component.jsx | 4 +- .../payment-list-paginated.component.jsx | 4 +- .../phonebook-form.container.jsx | 4 +- .../production-list-detail.component.jsx | 4 +- .../production-remove-button.component.jsx | 4 +- .../qbo-authorize/qbo-authorize.component.jsx | 4 +- .../scheduler-calendar-wrapper.component.jsx | 4 +- .../shop-employees-form.component.jsx | 4 +- .../shop-employees-list.component.jsx | 4 +- .../shop-info/shop-info.component.jsx | 4 +- .../shop-template-add.component.jsx | 4 +- .../shop-template-delete.component.jsx | 4 +- .../shop-templates-list.container.jsx | 4 +- .../sign-in-form/sign-in-form.component.jsx | 6 +- .../tech-login/tech-login.component.jsx | 6 +- .../tech-lookup-jobs-drawer.component.jsx | 4 +- .../tech-lookup-jobs-list.component.jsx | 4 +- .../time-tickets-dates-selector.component.jsx | 4 +- .../vehicle-detail-form.container.jsx | 4 +- .../vehicles-list/vehicles-list.component.jsx | 4 +- .../vendors-form/vendors-form.container.jsx | 4 +- .../vendors-list/vendors-list.container.jsx | 4 +- .../src/pages/bills/bills.page.component.jsx | 4 +- .../contract-create.page.container.jsx | 4 +- .../courtesy-car-create.page.container.jsx | 4 +- .../dms-payables/dms-payables.container.jsx | 4 +- client/src/pages/dms/dms.container.jsx | 4 +- .../export-logs.page.component.jsx | 4 +- .../jobs-detail.page.component.jsx | 4 +- client/src/pages/landing/landing.page.jsx | 5 +- .../manage-root.page.component.jsx | 6 +- .../pages/manage/manage.page.component.jsx | 10 +- .../parts-queue.page.component.jsx | 4 +- .../phonebook/phonebook.page.component.jsx | 4 +- .../phonebook/phonebook.page.container.jsx | 4 +- .../scoreboard/scoreboard.page.container.jsx | 4 +- .../shop-vendor.page.component.jsx | 4 +- client/src/pages/shop/shop.page.component.jsx | 4 +- client/src/pages/tech/tech.page.component.jsx | 10 +- client/src/utils/private-route.js | 13 +- client/src/utils/prompt.js | 18 ++ 68 files changed, 279 insertions(+), 294 deletions(-) create mode 100644 client/src/utils/prompt.js diff --git a/client/package-lock.json b/client/package-lock.json index bcddac644..544e89b60 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -44,28 +44,28 @@ "query-string": "^8.1.0", "rc-queue-anim": "^2.0.0", "rc-scroll-anim": "^2.7.6", - "react": "^17.0.2", + "react": "^18.2.0", "react-big-calendar": "^1.6.8", "react-color": "^2.19.3", - "react-cookie": "^4.1.1", - "react-dom": "^17.0.2", - "react-drag-listview": "^0.2.1", + "react-cookie": "^6.1.1", + "react-dom": "^18.2.0", + "react-drag-listview": "^2.0.0", "react-grid-gallery": "^1.0.0", "react-grid-layout": "^1.3.4", - "react-i18next": "^12.2.0", + "react-i18next": "^13.5.0", "react-icons": "^4.7.1", "react-image-lightbox": "^5.1.4", "react-intersection-observer": "^9.4.3", "react-number-format": "^5.1.3", - "react-redux": "^8.0.5", + "react-redux": "^9.0.2", "react-resizable": "^3.0.4", - "react-router-dom": "^5.3.0", + "react-router-dom": "^6.20.1", "react-scripts": "^5.0.1", "react-sticky": "^6.0.3", "react-sublime-video": "^0.2.5", "react-virtualized": "^9.22.3", "recharts": "^2.4.3", - "redux": "^4.2.1", + "redux": "^5.0.0", "redux-persist": "^6.0.0", "redux-saga": "^1.2.2", "redux-state-sync": "^3.1.4", @@ -4049,6 +4049,14 @@ "url": "https://opencollective.com/redux-saga" } }, + "node_modules/@redux-saga/core/node_modules/redux": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/redux/-/redux-4.2.1.tgz", + "integrity": "sha512-LAUYz4lc+Do8/g7aeRa8JkyDErK6ekstQaqWQrNRW//MY1TvCEpMtpTWvlQ+FPbWCx+Xixu/6SHt5N0HR+SB4w==", + "dependencies": { + "@babel/runtime": "^7.9.2" + } + }, "node_modules/@redux-saga/deferred": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@redux-saga/deferred/-/deferred-1.2.1.tgz", @@ -4081,6 +4089,14 @@ "resolved": "https://registry.npmjs.org/@redux-saga/types/-/types-1.2.1.tgz", "integrity": "sha512-1dgmkh+3so0+LlBWRhGA33ua4MYr7tUOj+a9Si28vUi0IUFNbff1T3sgpeDJI/LaC75bBYnQ0A3wXjn0OrRNBA==" }, + "node_modules/@remix-run/router": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.13.1.tgz", + "integrity": "sha512-so+DHzZKsoOcoXrILB4rqDkMDy7NLMErRdOxvzvOKb507YINKUP4Di+shbTZDhSE/pBZ+vr7XGIpcOO0VLSA+Q==", + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/@restart/hooks": { "version": "0.4.11", "resolved": "https://registry.npmjs.org/@restart/hooks/-/hooks-0.4.11.tgz", @@ -5011,9 +5027,9 @@ } }, "node_modules/@types/cookie": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.3.3.tgz", - "integrity": "sha512-LKVP3cgXBT9RYj+t+9FDKwS5tdI+rPBXaNSkma7hvqy35lc7mAokC2zsqWJH0LaqIt3B962nuYI77hsJoT1gow==" + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.5.4.tgz", + "integrity": "sha512-7z/eR6O859gyWIAjuvBWFzNURmf2oPBmJlfVWkwehU5nzIyjwBsTh7WMmEEV4JFnHuQ3ex4oyTvfKzcyJVDBNA==" }, "node_modules/@types/d3-array": { "version": "3.2.1", @@ -5265,6 +5281,14 @@ "redux": "^4.0.0" } }, + "node_modules/@types/react-redux/node_modules/redux": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/redux/-/redux-4.2.1.tgz", + "integrity": "sha512-LAUYz4lc+Do8/g7aeRa8JkyDErK6ekstQaqWQrNRW//MY1TvCEpMtpTWvlQ+FPbWCx+Xixu/6SHt5N0HR+SB4w==", + "dependencies": { + "@babel/runtime": "^7.9.2" + } + }, "node_modules/@types/resolve": { "version": "1.17.1", "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz", @@ -7671,9 +7695,9 @@ "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==" }, "node_modules/cookie": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", - "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", + "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", "engines": { "node": ">= 0.6" } @@ -10106,14 +10130,6 @@ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" }, - "node_modules/express/node_modules/cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", - "engines": { - "node": ">= 0.6" - } - }, "node_modules/express/node_modules/debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -11131,19 +11147,6 @@ "he": "bin/he" } }, - "node_modules/history": { - "version": "4.10.1", - "resolved": "https://registry.npmjs.org/history/-/history-4.10.1.tgz", - "integrity": "sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==", - "dependencies": { - "@babel/runtime": "^7.1.2", - "loose-envify": "^1.2.0", - "resolve-pathname": "^3.0.0", - "tiny-invariant": "^1.0.2", - "tiny-warning": "^1.0.0", - "value-equal": "^1.0.1" - } - }, "node_modules/hoist-non-react-statics": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz", @@ -14917,19 +14920,6 @@ "node": ">=16 || 14 >=14.17" } }, - "node_modules/path-to-regexp": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz", - "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==", - "dependencies": { - "isarray": "0.0.1" - } - }, - "node_modules/path-to-regexp/node_modules/isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==" - }, "node_modules/path-type": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", @@ -17272,12 +17262,11 @@ } }, "node_modules/react": { - "version": "17.0.2", - "resolved": "https://registry.npmjs.org/react/-/react-17.0.2.tgz", - "integrity": "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==", + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", + "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", "dependencies": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1" + "loose-envify": "^1.1.0" }, "engines": { "node": ">=0.10.0" @@ -17361,6 +17350,14 @@ } } }, + "node_modules/react-beautiful-dnd/node_modules/redux": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/redux/-/redux-4.2.1.tgz", + "integrity": "sha512-LAUYz4lc+Do8/g7aeRa8JkyDErK6ekstQaqWQrNRW//MY1TvCEpMtpTWvlQ+FPbWCx+Xixu/6SHt5N0HR+SB4w==", + "dependencies": { + "@babel/runtime": "^7.9.2" + } + }, "node_modules/react-big-calendar": { "version": "1.8.5", "resolved": "https://registry.npmjs.org/react-big-calendar/-/react-big-calendar-1.8.5.tgz", @@ -17411,13 +17408,13 @@ } }, "node_modules/react-cookie": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/react-cookie/-/react-cookie-4.1.1.tgz", - "integrity": "sha512-ffn7Y7G4bXiFbnE+dKhHhbP+b8I34mH9jqnm8Llhj89zF4nPxPutxHT1suUqMeCEhLDBI7InYwf1tpaSoK5w8A==", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/react-cookie/-/react-cookie-6.1.1.tgz", + "integrity": "sha512-fuFRpf8LH6SfmVMowDUIRywJF5jAUDUWrm0EI5VdXfTl5bPcJ7B0zWbuYpT0Tvikx7Gs18MlvAT+P+744dUz2g==", "dependencies": { - "@types/hoist-non-react-statics": "^3.0.1", - "hoist-non-react-statics": "^3.0.0", - "universal-cookie": "^4.0.0" + "@types/hoist-non-react-statics": "^3.3.1", + "hoist-non-react-statics": "^3.3.2", + "universal-cookie": "^6.0.0" }, "peerDependencies": { "react": ">= 16.3.0" @@ -17477,22 +17474,21 @@ } }, "node_modules/react-dom": { - "version": "17.0.2", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-17.0.2.tgz", - "integrity": "sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==", + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", + "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", "dependencies": { "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "scheduler": "^0.20.2" + "scheduler": "^0.23.0" }, "peerDependencies": { - "react": "17.0.2" + "react": "^18.2.0" } }, "node_modules/react-drag-listview": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/react-drag-listview/-/react-drag-listview-0.2.2.tgz", - "integrity": "sha512-YftPVvUmzhqMtJnb6pCaekI8Uzvy8jRoZysxeaPvR7NnXrdDoxkqwmisvrDsb7fFn7dygSvhhfhYiV6mRIK3Lw==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/react-drag-listview/-/react-drag-listview-2.0.0.tgz", + "integrity": "sha512-7Apx/1Xt4qu+JHHP0rH6aLgZgS7c2MX8ocHVGCi03KfeIWEu0t14MhT3boQKM33l5eJrE/IWfExFTvoYq22fsg==", "dependencies": { "babel-runtime": "^6.26.0", "prop-types": "^15.5.8" @@ -17550,15 +17546,15 @@ } }, "node_modules/react-i18next": { - "version": "12.3.1", - "resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-12.3.1.tgz", - "integrity": "sha512-5v8E2XjZDFzK7K87eSwC7AJcAkcLt5xYZ4+yTPDAW1i7C93oOY1dnr4BaQM7un4Hm+GmghuiPvevWwlca5PwDA==", + "version": "13.5.0", + "resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-13.5.0.tgz", + "integrity": "sha512-CFJ5NDGJ2MUyBohEHxljOq/39NQ972rh1ajnadG9BjTk+UXbHLq4z5DKEbEQBDoIhUmmbuS/fIMJKo6VOax1HA==", "dependencies": { - "@babel/runtime": "^7.20.6", + "@babel/runtime": "^7.22.5", "html-parse-stringify": "^3.0.1" }, "peerDependencies": { - "i18next": ">= 19.0.0", + "i18next": ">= 23.2.3", "react": ">= 16.8.0" }, "peerDependenciesMeta": { @@ -17660,24 +17656,20 @@ } }, "node_modules/react-redux": { - "version": "8.1.3", - "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-8.1.3.tgz", - "integrity": "sha512-n0ZrutD7DaX/j9VscF+uTALI3oUPa/pO4Z3soOBIjuRn/FzVu6aehhysxZCLi6y7duMf52WNZGMl7CtuK5EnRw==", + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.0.2.tgz", + "integrity": "sha512-34EI42cYZxJF59Iht6RDM5xDun5EdhV8CbJcTe+mYx97XMHLNYA6RrH9r/ZOZX3CetVCYfBEU9oAY9h3sZarsw==", "dependencies": { - "@babel/runtime": "^7.12.1", - "@types/hoist-non-react-statics": "^3.3.1", "@types/use-sync-external-store": "^0.0.3", - "hoist-non-react-statics": "^3.3.2", - "react-is": "^18.0.0", "use-sync-external-store": "^1.0.0" }, "peerDependencies": { - "@types/react": "^16.8 || ^17.0 || ^18.0", - "@types/react-dom": "^16.8 || ^17.0 || ^18.0", - "react": "^16.8 || ^17.0 || ^18.0", - "react-dom": "^16.8 || ^17.0 || ^18.0", - "react-native": ">=0.59", - "redux": "^4 || ^5.0.0-beta.0" + "@types/react": "^18.2.41", + "@types/react-dom": "^18.2.17", + "react": "^18.0", + "react-dom": "^18.0", + "react-native": ">=0.71", + "redux": "^5.0.0" }, "peerDependenciesMeta": { "@types/react": { @@ -17697,11 +17689,6 @@ } } }, - "node_modules/react-redux/node_modules/react-is": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", - "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==" - }, "node_modules/react-refresh": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz", @@ -17723,39 +17710,33 @@ } }, "node_modules/react-router": { - "version": "5.3.4", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-5.3.4.tgz", - "integrity": "sha512-Ys9K+ppnJah3QuaRiLxk+jDWOR1MekYQrlytiXxC1RyfbdsZkS5pvKAzCCr031xHixZwpnsYNT5xysdFHQaYsA==", + "version": "6.20.1", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.20.1.tgz", + "integrity": "sha512-ccvLrB4QeT5DlaxSFFYi/KR8UMQ4fcD8zBcR71Zp1kaYTC5oJKYAp1cbavzGrogwxca+ubjkd7XjFZKBW8CxPA==", "dependencies": { - "@babel/runtime": "^7.12.13", - "history": "^4.9.0", - "hoist-non-react-statics": "^3.1.0", - "loose-envify": "^1.3.1", - "path-to-regexp": "^1.7.0", - "prop-types": "^15.6.2", - "react-is": "^16.6.0", - "tiny-invariant": "^1.0.2", - "tiny-warning": "^1.0.0" + "@remix-run/router": "1.13.1" + }, + "engines": { + "node": ">=14.0.0" }, "peerDependencies": { - "react": ">=15" + "react": ">=16.8" } }, "node_modules/react-router-dom": { - "version": "5.3.4", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-5.3.4.tgz", - "integrity": "sha512-m4EqFMHv/Ih4kpcBCONHbkT68KoAeHN4p3lAGoNryfHi0dMy0kCzEZakiKRsvg5wHZ/JLrLW8o8KomWiz/qbYQ==", + "version": "6.20.1", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.20.1.tgz", + "integrity": "sha512-npzfPWcxfQN35psS7rJgi/EW0Gx6EsNjfdJSAk73U/HqMEJZ2k/8puxfwHFgDQhBGmS3+sjnGbMdMSV45axPQw==", "dependencies": { - "@babel/runtime": "^7.12.13", - "history": "^4.9.0", - "loose-envify": "^1.3.1", - "prop-types": "^15.6.2", - "react-router": "5.3.4", - "tiny-invariant": "^1.0.2", - "tiny-warning": "^1.0.0" + "@remix-run/router": "1.13.1", + "react-router": "6.20.1" + }, + "engines": { + "node": ">=14.0.0" }, "peerDependencies": { - "react": ">=15" + "react": ">=16.8", + "react-dom": ">=16.8" } }, "node_modules/react-scripts": { @@ -18068,12 +18049,9 @@ } }, "node_modules/redux": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/redux/-/redux-4.2.1.tgz", - "integrity": "sha512-LAUYz4lc+Do8/g7aeRa8JkyDErK6ekstQaqWQrNRW//MY1TvCEpMtpTWvlQ+FPbWCx+Xixu/6SHt5N0HR+SB4w==", - "dependencies": { - "@babel/runtime": "^7.9.2" - } + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.0.tgz", + "integrity": "sha512-blLIYmYetpZMET6Q6uCY7Jtl/Im5OBldy+vNPauA8vvsdqyt66oep4EUpAMWNHauTC6xa9JuRPhRB72rY82QGA==" }, "node_modules/redux-logger": { "version": "3.0.6", @@ -18320,11 +18298,6 @@ "node": ">=4" } }, - "node_modules/resolve-pathname": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/resolve-pathname/-/resolve-pathname-3.0.0.tgz", - "integrity": "sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng==" - }, "node_modules/resolve-url-loader": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-url-loader/-/resolve-url-loader-4.0.0.tgz", @@ -18655,12 +18628,11 @@ } }, "node_modules/scheduler": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.20.2.tgz", - "integrity": "sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", + "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", "dependencies": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1" + "loose-envify": "^1.1.0" } }, "node_modules/schema-utils": { @@ -20135,11 +20107,6 @@ "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.1.tgz", "integrity": "sha512-AD5ih2NlSssTCwsMznbvwMZpJ1cbhkGd2uueNxzv2jDlEeZdU04JQfRnggJQ8DrcVBGjAsCKwFBbDlVNtEMlzw==" }, - "node_modules/tiny-warning": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz", - "integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==" - }, "node_modules/tinycolor2": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.6.0.tgz", @@ -20644,12 +20611,12 @@ } }, "node_modules/universal-cookie": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/universal-cookie/-/universal-cookie-4.0.4.tgz", - "integrity": "sha512-lbRVHoOMtItjWbM7TwDLdl8wug7izB0tq3/YVKhT/ahB4VDvWMyvnADfnJI8y6fSvsjh51Ix7lTGC6Tn4rMPhw==", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/universal-cookie/-/universal-cookie-6.1.1.tgz", + "integrity": "sha512-33S9x3CpdUnnjwTNs2Fgc41WGve2tdLtvaK2kPSbZRc5pGpz2vQFbRWMxlATsxNNe/Cy8SzmnmbuBM85jpZPtA==", "dependencies": { - "@types/cookie": "^0.3.3", - "cookie": "^0.4.0" + "@types/cookie": "^0.5.1", + "cookie": "^0.5.0" } }, "node_modules/universalify": { @@ -20845,11 +20812,6 @@ "node": ">= 8" } }, - "node_modules/value-equal": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/value-equal/-/value-equal-1.0.1.tgz", - "integrity": "sha512-NOJ6JZCAWr0zlxZt+xqCHNTEKOsrks2HQd4MqhP1qy4z1SkbEP467eNx6TgDKXMvUOb+OENfJCZwM+16n7fRfw==" - }, "node_modules/vanilla-picker": { "version": "2.12.2", "resolved": "https://registry.npmjs.org/vanilla-picker/-/vanilla-picker-2.12.2.tgz", diff --git a/client/package.json b/client/package.json index bc1df3327..845e614b2 100644 --- a/client/package.json +++ b/client/package.json @@ -40,28 +40,28 @@ "query-string": "^8.1.0", "rc-queue-anim": "^2.0.0", "rc-scroll-anim": "^2.7.6", - "react": "^17.0.2", + "react": "^18.2.0", "react-big-calendar": "^1.6.8", "react-color": "^2.19.3", - "react-cookie": "^4.1.1", - "react-dom": "^17.0.2", - "react-drag-listview": "^0.2.1", + "react-cookie": "^6.1.1", + "react-dom": "^18.2.0", + "react-drag-listview": "^2.0.0", "react-grid-gallery": "^1.0.0", "react-grid-layout": "^1.3.4", - "react-i18next": "^12.2.0", + "react-i18next": "^13.5.0", "react-icons": "^4.7.1", "react-image-lightbox": "^5.1.4", "react-intersection-observer": "^9.4.3", "react-number-format": "^5.1.3", - "react-redux": "^8.0.5", + "react-redux": "^9.0.2", "react-resizable": "^3.0.4", - "react-router-dom": "^5.3.0", + "react-router-dom": "^6.20.1", "react-scripts": "^5.0.1", "react-sticky": "^6.0.3", "react-sublime-video": "^0.2.5", "react-virtualized": "^9.22.3", "recharts": "^2.4.3", - "redux": "^4.2.1", + "redux": "^5.0.0", "redux-persist": "^6.0.0", "redux-saga": "^1.2.2", "redux-state-sync": "^3.1.4", diff --git a/client/src/App/App.jsx b/client/src/App/App.jsx index 45886b5a0..199bbd26d 100644 --- a/client/src/App/App.jsx +++ b/client/src/App/App.jsx @@ -4,7 +4,7 @@ import LogRocket from "logrocket"; import React, { lazy, Suspense, useEffect } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { Route, Switch } from "react-router-dom"; +import { Route } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import DocumentEditorContainer from "../components/document-editor/document-editor.container"; import ErrorBoundary from "../components/error-boundary/error-boundary.component"; diff --git a/client/src/components/bill-detail-edit/bill-detail-edit-return.component.jsx b/client/src/components/bill-detail-edit/bill-detail-edit-return.component.jsx index 986920caa..32d27e3cd 100644 --- a/client/src/components/bill-detail-edit/bill-detail-edit-return.component.jsx +++ b/client/src/components/bill-detail-edit/bill-detail-edit-return.component.jsx @@ -3,7 +3,7 @@ import queryString from "query-string"; import React, { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { useHistory, useLocation } from "react-router-dom"; +import { useNavigate, useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { insertAuditTrail } from "../../redux/application/application.actions"; import { setModalContext } from "../../redux/modals/modals.actions"; @@ -33,7 +33,7 @@ export function BillDetailEditReturn({ disabled, }) { const search = queryString.parse(useLocation().search); - const history = useHistory(); + const history = useNavigate(); const { t } = useTranslation(); const [form] = Form.useForm(); const [visible, setVisible] = useState(false); diff --git a/client/src/components/bill-detail-edit/bill-detail-edit.container.jsx b/client/src/components/bill-detail-edit/bill-detail-edit.container.jsx index 61c9b44f9..dd9490d77 100644 --- a/client/src/components/bill-detail-edit/bill-detail-edit.container.jsx +++ b/client/src/components/bill-detail-edit/bill-detail-edit.container.jsx @@ -1,12 +1,12 @@ import { Drawer, Grid } from "antd"; import queryString from "query-string"; import React from "react"; -import { useHistory, useLocation } from "react-router-dom"; +import { useNavigate, useLocation } from "react-router-dom"; import BillDetailEditComponent from "./bill-detail-edit-component"; export default function BillDetailEditcontainer() { const search = queryString.parse(useLocation().search); - const history = useHistory(); + const history = useNavigate(); const selectedBreakpoint = Object.entries(Grid.useBreakpoint()) .filter((screen) => !!screen[1]) diff --git a/client/src/components/bills-vendors-list/bills-vendors-list.component.jsx b/client/src/components/bills-vendors-list/bills-vendors-list.component.jsx index 417c719dd..9af21662b 100644 --- a/client/src/components/bills-vendors-list/bills-vendors-list.component.jsx +++ b/client/src/components/bills-vendors-list/bills-vendors-list.component.jsx @@ -2,7 +2,7 @@ import React, { useState } from "react"; import { QUERY_ALL_VENDORS } from "../../graphql/vendors.queries"; import { useQuery } from "@apollo/client"; import queryString from "query-string"; -import { useHistory, useLocation } from "react-router-dom"; +import { useNavigate, useLocation } from "react-router-dom"; import { Table, Input } from "antd"; import { useTranslation } from "react-i18next"; import { alphaSort } from "../../utils/sorters"; @@ -10,7 +10,7 @@ import AlertComponent from "../alert/alert.component"; export default function BillsVendorsList() { const search = queryString.parse(useLocation().search); - const history = useHistory(); + const history = useNavigate(); const { loading, error, data } = useQuery(QUERY_ALL_VENDORS, { fetchPolicy: "network-only", diff --git a/client/src/components/contract-convert-to-ro/contract-convert-to-ro.component.jsx b/client/src/components/contract-convert-to-ro/contract-convert-to-ro.component.jsx index 7a6fff44a..c9f401659 100644 --- a/client/src/components/contract-convert-to-ro/contract-convert-to-ro.component.jsx +++ b/client/src/components/contract-convert-to-ro/contract-convert-to-ro.component.jsx @@ -14,7 +14,7 @@ import moment from "moment"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { useHistory } from "react-router-dom"; +import { useNavigate } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { INSERT_NEW_JOB } from "../../graphql/jobs.queries"; import { @@ -41,7 +41,7 @@ export function ContractConvertToRo({ const [visible, setVisible] = useState(false); const [loading, setLoading] = useState(false); const [insertJob] = useMutation(INSERT_NEW_JOB); - const history = useHistory(); + const history = useNavigate(); const handleFinish = async (values) => { setLoading(true); diff --git a/client/src/components/contracts-list/contracts-list.component.jsx b/client/src/components/contracts-list/contracts-list.component.jsx index cd25e1e9a..8495bf340 100644 --- a/client/src/components/contracts-list/contracts-list.component.jsx +++ b/client/src/components/contracts-list/contracts-list.component.jsx @@ -3,7 +3,7 @@ import { Button, Card, Input, Space, Table, Typography } from "antd"; import queryString from "query-string"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; -import { Link, useHistory, useLocation } from "react-router-dom"; +import { Link, useNavigate, useLocation } from "react-router-dom"; import { setModalContext } from "../../redux/modals/modals.actions"; import { DateTimeFormatter } from "../../utils/DateFormatter"; import { alphaSort } from "../../utils/sorters"; @@ -39,7 +39,7 @@ export function ContractsList({ sortedInfo: {}, filteredInfo: { text: "" }, }); - const history = useHistory(); + const history = useNavigate(); const search = queryString.parse(useLocation().search); const { page } = search; diff --git a/client/src/components/courtesy-car-contract-list/courtesy-car-contract-list.component.jsx b/client/src/components/courtesy-car-contract-list/courtesy-car-contract-list.component.jsx index 125033101..0d2b4bc1f 100644 --- a/client/src/components/courtesy-car-contract-list/courtesy-car-contract-list.component.jsx +++ b/client/src/components/courtesy-car-contract-list/courtesy-car-contract-list.component.jsx @@ -2,7 +2,7 @@ import { Card, Table } from "antd"; import queryString from "query-string"; import React from "react"; import { useTranslation } from "react-i18next"; -import { Link, useHistory, useLocation } from "react-router-dom"; +import { Link, useNavigate, useLocation } from "react-router-dom"; import { DateFormatter } from "../../utils/DateFormatter"; import { alphaSort } from "../../utils/sorters"; import {pageLimit} from "../../utils/config"; @@ -13,7 +13,7 @@ export default function CourtesyCarContractListComponent({ }) { const search = queryString.parse(useLocation().search); const { page, sortcolumn, sortorder } = search; - const history = useHistory(); + const history = useNavigate(); const { t } = useTranslation(); diff --git a/client/src/components/csi-response-list-paginated/csi-response-list-paginated.component.jsx b/client/src/components/csi-response-list-paginated/csi-response-list-paginated.component.jsx index f73e35512..05f076e47 100644 --- a/client/src/components/csi-response-list-paginated/csi-response-list-paginated.component.jsx +++ b/client/src/components/csi-response-list-paginated/csi-response-list-paginated.component.jsx @@ -3,7 +3,7 @@ import { Button, Card, Table } from "antd"; import queryString from "query-string"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; -import { Link, useHistory, useLocation } from "react-router-dom"; +import { Link, useNavigate, useLocation } from "react-router-dom"; import { DateFormatter } from "../../utils/DateFormatter"; import { alphaSort } from "../../utils/sorters"; import OwnerNameDisplay from "../owner-name-display/owner-name-display.component"; @@ -17,7 +17,7 @@ export default function CsiResponseListPaginated({ }) { const search = queryString.parse(useLocation().search); const { responseid, page, sortcolumn, sortorder } = search; - const history = useHistory(); + const history = useNavigate(); const [state, setState] = useState({ sortedInfo: {}, filteredInfo: { text: "" }, diff --git a/client/src/components/form-fields-changed-alert/form-fields-changed-alert.component.jsx b/client/src/components/form-fields-changed-alert/form-fields-changed-alert.component.jsx index a1d0eb7af..73fda834c 100644 --- a/client/src/components/form-fields-changed-alert/form-fields-changed-alert.component.jsx +++ b/client/src/components/form-fields-changed-alert/form-fields-changed-alert.component.jsx @@ -2,8 +2,9 @@ import React from "react"; import { Form, Space } from "antd"; import { useTranslation } from "react-i18next"; import AlertComponent from "../alert/alert.component"; -import { Prompt, useLocation } from "react-router-dom"; +import {useLocation } from "react-router-dom"; import "./form-fields-changed.styles.scss"; +import Prompt from "../../utils/prompt"; export default function FormsFieldChanged({ form, skipPrompt }) { const { t } = useTranslation(); diff --git a/client/src/components/global-search/global-search-os.component.jsx b/client/src/components/global-search/global-search-os.component.jsx index 82e5152b4..112c51789 100644 --- a/client/src/components/global-search/global-search-os.component.jsx +++ b/client/src/components/global-search/global-search-os.component.jsx @@ -3,7 +3,7 @@ import axios from "axios"; import _ from "lodash"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; -import { Link, useHistory } from "react-router-dom"; +import { Link, useNavigate } from "react-router-dom"; import PhoneNumberFormatter from "../../utils/PhoneFormatter"; import OwnerNameDisplay, { OwnerNameDisplayFunction, @@ -12,7 +12,7 @@ import VehicleVinDisplay from "../vehicle-vin-display/vehicle-vin-display.compon export default function GlobalSearchOs() { const { t } = useTranslation(); - const history = useHistory(); + const history = useNavigate(); const [loading, setLoading] = useState(false); const [data, setData] = useState(false); diff --git a/client/src/components/global-search/global-search.component.jsx b/client/src/components/global-search/global-search.component.jsx index 787583d66..7b3f752f1 100644 --- a/client/src/components/global-search/global-search.component.jsx +++ b/client/src/components/global-search/global-search.component.jsx @@ -3,7 +3,7 @@ import { AutoComplete, Divider, Input, Space } from "antd"; import _ from "lodash"; import React from "react"; import { useTranslation } from "react-i18next"; -import { Link, useHistory } from "react-router-dom"; +import { Link, useNavigate } from "react-router-dom"; import { GLOBAL_SEARCH_QUERY } from "../../graphql/search.queries"; import PhoneNumberFormatter from "../../utils/PhoneFormatter"; import AlertComponent from "../alert/alert.component"; @@ -13,7 +13,7 @@ import OwnerNameDisplay, { import VehicleVinDisplay from "../vehicle-vin-display/vehicle-vin-display.component"; export default function GlobalSearch() { const { t } = useTranslation(); - const history = useHistory(); + const history = useNavigate(); const [callSearch, { loading, error, data }] = useLazyQuery(GLOBAL_SEARCH_QUERY); diff --git a/client/src/components/inventory-list/inventory-list.component.jsx b/client/src/components/inventory-list/inventory-list.component.jsx index 1e3bce8d7..31b9ca158 100644 --- a/client/src/components/inventory-list/inventory-list.component.jsx +++ b/client/src/components/inventory-list/inventory-list.component.jsx @@ -4,7 +4,7 @@ import queryString from "query-string"; import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { Link, useHistory, useLocation } from "react-router-dom"; +import { Link, useNavigate, useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { setModalContext } from "../../redux/modals/modals.actions"; import { selectBodyshop } from "../../redux/user/user.selectors"; @@ -31,7 +31,7 @@ export function JobsList({ }) { const search = queryString.parse(useLocation().search); const { page, sortcolumn, sortorder } = search; - const history = useHistory(); + const history = useNavigate(); const { t } = useTranslation(); const columns = [ diff --git a/client/src/components/job-at-change/schedule-event.component.jsx b/client/src/components/job-at-change/schedule-event.component.jsx index f5d456165..2651c5e27 100644 --- a/client/src/components/job-at-change/schedule-event.component.jsx +++ b/client/src/components/job-at-change/schedule-event.component.jsx @@ -17,7 +17,7 @@ import queryString from "query-string"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { Link, useHistory, useLocation } from "react-router-dom"; +import { Link, useNavigate, useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { openChatByPhone, @@ -59,7 +59,7 @@ export function ScheduleEventComponent({ }) { const { t } = useTranslation(); const [visible, setVisible] = useState(false); - const history = useHistory(); + const history = useNavigate(); const searchParams = queryString.parse(useLocation().search); const [updateAppointment] = useMutation(UPDATE_APPOINTMENT); const [title, setTitle] = useState(event.title); diff --git a/client/src/components/job-checklist/components/job-checklist-form/job-checklist-form.component.jsx b/client/src/components/job-checklist/components/job-checklist-form/job-checklist-form.component.jsx index a809100a6..55bf299d2 100644 --- a/client/src/components/job-checklist/components/job-checklist-form/job-checklist-form.component.jsx +++ b/client/src/components/job-checklist/components/job-checklist-form/job-checklist-form.component.jsx @@ -5,7 +5,7 @@ import queryString from "query-string"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { useHistory, useLocation, useParams } from "react-router-dom"; +import { useNavigate, useLocation, useParams } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { logImEXEvent } from "../../../../firebase/firebase.utils"; import { @@ -49,7 +49,7 @@ export function JobChecklistForm({ const [updateOwner] = useMutation(UPDATE_OWNER); const { jobId } = useParams(); - const history = useHistory(); + const history = useNavigate(); const search = queryString.parse(useLocation().search); const [form] = Form.useForm(); diff --git a/client/src/components/job-create-iou/job-create-iou.component.jsx b/client/src/components/job-create-iou/job-create-iou.component.jsx index 8ebc8fb75..12df9a9b4 100644 --- a/client/src/components/job-create-iou/job-create-iou.component.jsx +++ b/client/src/components/job-create-iou/job-create-iou.component.jsx @@ -4,7 +4,7 @@ import { Button, notification, Popconfirm } from "antd"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { useHistory } from "react-router"; +import { useNavigate } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { UPDATE_JOB_LINES_IOU } from "../../graphql/jobs-lines.queries"; import { @@ -25,7 +25,7 @@ export function JobCreateIOU({ bodyshop, currentUser, job, selectedJobLines }) { const { t } = useTranslation(); const [loading, setLoading] = useState(false); const client = useApolloClient(); - const history = useHistory(); + const history = useNavigate(); const { IOU_Tracking } = useTreatments( ["IOU_Tracking"], diff --git a/client/src/components/job-detail-cards/job-detail-cards.component.jsx b/client/src/components/job-detail-cards/job-detail-cards.component.jsx index a14917af0..9740f89ce 100644 --- a/client/src/components/job-detail-cards/job-detail-cards.component.jsx +++ b/client/src/components/job-detail-cards/job-detail-cards.component.jsx @@ -5,7 +5,7 @@ import queryString from "query-string"; import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { Link, useHistory, useLocation } from "react-router-dom"; +import { Link, useNavigate, useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { QUERY_JOB_CARD_DETAILS } from "../../graphql/jobs.queries"; import { setModalContext } from "../../redux/modals/modals.actions"; @@ -56,7 +56,7 @@ export function JobDetailCards({ bodyshop, setPrintCenterContext }) { const searchParams = queryString.parse(useLocation().search); const { selected } = searchParams; - const history = useHistory(); + const history = useNavigate(); const { loading, error, data, refetch } = useQuery(QUERY_JOB_CARD_DETAILS, { variables: { id: selected }, skip: !selected, diff --git a/client/src/components/job-sync-button/job-sync-button.component.jsx b/client/src/components/job-sync-button/job-sync-button.component.jsx index 042664c49..71fa014c4 100644 --- a/client/src/components/job-sync-button/job-sync-button.component.jsx +++ b/client/src/components/job-sync-button/job-sync-button.component.jsx @@ -2,11 +2,11 @@ import { Button } from "antd"; import React from "react"; import { useTranslation } from "react-i18next"; import { SyncOutlined } from "@ant-design/icons"; -import { useHistory } from "react-router-dom"; +import { useNavigate } from "react-router-dom"; export default function JobSyncButton({ job }) { const { t } = useTranslation(); - const history = useHistory(); + const history = useNavigate(); const handleClick = () => { history.push( `/manage/available?availableJobId=${job.available_jobs[0].id}&clm_no=${job.clm_no}` diff --git a/client/src/components/jobs-available-table/jobs-available-table.container.jsx b/client/src/components/jobs-available-table/jobs-available-table.container.jsx index 12d10baf9..d76267140 100644 --- a/client/src/components/jobs-available-table/jobs-available-table.container.jsx +++ b/client/src/components/jobs-available-table/jobs-available-table.container.jsx @@ -14,7 +14,7 @@ import queryString from "query-string"; import React, { useCallback, useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { useHistory, useLocation } from "react-router-dom"; +import { useNavigate, useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { logImEXEvent } from "../../firebase/firebase.utils"; import { @@ -65,7 +65,7 @@ export function JobsAvailableContainer({ nextFetchPolicy: "network-only", }); const { clm_no, availableJobId } = queryString.parse(useLocation().search); - const history = useHistory(); + const history = useNavigate(); const { t } = useTranslation(); const [ownerModalVisible, setOwnerModalVisible] = useState(false); diff --git a/client/src/components/jobs-close-export-button/jobs-close-export-button.component.jsx b/client/src/components/jobs-close-export-button/jobs-close-export-button.component.jsx index 8bbda03e1..f125fec80 100644 --- a/client/src/components/jobs-close-export-button/jobs-close-export-button.component.jsx +++ b/client/src/components/jobs-close-export-button/jobs-close-export-button.component.jsx @@ -4,7 +4,7 @@ import axios from "axios"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { useHistory } from "react-router-dom"; +import { useNavigate } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { auth, logImEXEvent } from "../../firebase/firebase.utils"; import { INSERT_EXPORT_LOG } from "../../graphql/accounting.queries"; @@ -41,7 +41,7 @@ export function JobsCloseExportButton({ setSelectedJobs, refetch, }) { - const history = useHistory(); + const history = useNavigate(); const { t } = useTranslation(); const [updateJob] = useMutation(UPDATE_JOB); const [insertExportLog] = useMutation(INSERT_EXPORT_LOG); diff --git a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx index ae3ba9a7b..446093c2b 100644 --- a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx +++ b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx @@ -13,7 +13,7 @@ import { import React, { useMemo } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { Link, useHistory } from "react-router-dom"; +import { Link, useNavigate } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { logImEXEvent } from "../../firebase/firebase.utils"; import { CANCEL_APPOINTMENTS_BY_JOB_ID } from "../../graphql/appointments.queries"; @@ -72,7 +72,7 @@ export function JobsDetailHeaderActions({ }) { const { t } = useTranslation(); const client = useApolloClient(); - const history = useHistory(); + const history = useNavigate(); const [deleteJob] = useMutation(DELETE_JOB); const [updateJob] = useMutation(UPDATE_JOB); const [voidJob] = useMutation(VOID_JOB); diff --git a/client/src/components/jobs-detail-pli/jobs-detail-pli.container.jsx b/client/src/components/jobs-detail-pli/jobs-detail-pli.container.jsx index c2fd78020..e540e8a5a 100644 --- a/client/src/components/jobs-detail-pli/jobs-detail-pli.container.jsx +++ b/client/src/components/jobs-detail-pli/jobs-detail-pli.container.jsx @@ -1,7 +1,7 @@ import { useQuery } from "@apollo/client"; import queryString from "query-string"; import React from "react"; -import { useHistory, useLocation } from "react-router-dom"; +import { useNavigate, useLocation } from "react-router-dom"; import { QUERY_BILLS_BY_JOBID } from "../../graphql/bills.queries"; import JobsDetailPliComponent from "./jobs-detail-pli.component"; @@ -13,7 +13,7 @@ export default function JobsDetailPliContainer({ job }) { }); const search = queryString.parse(useLocation().search); - const history = useHistory(); + const history = useNavigate(); const handleBillOnRowClick = (record) => { if (record) { diff --git a/client/src/components/jobs-list-paginated/jobs-list-paginated.component.jsx b/client/src/components/jobs-list-paginated/jobs-list-paginated.component.jsx index b5048d0ef..b95698a95 100644 --- a/client/src/components/jobs-list-paginated/jobs-list-paginated.component.jsx +++ b/client/src/components/jobs-list-paginated/jobs-list-paginated.component.jsx @@ -6,7 +6,7 @@ import queryString from "query-string"; import React, { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { Link, useHistory, useLocation } from "react-router-dom"; +import { Link, useNavigate, useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { selectBodyshop } from "../../redux/user/user.selectors"; import CurrencyFormatter from "../../utils/CurrencyFormatter"; @@ -26,7 +26,7 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) { const [openSearchResults, setOpenSearchResults] = useState([]); const [searchLoading, setSearchLoading] = useState(false); const { page, sortcolumn, sortorder } = search; - const history = useHistory(); + const history = useNavigate(); const { t } = useTranslation(); const columns = [ diff --git a/client/src/components/jobs-list/jobs-list.component.jsx b/client/src/components/jobs-list/jobs-list.component.jsx index fb2e1daa6..7b2e24b8f 100644 --- a/client/src/components/jobs-list/jobs-list.component.jsx +++ b/client/src/components/jobs-list/jobs-list.component.jsx @@ -10,7 +10,7 @@ import queryString from "query-string"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { Link, useHistory, useLocation } from "react-router-dom"; +import { Link, useNavigate, useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { QUERY_ALL_ACTIVE_JOBS } from "../../graphql/jobs.queries"; import { selectBodyshop } from "../../redux/user/user.selectors"; @@ -45,7 +45,7 @@ export function JobsList({ bodyshop }) { }); const { t } = useTranslation(); - const history = useHistory(); + const history = useNavigate(); const [searchText, setSearchText] = useState(""); if (error) return ; diff --git a/client/src/components/jobs-ready-list/jobs-ready-list.component.jsx b/client/src/components/jobs-ready-list/jobs-ready-list.component.jsx index fee461df2..da08dc78d 100644 --- a/client/src/components/jobs-ready-list/jobs-ready-list.component.jsx +++ b/client/src/components/jobs-ready-list/jobs-ready-list.component.jsx @@ -10,7 +10,7 @@ import queryString from "query-string"; import React, { useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { Link, useHistory, useLocation } from "react-router-dom"; +import { Link, useNavigate, useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { QUERY_ALL_ACTIVE_JOBS } from "../../graphql/jobs.queries"; import { selectBodyshop } from "../../redux/user/user.selectors"; @@ -59,7 +59,7 @@ export function JobsReadyList({ bodyshop }) { }); const { t } = useTranslation(); - const history = useHistory(); + const history = useNavigate(); const [searchText, setSearchText] = useState(""); if (error) return ; diff --git a/client/src/components/owner-detail-form/owner-detail-form.container.jsx b/client/src/components/owner-detail-form/owner-detail-form.container.jsx index fc1ae6bd1..fd2a5d636 100644 --- a/client/src/components/owner-detail-form/owner-detail-form.container.jsx +++ b/client/src/components/owner-detail-form/owner-detail-form.container.jsx @@ -1,6 +1,6 @@ import { Button, Form, notification, PageHeader, Popconfirm } from "antd"; import React, { useState } from "react"; -import { useHistory } from "react-router-dom"; +import { useNavigate } from "react-router-dom"; import { useMutation } from "@apollo/client"; import { useTranslation } from "react-i18next"; import { DELETE_OWNER, UPDATE_OWNER } from "../../graphql/owners.queries"; @@ -9,7 +9,7 @@ import OwnerDetailFormComponent from "./owner-detail-form.component"; function OwnerDetailFormContainer({ owner, refetch }) { const { t } = useTranslation(); const [form] = Form.useForm(); - const history = useHistory(); + const history = useNavigate(); const [loading, setLoading] = useState(false); const [updateOwner] = useMutation(UPDATE_OWNER); const [deleteOwner] = useMutation(DELETE_OWNER); diff --git a/client/src/components/owners-list/owners-list.component.jsx b/client/src/components/owners-list/owners-list.component.jsx index f0ed2f4c2..08226e486 100644 --- a/client/src/components/owners-list/owners-list.component.jsx +++ b/client/src/components/owners-list/owners-list.component.jsx @@ -3,7 +3,7 @@ import { Button, Card, Input, Space, Table, Typography } from "antd"; import queryString from "query-string"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; -import { Link, useHistory, useLocation } from "react-router-dom"; +import { Link, useNavigate, useLocation } from "react-router-dom"; import PhoneFormatter from "../../utils/PhoneFormatter"; import OwnerNameDisplay from "../owner-name-display/owner-name-display.component"; import {pageLimit} from "../../utils/config"; @@ -19,7 +19,7 @@ export default function OwnersListComponent({ page, // sortcolumn, sortorder } = search; - const history = useHistory(); + const history = useNavigate(); const [state, setState] = useState({ sortedInfo: {}, diff --git a/client/src/components/payments-list-paginated/payment-list-paginated.component.jsx b/client/src/components/payments-list-paginated/payment-list-paginated.component.jsx index 86ad50cb8..83b8fc499 100644 --- a/client/src/components/payments-list-paginated/payment-list-paginated.component.jsx +++ b/client/src/components/payments-list-paginated/payment-list-paginated.component.jsx @@ -6,7 +6,7 @@ import queryString from "query-string"; import React, { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { Link, useHistory, useLocation } from "react-router-dom"; +import { Link, useNavigate, useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { QUERY_PAYMENT_BY_ID } from "../../graphql/payments.queries"; import { setModalContext } from "../../redux/modals/modals.actions"; @@ -47,7 +47,7 @@ export function PaymentsListPaginated({ const [searchLoading, setSearchLoading] = useState(false); const { page, sortcolumn, sortorder } = search; const client = useApolloClient(); - const history = useHistory(); + const history = useNavigate(); const [state, setState] = useState({ sortedInfo: {}, filteredInfo: { text: "" }, diff --git a/client/src/components/phonebook-form/phonebook-form.container.jsx b/client/src/components/phonebook-form/phonebook-form.container.jsx index ea99c30b9..1fb466e9e 100644 --- a/client/src/components/phonebook-form/phonebook-form.container.jsx +++ b/client/src/components/phonebook-form/phonebook-form.container.jsx @@ -4,7 +4,7 @@ import queryString from "query-string"; import React, { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { useHistory, useLocation } from "react-router-dom"; +import { useNavigate, useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { DELETE_PHONEBOOK, @@ -22,7 +22,7 @@ const mapStateToProps = createStructuredSelector({ }); function PhonebookFormContainer({ refetch, bodyshop }) { - const history = useHistory(); + const history = useNavigate(); const search = queryString.parse(useLocation().search); const { phonebookentry } = search; const [formLoading, setFormLoading] = useState(false); diff --git a/client/src/components/production-list-detail/production-list-detail.component.jsx b/client/src/components/production-list-detail/production-list-detail.component.jsx index 00466b7f3..bdb2aa533 100644 --- a/client/src/components/production-list-detail/production-list-detail.component.jsx +++ b/client/src/components/production-list-detail/production-list-detail.component.jsx @@ -5,7 +5,7 @@ import queryString from "query-string"; import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { useHistory, useLocation } from "react-router-dom"; +import { useNavigate, useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { QUERY_JOB_CARD_DETAILS } from "../../graphql/jobs.queries"; import { setModalContext } from "../../redux/modals/modals.actions"; @@ -45,7 +45,7 @@ export function ProductionListDetail({ technician, }) { const search = queryString.parse(useLocation().search); - const history = useHistory(); + const history = useNavigate(); const { selected } = search; const { t } = useTranslation(); diff --git a/client/src/components/production-remove-button/production-remove-button.component.jsx b/client/src/components/production-remove-button/production-remove-button.component.jsx index 3f7b0a896..499c2a562 100644 --- a/client/src/components/production-remove-button/production-remove-button.component.jsx +++ b/client/src/components/production-remove-button/production-remove-button.component.jsx @@ -5,14 +5,14 @@ import { useTranslation } from "react-i18next"; import { logImEXEvent } from "../../firebase/firebase.utils"; import { UPDATE_JOB } from "../../graphql/jobs.queries"; import queryString from "query-string"; -import { useHistory, useLocation } from "react-router-dom"; +import { useNavigate, useLocation } from "react-router-dom"; export default function ProductionRemoveButton({ jobId }) { const [removeJobFromProduction] = useMutation(UPDATE_JOB); const { t } = useTranslation(); const [loading, setLoading] = useState(false); const search = queryString.parse(useLocation().search); - const history = useHistory(); + const history = useNavigate(); const handleRemoveFromProd = async () => { logImEXEvent("production_remove_job"); diff --git a/client/src/components/qbo-authorize/qbo-authorize.component.jsx b/client/src/components/qbo-authorize/qbo-authorize.component.jsx index 8d333a989..c924d8b83 100644 --- a/client/src/components/qbo-authorize/qbo-authorize.component.jsx +++ b/client/src/components/qbo-authorize/qbo-authorize.component.jsx @@ -3,12 +3,12 @@ import Axios from "axios"; import queryString from "query-string"; import React, { useEffect } from "react"; import { useCookies } from "react-cookie"; -import { useHistory, useLocation } from "react-router-dom"; +import { useNavigate, useLocation } from "react-router-dom"; import QboSignIn from "../../assets/qbo/C2QB_green_btn_med_default.svg"; export default function QboAuthorizeComponent() { const location = useLocation(); - const history = useHistory(); + const history = useNavigate(); const [, setCookie] = useCookies(["access_token", "refresh_token"]); const handleQbSignIn = async () => { diff --git a/client/src/components/schedule-calendar-wrapper/scheduler-calendar-wrapper.component.jsx b/client/src/components/schedule-calendar-wrapper/scheduler-calendar-wrapper.component.jsx index 7cd90bd14..1ba555475 100644 --- a/client/src/components/schedule-calendar-wrapper/scheduler-calendar-wrapper.component.jsx +++ b/client/src/components/schedule-calendar-wrapper/scheduler-calendar-wrapper.component.jsx @@ -3,7 +3,7 @@ import queryString from "query-string"; import React from "react"; import { Calendar, momentLocalizer } from "react-big-calendar"; import { connect } from "react-redux"; -import { useHistory, useLocation } from "react-router-dom"; +import { useNavigate, useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { selectBodyshop } from "../../redux/user/user.selectors"; import Event from "../job-at-change/schedule-event.container"; @@ -31,7 +31,7 @@ export function ScheduleCalendarWrapperComponent({ ...otherProps }) { const search = queryString.parse(useLocation().search); - const history = useHistory(); + const history = useNavigate(); const { t } = useTranslation(); const handleEventPropStyles = (event, start, end, isSelected) => { return { diff --git a/client/src/components/shop-employees/shop-employees-form.component.jsx b/client/src/components/shop-employees/shop-employees-form.component.jsx index 82fafb1aa..8587dc39a 100644 --- a/client/src/components/shop-employees/shop-employees-form.component.jsx +++ b/client/src/components/shop-employees/shop-employees-form.component.jsx @@ -17,7 +17,7 @@ import querystring from "query-string"; import React, { useEffect } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { useHistory, useLocation } from "react-router-dom"; +import { useNavigate, useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { logImEXEvent } from "../../firebase/firebase.utils"; import { @@ -47,7 +47,7 @@ const mapDispatchToProps = (dispatch) => ({ export function ShopEmployeesFormComponent({ bodyshop }) { const { t } = useTranslation(); const [form] = useForm(); - const history = useHistory(); + const history = useNavigate(); const search = querystring.parse(useLocation().search); const [deleteVacation] = useMutation(DELETE_VACATION); const { error, data } = useQuery(QUERY_EMPLOYEE_BY_ID, { diff --git a/client/src/components/shop-employees/shop-employees-list.component.jsx b/client/src/components/shop-employees/shop-employees-list.component.jsx index 416e875f9..6d2bec36a 100644 --- a/client/src/components/shop-employees/shop-employees-list.component.jsx +++ b/client/src/components/shop-employees/shop-employees-list.component.jsx @@ -2,11 +2,11 @@ import { Button, Table } from "antd"; import queryString from "query-string"; import React from "react"; import { useTranslation } from "react-i18next"; -import { useHistory, useLocation } from "react-router-dom"; +import { useNavigate, useLocation } from "react-router-dom"; export default function ShopEmployeesListComponent({ loading, employees }) { const { t } = useTranslation(); - const history = useHistory(); + const history = useNavigate(); const search = queryString.parse(useLocation().search); const handleOnRowClick = (record) => { diff --git a/client/src/components/shop-info/shop-info.component.jsx b/client/src/components/shop-info/shop-info.component.jsx index 8803500ef..c387e94a0 100644 --- a/client/src/components/shop-info/shop-info.component.jsx +++ b/client/src/components/shop-info/shop-info.component.jsx @@ -15,7 +15,7 @@ import ShopInfoResponsibilityCenterComponent from "./shop-info.responsibilitycen import ShopInfoROStatusComponent from "./shop-info.rostatus.component"; import ShopInfoSchedulingComponent from "./shop-info.scheduling.component"; import ShopInfoSpeedPrint from "./shop-info.speedprint.component"; -import { useHistory, useLocation } from "react-router-dom"; +import { useNavigate, useLocation } from "react-router-dom"; import queryString from "query-string"; const mapStateToProps = createStructuredSelector({ @@ -33,7 +33,7 @@ export function ShopInfoComponent({ bodyshop, form, saveLoading }) { bodyshop.imexshopid ); const { t } = useTranslation(); - const history = useHistory(); + const history = useNavigate(); const location = useLocation(); const search = queryString.parse(location.search); diff --git a/client/src/components/shop-template-add/shop-template-add.component.jsx b/client/src/components/shop-template-add/shop-template-add.component.jsx index 5fb45635a..8ccca1967 100644 --- a/client/src/components/shop-template-add/shop-template-add.component.jsx +++ b/client/src/components/shop-template-add/shop-template-add.component.jsx @@ -5,7 +5,7 @@ import queryString from "query-string"; import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { useHistory, useLocation } from "react-router-dom"; +import { useNavigate, useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { logImEXEvent } from "../../firebase/firebase.utils"; import { @@ -30,7 +30,7 @@ export function ShopTemplateAddComponent({ }) { const { t } = useTranslation(); const search = queryString.parse(useLocation().search); - const history = useHistory(); + const history = useNavigate(); const [insertTemplate] = useMutation(INSERT_TEMPLATE); const shopTemplateKeys = shopTemplateList.map((template) => template.name); diff --git a/client/src/components/shop-template-delete/shop-template-delete.component.jsx b/client/src/components/shop-template-delete/shop-template-delete.component.jsx index 763fd571a..8bc872f08 100644 --- a/client/src/components/shop-template-delete/shop-template-delete.component.jsx +++ b/client/src/components/shop-template-delete/shop-template-delete.component.jsx @@ -3,14 +3,14 @@ import { Button, notification, Popconfirm } from "antd"; import queryString from "query-string"; import React from "react"; import { useTranslation } from "react-i18next"; -import { useHistory, useLocation } from "react-router-dom"; +import { useNavigate, useLocation } from "react-router-dom"; import { DELETE_TEMPLATE } from "../../graphql/templates.queries"; import { logImEXEvent } from "../../firebase/firebase.utils"; export default function ShopTemplateDeleteComponent({ templateId, refetch }) { const { t } = useTranslation(); const search = queryString.parse(useLocation().search); - const history = useHistory(); + const history = useNavigate(); const [deleteTemplate] = useMutation(DELETE_TEMPLATE); const handleDelete = async () => { diff --git a/client/src/components/shop-templates-list/shop-templates-list.container.jsx b/client/src/components/shop-templates-list/shop-templates-list.container.jsx index 8f0868796..e8ab7e448 100644 --- a/client/src/components/shop-templates-list/shop-templates-list.container.jsx +++ b/client/src/components/shop-templates-list/shop-templates-list.container.jsx @@ -5,7 +5,7 @@ import { QUERY_CUSTOM_TEMPLATES } from "../../graphql/templates.queries"; import AlertComponent from "../alert/alert.component"; import Skeleton from "../loading-skeleton/loading-skeleton.component"; import { useTranslation } from "react-i18next"; -import { useHistory, useLocation } from "react-router-dom"; +import { useNavigate, useLocation } from "react-router-dom"; import queryString from "query-string"; import { TemplateList } from "../../utils/TemplateConstants"; import ShopTemplateAdd from "../shop-template-add/shop-template-add.component"; @@ -19,7 +19,7 @@ export default function ShopTemplatesListContainer({ visibleState }) { }); const { t } = useTranslation(); const search = queryString.parse(useLocation().search); - const history = useHistory(); + const history = useNavigate(); if (error) return ; const handleEdit = (record) => { diff --git a/client/src/components/sign-in-form/sign-in-form.component.jsx b/client/src/components/sign-in-form/sign-in-form.component.jsx index c964c0dc2..4e8d29cf9 100644 --- a/client/src/components/sign-in-form/sign-in-form.component.jsx +++ b/client/src/components/sign-in-form/sign-in-form.component.jsx @@ -4,7 +4,7 @@ import queryString from "query-string"; import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { Link, Redirect, useLocation } from "react-router-dom"; +import { Link, useNavigate, useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import ImEXOnlineLogo from "../../assets/logo192.png"; import { @@ -39,7 +39,7 @@ export function SignInComponent({ loginLoading, }) { const { redirect } = queryString.parse(useLocation().search); - + const navigate = useNavigate(); const { t } = useTranslation(); const handleFinish = (values) => { const { email, password } = values; @@ -48,7 +48,7 @@ export function SignInComponent({ const [form] = Form.useForm(); if (currentUser.authorized === true) - return ; + return navigate("/manage"); return (
diff --git a/client/src/components/tech-login/tech-login.component.jsx b/client/src/components/tech-login/tech-login.component.jsx index 502b20cbf..eec9775b4 100644 --- a/client/src/components/tech-login/tech-login.component.jsx +++ b/client/src/components/tech-login/tech-login.component.jsx @@ -11,7 +11,7 @@ import { } from "../../redux/tech/tech.selectors"; import AlertComponent from "../alert/alert.component"; import "./tech-login.styles.scss"; -import { Redirect } from "react-router-dom"; +import { useNavigate } from "react-router-dom"; const mapStateToProps = createStructuredSelector({ technician: selectTechnician, @@ -30,14 +30,16 @@ export function TechLogin({ techLoginStart, }) { const { t } = useTranslation(); + const navigate = useNavigate(); const handleFinish = (values) => { techLoginStart(values); }; + if (technician) return navigate("/tech/joblookup"); + return (
- {technician ? : null}
; diff --git a/client/src/components/ticket-tickets-dates-selector/time-tickets-dates-selector.component.jsx b/client/src/components/ticket-tickets-dates-selector/time-tickets-dates-selector.component.jsx index a827e3fd7..3c6792aaf 100644 --- a/client/src/components/ticket-tickets-dates-selector/time-tickets-dates-selector.component.jsx +++ b/client/src/components/ticket-tickets-dates-selector/time-tickets-dates-selector.component.jsx @@ -3,12 +3,12 @@ import { DatePicker } from "antd"; import moment from "moment"; import queryString from "query-string"; import React from "react"; -import { useHistory, useLocation } from "react-router-dom"; +import { useNavigate, useLocation } from "react-router-dom"; export default function TimeTicketsDatesSelector() { const searchParams = queryString.parse(useLocation().search); const { start, end } = searchParams; - const history = useHistory(); + const history = useNavigate(); const handleChange = (dates) => { if (dates) { diff --git a/client/src/components/vehicle-detail-form/vehicle-detail-form.container.jsx b/client/src/components/vehicle-detail-form/vehicle-detail-form.container.jsx index 9fbe45ed7..38406e515 100644 --- a/client/src/components/vehicle-detail-form/vehicle-detail-form.container.jsx +++ b/client/src/components/vehicle-detail-form/vehicle-detail-form.container.jsx @@ -5,7 +5,7 @@ import VehicleDetailFormComponent from "./vehicle-detail-form.component"; import { useTranslation } from "react-i18next"; import moment from "moment"; import { DELETE_VEHICLE, UPDATE_VEHICLE } from "../../graphql/vehicles.queries"; -import { useHistory } from "react-router-dom"; +import { useNavigate } from "react-router-dom"; function VehicleDetailFormContainer({ vehicle, refetch }) { const { t } = useTranslation(); @@ -13,7 +13,7 @@ function VehicleDetailFormContainer({ vehicle, refetch }) { const [deleteVehicle] = useMutation(DELETE_VEHICLE); const [form] = Form.useForm(); const [loading, setLoading] = useState(false); - const history = useHistory(); + const history = useNavigate(); const handleDelete = async () => { setLoading(true); diff --git a/client/src/components/vehicles-list/vehicles-list.component.jsx b/client/src/components/vehicles-list/vehicles-list.component.jsx index bb1a97183..38e68655b 100644 --- a/client/src/components/vehicles-list/vehicles-list.component.jsx +++ b/client/src/components/vehicles-list/vehicles-list.component.jsx @@ -3,7 +3,7 @@ import { Button, Card, Input, Space, Table, Typography } from "antd"; import queryString from "query-string"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; -import { Link, useHistory, useLocation } from "react-router-dom"; +import { Link, useNavigate, useLocation } from "react-router-dom"; import VehicleVinDisplay from "../vehicle-vin-display/vehicle-vin-display.component"; import {pageLimit} from "../../utils/config"; export default function VehiclesListComponent({ @@ -17,7 +17,7 @@ export default function VehiclesListComponent({ page, //sortcolumn, sortorder, } = search; - const history = useHistory(); + const history = useNavigate(); const [state, setState] = useState({ sortedInfo: {}, diff --git a/client/src/components/vendors-form/vendors-form.container.jsx b/client/src/components/vendors-form/vendors-form.container.jsx index af9257bf2..3f92c717d 100644 --- a/client/src/components/vendors-form/vendors-form.container.jsx +++ b/client/src/components/vendors-form/vendors-form.container.jsx @@ -4,7 +4,7 @@ import queryString from "query-string"; import React, { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { useHistory, useLocation } from "react-router-dom"; +import { useNavigate, useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { DELETE_VENDOR, @@ -22,7 +22,7 @@ const mapStateToProps = createStructuredSelector({ }); function VendorsFormContainer({ refetch, bodyshop }) { - const history = useHistory(); + const history = useNavigate(); const search = queryString.parse(useLocation().search); const { selectedvendor } = search; const [formLoading, setFormLoading] = useState(false); diff --git a/client/src/components/vendors-list/vendors-list.container.jsx b/client/src/components/vendors-list/vendors-list.container.jsx index 11cfa919e..5bf201790 100644 --- a/client/src/components/vendors-list/vendors-list.container.jsx +++ b/client/src/components/vendors-list/vendors-list.container.jsx @@ -1,7 +1,7 @@ import { useQuery } from "@apollo/client"; import queryString from "query-string"; import React from "react"; -import { useHistory, useLocation } from "react-router-dom"; +import { useNavigate, useLocation } from "react-router-dom"; import AlertComponent from "../../components/alert/alert.component"; import { QUERY_ALL_VENDORS } from "../../graphql/vendors.queries"; import VendorsListComponent from "./vendors-list.component"; @@ -12,7 +12,7 @@ export default function VendorsListContainer() { nextFetchPolicy: "network-only", }); const search = queryString.parse(useLocation().search); - const history = useHistory(); + const history = useNavigate(); const handleNewVendor = () => { search.selectedvendor = "new"; diff --git a/client/src/pages/bills/bills.page.component.jsx b/client/src/pages/bills/bills.page.component.jsx index 169a94a5e..b3854c423 100644 --- a/client/src/pages/bills/bills.page.component.jsx +++ b/client/src/pages/bills/bills.page.component.jsx @@ -5,7 +5,7 @@ import queryString from "query-string"; import React, { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { Link, useHistory, useLocation } from "react-router-dom"; +import { Link, useNavigate, useLocation } from "react-router-dom"; import BillDeleteButton from "../../components/bill-delete-button/bill-delete-button.component"; import PartsOrderModalContainer from "../../components/parts-order-modal/parts-order-modal.container"; import PrintWrapperComponent from "../../components/print-wrapper/print-wrapper.component"; @@ -35,7 +35,7 @@ export function BillsListPage({ const [openSearchResults, setOpenSearchResults] = useState([]); const [searchLoading, setSearchLoading] = useState(false); const { page } = search; - const history = useHistory(); + const history = useNavigate(); const [state, setState] = useState({ sortedInfo: {}, filteredInfo: { text: "" }, diff --git a/client/src/pages/contract-create/contract-create.page.container.jsx b/client/src/pages/contract-create/contract-create.page.container.jsx index 7ab35f1c5..8eae1e43b 100644 --- a/client/src/pages/contract-create/contract-create.page.container.jsx +++ b/client/src/pages/contract-create/contract-create.page.container.jsx @@ -3,7 +3,7 @@ import { Form, notification } from "antd"; import React, { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { useHistory, useLocation } from "react-router-dom"; +import { useNavigate, useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component"; import { INSERT_NEW_CONTRACT } from "../../graphql/cccontracts.queries"; @@ -30,7 +30,7 @@ export function ContractCreatePageContainer({ }) { const [form] = Form.useForm(); const { t } = useTranslation(); - const history = useHistory(); + const history = useNavigate(); const location = useLocation(); const [loading, setLoading] = useState(false); const selectedCarState = useState(null); diff --git a/client/src/pages/courtesy-car-create/courtesy-car-create.page.container.jsx b/client/src/pages/courtesy-car-create/courtesy-car-create.page.container.jsx index f373e4066..5079c65d6 100644 --- a/client/src/pages/courtesy-car-create/courtesy-car-create.page.container.jsx +++ b/client/src/pages/courtesy-car-create/courtesy-car-create.page.container.jsx @@ -3,7 +3,7 @@ import { Form, notification } from "antd"; import React, { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { useHistory } from "react-router-dom"; +import { useNavigate } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import CourtesyCarFormComponent from "../../components/courtesy-car-form/courtesy-car-form.component"; import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component"; @@ -30,7 +30,7 @@ export function CourtesyCarCreateContainer({ const [loading, setLoading] = useState(false); const [insertCourtesyCar] = useMutation(INSERT_NEW_COURTESY_CAR); const { t } = useTranslation(); - const history = useHistory(); + const history = useNavigate(); const handleFinish = async (values) => { setLoading(true); diff --git a/client/src/pages/dms-payables/dms-payables.container.jsx b/client/src/pages/dms-payables/dms-payables.container.jsx index de3bd2f17..4349c49c5 100644 --- a/client/src/pages/dms-payables/dms-payables.container.jsx +++ b/client/src/pages/dms-payables/dms-payables.container.jsx @@ -2,7 +2,7 @@ import { Button, Card, Col, notification, Row, Select, Space } from "antd"; import React, { useEffect, useRef, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { useHistory, useLocation } from "react-router-dom"; +import { useNavigate, useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import SocketIO from "socket.io-client"; import DmsAllocationsSummaryApComponent from "../../components/dms-allocations-summary-ap/dms-allocations-summary-ap.component"; @@ -42,7 +42,7 @@ export const socket = SocketIO( export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader }) { const { t } = useTranslation(); const [logLevel, setLogLevel] = useState("DEBUG"); - const history = useHistory(); + const history = useNavigate(); const [logs, setLogs] = useState([]); const { state } = useLocation(); diff --git a/client/src/pages/dms/dms.container.jsx b/client/src/pages/dms/dms.container.jsx index 77c670e60..ae748c04c 100644 --- a/client/src/pages/dms/dms.container.jsx +++ b/client/src/pages/dms/dms.container.jsx @@ -13,7 +13,7 @@ import queryString from "query-string"; import React, { useEffect, useRef, useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { Link, useHistory, useLocation } from "react-router-dom"; +import { Link, useNavigate, useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import SocketIO from "socket.io-client"; import AlertComponent from "../../components/alert/alert.component"; @@ -60,7 +60,7 @@ export const socket = SocketIO( export function DmsContainer({ bodyshop, setBreadcrumbs, setSelectedHeader }) { const { t } = useTranslation(); const [logLevel, setLogLevel] = useState("DEBUG"); - const history = useHistory(); + const history = useNavigate(); const [logs, setLogs] = useState([]); const search = queryString.parse(useLocation().search); const { jobId } = search; diff --git a/client/src/pages/export-logs/export-logs.page.component.jsx b/client/src/pages/export-logs/export-logs.page.component.jsx index 7ae8977cf..14c415990 100644 --- a/client/src/pages/export-logs/export-logs.page.component.jsx +++ b/client/src/pages/export-logs/export-logs.page.component.jsx @@ -6,7 +6,7 @@ import queryString from "query-string"; import React from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { Link, useHistory, useLocation } from "react-router-dom"; +import { Link, useNavigate, useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import AlertComponent from "../../components/alert/alert.component"; import { QUERY_EXPORT_LOG_PAGINATED } from "../../graphql/accounting.queries"; @@ -21,7 +21,7 @@ const mapStateToProps = createStructuredSelector({ export function ExportLogsPageComponent({ bodyshop }) { const searchParams = queryString.parse(useLocation().search); const { page, sortcolumn, sortorder, search } = searchParams; - const history = useHistory(); + const history = useNavigate(); const { loading, error, data, refetch } = useQuery( QUERY_EXPORT_LOG_PAGINATED, diff --git a/client/src/pages/jobs-detail/jobs-detail.page.component.jsx b/client/src/pages/jobs-detail/jobs-detail.page.component.jsx index 001a18166..ebde2e03e 100644 --- a/client/src/pages/jobs-detail/jobs-detail.page.component.jsx +++ b/client/src/pages/jobs-detail/jobs-detail.page.component.jsx @@ -24,7 +24,7 @@ import React, { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { FaHardHat, FaRegStickyNote, FaShieldAlt } from "react-icons/fa"; import { connect } from "react-redux"; -import { useHistory, useLocation } from "react-router-dom"; +import {useNavigate, useLocation} from "react-router-dom"; import { createStructuredSelector } from "reselect"; import FormFieldsChanged from "../../components/form-fields-changed-alert/form-fields-changed-alert.component"; import JobAuditTrail from "../../components/job-audit-trail/job-audit-trail.component"; @@ -77,7 +77,7 @@ export function JobsDetailPage({ }) { const { t } = useTranslation(); const [form] = Form.useForm(); - const history = useHistory(); + const history = useNavigate(); const [loading, setLoading] = useState(false); const search = queryString.parse(useLocation().search); diff --git a/client/src/pages/landing/landing.page.jsx b/client/src/pages/landing/landing.page.jsx index 9677488e6..a189a5409 100644 --- a/client/src/pages/landing/landing.page.jsx +++ b/client/src/pages/landing/landing.page.jsx @@ -1,6 +1,6 @@ import React from "react"; import { connect } from "react-redux"; -import { Redirect } from "react-router-dom"; +import { useNavigate } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { selectCurrentUser } from "../../redux/user/user.selectors"; import LandingPageStatic from "../../landing/index"; @@ -12,7 +12,8 @@ const mapStateToProps = createStructuredSelector({ export default connect(mapStateToProps, null)(LandingPage); export function LandingPage({ currentUser }) { - if (currentUser.authorized) return ; + const navigate = useNavigate(); + if (currentUser.authorized) return navigate("/manage"); return ; //return ; diff --git a/client/src/pages/manage-root/manage-root.page.component.jsx b/client/src/pages/manage-root/manage-root.page.component.jsx index 1d15268f2..0b87db1d8 100644 --- a/client/src/pages/manage-root/manage-root.page.component.jsx +++ b/client/src/pages/manage-root/manage-root.page.component.jsx @@ -1,10 +1,10 @@ import React from "react"; //import DashboardGridComponent from "../../components/dashboard-grid/dashboard-grid.component"; -import { Redirect } from "react-router-dom"; +import { useNavigate } from "react-router-dom"; export default function ManageRootPageComponent() { //const client = useApolloClient(); - - return ; + const navigate = useNavigate(); + return navigate("/manage/jobs"); // return ( //
diff --git a/client/src/pages/manage/manage.page.component.jsx b/client/src/pages/manage/manage.page.component.jsx index fe1969ee9..c83ebd0e8 100644 --- a/client/src/pages/manage/manage.page.component.jsx +++ b/client/src/pages/manage/manage.page.component.jsx @@ -3,7 +3,7 @@ import preval from "preval.macro"; import React, { lazy, Suspense, useEffect } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { Link, Route, Switch } from "react-router-dom"; +import { Link, Route, Routes } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import BreadCrumbs from "../../components/breadcrumbs/breadcrumbs.component"; import ChatAffixContainer from "../../components/chat-affix/chat-affix.container"; @@ -212,7 +212,7 @@ export function Manage({ match, conflict, bodyshop }) { - + - + - + - + ({ setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)), @@ -31,7 +31,7 @@ export function PhonebookContainer({ setBreadcrumbs, setSelectedHeader }) { }, [setBreadcrumbs, t, setSelectedHeader]); const search = queryString.parse(useLocation().search); const { phonebookentry } = search; - const history = useHistory(); + const history = useNavigate(); const selectedBreakpoint = Object.entries(Grid.useBreakpoint()) .filter((screen) => !!screen[1]) diff --git a/client/src/pages/scoreboard/scoreboard.page.container.jsx b/client/src/pages/scoreboard/scoreboard.page.container.jsx index 1ef4b273f..c181c55df 100644 --- a/client/src/pages/scoreboard/scoreboard.page.container.jsx +++ b/client/src/pages/scoreboard/scoreboard.page.container.jsx @@ -5,7 +5,7 @@ import React, { useEffect } from "react"; import { useTranslation } from "react-i18next"; import { FaShieldAlt } from "react-icons/fa"; import { connect } from "react-redux"; -import { useHistory, useLocation } from "react-router-dom"; +import { useNavigate, useLocation } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import FeatureWrapper from "../../components/feature-wrapper/feature-wrapper.component"; import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component"; @@ -31,7 +31,7 @@ export function ScoreboardContainer({ setBreadcrumbs, setSelectedHeader }) { const { t } = useTranslation(); const searchParams = queryString.parse(useLocation().search); const { tab } = searchParams; - const history = useHistory(); + const history = useNavigate(); useEffect(() => { document.title = t("titles.scoreboard"); setSelectedHeader("scoreboard"); diff --git a/client/src/pages/shop-vendor/shop-vendor.page.component.jsx b/client/src/pages/shop-vendor/shop-vendor.page.component.jsx index 6eb6e2064..dafa7ffbe 100644 --- a/client/src/pages/shop-vendor/shop-vendor.page.component.jsx +++ b/client/src/pages/shop-vendor/shop-vendor.page.component.jsx @@ -1,14 +1,14 @@ import { Drawer, Grid } from "antd"; import queryString from "query-string"; import React from "react"; -import { useHistory, useLocation } from "react-router-dom"; +import { useNavigate, useLocation } from "react-router-dom"; import VendorsFormContainer from "../../components/vendors-form/vendors-form.container"; import VendorsListContainer from "../../components/vendors-list/vendors-list.container"; export default function ShopVendorPageComponent() { const search = queryString.parse(useLocation().search); const { selectedvendor } = search; - const history = useHistory(); + const history = useNavigate(); const selectedBreakpoint = Object.entries(Grid.useBreakpoint()) .filter((screen) => !!screen[1]) diff --git a/client/src/pages/shop/shop.page.component.jsx b/client/src/pages/shop/shop.page.component.jsx index de6b267d5..0ce020a54 100644 --- a/client/src/pages/shop/shop.page.component.jsx +++ b/client/src/pages/shop/shop.page.component.jsx @@ -1,6 +1,6 @@ import { Tabs } from "antd"; import React, { useEffect } from "react"; -import { useHistory, useLocation } from "react-router-dom"; +import { useNavigate, useLocation } from "react-router-dom"; import queryString from "query-string"; import { useTranslation } from "react-i18next"; import ShopEmployeesContainer from "../../components/shop-employees/shop-employees.container"; @@ -26,7 +26,7 @@ const mapDispatchToProps = (dispatch) => ({ export function ShopPage({ bodyshop, setSelectedHeader, setBreadcrumbs }) { const { t } = useTranslation(); - const history = useHistory(); + const history = useNavigate(); const search = queryString.parse(useLocation().search); useEffect(() => { diff --git a/client/src/pages/tech/tech.page.component.jsx b/client/src/pages/tech/tech.page.component.jsx index 5808ae84c..cdf0d6e1b 100644 --- a/client/src/pages/tech/tech.page.component.jsx +++ b/client/src/pages/tech/tech.page.component.jsx @@ -2,7 +2,7 @@ import { BackTop, Layout } from "antd"; import React, { Suspense, lazy, useEffect } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; -import { Redirect, Route, Switch } from "react-router-dom"; +import { useNavigate, Route, Routes } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import ErrorBoundary from "../../components/error-boundary/error-boundary.component"; @@ -50,16 +50,18 @@ const mapDispatchToProps = (dispatch) => ({ export function TechPage({ technician, match }) { const { t } = useTranslation(); + const navigate = useNavigate(); useEffect(() => { document.title = t("titles.app"); }, [t]); + if (!technician) return navigate(`${match.path}/login` + ); return ( - {technician ? null : } @@ -74,7 +76,7 @@ export function TechPage({ technician, match }) { - + - + diff --git a/client/src/utils/private-route.js b/client/src/utils/private-route.js index 372dba49b..13b7c837d 100644 --- a/client/src/utils/private-route.js +++ b/client/src/utils/private-route.js @@ -1,18 +1,17 @@ import React from "react"; -import { Redirect, Route, useLocation } from "react-router-dom"; +import { useNavigate, Route, useLocation } from "react-router-dom"; function PrivateRoute({ component: Component, isAuthorized, ...rest }) { const location = useLocation(); + const navigate = useNavigate(); + if (!isAuthorized) { + navigate(`/signin?redirect=${location.pathname}`); + } return ( - isAuthorized === true ? ( - - ) : ( - - ) + render={(props) => } /> ); diff --git a/client/src/utils/prompt.js b/client/src/utils/prompt.js new file mode 100644 index 000000000..718029f73 --- /dev/null +++ b/client/src/utils/prompt.js @@ -0,0 +1,18 @@ +import { unstable_usePrompt as useBlocker } from 'react-router-dom' + +function Prompt(props) { + const block = props.when + + useBlocker(() => { + if (block) { + return ! window.confirm(props.message) + } + return false + }) + + return ( +
+ ) +} + +export default Prompt \ No newline at end of file