From ec4ab5495fdfdb8a3db5f6ad6daf9329b20ef3ff Mon Sep 17 00:00:00 2001 From: leon666 Date: Thu, 16 Nov 2023 21:12:14 +0800 Subject: [PATCH 1/4] feat: restructure the api module --- src/Router/index.js | 0 src/api/api.js | 15 +++++++++++ src/api/auth.api.js | 13 ++++++++++ src/api/booking.api.js | 11 ++++++++ src/api/doctor.api.js | 13 ++++++++++ src/api/patient.api.js | 17 +++++++++++++ src/api/request.js | 57 ++++++++++++++++++++++++++++++++++++++++++ src/api/user.api.js | 13 ++++++++++ 8 files changed, 139 insertions(+) create mode 100644 src/Router/index.js create mode 100644 src/api/api.js create mode 100644 src/api/auth.api.js create mode 100644 src/api/booking.api.js create mode 100644 src/api/doctor.api.js create mode 100644 src/api/patient.api.js create mode 100644 src/api/request.js create mode 100644 src/api/user.api.js diff --git a/src/Router/index.js b/src/Router/index.js new file mode 100644 index 0000000..e69de29 diff --git a/src/api/api.js b/src/api/api.js new file mode 100644 index 0000000..d6d28f0 --- /dev/null +++ b/src/api/api.js @@ -0,0 +1,15 @@ +import authApi from './auth.api' +import bookingApi from './booking.api' +import doctorApi from './doctor.api' +import patientApi from './patient.api' +import userApi from './user.api' + +const api = { + ...authApi, + ...bookingApi, + ...doctorApi, + ...patientApi, + ...userApi, +} + +export default api \ No newline at end of file diff --git a/src/api/auth.api.js b/src/api/auth.api.js new file mode 100644 index 0000000..d72c4a8 --- /dev/null +++ b/src/api/auth.api.js @@ -0,0 +1,13 @@ +import { request } from './request'; + +const authApi = { + signup: (body) => request("post", `/auth/signup`, body), + + signin: (body) => request("post", `/auth/signin`, body), + + refreshToken: (body) => request("post", `/auth/refresh`, body), + + logout: (body) => request("delete", `/auth/logout`, body), +} + +export default authApi; \ No newline at end of file diff --git a/src/api/booking.api.js b/src/api/booking.api.js new file mode 100644 index 0000000..8a72f45 --- /dev/null +++ b/src/api/booking.api.js @@ -0,0 +1,11 @@ +import { request } from './request'; + +const bookingApi = { + bookAppointment: (body) => request("post", `/booking/appointment`, body), + + duePayment: () => request("get", `/booking/duepayment`), + + makePayment: (body) => request("post", `/booking/payment`, body), +} + +export default bookingApi; \ No newline at end of file diff --git a/src/api/doctor.api.js b/src/api/doctor.api.js new file mode 100644 index 0000000..77349a8 --- /dev/null +++ b/src/api/doctor.api.js @@ -0,0 +1,13 @@ +import { request } from './request'; + +const doctorApi = { + docList: () => request("get", `/doctor/list`), + + addNew: (body) => request("post", `/doctor/new`, body), + + updateFee: (body) => request("post", `/doctor/fee`, body), + + uploadPrescription: (body) => request("post", `/doctor/prescription/upload`, body), +} + +export default doctorApi; \ No newline at end of file diff --git a/src/api/patient.api.js b/src/api/patient.api.js new file mode 100644 index 0000000..fdb0c58 --- /dev/null +++ b/src/api/patient.api.js @@ -0,0 +1,17 @@ +import { request } from './request'; + +const patientApi = { + myAppointments: () => request('get', `/patient/appointments`), + + cancelAppointment: (body) => request("delete", `/patient/appointments/cancel`, body), + + prescriptions: () => request("get", `/patient/prescriptions`), + + writeFeedback: (body) => request("post", `/patient/feedback/write`, body), + + deleteFeedback: (body) => request("post", `/patient/feedback/delete`, body), + + patientFeedbacks: () => request("get", `/patient/feedbacks`), +} + +export default patientApi; \ No newline at end of file diff --git a/src/api/request.js b/src/api/request.js new file mode 100644 index 0000000..af571a4 --- /dev/null +++ b/src/api/request.js @@ -0,0 +1,57 @@ +import axios from "axios"; + +const baseUrl = `${process.env.REACT_APP_BASE}/api`; + +axios.interceptors.request.use( + (config) => { + const accessToken = localStorage.getItem("accessToken"); + if (accessToken) { + config.headers["x-auth-token"] = accessToken; + } + return config; + }, + (error) => { + Promise.reject(error); + } +); + +axios.interceptors.response.use( + (response) => { + return response; + }, + (error) => { + const originalRequest = error.config; + let refreshToken = localStorage.getItem("refreshToken"); + if ( + refreshToken && + error.response.status === 401 && + !originalRequest._retry + ) { + originalRequest._retry = true; + return axios + .post(`${baseUrl}/auth/refresh`, { refreshToken: refreshToken }) + .then((res) => { + if (res.status === 200) { + localStorage.setItem("accessToken", res.data.accessToken); + return axios(originalRequest); + } + }); + } + return Promise.reject(error); + } +); + +export const request = (method, url, data, config) => { + switch (method) { + case 'post': + return axiosInstance.post(url, data, config); + case 'get': + return axiosInstance.get(url, { params: data, ...config }); + case 'delete': + return axiosInstance.delete(url, { params: data, ...config }); + case 'put': + return axiosInstance.put(url, data, config); + default: + break; + } +}; diff --git a/src/api/user.api.js b/src/api/user.api.js new file mode 100644 index 0000000..bbebd80 --- /dev/null +++ b/src/api/user.api.js @@ -0,0 +1,13 @@ +import { request } from './request'; + +const userApi = { + unverified: () => request("get", `/users/unverified`), + + verify: (body) => request("post", `/users/unverified/verify`, body), + + reject: (body) => request("delete", `/users/unverified/reject`, body), + + generateStats: () => request("get", `/generate/stats`), +} + +export default userApi; \ No newline at end of file From 9f5e27c241b05a9910c13080ed3add23a046994d Mon Sep 17 00:00:00 2001 From: leon666 Date: Wed, 13 Dec 2023 03:50:03 +0800 Subject: [PATCH 2/4] refactor: fetch api style --- package.json | 1 + src/Router/adminRouter.js | 48 +++ src/Router/doctorRouter.js | 26 ++ src/Router/index.js | 65 ++++ src/Router/patientRouter.js | 66 ++++ src/Router/staffRouter.js | 54 ++++ yarn.lock | 614 ++++++++++++++++++++++++++++++++++++ 7 files changed, 874 insertions(+) create mode 100644 src/Router/adminRouter.js create mode 100644 src/Router/doctorRouter.js create mode 100644 src/Router/patientRouter.js create mode 100644 src/Router/staffRouter.js diff --git a/package.json b/package.json index e730071..4e9eb4d 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "@testing-library/jest-dom": "^5.11.4", "@testing-library/react": "^11.1.0", "@testing-library/user-event": "^12.1.10", + "antd": "^5.11.1", "axios": "^0.24.0", "date-fns": "^2.27.0", "jsonwebtoken": "^8.5.1", diff --git a/src/Router/adminRouter.js b/src/Router/adminRouter.js new file mode 100644 index 0000000..62575fc --- /dev/null +++ b/src/Router/adminRouter.js @@ -0,0 +1,48 @@ +import AdminDash from '../components/Dashboards/AdminDash/AdminDash'; +import DocList from '../components/Dashboards/AdminDash/Tabs/DocList'; +import AddNew from '../components/Dashboards/AdminDash/Tabs/AddNew'; +import GenerateStats from '../components/Dashboards/AdminDash/Tabs/GenerateStats'; +import VerifySignUp from '../components/Dashboards/AdminDash/Tabs/VerifySignUp'; +import Feedbacks from '../components/Dashboards/AdminDash/Tabs/Feedbacks'; + + +const adminRouter = [ + { + path: '/dashboard/admin', + element: + + + }, + { + path: `/dashboard/admin/doctors'-list`, + element: + + + }, + { + path: `/dashboard/admin/doctors'-list/add-new`, + element: + + + }, + { + path: `/dashboard/admin/generate-stats`, + element: + + + }, + { + path: `/dashboard/admin/verify-signup`, + element: + + + }, + { + path: `/dashboard/admin/generate-stats/feedbacks`, + element: + + + }, +] + +export default adminRouter \ No newline at end of file diff --git a/src/Router/doctorRouter.js b/src/Router/doctorRouter.js new file mode 100644 index 0000000..05c9493 --- /dev/null +++ b/src/Router/doctorRouter.js @@ -0,0 +1,26 @@ +import DoctorDash from '../components/Dashboards/DoctorDash/DoctorDash'; +import Appointments from '../components/Dashboards/DoctorDash/Tabs/Appointments'; +import UploadPrescription from '../components/Dashboards/DoctorDash/Tabs/UploadPrescription'; + +const doctorRouter = [ + { + path: '/dashboard/doctor', + element: + + + }, + { + path: `/dashboard/doctor/appointments`, + element: + + + }, + { + path: `/dashboard/doctor/upload-prescription`, + element: + + + } +] + +export default doctorRouter \ No newline at end of file diff --git a/src/Router/index.js b/src/Router/index.js index e69de29..ce119a7 100644 --- a/src/Router/index.js +++ b/src/Router/index.js @@ -0,0 +1,65 @@ +import React, { useEffect, useState } from 'react'; +import { createBrowserRouter, Navigate, RouterProvider } from 'react-router-dom' +import jwt from "jsonwebtoken"; +import HomePage from '../components/HomePage/HomePage'; +import SignIn from '../components/SignIn/SignIn'; +import SignUp from '../components/SignUp/SignUp'; +import AdminDash from '../components/Dashboards/AdminDash/AdminDash'; +import DocList from '../components/Dashboards/AdminDash/Tabs/DocList'; +import AddNew from '../components/Dashboards/AdminDash/Tabs/AddNew'; +import GenerateStats from '../components/Dashboards/AdminDash/Tabs/GenerateStats'; +import VerifySignUp from '../components/Dashboards/AdminDash/Tabs/VerifySignUp'; +import Feedbacks from '../components/Dashboards/AdminDash/Tabs/Feedbacks'; +import adminRouter from './adminRouter'; +import doctorRouter from './doctorRouter'; +import staffRouter from './staffRouter'; + +export const AuthContext = React.createContext(); + +export default function MyRouter() { + const [userType, setUserType] = useState( + jwt.decode(localStorage.getItem("accessToken"))?.userType + ); + useEffect(() => { + const token = localStorage.getItem("accessToken"); + const payload = token && jwt.decode(token); + const userTyp = payload && payload.userType; + setUserType(userTyp && userTyp); + }, []); + + + + const router = createBrowserRouter([ + { + path: '/', + element: + }, + { + path: '/signin', + element: userType ? ( + + ) : ( + + + + ), + }, + { + path: '/signup', + element: userType ? : + }, + userType === "admin" && { ...adminRouter }, + userType === "doctor" && { ...doctorRouter }, + userType === "staff" && { ...staffRouter }, + { + path: '*', + element: + + , + // loader: async ({ params }) => await getonetutorial(params.tutorialID) + }, + ]) + return ( + + ) +} diff --git a/src/Router/patientRouter.js b/src/Router/patientRouter.js new file mode 100644 index 0000000..498d65a --- /dev/null +++ b/src/Router/patientRouter.js @@ -0,0 +1,66 @@ +import PatientDash from '../components/Dashboards/PatientDash/PatientDash'; +import BookAppointment from '../components/Dashboards/PatientDash/Tabs/BookAppointment'; +import CardPaymentPatient from '../components/Dashboards/PatientDash/Tabs/CardPayment'; +import Feedback from '../components/Dashboards/PatientDash/Tabs/Feedback'; +import MakePaymentPatinet from '../components/Dashboards/PatientDash/Tabs/MakePayment'; +import MyAppointments from '../components/Dashboards/PatientDash/Tabs/MyAppointments'; +import Prescriptions from '../components/Dashboards/PatientDash/Tabs/Prescriptions'; +import UpiPaymentPatient from '../components/Dashboards/PatientDash/Tabs/UpiPayment'; +import ViewLocation from '../components/Dashboards/PatientDash/Tabs/ViewLocation'; + +const patientRouter = [ + { + path: '/dashboard/patient', + element: + + + }, + { + path: "/dashboard/patient/view-location", + element: + }, + { + path: "/dashboard/patient/my-appointments", + element: + + + }, + { + path: "/dashboard/patient/book-appointment", + element: + + + }, + { + path: "/dashboard/patient/make-payment", + element: + + + }, + { + path: "/dashboard/patient/make-payment/card-payment", + element: + + + }, + { + path: "/dashboard/patient/make-payment/upi-payment", + element: + + + }, + { + path: "/dashboard/patient/prescriptions", + element: + + + }, + { + path: "/dashboard/patient/feedback", + element: + + + }, +] + +export default patientRouter \ No newline at end of file diff --git a/src/Router/staffRouter.js b/src/Router/staffRouter.js new file mode 100644 index 0000000..dcdeb03 --- /dev/null +++ b/src/Router/staffRouter.js @@ -0,0 +1,54 @@ +import StaffDash from '../components/Dashboards/StaffDash/StaffDash'; +import BookAppointmentStaff from '../components/Dashboards/StaffDash/Tabs/BookAppointment'; +import CancelAppointment from '../components/Dashboards/StaffDash/Tabs/CancelAppointment'; +import CardPaymentStaff from '../components/Dashboards/StaffDash/Tabs/CardPayment'; +import CashPayment from '../components/Dashboards/StaffDash/Tabs/CashPayment'; +import MakePaymentStaff from '../components/Dashboards/StaffDash/Tabs/MakePayment'; +import UpiPaymentStaff from '../components/Dashboards/StaffDash/Tabs/UpiPayment'; + +const staffRouter = [ + { + path: '/dashboard/staff', + element: + + + }, + { + path: `/dashboard/staff/book-appointment`, + element: + + + }, + { + path: `/dashboard/staff/cancel-appointment`, + element: + + + }, + { + path: `/dashboard/staff/make-payment`, + element: + + + }, + { + path: `/dashboard/staff/make-payment/card-payment`, + element: + + + }, + { + path: `/dashboard/staff/make-payment/upi-payment`, + element: + + + }, + { + path: `/dashboard/staff/make-payment/cash-payment`, + element: + + + } +] + +export default staffRouter \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 2950bdd..48a4925 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,53 @@ # yarn lockfile v1 +"@ant-design/colors@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@ant-design/colors/-/colors-7.0.0.tgz#eb7eecead124c3533aea05d61254f0a17f2b61b3" + integrity sha512-iVm/9PfGCbC0dSMBrz7oiEXZaaGH7ceU40OJEfKmyuzR9R5CRimJYPlRiFtMQGQcbNMea/ePcoIebi4ASGYXtg== + dependencies: + "@ctrl/tinycolor" "^3.4.0" + +"@ant-design/cssinjs@^1.17.2": + version "1.17.2" + resolved "https://registry.yarnpkg.com/@ant-design/cssinjs/-/cssinjs-1.17.2.tgz#08e939cbe60e9e0e0f3f03cd53a52e4a7623ed1f" + integrity sha512-vu7lnfEx4Mf8MPzZxn506Zen3Nt4fRr2uutwvdCuTCN5IiU0lDdQ0tiJ24/rmB8+pefwjluYsbyzbQSbgfJy+A== + dependencies: + "@babel/runtime" "^7.11.1" + "@emotion/hash" "^0.8.0" + "@emotion/unitless" "^0.7.5" + classnames "^2.3.1" + csstype "^3.0.10" + rc-util "^5.35.0" + stylis "^4.0.13" + +"@ant-design/icons-svg@^4.3.0": + version "4.3.1" + resolved "https://registry.yarnpkg.com/@ant-design/icons-svg/-/icons-svg-4.3.1.tgz#4b2f65a17d4d32b526baa6414aca2117382bf8da" + integrity sha512-4QBZg8ccyC6LPIRii7A0bZUk3+lEDCLnhB+FVsflGdcWPPmV+j3fire4AwwoqHV/BibgvBmR9ZIo4s867smv+g== + +"@ant-design/icons@^5.2.6": + version "5.2.6" + resolved "https://registry.yarnpkg.com/@ant-design/icons/-/icons-5.2.6.tgz#2d4a9a37f531eb2a20cebec01d6fb69cf593900d" + integrity sha512-4wn0WShF43TrggskBJPRqCD0fcHbzTYjnaoskdiJrVHg86yxoZ8ZUqsXvyn4WUqehRiFKnaclOhqk9w4Ui2KVw== + dependencies: + "@ant-design/colors" "^7.0.0" + "@ant-design/icons-svg" "^4.3.0" + "@babel/runtime" "^7.11.2" + classnames "^2.2.6" + rc-util "^5.31.1" + +"@ant-design/react-slick@~1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@ant-design/react-slick/-/react-slick-1.0.2.tgz#241bb412aeacf7ff5d50c61fa5db66773fde6b56" + integrity sha512-Wj8onxL/T8KQLFFiCA4t8eIRGpRR+UPgOdac2sYzonv+i0n3kXHmvHLLiOYL655DQx2Umii9Y9nNgL7ssu5haQ== + dependencies: + "@babel/runtime" "^7.10.4" + classnames "^2.2.5" + json2mq "^0.2.0" + resize-observer-polyfill "^1.5.1" + throttle-debounce "^5.0.0" + "@babel/code-frame@7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.10.4.tgz#168da1a36e90da68ae8d49c0f1b48c7c6249213a" @@ -1091,6 +1138,13 @@ dependencies: regenerator-runtime "^0.13.4" +"@babel/runtime@^7.10.1", "@babel/runtime@^7.10.4", "@babel/runtime@^7.11.1", "@babel/runtime@^7.16.7", "@babel/runtime@^7.18.0", "@babel/runtime@^7.18.3", "@babel/runtime@^7.20.0", "@babel/runtime@^7.20.7", "@babel/runtime@^7.21.0", "@babel/runtime@^7.22.5", "@babel/runtime@^7.23.2": + version "7.23.2" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.2.tgz#062b0ac103261d68a966c4c7baf2ae3e62ec3885" + integrity sha512-mM8eg4yl5D6i3lu2QKPuPH4FArvJ8KhTofbE7jwMUv9KX5mBvwPAqnV3MlyBNqdp9RyRKP6Yck8TrfYrPvX3bg== + dependencies: + regenerator-runtime "^0.14.0" + "@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.4": version "7.12.18" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.12.18.tgz#af137bd7e7d9705a412b3caaf991fe6aaa97831b" @@ -1161,6 +1215,11 @@ resolved "https://registry.yarnpkg.com/@csstools/normalize.css/-/normalize.css-10.1.0.tgz#f0950bba18819512d42f7197e56c518aa491cf18" integrity sha512-ij4wRiunFfaJxjB0BdrYHIH8FxBJpOwNPhhAcunlmPdXudL1WQV1qoP9un6JsEBAgQH+7UXyyjh0g7jTxXK6tg== +"@ctrl/tinycolor@^3.4.0", "@ctrl/tinycolor@^3.6.0", "@ctrl/tinycolor@^3.6.1": + version "3.6.1" + resolved "https://registry.yarnpkg.com/@ctrl/tinycolor/-/tinycolor-3.6.1.tgz#b6c75a56a1947cc916ea058772d666a2c8932f31" + integrity sha512-SITSV6aIXsuVNV3f3O0f2n/cgyEDWoSqtZMYiAmcsYHydcKrOz3gUxB/iXd/Qf08+IZX4KpgNbvUdMBmWz+kcA== + "@date-io/core@^2.11.0": version "2.11.0" resolved "https://registry.yarnpkg.com/@date-io/core/-/core-2.11.0.tgz#28580cda1c8228ab2c7ed6aee673ef0495f913e6" @@ -1739,6 +1798,72 @@ resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.10.2.tgz#0798c03351f0dea1a5a4cabddf26a55a7cbee590" integrity sha512-IXf3XA7+XyN7CP9gGh/XB0UxVMlvARGEgGXLubFICsUMGz6Q+DU+i4gGlpOxTjKvXjkJDJC8YdqdKkDj9qZHEQ== +"@rc-component/color-picker@~1.4.1": + version "1.4.1" + resolved "https://registry.yarnpkg.com/@rc-component/color-picker/-/color-picker-1.4.1.tgz#dcab0b660e9c4ed63a7582db68ed4a77c862cb93" + integrity sha512-vh5EWqnsayZa/JwUznqDaPJz39jznx/YDbyBuVJntv735tKXKwEUZZb2jYEldOg+NKWZwtALjGMrNeGBmqFoEw== + dependencies: + "@babel/runtime" "^7.10.1" + "@ctrl/tinycolor" "^3.6.0" + classnames "^2.2.6" + rc-util "^5.30.0" + +"@rc-component/context@^1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@rc-component/context/-/context-1.4.0.tgz#dc6fb021d6773546af8f016ae4ce9aea088395e8" + integrity sha512-kFcNxg9oLRMoL3qki0OMxK+7g5mypjgaaJp/pkOis/6rVxma9nJBF/8kCIuTYHUQNr0ii7MxqE33wirPZLJQ2w== + dependencies: + "@babel/runtime" "^7.10.1" + rc-util "^5.27.0" + +"@rc-component/mini-decimal@^1.0.1": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@rc-component/mini-decimal/-/mini-decimal-1.1.0.tgz#7b7a362b14a0a54cb5bc6fd2b82731f29f11d9b0" + integrity sha512-jS4E7T9Li2GuYwI6PyiVXmxTiM6b07rlD9Ge8uGZSCz3WlzcG5ZK7g5bbuKNeZ9pgUuPK/5guV781ujdVpm4HQ== + dependencies: + "@babel/runtime" "^7.18.0" + +"@rc-component/mutate-observer@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@rc-component/mutate-observer/-/mutate-observer-1.1.0.tgz#ee53cc88b78aade3cd0653609215a44779386fd8" + integrity sha512-QjrOsDXQusNwGZPf4/qRQasg7UFEj06XiCJ8iuiq/Io7CrHrgVi6Uuetw60WAMG1799v+aM8kyc+1L/GBbHSlw== + dependencies: + "@babel/runtime" "^7.18.0" + classnames "^2.3.2" + rc-util "^5.24.4" + +"@rc-component/portal@^1.0.0-8", "@rc-component/portal@^1.0.0-9", "@rc-component/portal@^1.0.2", "@rc-component/portal@^1.1.0", "@rc-component/portal@^1.1.1": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@rc-component/portal/-/portal-1.1.2.tgz#55db1e51d784e034442e9700536faaa6ab63fc71" + integrity sha512-6f813C0IsasTZms08kfA8kPAGxbbkYToa8ALaiDIGGECU4i9hj8Plgbx0sNJDrey3EtHO30hmdaxtT0138xZcg== + dependencies: + "@babel/runtime" "^7.18.0" + classnames "^2.3.2" + rc-util "^5.24.4" + +"@rc-component/tour@~1.10.0": + version "1.10.0" + resolved "https://registry.yarnpkg.com/@rc-component/tour/-/tour-1.10.0.tgz#b05bc327438f1c583439e2d2dcc10ec0530aea19" + integrity sha512-voV0BKaTJbewB9LLgAHQ7tAGG7rgDkKQkZo82xw2gIk542hY+o7zwoqdN16oHhIKk7eG/xi+mdXrONT62Dt57A== + dependencies: + "@babel/runtime" "^7.18.0" + "@rc-component/portal" "^1.0.0-9" + "@rc-component/trigger" "^1.3.6" + classnames "^2.3.2" + rc-util "^5.24.4" + +"@rc-component/trigger@^1.17.0", "@rc-component/trigger@^1.18.0", "@rc-component/trigger@^1.18.1", "@rc-component/trigger@^1.3.6", "@rc-component/trigger@^1.5.0", "@rc-component/trigger@^1.7.0": + version "1.18.2" + resolved "https://registry.yarnpkg.com/@rc-component/trigger/-/trigger-1.18.2.tgz#dc52c4c66fa8aaccaf0710498f2429fc05454e3b" + integrity sha512-jRLYgFgjLEPq3MvS87fIhcfuywFSRDaDrYw1FLku7Cm4esszvzTbA0JBsyacAyLrK9rF3TiHFcvoEDMzoD3CTA== + dependencies: + "@babel/runtime" "^7.23.2" + "@rc-component/portal" "^1.1.0" + classnames "^2.3.2" + rc-motion "^2.0.0" + rc-resize-observer "^1.3.1" + rc-util "^5.38.0" + "@rollup/plugin-node-resolve@^7.1.1": version "7.1.3" resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-7.1.3.tgz#80de384edfbd7bfc9101164910f86078151a3eca" @@ -2613,6 +2738,60 @@ ansi-styles@^5.0.0: resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-5.2.0.tgz#07449690ad45777d1924ac2abb2fc8895dba836b" integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== +antd@^5.11.1: + version "5.11.1" + resolved "https://registry.yarnpkg.com/antd/-/antd-5.11.1.tgz#69bc1a7f52536ec5eec0afe88ec3aacd274c5faf" + integrity sha512-X7Gk1TtJtM9goTrmTPVserqcP7crtV2TX/pbxgqyHpMZRrnBy0EI3h4ngrW+zsIAW8/iqpgrYsG/NVUel6xkBA== + dependencies: + "@ant-design/colors" "^7.0.0" + "@ant-design/cssinjs" "^1.17.2" + "@ant-design/icons" "^5.2.6" + "@ant-design/react-slick" "~1.0.2" + "@babel/runtime" "^7.18.3" + "@ctrl/tinycolor" "^3.6.1" + "@rc-component/color-picker" "~1.4.1" + "@rc-component/mutate-observer" "^1.1.0" + "@rc-component/tour" "~1.10.0" + "@rc-component/trigger" "^1.18.1" + classnames "^2.3.2" + copy-to-clipboard "^3.3.3" + dayjs "^1.11.1" + qrcode.react "^3.1.0" + rc-cascader "~3.20.0" + rc-checkbox "~3.1.0" + rc-collapse "~3.7.1" + rc-dialog "~9.3.4" + rc-drawer "~6.5.2" + rc-dropdown "~4.1.0" + rc-field-form "~1.40.0" + rc-image "~7.3.2" + rc-input "~1.3.5" + rc-input-number "~8.4.0" + rc-mentions "~2.9.1" + rc-menu "~9.12.2" + rc-motion "^2.9.0" + rc-notification "~5.3.0" + rc-pagination "~3.7.0" + rc-picker "~3.14.6" + rc-progress "~3.5.1" + rc-rate "~2.12.0" + rc-resize-observer "^1.4.0" + rc-segmented "~2.2.2" + rc-select "~14.10.0" + rc-slider "~10.4.0" + rc-steps "~6.0.1" + rc-switch "~4.1.0" + rc-table "~7.35.2" + rc-tabs "~12.13.1" + rc-textarea "~1.5.2" + rc-tooltip "~6.1.2" + rc-tree "~5.8.2" + rc-tree-select "~5.15.0" + rc-upload "~4.3.5" + rc-util "^5.38.1" + scroll-into-view-if-needed "^3.1.0" + throttle-debounce "^5.0.0" + anymatch@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb" @@ -2690,6 +2869,11 @@ array-includes@^3.1.1, array-includes@^3.1.2: get-intrinsic "^1.1.1" is-string "^1.0.5" +array-tree-filter@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array-tree-filter/-/array-tree-filter-2.1.0.tgz#873ac00fec83749f255ac8dd083814b4f6329190" + integrity sha512-4ROwICNlNw/Hqa9v+rk5h22KjmzB1JGTMVKP2AKJBOCgb0yL0ASf0+YvCcLNNwquOHNX48jkeZIJ3a+oOQqKcw== + array-union@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" @@ -2796,6 +2980,11 @@ async-limiter@~1.0.0: resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== +async-validator@^4.1.0: + version "4.2.5" + resolved "https://registry.yarnpkg.com/async-validator/-/async-validator-4.2.5.tgz#c96ea3332a521699d0afaaceed510a54656c6339" + integrity sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg== + async@^2.6.2: version "2.6.3" resolved "https://registry.yarnpkg.com/async/-/async-2.6.3.tgz#d72625e2344a3656e3a3ad4fa749fa83299d82ff" @@ -3579,6 +3768,11 @@ class-utils@^0.3.5: isobject "^3.0.0" static-extend "^0.1.1" +classnames@2.x, classnames@^2.2.1, classnames@^2.2.3, classnames@^2.2.5, classnames@^2.2.6, classnames@^2.3.1, classnames@^2.3.2: + version "2.3.2" + resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.3.2.tgz#351d813bf0137fcc6a76a16b88208d2560a0d924" + integrity sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw== + clean-css@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.2.3.tgz#507b5de7d97b48ee53d84adb0160ff6216380f78" @@ -3745,6 +3939,11 @@ compression@^1.7.4: safe-buffer "5.1.2" vary "~1.1.2" +compute-scroll-into-view@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/compute-scroll-into-view/-/compute-scroll-into-view-3.1.0.tgz#753f11d972596558d8fe7c6bcbc8497690ab4c87" + integrity sha512-rj8l8pD4bJ1nx+dAkMhV1xB5RuZEyVysfxJqB1pRchh1KVvwOv9b7CGB8ZfjTImVv2oF+sYMUkMZq6Na5Ftmbg== + concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" @@ -3843,6 +4042,13 @@ copy-descriptor@^0.1.0: resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= +copy-to-clipboard@^3.3.3: + version "3.3.3" + resolved "https://registry.yarnpkg.com/copy-to-clipboard/-/copy-to-clipboard-3.3.3.tgz#55ac43a1db8ae639a4bd99511c148cdd1b83a1b0" + integrity sha512-2KV8NhB5JqC3ky0r9PMCAZKbUHSwtEo4CwCs0KXgruG43gX5PMqDEBbVU4OUzw2MuAWUfsuFmWvEKG5QRfSnJA== + dependencies: + toggle-selection "^1.0.6" + core-js-compat@^3.6.2, core-js-compat@^3.8.0: version "3.9.0" resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.9.0.tgz#29da39385f16b71e1915565aa0385c4e0963ad56" @@ -4240,6 +4446,11 @@ date-fns@^2.27.0: resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.27.0.tgz#e1ff3c3ddbbab8a2eaadbb6106be2929a5a2d92b" integrity sha512-sj+J0Mo2p2X1e306MHq282WS4/A8Pz/95GIFcsPNMPMZVI3EUrAdSv90al1k+p74WGLCruMXk23bfEDZa71X9Q== +dayjs@^1.11.1: + version "1.11.10" + resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.10.tgz#68acea85317a6e164457d6d6947564029a6a16a0" + integrity sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ== + debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" @@ -7129,6 +7340,13 @@ json-stringify-safe@~5.0.1: resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= +json2mq@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/json2mq/-/json2mq-0.2.0.tgz#b637bd3ba9eabe122c83e9720483aeb10d2c904a" + integrity sha512-SzoRg7ux5DWTII9J2qkrZrqV1gt+rTaoufMxEzXbS26Uid0NwaJd123HcoB80TgubEppxxIGdNxCx50fEoEWQA== + dependencies: + string-convert "^0.2.0" + json3@^3.3.3: version "3.3.3" resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.3.tgz#7fc10e375fc5ae42c4705a5cc0aa6f62be305b81" @@ -9372,6 +9590,11 @@ qj@~2.0.0: resolved "https://registry.yarnpkg.com/qj/-/qj-2.0.0.tgz#054dd3b75ce018728d23a0605f030dfda0bd158a" integrity sha1-BU3Tt1zgGHKNI6BgXwMN/aC9FYo= +qrcode.react@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/qrcode.react/-/qrcode.react-3.1.0.tgz#5c91ddc0340f768316fbdb8fff2765134c2aecd8" + integrity sha512-oyF+Urr3oAMUG/OiOuONL3HXM+53wvuH3mtIWQrYmsXoAq0DkvZp2RYUWFSMFtbdOpuS++9v+WAkzNVkMlNW6Q== + qs@6.7.0: version "6.7.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc" @@ -9452,6 +9675,355 @@ raw-body@2.4.0: iconv-lite "0.4.24" unpipe "1.0.0" +rc-cascader@~3.20.0: + version "3.20.0" + resolved "https://registry.yarnpkg.com/rc-cascader/-/rc-cascader-3.20.0.tgz#b270f9d84ed83417ee7309ef5e56e415f1586076" + integrity sha512-lkT9EEwOcYdjZ/jvhLoXGzprK1sijT3/Tp4BLxQQcHDZkkOzzwYQC9HgmKoJz0K7CukMfgvO9KqHeBdgE+pELw== + dependencies: + "@babel/runtime" "^7.12.5" + array-tree-filter "^2.1.0" + classnames "^2.3.1" + rc-select "~14.10.0" + rc-tree "~5.8.1" + rc-util "^5.37.0" + +rc-checkbox@~3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/rc-checkbox/-/rc-checkbox-3.1.0.tgz#6be0d9d8de2cc96fb5e37f9036a1c3e360d0a42d" + integrity sha512-PAwpJFnBa3Ei+5pyqMMXdcKYKNBMS+TvSDiLdDnARnMJHC8ESxwPfm4Ao1gJiKtWLdmGfigascnCpwrHFgoOBQ== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.3.2" + rc-util "^5.25.2" + +rc-collapse@~3.7.1: + version "3.7.1" + resolved "https://registry.yarnpkg.com/rc-collapse/-/rc-collapse-3.7.1.tgz#bda1f7f80adccf3433c1c15d4d9f9ca09910c727" + integrity sha512-N/7ejyiTf3XElNJBBpxqnZBUuMsQWEOPjB2QkfNvZ/Ca54eAvJXuOD1EGbCWCk2m7v/MSxku7mRpdeaLOCd4Gg== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "2.x" + rc-motion "^2.3.4" + rc-util "^5.27.0" + +rc-dialog@~9.3.4: + version "9.3.4" + resolved "https://registry.yarnpkg.com/rc-dialog/-/rc-dialog-9.3.4.tgz#e0decb3d4a0dbe36524a67ed2f8fe2daa4b7b73c" + integrity sha512-975X3018GhR+EjZFbxA2Z57SX5rnu0G0/OxFgMMvZK4/hQWEm3MHaNvP4wXpxYDoJsp+xUvVW+GB9CMMCm81jA== + dependencies: + "@babel/runtime" "^7.10.1" + "@rc-component/portal" "^1.0.0-8" + classnames "^2.2.6" + rc-motion "^2.3.0" + rc-util "^5.21.0" + +rc-drawer@~6.5.2: + version "6.5.2" + resolved "https://registry.yarnpkg.com/rc-drawer/-/rc-drawer-6.5.2.tgz#49c1f279261992f6d4653d32a03b14acd436d610" + integrity sha512-QckxAnQNdhh4vtmKN0ZwDf3iakO83W9eZcSKWYYTDv4qcD2fHhRAZJJ/OE6v2ZlQ2kSqCJX5gYssF4HJFvsEPQ== + dependencies: + "@babel/runtime" "^7.10.1" + "@rc-component/portal" "^1.1.1" + classnames "^2.2.6" + rc-motion "^2.6.1" + rc-util "^5.36.0" + +rc-dropdown@~4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/rc-dropdown/-/rc-dropdown-4.1.0.tgz#418a68939631520de80d0865d02b440eeeb4168e" + integrity sha512-VZjMunpBdlVzYpEdJSaV7WM7O0jf8uyDjirxXLZRNZ+tAC+NzD3PXPEtliFwGzVwBBdCmGuSqiS9DWcOLxQ9tw== + dependencies: + "@babel/runtime" "^7.18.3" + "@rc-component/trigger" "^1.7.0" + classnames "^2.2.6" + rc-util "^5.17.0" + +rc-field-form@~1.40.0: + version "1.40.0" + resolved "https://registry.yarnpkg.com/rc-field-form/-/rc-field-form-1.40.0.tgz#808dce06ebae1c3aea574e672b673533fc98f11f" + integrity sha512-OM3N01X2BYFGJDJcwpk9/BBtlwgveE7eh2SQAKIxVCt9KVWlODYJ9ypTHQdxchfDbeJKJKxMBFXlLAmyvlgPHg== + dependencies: + "@babel/runtime" "^7.18.0" + async-validator "^4.1.0" + rc-util "^5.32.2" + +rc-image@~7.3.2: + version "7.3.2" + resolved "https://registry.yarnpkg.com/rc-image/-/rc-image-7.3.2.tgz#fd92ab9994552d4f42638af0810039d34ad32dba" + integrity sha512-ICEF6SWv9YKhDXxy1vrXcmf0TVvEcQWIww5Yg+f+mn7e4oGX7FNP4+FExwMjNO5UHBEuWrigbGhlCgI6yZZ1jg== + dependencies: + "@babel/runtime" "^7.11.2" + "@rc-component/portal" "^1.0.2" + classnames "^2.2.6" + rc-dialog "~9.3.4" + rc-motion "^2.6.2" + rc-util "^5.34.1" + +rc-input-number@~8.4.0: + version "8.4.0" + resolved "https://registry.yarnpkg.com/rc-input-number/-/rc-input-number-8.4.0.tgz#f0d0caa2ce3a4e37f062556f9cb4c08c8c23322d" + integrity sha512-B6rziPOLRmeP7kcS5qbdC5hXvvDHYKV4vUxmahevYx2E6crS2bRi0xLDjhJ0E1HtOWo8rTmaE2EBJAkTCZOLdA== + dependencies: + "@babel/runtime" "^7.10.1" + "@rc-component/mini-decimal" "^1.0.1" + classnames "^2.2.5" + rc-input "~1.3.5" + rc-util "^5.28.0" + +rc-input@~1.3.5: + version "1.3.6" + resolved "https://registry.yarnpkg.com/rc-input/-/rc-input-1.3.6.tgz#038b74779b6c8b688ff60a41c3976d1db7a1d7d6" + integrity sha512-/HjTaKi8/Ts4zNbYaB5oWCquxFyFQO4Co1MnMgoCeGJlpe7k8Eir2HN0a0F9IHDmmo+GYiGgPpz7w/d/krzsJA== + dependencies: + "@babel/runtime" "^7.11.1" + classnames "^2.2.1" + rc-util "^5.18.1" + +rc-mentions@~2.9.1: + version "2.9.1" + resolved "https://registry.yarnpkg.com/rc-mentions/-/rc-mentions-2.9.1.tgz#cfe55913fd5bc156ef9814f38c1a2ceefee032ce" + integrity sha512-cZuElWr/5Ws0PXx1uxobxfYh4mqUw2FitfabR62YnWgm+WAfDyXZXqZg5DxXW+M1cgVvntrQgDDd9LrihrXzew== + dependencies: + "@babel/runtime" "^7.22.5" + "@rc-component/trigger" "^1.5.0" + classnames "^2.2.6" + rc-input "~1.3.5" + rc-menu "~9.12.0" + rc-textarea "~1.5.0" + rc-util "^5.34.1" + +rc-menu@~9.12.0, rc-menu@~9.12.2: + version "9.12.2" + resolved "https://registry.yarnpkg.com/rc-menu/-/rc-menu-9.12.2.tgz#1bab34646421224eff5c5b7de993f8ea1238418e" + integrity sha512-NzloFH2pRUYmQ3S/YbJAvRkgCZaLvq0sRa5rgJtuIHLfPPprNHNyepeSlT64+dbVqI4qRWL44VN0lUCldCbbfg== + dependencies: + "@babel/runtime" "^7.10.1" + "@rc-component/trigger" "^1.17.0" + classnames "2.x" + rc-motion "^2.4.3" + rc-overflow "^1.3.1" + rc-util "^5.27.0" + +rc-motion@^2.0.0, rc-motion@^2.0.1, rc-motion@^2.3.0, rc-motion@^2.3.4, rc-motion@^2.4.3, rc-motion@^2.4.4, rc-motion@^2.6.1, rc-motion@^2.6.2, rc-motion@^2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/rc-motion/-/rc-motion-2.9.0.tgz#9e18a1b8d61e528a97369cf9a7601e9b29205710" + integrity sha512-XIU2+xLkdIr1/h6ohPZXyPBMvOmuyFZQ/T0xnawz+Rh+gh4FINcnZmMT5UTIj6hgI0VLDjTaPeRd+smJeSPqiQ== + dependencies: + "@babel/runtime" "^7.11.1" + classnames "^2.2.1" + rc-util "^5.21.0" + +rc-notification@~5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/rc-notification/-/rc-notification-5.3.0.tgz#e31c86fe2350598ade8cff383babd1befa7a94fe" + integrity sha512-WCf0uCOkZ3HGfF0p1H4Sgt7aWfipxORWTPp7o6prA3vxwtWhtug3GfpYls1pnBp4WA+j8vGIi5c2/hQRpGzPcQ== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "2.x" + rc-motion "^2.9.0" + rc-util "^5.20.1" + +rc-overflow@^1.3.1: + version "1.3.2" + resolved "https://registry.yarnpkg.com/rc-overflow/-/rc-overflow-1.3.2.tgz#72ee49e85a1308d8d4e3bd53285dc1f3e0bcce2c" + integrity sha512-nsUm78jkYAoPygDAcGZeC2VwIg/IBGSodtOY3pMof4W3M9qRJgqaDYm03ZayHlde3I6ipliAxbN0RUcGf5KOzw== + dependencies: + "@babel/runtime" "^7.11.1" + classnames "^2.2.1" + rc-resize-observer "^1.0.0" + rc-util "^5.37.0" + +rc-pagination@~3.7.0: + version "3.7.0" + resolved "https://registry.yarnpkg.com/rc-pagination/-/rc-pagination-3.7.0.tgz#4c4332800688ec0fd3b2435c4772f7f8d4d7b50e" + integrity sha512-IxSzKapd13L91/195o1TPkKnCNw8gIR25UP1GCW/7c7n/slhld4npu2j2PB9IWjXm4SssaAaSAt2lscYog7wzg== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.2.1" + rc-util "^5.32.2" + +rc-picker@~3.14.6: + version "3.14.6" + resolved "https://registry.yarnpkg.com/rc-picker/-/rc-picker-3.14.6.tgz#60fc34f9883272e10f6c593fa6d82e7e7a70781b" + integrity sha512-AdKKW0AqMwZsKvIpwUWDUnpuGKZVrbxVTZTNjcO+pViGkjC1EBcjMgxVe8tomOEaIHJL5Gd13vS8Rr3zzxWmag== + dependencies: + "@babel/runtime" "^7.10.1" + "@rc-component/trigger" "^1.5.0" + classnames "^2.2.1" + rc-util "^5.30.0" + +rc-progress@~3.5.1: + version "3.5.1" + resolved "https://registry.yarnpkg.com/rc-progress/-/rc-progress-3.5.1.tgz#a3cdfd2fe04eb5c3d43fa1c69e7dd70c73b102ae" + integrity sha512-V6Amx6SbLRwPin/oD+k1vbPrO8+9Qf8zW1T8A7o83HdNafEVvAxPV5YsgtKFP+Ud5HghLj33zKOcEHrcrUGkfw== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.2.6" + rc-util "^5.16.1" + +rc-rate@~2.12.0: + version "2.12.0" + resolved "https://registry.yarnpkg.com/rc-rate/-/rc-rate-2.12.0.tgz#0182deffed3b009cdcc61660da8746c39ed91ed5" + integrity sha512-g092v5iZCdVzbjdn28FzvWebK2IutoVoiTeqoLTj9WM7SjA/gOJIw5/JFZMRyJYYVe1jLAU2UhAfstIpCNRozg== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.2.5" + rc-util "^5.0.1" + +rc-resize-observer@^1.0.0, rc-resize-observer@^1.1.0, rc-resize-observer@^1.3.1, rc-resize-observer@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/rc-resize-observer/-/rc-resize-observer-1.4.0.tgz#7bba61e6b3c604834980647cce6451914750d0cc" + integrity sha512-PnMVyRid9JLxFavTjeDXEXo65HCRqbmLBw9xX9gfC4BZiSzbLXKzW3jPz+J0P71pLbD5tBMTT+mkstV5gD0c9Q== + dependencies: + "@babel/runtime" "^7.20.7" + classnames "^2.2.1" + rc-util "^5.38.0" + resize-observer-polyfill "^1.5.1" + +rc-segmented@~2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/rc-segmented/-/rc-segmented-2.2.2.tgz#a34f12ce6c0975fc3042ae7656bcd18e1744798e" + integrity sha512-Mq52M96QdHMsNdE/042ibT5vkcGcD5jxKp7HgPC2SRofpia99P5fkfHy1pEaajLMF/kj0+2Lkq1UZRvqzo9mSA== + dependencies: + "@babel/runtime" "^7.11.1" + classnames "^2.2.1" + rc-motion "^2.4.4" + rc-util "^5.17.0" + +rc-select@~14.10.0: + version "14.10.0" + resolved "https://registry.yarnpkg.com/rc-select/-/rc-select-14.10.0.tgz#5f60e61ed7c9a83c8591616b1174a1c4ab2de0cd" + integrity sha512-TsIJTYafTTapCA32LLNpx/AD6ntepR1TG8jEVx35NiAAWCPymhUfuca8kRcUNd3WIGVMDcMKn9kkphoxEz+6Ag== + dependencies: + "@babel/runtime" "^7.10.1" + "@rc-component/trigger" "^1.5.0" + classnames "2.x" + rc-motion "^2.0.1" + rc-overflow "^1.3.1" + rc-util "^5.16.1" + rc-virtual-list "^3.5.2" + +rc-slider@~10.4.0: + version "10.4.0" + resolved "https://registry.yarnpkg.com/rc-slider/-/rc-slider-10.4.0.tgz#efc016583fdea5f5dfb4f3dc61b6755a19e5f453" + integrity sha512-ZlpWjFhOlEf0w4Ng31avFBkXNNBj60NAcTPaIoiCxBkJ29wOtHSPMqv9PZeEoqmx64bpJkgK7kPa47HG4LPzww== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.2.5" + rc-util "^5.27.0" + +rc-steps@~6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/rc-steps/-/rc-steps-6.0.1.tgz#c2136cd0087733f6d509209a84a5c80dc29a274d" + integrity sha512-lKHL+Sny0SeHkQKKDJlAjV5oZ8DwCdS2hFhAkIjuQt1/pB81M0cA0ErVFdHq9+jmPmFw1vJB2F5NBzFXLJxV+g== + dependencies: + "@babel/runtime" "^7.16.7" + classnames "^2.2.3" + rc-util "^5.16.1" + +rc-switch@~4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/rc-switch/-/rc-switch-4.1.0.tgz#f37d81b4e0c5afd1274fd85367b17306bf25e7d7" + integrity sha512-TI8ufP2Az9oEbvyCeVE4+90PDSljGyuwix3fV58p7HV2o4wBnVToEyomJRVyTaZeqNPAp+vqeo4Wnj5u0ZZQBg== + dependencies: + "@babel/runtime" "^7.21.0" + classnames "^2.2.1" + rc-util "^5.30.0" + +rc-table@~7.35.2: + version "7.35.2" + resolved "https://registry.yarnpkg.com/rc-table/-/rc-table-7.35.2.tgz#8fcd59e9342bf13fe131ca54c6105e71ab95588b" + integrity sha512-ZLIZdAEdfen21FI21xt2LDg9chQ7gc5Lpy4nkjWKPDgmQMnH0KJ8JQQzrd3zrEN16xzjiVdHHvRmi1RU8BtgYg== + dependencies: + "@babel/runtime" "^7.10.1" + "@rc-component/context" "^1.4.0" + classnames "^2.2.5" + rc-resize-observer "^1.1.0" + rc-util "^5.37.0" + rc-virtual-list "^3.11.1" + +rc-tabs@~12.13.1: + version "12.13.1" + resolved "https://registry.yarnpkg.com/rc-tabs/-/rc-tabs-12.13.1.tgz#e28c5652dfed4e72eb27a75a2691754afd3e5f68" + integrity sha512-83u3l2QkO0UznCzdBLEk9WnNcT+imtmDmMT993sUUEOGnNQAmqOdev0XjeqrcvsAMe9CDpAWDFd7L/RZw+LVJQ== + dependencies: + "@babel/runtime" "^7.11.2" + classnames "2.x" + rc-dropdown "~4.1.0" + rc-menu "~9.12.0" + rc-motion "^2.6.2" + rc-resize-observer "^1.0.0" + rc-util "^5.34.1" + +rc-textarea@~1.5.0, rc-textarea@~1.5.2: + version "1.5.3" + resolved "https://registry.yarnpkg.com/rc-textarea/-/rc-textarea-1.5.3.tgz#513e837d308584996c05f540f4f58645a3a8c89a" + integrity sha512-oH682ghHx++stFNYrosPRBfwsypywrTXpaD0/5Z8MPkUOnyOQUaY9ueL9tMu6BP1LfsuYQ1VLpg5OtshViLNgA== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "^2.2.1" + rc-input "~1.3.5" + rc-resize-observer "^1.0.0" + rc-util "^5.27.0" + +rc-tooltip@~6.1.2: + version "6.1.2" + resolved "https://registry.yarnpkg.com/rc-tooltip/-/rc-tooltip-6.1.2.tgz#33923ecfb2cf24347975093cbd0b048ab33c9567" + integrity sha512-89zwvybvCxGJu3+gGF8w5AXd4HHk6hIN7K0vZbkzjilVaEAIWPqc1fcyeUeP71n3VCcw7pTL9LyFupFbrx8gHw== + dependencies: + "@babel/runtime" "^7.11.2" + "@rc-component/trigger" "^1.18.0" + classnames "^2.3.1" + +rc-tree-select@~5.15.0: + version "5.15.0" + resolved "https://registry.yarnpkg.com/rc-tree-select/-/rc-tree-select-5.15.0.tgz#8591f1dd28b043dde6fa1ca30c7acb198b160a42" + integrity sha512-YJHfdO6azFnR0/JuNBZLDptGE4/RGfVeHAafUIYcm2T3RBkL1O8aVqiHvwIyLzdK59ry0NLrByd+3TkfpRM+9Q== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "2.x" + rc-select "~14.10.0" + rc-tree "~5.8.1" + rc-util "^5.16.1" + +rc-tree@~5.8.1, rc-tree@~5.8.2: + version "5.8.2" + resolved "https://registry.yarnpkg.com/rc-tree/-/rc-tree-5.8.2.tgz#ed3a3f7c56597bbeab3303407a9e1739bbf15621" + integrity sha512-xH/fcgLHWTLmrSuNphU8XAqV7CdaOQgm4KywlLGNoTMhDAcNR3GVNP6cZzb0GrKmIZ9yae+QLot/cAgUdPRMzg== + dependencies: + "@babel/runtime" "^7.10.1" + classnames "2.x" + rc-motion "^2.0.1" + rc-util "^5.16.1" + rc-virtual-list "^3.5.1" + +rc-upload@~4.3.5: + version "4.3.5" + resolved "https://registry.yarnpkg.com/rc-upload/-/rc-upload-4.3.5.tgz#12fc69b2af74d08646a104828831bcaf44076eda" + integrity sha512-EHlKJbhkgFSQHliTj9v/2K5aEuFwfUQgZARzD7AmAPOneZEPiCNF3n6PEWIuqz9h7oq6FuXgdR67sC5BWFxJbA== + dependencies: + "@babel/runtime" "^7.18.3" + classnames "^2.2.5" + rc-util "^5.2.0" + +rc-util@^5.0.1, rc-util@^5.16.1, rc-util@^5.17.0, rc-util@^5.18.1, rc-util@^5.2.0, rc-util@^5.20.1, rc-util@^5.21.0, rc-util@^5.24.4, rc-util@^5.25.2, rc-util@^5.27.0, rc-util@^5.28.0, rc-util@^5.30.0, rc-util@^5.31.1, rc-util@^5.32.2, rc-util@^5.34.1, rc-util@^5.35.0, rc-util@^5.36.0, rc-util@^5.37.0, rc-util@^5.38.0, rc-util@^5.38.1: + version "5.38.1" + resolved "https://registry.yarnpkg.com/rc-util/-/rc-util-5.38.1.tgz#4915503b89855f5c5cd9afd4c72a7a17568777bb" + integrity sha512-e4ZMs7q9XqwTuhIK7zBIVFltUtMSjphuPPQXHoHlzRzNdOwUxDejo0Zls5HYaJfRKNURcsS/ceKVULlhjBrxng== + dependencies: + "@babel/runtime" "^7.18.3" + react-is "^18.2.0" + +rc-virtual-list@^3.11.1, rc-virtual-list@^3.5.1, rc-virtual-list@^3.5.2: + version "3.11.3" + resolved "https://registry.yarnpkg.com/rc-virtual-list/-/rc-virtual-list-3.11.3.tgz#77d4e12e20c1ba314b43c0e37e118296674c5401" + integrity sha512-tu5UtrMk/AXonHwHxUogdXAWynaXsrx1i6dsgg+lOo/KJSF8oBAcprh1z5J3xgnPJD5hXxTL58F8s8onokdt0Q== + dependencies: + "@babel/runtime" "^7.20.0" + classnames "^2.2.6" + rc-resize-observer "^1.0.0" + rc-util "^5.36.0" + react-app-polyfill@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/react-app-polyfill/-/react-app-polyfill-2.0.0.tgz#a0bea50f078b8a082970a9d853dc34b6dcc6a3cf" @@ -9530,6 +10102,11 @@ react-is@^17.0.2: resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== +react-is@^18.2.0: + version "18.2.0" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" + integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w== + react-refresh@^0.8.3: version "0.8.3" resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.8.3.tgz#721d4657672d400c5e3c75d063c4a85fb2d5d68f" @@ -9745,6 +10322,11 @@ regenerator-runtime@^0.13.4, regenerator-runtime@^0.13.7: resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz#cac2dacc8a1ea675feaabaeb8ae833898ae46f55" integrity sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew== +regenerator-runtime@^0.14.0: + version "0.14.0" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz#5e19d68eb12d486f797e15a3c6a918f7cec5eb45" + integrity sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA== + regenerator-transform@^0.14.2: version "0.14.5" resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.14.5.tgz#c98da154683671c9c4dcb16ece736517e1b7feb4" @@ -9895,6 +10477,11 @@ requires-port@^1.0.0: resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8= +resize-observer-polyfill@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz#0e9020dd3d21024458d4ebd27e23e40269810464" + integrity sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg== + resolve-cwd@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a" @@ -10180,6 +10767,13 @@ schema-utils@^3.0.0: ajv "^6.12.5" ajv-keywords "^3.5.2" +scroll-into-view-if-needed@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/scroll-into-view-if-needed/-/scroll-into-view-if-needed-3.1.0.tgz#fa9524518c799b45a2ef6bbffb92bcad0296d01f" + integrity sha512-49oNpRjWRvnU8NyGVmUaYG4jtTkNonFZI86MmGRDqBphEK2EXT9gdEUoQPZhuBM8yWHxCWbobltqYO5M4XrUvQ== + dependencies: + compute-scroll-into-view "^3.0.2" + select-hose@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/select-hose/-/select-hose-2.0.0.tgz#625d8658f865af43ec962bfc376a37359a4994ca" @@ -10664,6 +11258,11 @@ strict-uri-encode@^1.0.0: resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" integrity sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM= +string-convert@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/string-convert/-/string-convert-0.2.1.tgz#6982cc3049fbb4cd85f8b24568b9d9bf39eeff97" + integrity sha512-u/1tdPl4yQnPBjnVrmdLo9gtuLvELKsAoRapekWggdiQNvvvum+jYF329d84NAa660KQw7pB2n36KrIKVoXa3A== + string-length@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.1.tgz#4a973bf31ef77c4edbceadd6af2611996985f8a1" @@ -10830,6 +11429,11 @@ stylis@^4.0.10, stylis@^4.0.3: resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.0.10.tgz#446512d1097197ab3f02fb3c258358c3f7a14240" integrity sha512-m3k+dk7QeJw660eIKRRn3xPF6uuvHs/FFzjX3HQ5ove0qYsiygoAhwn5a3IYKaZPo5LrYD0rfVmtv1gNY1uYwg== +stylis@^4.0.13: + version "4.3.0" + resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.3.0.tgz#abe305a669fc3d8777e10eefcfc73ad861c5588c" + integrity sha512-E87pIogpwUsUwXw7dNyU4QDjdgVMy52m+XEOPEKUn161cCzWjjhPSQhByfd1CcNvrOLnXQ6OnnZDwnJrz/Z4YQ== + supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" @@ -11004,6 +11608,11 @@ throat@^5.0.0: resolved "https://registry.yarnpkg.com/throat/-/throat-5.0.0.tgz#c5199235803aad18754a667d659b5e72ce16764b" integrity sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA== +throttle-debounce@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/throttle-debounce/-/throttle-debounce-5.0.0.tgz#a17a4039e82a2ed38a5e7268e4132d6960d41933" + integrity sha512-2iQTSgkkc1Zyk0MeVrt/3BvuOXYPl/R8Z0U2xxo9rjwNciaHDG3R+Lm6dh4EeUci49DanvBnuqI6jshoQQRGEg== + through2@^2.0.0: version "2.0.5" resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" @@ -11076,6 +11685,11 @@ to-regex@^3.0.1, to-regex@^3.0.2: regex-not "^1.0.2" safe-regex "^1.1.0" +toggle-selection@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/toggle-selection/-/toggle-selection-1.0.6.tgz#6e45b1263f2017fa0acc7d89d78b15b8bf77da32" + integrity sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ== + toidentifier@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553" From 7c8fee6ba0267ae5a48249d84b67245c25e4bcb8 Mon Sep 17 00:00:00 2001 From: leon666 Date: Sun, 17 Dec 2023 00:19:15 +0800 Subject: [PATCH 3/4] refactor: finish the project file restructuction --- package.json | 2 +- src/App.js | 306 +----------------- src/Router/adminRouter.js | 16 +- src/Router/doctorRouter.js | 10 +- src/Router/index.js | 24 +- src/Router/patientRouter.js | 22 +- src/Router/staffRouter.js | 18 +- src/api.js | 130 -------- src/api/{api.js => index.js} | 4 +- src/api/request.js | 7 + src/components/Cards/AppointmentCard.js | 4 +- src/components/Cards/BookingCard.js | 5 +- src/components/Cards/DashCard.js | 2 +- src/components/Cards/DocListCard.js | 5 +- src/components/Cards/DuePaymentCard.js | 6 +- src/components/Cards/FeedbackCard.js | 6 +- src/components/Cards/PrescriptionCard.js | 2 +- src/components/Cards/StatsCard.js | 2 +- src/components/Cards/VerifyCard.js | 6 +- src/components/DashBar/DashBar.js | 6 +- src/components/FileUploader/FileUploader.js | 4 +- src/components/Payments/Card/CardPay.js | 4 +- src/components/Payments/Cash/CashPay.js | 4 +- src/components/Payments/UPI/UpiPay.js | 4 +- .../AdminDash/Tabs/AddNew.css | 0 .../AdminDash/Tabs/AddNew.js | 6 +- .../AdminDash/Tabs/DocList.js | 10 +- .../AdminDash/Tabs/Feedbacks.js | 9 +- .../AdminDash/Tabs/GenerateStats.js | 8 +- .../AdminDash/Tabs/VerifySignUp.js | 10 +- .../AdminDash.js => pages/AdminDash/index.js} | 2 +- .../DoctorDash/DoctorDash.js | 2 +- .../DoctorDash/Tabs/Appointments.js | 8 +- .../DoctorDash/Tabs/UploadPrescription.js | 8 +- .../HomePage/HomePage.css | 0 .../HomePage/HomePage.js | 0 src/{components => pages}/HomePage/brain.png | Bin src/{components => pages}/Page404/Page404.css | 0 src/{components => pages}/Page404/Page404.js | 0 src/{components => pages}/Page404/bg404.png | Bin .../PatientDash/Tabs/BookAppointment.js | 13 +- .../PatientDash/Tabs/CardPayment.js | 2 +- .../PatientDash/Tabs/Feedback.js | 10 +- .../PatientDash/Tabs/MakePayment.js | 12 +- .../PatientDash/Tabs/MyAppointments.js | 11 +- .../PatientDash/Tabs/Prescriptions.js | 9 +- .../PatientDash/Tabs/UpiPayment.js | 2 +- .../PatientDash/Tabs/ViewLocation.js | 0 .../PatientDash/index.js} | 2 +- src/{components => pages}/SignIn/SignIn.css | 0 src/{components => pages}/SignIn/SignIn.js | 6 +- src/{components => pages}/SignUp/SignUp.css | 0 src/{components => pages}/SignUp/SignUp.js | 4 +- .../StaffDash/StaffDash.js | 2 +- .../StaffDash/Tabs/BookAppointment.js | 12 +- .../StaffDash/Tabs/CancelAppointment.js | 8 +- .../StaffDash/Tabs/CardPayment.js | 5 +- .../StaffDash/Tabs/CashPayment.js | 3 +- .../StaffDash/Tabs/MakePayment.js | 10 +- .../StaffDash/Tabs/UpiPayment.js | 2 +- yarn.lock | 36 +-- 61 files changed, 197 insertions(+), 614 deletions(-) delete mode 100644 src/api.js rename src/api/{api.js => index.js} (89%) rename src/{components/Dashboards => pages}/AdminDash/Tabs/AddNew.css (100%) rename src/{components/Dashboards => pages}/AdminDash/Tabs/AddNew.js (99%) rename src/{components/Dashboards => pages}/AdminDash/Tabs/DocList.js (90%) rename src/{components/Dashboards => pages}/AdminDash/Tabs/Feedbacks.js (91%) rename src/{components/Dashboards => pages}/AdminDash/Tabs/GenerateStats.js (93%) rename src/{components/Dashboards => pages}/AdminDash/Tabs/VerifySignUp.js (90%) rename src/{components/Dashboards/AdminDash/AdminDash.js => pages/AdminDash/index.js} (74%) rename src/{components/Dashboards => pages}/DoctorDash/DoctorDash.js (73%) rename src/{components/Dashboards => pages}/DoctorDash/Tabs/Appointments.js (92%) rename src/{components/Dashboards => pages}/DoctorDash/Tabs/UploadPrescription.js (92%) rename src/{components => pages}/HomePage/HomePage.css (100%) rename src/{components => pages}/HomePage/HomePage.js (100%) rename src/{components => pages}/HomePage/brain.png (100%) rename src/{components => pages}/Page404/Page404.css (100%) rename src/{components => pages}/Page404/Page404.js (100%) rename src/{components => pages}/Page404/bg404.png (100%) rename src/{components/Dashboards => pages}/PatientDash/Tabs/BookAppointment.js (91%) rename src/{components/Dashboards => pages}/PatientDash/Tabs/CardPayment.js (58%) rename src/{components/Dashboards => pages}/PatientDash/Tabs/Feedback.js (92%) rename src/{components/Dashboards => pages}/PatientDash/Tabs/MakePayment.js (91%) rename src/{components/Dashboards => pages}/PatientDash/Tabs/MyAppointments.js (94%) rename src/{components/Dashboards => pages}/PatientDash/Tabs/Prescriptions.js (92%) rename src/{components/Dashboards => pages}/PatientDash/Tabs/UpiPayment.js (59%) rename src/{components/Dashboards => pages}/PatientDash/Tabs/ViewLocation.js (100%) rename src/{components/Dashboards/PatientDash/PatientDash.js => pages/PatientDash/index.js} (79%) rename src/{components => pages}/SignIn/SignIn.css (100%) rename src/{components => pages}/SignIn/SignIn.js (97%) rename src/{components => pages}/SignUp/SignUp.css (100%) rename src/{components => pages}/SignUp/SignUp.js (99%) rename src/{components/Dashboards => pages}/StaffDash/StaffDash.js (74%) rename src/{components/Dashboards => pages}/StaffDash/Tabs/BookAppointment.js (93%) rename src/{components/Dashboards => pages}/StaffDash/Tabs/CancelAppointment.js (95%) rename src/{components/Dashboards => pages}/StaffDash/Tabs/CardPayment.js (96%) rename src/{components/Dashboards => pages}/StaffDash/Tabs/CashPayment.js (54%) rename src/{components/Dashboards => pages}/StaffDash/Tabs/MakePayment.js (95%) rename src/{components/Dashboards => pages}/StaffDash/Tabs/UpiPayment.js (58%) diff --git a/package.json b/package.json index 4e9eb4d..f211984 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "react": "^17.0.2", "react-credit-cards": "^0.8.3", "react-dom": "^17.0.2", - "react-router-dom": "^6.0.2", + "react-router-dom": "6.21.0", "react-scripts": "4.0.3", "web-vitals": "^1.0.1" }, diff --git a/src/App.js b/src/App.js index 3fe2a78..451ad02 100644 --- a/src/App.js +++ b/src/App.js @@ -1,310 +1,8 @@ -import React, { useEffect, useState, Fragment } from "react"; -import jwt from "jsonwebtoken"; -import { - BrowserRouter as Router, - Routes, - Route, - Navigate, -} from "react-router-dom"; -import HomePage from "./components/HomePage/HomePage"; -import SignIn from "./components/SignIn/SignIn"; -import SignUp from "./components/SignUp/SignUp"; -import Page404 from "./components/Page404/Page404"; -import PatientDash from "./components/Dashboards/PatientDash/PatientDash"; -import ViewLocation from "./components/Dashboards/PatientDash/Tabs/ViewLocation"; -import MyAppointments from "./components/Dashboards/PatientDash/Tabs/MyAppointments"; -import BookAppointment from "./components/Dashboards/PatientDash/Tabs/BookAppointment"; -import MakePaymentPatinet from "./components/Dashboards/PatientDash/Tabs/MakePayment"; -import CardPaymentPatient from "./components/Dashboards/PatientDash/Tabs/CardPayment"; -import UpiPaymentPatient from "./components/Dashboards/PatientDash/Tabs/UpiPayment"; -import Prescriptions from "./components/Dashboards/PatientDash/Tabs/Prescriptions"; -import Feedback from "./components/Dashboards/PatientDash/Tabs/Feedback"; -import StaffDash from "./components/Dashboards/StaffDash/StaffDash"; -import BookAppointmentStaff from "./components/Dashboards/StaffDash/Tabs/BookAppointment"; -import CancelAppointment from "./components/Dashboards/StaffDash/Tabs/CancelAppointment"; -import MakePaymentStaff from "./components/Dashboards/StaffDash/Tabs/MakePayment"; -import CardPaymentStaff from "./components/Dashboards/StaffDash/Tabs/CardPayment"; -import UpiPaymentStaff from "./components/Dashboards/StaffDash/Tabs/UpiPayment"; -import CashPayment from "./components/Dashboards/StaffDash/Tabs/CashPayment"; -import DoctorDash from "./components/Dashboards/DoctorDash/DoctorDash"; -import Appointments from "./components/Dashboards/DoctorDash/Tabs/Appointments"; -import UploadPrescription from "./components/Dashboards/DoctorDash/Tabs/UploadPrescription"; -import AdminDash from "./components/Dashboards/AdminDash/AdminDash"; -import DocList from "./components/Dashboards/AdminDash/Tabs/DocList"; -import AddNew from "./components/Dashboards/AdminDash/Tabs/AddNew"; -import GenerateStats from "./components/Dashboards/AdminDash/Tabs/GenerateStats"; -import VerifySignUp from "./components/Dashboards/AdminDash/Tabs/VerifySignUp"; -import Feedbacks from "./components/Dashboards/AdminDash/Tabs/Feedbacks"; - -export const AuthContext = React.createContext(); +import MyRouter from "./Router"; function App() { - const [userType, setUserType] = useState( - jwt.decode(localStorage.getItem("accessToken"))?.userType - ); - useEffect(() => { - const token = localStorage.getItem("accessToken"); - const payload = token && jwt.decode(token); - const userTyp = payload && payload.userType; - setUserType(userTyp && userTyp); - }, []); - return ( - - - } /> - - ) : ( - - - - ) - } - /> - : - } - /> - {/*----------> Admin Routes <------------- */} - {userType === "admin" && ( - - - - - } - /> - - - - } - /> - - - - } - /> - - - - } - /> - - - - } - /> - - - - } - /> - - )} - {/*----------> Doctor Routes <------------- */} - {userType === "doctor" && ( - - - - - } - /> - - - - } - /> - - - - } - /> - - )} - {/*----------> Patient Routes <------------- */} - {userType === "patient" && ( - - - - - } - /> - } - /> - - - - } - /> - - - - } - /> - - - - } - /> - - - - } - /> - - - - } - /> - - - - } - /> - - - - } - /> - - )} - {/*----------> Staff Routes <------------- */} - {userType === "staff" && ( - - - - - } - /> - - - - } - /> - - - - } - /> - - - - } - /> - } - /> - } - /> - } - /> - - )} - {/*----------> Unknown Routes <------------- */} - - - - } - /> - - + ); } diff --git a/src/Router/adminRouter.js b/src/Router/adminRouter.js index 62575fc..039162d 100644 --- a/src/Router/adminRouter.js +++ b/src/Router/adminRouter.js @@ -1,12 +1,14 @@ -import AdminDash from '../components/Dashboards/AdminDash/AdminDash'; -import DocList from '../components/Dashboards/AdminDash/Tabs/DocList'; -import AddNew from '../components/Dashboards/AdminDash/Tabs/AddNew'; -import GenerateStats from '../components/Dashboards/AdminDash/Tabs/GenerateStats'; -import VerifySignUp from '../components/Dashboards/AdminDash/Tabs/VerifySignUp'; -import Feedbacks from '../components/Dashboards/AdminDash/Tabs/Feedbacks'; +import { AuthContext } from '.'; +import DocList from '../pages/AdminDash/Tabs/DocList'; +import AddNew from '../pages/AdminDash/Tabs/AddNew'; +import GenerateStats from '../pages/AdminDash/Tabs/GenerateStats'; +import Feedbacks from '../pages/AdminDash/Tabs/Feedbacks'; +import VerifySignUp from '../pages/AdminDash/Tabs/VerifySignUp'; +import AdminDash from '../pages/AdminDash'; -const adminRouter = [ + +const adminRouter = (setUserType) => [ { path: '/dashboard/admin', element: diff --git a/src/Router/doctorRouter.js b/src/Router/doctorRouter.js index 05c9493..21c3c78 100644 --- a/src/Router/doctorRouter.js +++ b/src/Router/doctorRouter.js @@ -1,8 +1,10 @@ -import DoctorDash from '../components/Dashboards/DoctorDash/DoctorDash'; -import Appointments from '../components/Dashboards/DoctorDash/Tabs/Appointments'; -import UploadPrescription from '../components/Dashboards/DoctorDash/Tabs/UploadPrescription'; +import { AuthContext } from '.'; -const doctorRouter = [ +import Appointments from '../pages/DoctorDash/Tabs/Appointments'; +import UploadPrescription from '../pages/DoctorDash/Tabs/UploadPrescription'; +import DoctorDash from '../pages/DoctorDash/DoctorDash'; + +const doctorRouter = (setUserType) => [ { path: '/dashboard/doctor', element: diff --git a/src/Router/index.js b/src/Router/index.js index ce119a7..9239763 100644 --- a/src/Router/index.js +++ b/src/Router/index.js @@ -1,18 +1,14 @@ import React, { useEffect, useState } from 'react'; import { createBrowserRouter, Navigate, RouterProvider } from 'react-router-dom' import jwt from "jsonwebtoken"; -import HomePage from '../components/HomePage/HomePage'; -import SignIn from '../components/SignIn/SignIn'; -import SignUp from '../components/SignUp/SignUp'; -import AdminDash from '../components/Dashboards/AdminDash/AdminDash'; -import DocList from '../components/Dashboards/AdminDash/Tabs/DocList'; -import AddNew from '../components/Dashboards/AdminDash/Tabs/AddNew'; -import GenerateStats from '../components/Dashboards/AdminDash/Tabs/GenerateStats'; -import VerifySignUp from '../components/Dashboards/AdminDash/Tabs/VerifySignUp'; -import Feedbacks from '../components/Dashboards/AdminDash/Tabs/Feedbacks'; +import HomePage from '../pages/HomePage/HomePage'; +import SignIn from '../pages/SignIn/SignIn'; +import SignUp from '../pages/SignUp/SignUp'; import adminRouter from './adminRouter'; import doctorRouter from './doctorRouter'; import staffRouter from './staffRouter'; +import patientRouter from './patientRouter'; +import Page404 from '../pages/Page404/Page404'; export const AuthContext = React.createContext(); @@ -27,8 +23,6 @@ export default function MyRouter() { setUserType(userTyp && userTyp); }, []); - - const router = createBrowserRouter([ { path: '/', @@ -48,15 +42,15 @@ export default function MyRouter() { path: '/signup', element: userType ? : }, - userType === "admin" && { ...adminRouter }, - userType === "doctor" && { ...doctorRouter }, - userType === "staff" && { ...staffRouter }, + userType === "admin" && { ...adminRouter(setUserType) }, + userType === "doctor" && { ...doctorRouter(setUserType) }, + userType === "patient" && { ...patientRouter(setUserType) }, + userType === "staff" && { ...staffRouter(setUserType) }, { path: '*', element: , - // loader: async ({ params }) => await getonetutorial(params.tutorialID) }, ]) return ( diff --git a/src/Router/patientRouter.js b/src/Router/patientRouter.js index 498d65a..a4dba57 100644 --- a/src/Router/patientRouter.js +++ b/src/Router/patientRouter.js @@ -1,14 +1,16 @@ -import PatientDash from '../components/Dashboards/PatientDash/PatientDash'; -import BookAppointment from '../components/Dashboards/PatientDash/Tabs/BookAppointment'; -import CardPaymentPatient from '../components/Dashboards/PatientDash/Tabs/CardPayment'; -import Feedback from '../components/Dashboards/PatientDash/Tabs/Feedback'; -import MakePaymentPatinet from '../components/Dashboards/PatientDash/Tabs/MakePayment'; -import MyAppointments from '../components/Dashboards/PatientDash/Tabs/MyAppointments'; -import Prescriptions from '../components/Dashboards/PatientDash/Tabs/Prescriptions'; -import UpiPaymentPatient from '../components/Dashboards/PatientDash/Tabs/UpiPayment'; -import ViewLocation from '../components/Dashboards/PatientDash/Tabs/ViewLocation'; +import { AuthContext } from '.'; -const patientRouter = [ +import BookAppointment from '../pages/PatientDash/Tabs/BookAppointment'; +import CardPaymentPatient from '../pages/PatientDash/Tabs/CardPayment'; +import Feedback from '../pages/PatientDash/Tabs/Feedback'; +import MakePaymentPatinet from '../pages/PatientDash/Tabs/MakePayment'; +import MyAppointments from '../pages/PatientDash/Tabs/MyAppointments'; +import Prescriptions from '../pages/PatientDash/Tabs/Prescriptions'; +import UpiPaymentPatient from '../pages/PatientDash/Tabs/UpiPayment'; +import ViewLocation from '../pages/PatientDash/Tabs/ViewLocation'; +import PatientDash from '../pages/PatientDash'; + +const patientRouter = (setUserType) => [ { path: '/dashboard/patient', element: diff --git a/src/Router/staffRouter.js b/src/Router/staffRouter.js index dcdeb03..91b6272 100644 --- a/src/Router/staffRouter.js +++ b/src/Router/staffRouter.js @@ -1,12 +1,14 @@ -import StaffDash from '../components/Dashboards/StaffDash/StaffDash'; -import BookAppointmentStaff from '../components/Dashboards/StaffDash/Tabs/BookAppointment'; -import CancelAppointment from '../components/Dashboards/StaffDash/Tabs/CancelAppointment'; -import CardPaymentStaff from '../components/Dashboards/StaffDash/Tabs/CardPayment'; -import CashPayment from '../components/Dashboards/StaffDash/Tabs/CashPayment'; -import MakePaymentStaff from '../components/Dashboards/StaffDash/Tabs/MakePayment'; -import UpiPaymentStaff from '../components/Dashboards/StaffDash/Tabs/UpiPayment'; +import { AuthContext } from '.'; -const staffRouter = [ +import BookAppointmentStaff from '../pages/StaffDash/Tabs/BookAppointment'; +import CancelAppointment from '../pages/StaffDash/Tabs/CancelAppointment'; +import CardPaymentStaff from '../pages/StaffDash/Tabs/CardPayment'; +import CashPayment from '../pages/StaffDash/Tabs/CashPayment'; +import MakePaymentStaff from '../pages/StaffDash/Tabs/MakePayment'; +import UpiPaymentStaff from '../pages/StaffDash/Tabs/UpiPayment'; +import StaffDash from '../pages/StaffDash/StaffDash'; + +const staffRouter = (setUserType) => [ { path: '/dashboard/staff', element: diff --git a/src/api.js b/src/api.js deleted file mode 100644 index f3c6f45..0000000 --- a/src/api.js +++ /dev/null @@ -1,130 +0,0 @@ -import axios from "axios"; - -const baseUrl = `${process.env.REACT_APP_BASE}/api`; - -axios.interceptors.request.use( - (config) => { - const accessToken = localStorage.getItem("accessToken"); - if (accessToken) { - config.headers["x-auth-token"] = accessToken; - } - return config; - }, - (error) => { - Promise.reject(error); - } -); - -axios.interceptors.response.use( - (response) => { - return response; - }, - (error) => { - const originalRequest = error.config; - let refreshToken = localStorage.getItem("refreshToken"); - if ( - refreshToken && - error.response.status === 401 && - !originalRequest._retry - ) { - originalRequest._retry = true; - return axios - .post(`${baseUrl}/auth/refresh`, { refreshToken: refreshToken }) - .then((res) => { - if (res.status === 200) { - localStorage.setItem("accessToken", res.data.accessToken); - return axios(originalRequest); - } - }); - } - return Promise.reject(error); - } -); - -const api = { - signup: (body) => { - return axios.post(`${baseUrl}/auth/signup`, body); - }, - - signin: (body) => { - return axios.post(`${baseUrl}/auth/signin`, body); - }, - - refreshToken: (body) => { - return axios.post(`${baseUrl}/auth/refresh`, body); - }, - - logout: (body) => { - return axios.delete(`${baseUrl}/auth/logout`, body); - }, - - docList: () => { - return axios.get(`${baseUrl}/doctor/list`); - }, - - addNew: (body) => { - return axios.post(`${baseUrl}/doctor/new`, body); - }, - - updateFee: (body) => { - return axios.post(`${baseUrl}/doctor/fee`, body); - }, - - unverified: () => { - return axios.get(`${baseUrl}/users/unverified`); - }, - - verify: (body) => { - return axios.post(`${baseUrl}/users/unverified/verify`, body); - }, - - reject: (body) => { - return axios.delete(`${baseUrl}/users/unverified/reject`, body); - }, - - generateStats: () => { - return axios.get(`${baseUrl}/generate/stats`); - }, - - patientFeedbacks: () => { - return axios.get(`${baseUrl}/patient/feedbacks`); - }, - - bookAppointment: (body) => { - return axios.post(`${baseUrl}/booking/appointment`, body); - }, - - duePayment: () => { - return axios.get(`${baseUrl}/booking/duepayment`); - }, - - makePayment: (body) => { - return axios.post(`${baseUrl}/booking/payment`, body); - }, - - myAppointments: () => { - return axios.get(`${baseUrl}/patient/appointments`); - }, - - cancelAppointment: (body) => { - return axios.delete(`${baseUrl}/patient/appointments/cancel`, body); - }, - - prescriptions: () => { - return axios.get(`${baseUrl}/patient/prescriptions`); - }, - - writeFeedback: (body) => { - return axios.post(`${baseUrl}/patient/feedback/write`, body); - }, - - deleteFeedback: (body) => { - return axios.post(`${baseUrl}/patient/feedback/delete`, body); - }, - - uploadPrescription: (body) => { - return axios.post(`${baseUrl}/doctor/prescription/upload`, body); - }, -}; - -export default api; diff --git a/src/api/api.js b/src/api/index.js similarity index 89% rename from src/api/api.js rename to src/api/index.js index d6d28f0..4d4aded 100644 --- a/src/api/api.js +++ b/src/api/index.js @@ -4,7 +4,7 @@ import doctorApi from './doctor.api' import patientApi from './patient.api' import userApi from './user.api' -const api = { +const API = { ...authApi, ...bookingApi, ...doctorApi, @@ -12,4 +12,4 @@ const api = { ...userApi, } -export default api \ No newline at end of file +export default API \ No newline at end of file diff --git a/src/api/request.js b/src/api/request.js index af571a4..9d6a4fe 100644 --- a/src/api/request.js +++ b/src/api/request.js @@ -2,6 +2,13 @@ import axios from "axios"; const baseUrl = `${process.env.REACT_APP_BASE}/api`; +const axiosInstance = axios.create({ + // baseURL: 'https://medal.onrender.com/api', + baseURL: baseUrl, + // timeout: 6000, +}); + + axios.interceptors.request.use( (config) => { const accessToken = localStorage.getItem("accessToken"); diff --git a/src/components/Cards/AppointmentCard.js b/src/components/Cards/AppointmentCard.js index a1f4f79..68cc284 100644 --- a/src/components/Cards/AppointmentCard.js +++ b/src/components/Cards/AppointmentCard.js @@ -7,14 +7,14 @@ import Button from "@mui/material/Button"; import CancelIcon from "@mui/icons-material/Cancel"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; -import api from "../../api"; +import API from "../../api"; export default function AppointmentCard(props) { const [openBackdrop, setOpenBackdrop] = useState(false); async function handleCancel() { setOpenBackdrop(true); try { - const res = await api.cancelAppointment({ + const res = await API.cancelAppointment({ data: { pemail: props.pemail, demail: props.demail, doa: props.doa }, }); if (res.data.error) { diff --git a/src/components/Cards/BookingCard.js b/src/components/Cards/BookingCard.js index 543574b..8dc0f6e 100644 --- a/src/components/Cards/BookingCard.js +++ b/src/components/Cards/BookingCard.js @@ -8,8 +8,9 @@ import AddTaskIcon from "@mui/icons-material/AddTask"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; import { useNavigate, createSearchParams } from "react-router-dom"; -import api from "../../api"; + import jwt from "jsonwebtoken"; +import API from "../../api"; export default function BookingCard(props) { const [openBackdrop, setOpenBackdrop] = useState(false); @@ -63,7 +64,7 @@ export default function BookingCard(props) { doa: Date.parse(props.date), }; try { - const res = await api.bookAppointment(postData); + const res = await API.bookAppointment(postData); if (res.data.error) { setOpenBackdrop(false); alert(res.data.errorMsg); diff --git a/src/components/Cards/DashCard.js b/src/components/Cards/DashCard.js index 4c7a2cc..b4dcbd3 100644 --- a/src/components/Cards/DashCard.js +++ b/src/components/Cards/DashCard.js @@ -4,7 +4,7 @@ import CardContent from "@mui/material/CardContent"; import Typography from "@mui/material/Typography"; import { useNavigate, useLocation, createSearchParams } from "react-router-dom"; import "./DashCard.css"; -import { PaymentContext } from "../Dashboards/PatientDash/Tabs/MakePayment"; +import { PaymentContext } from "../../pages/PatientDash/Tabs/MakePayment"; import { StaffPaymentContext } from "../Dashboards/StaffDash/Tabs/MakePayment"; export default function DashCard(props) { diff --git a/src/components/Cards/DocListCard.js b/src/components/Cards/DocListCard.js index 57d1574..d2bd10d 100644 --- a/src/components/Cards/DocListCard.js +++ b/src/components/Cards/DocListCard.js @@ -10,7 +10,8 @@ import Button from "@mui/material/Button"; import TextField from "@mui/material/TextField"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; -import api from "../../api"; +import API from "../../api"; + const styles = { backgroundColor: "#FF5403", @@ -42,7 +43,7 @@ export default function DocListCard(props) { async function handleDone() { setOpenBackdrop(true); try { - const res = await api.updateFee({ docName: props.heading, fee: newFee }); + const res = await API.updateFee({ docName: props.heading, fee: newFee }); if (res.data.error) { setOpenBackdrop(false); alert(res.data.errorMsg); diff --git a/src/components/Cards/DuePaymentCard.js b/src/components/Cards/DuePaymentCard.js index 7cb715f..d7673ce 100644 --- a/src/components/Cards/DuePaymentCard.js +++ b/src/components/Cards/DuePaymentCard.js @@ -9,9 +9,9 @@ import DoNotDisturbIcon from "@mui/icons-material/DoNotDisturb"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; import { useNavigate, createSearchParams } from "react-router-dom"; -import api from "../../api"; +import API from "../../api"; -export default function AppointmentCard(props) { +export default function DuePaymentCard(props) { const [openBackdrop, setOpenBackdrop] = useState(false); const navigate = useNavigate(); function handlePayNow() { @@ -28,7 +28,7 @@ export default function AppointmentCard(props) { async function handleCancel() { setOpenBackdrop(true); try { - const res = await api.cancelAppointment({ + const res = await API.cancelAppointment({ data: { pemail: props.pemail, demail: props.demail, doa: props.doa }, }); if (res.data.error) { diff --git a/src/components/Cards/FeedbackCard.js b/src/components/Cards/FeedbackCard.js index 0aa0cd2..2402f57 100644 --- a/src/components/Cards/FeedbackCard.js +++ b/src/components/Cards/FeedbackCard.js @@ -11,7 +11,7 @@ import Fab from "@mui/material/Fab"; import Tooltip from "@mui/material/Tooltip"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; -import api from "../../api"; +import API from "../../api"; export default function FeedbackCard(props) { const [openBackdrop, setOpenBackdrop] = useState(false); @@ -27,7 +27,7 @@ export default function FeedbackCard(props) { async function handleSubmit() { setOpenBackdrop(true); try { - const res = await api.writeFeedback({ + const res = await API.writeFeedback({ pemail: props.pemail, demail: props.demail, doa: props.doa, @@ -52,7 +52,7 @@ export default function FeedbackCard(props) { async function handleDelete() { setOpenBackdrop(true); try { - const res = await api.deleteFeedback({ + const res = await API.deleteFeedback({ pemail: props.pemail, demail: props.demail, doa: props.doa, diff --git a/src/components/Cards/PrescriptionCard.js b/src/components/Cards/PrescriptionCard.js index f989147..a66eeec 100644 --- a/src/components/Cards/PrescriptionCard.js +++ b/src/components/Cards/PrescriptionCard.js @@ -4,7 +4,7 @@ import Typography from "@mui/material/Typography"; import Fab from "@mui/material/Fab"; import FileDownloadIcon from "@mui/icons-material/FileDownload"; -export default function AppointmentCard(props) { +export default function PrescriptionCard(props) { return ( diff --git a/src/components/Cards/StatsCard.js b/src/components/Cards/StatsCard.js index 984b693..73a924a 100644 --- a/src/components/Cards/StatsCard.js +++ b/src/components/Cards/StatsCard.js @@ -3,7 +3,7 @@ import CardContent from "@mui/material/CardContent"; import Typography from "@mui/material/Typography"; import StarRateIcon from "@mui/icons-material/StarRate"; -export default function AppointmentCard(props) { +export default function StatsCard(props) { return ( diff --git a/src/components/Cards/VerifyCard.js b/src/components/Cards/VerifyCard.js index 9f56c2f..5e6b647 100644 --- a/src/components/Cards/VerifyCard.js +++ b/src/components/Cards/VerifyCard.js @@ -10,7 +10,7 @@ import Tooltip from "@mui/material/Tooltip"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; import { useNavigate, createSearchParams } from "react-router-dom"; -import api from "../../api"; +import API from "../../api"; const styleVerify = { backgroundColor: "#64dd17", @@ -38,7 +38,7 @@ export default function VerifyCard(props) { async function handleVerify() { setOpenBackdrop(true); try { - const res = await api.verify({ email: props.subheading }); + const res = await API.verify({ email: props.subheading }); if (res.data.error) { setOpenBackdrop(false); alert(res.data.errorMsg); @@ -69,7 +69,7 @@ export default function VerifyCard(props) { async function handleReject() { setOpenBackdrop(true); try { - const res = await api.reject({ data: { email: props.subheading } }); + const res = await API.reject({ data: { email: props.subheading } }); if (res.data.error) { setOpenBackdrop(false); alert(res.data.errorMsg); diff --git a/src/components/DashBar/DashBar.js b/src/components/DashBar/DashBar.js index 9f318b0..8e4cd7a 100644 --- a/src/components/DashBar/DashBar.js +++ b/src/components/DashBar/DashBar.js @@ -1,5 +1,5 @@ import { useContext, useState, Fragment } from "react"; -import { AuthContext } from "../../App"; +import { AuthContext } from "../../Router"; import jwt from "jsonwebtoken"; import AppBar from "@mui/material/AppBar"; import Box from "@mui/material/Box"; @@ -13,7 +13,7 @@ import { red } from "@mui/material/colors"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; import { useNavigate } from "react-router-dom"; -import api from "../../api"; +import API from "../../api"; export default function DashBar() { const [openBackdrop, setOpenBackdrop] = useState(false); @@ -30,7 +30,7 @@ export default function DashBar() { const refreshToken = localStorage.getItem("refreshToken"); localStorage.removeItem("accessToken"); localStorage.removeItem("refreshToken"); - await api.logout({ data: { refreshToken } }); + await API.logout({ data: { refreshToken } }); setOpenBackdrop(false); auth.setUserType(null); navigate("/"); diff --git a/src/components/FileUploader/FileUploader.js b/src/components/FileUploader/FileUploader.js index ea34ad7..26c5b8c 100644 --- a/src/components/FileUploader/FileUploader.js +++ b/src/components/FileUploader/FileUploader.js @@ -6,7 +6,7 @@ import FormGroup from "@mui/material/FormGroup"; import Typography from "@mui/material/Typography"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; -import api from "../../api"; +import API from "../../api"; const Input = styled("input")({ display: "none", @@ -47,7 +47,7 @@ export default function FileUploader(props) { formData.append("doa", props.doa); formData.append("prescriptionFile", file); try { - const res = await api.uploadPrescription(formData); + const res = await API.uploadPrescription(formData); if (res.data.error) { setOpenBackdrop(false); alert(res.data.errorMsg); diff --git a/src/components/Payments/Card/CardPay.js b/src/components/Payments/Card/CardPay.js index 09a013f..ce1cbe7 100644 --- a/src/components/Payments/Card/CardPay.js +++ b/src/components/Payments/Card/CardPay.js @@ -17,7 +17,7 @@ import { import "react-credit-cards/es/styles-compiled.css"; import "./CardPay.css"; -import api from "../../../api"; +import API from "../../../api"; import { useSearchParams, useNavigate } from "react-router-dom"; function CardPay() { @@ -77,7 +77,7 @@ function CardPay() { setOpenBackdrop(true); e.preventDefault(); try { - const res = await api.makePayment({ pemail, demail, doa }); + const res = await API.makePayment({ pemail, demail, doa }); if (res.data.error) { setOpenBackdrop(false); alert(res.data.errorMsg); diff --git a/src/components/Payments/Cash/CashPay.js b/src/components/Payments/Cash/CashPay.js index 3c594b3..9962521 100644 --- a/src/components/Payments/Cash/CashPay.js +++ b/src/components/Payments/Cash/CashPay.js @@ -7,7 +7,7 @@ import CheckIcon from "@mui/icons-material/Check"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; import { useSearchParams, useNavigate } from "react-router-dom"; -import api from "../../../api"; +import API from "../../../api"; function CashPay() { const navigate = useNavigate(); @@ -22,7 +22,7 @@ function CashPay() { async function handleConfirm() { setOpenBackdrop(true); try { - const res = await api.makePayment({ pemail, demail, doa }); + const res = await API.makePayment({ pemail, demail, doa }); if (res.data.error) { setOpenBackdrop(false); alert(res.data.errorMsg); diff --git a/src/components/Payments/UPI/UpiPay.js b/src/components/Payments/UPI/UpiPay.js index 252d0f4..32f3f35 100644 --- a/src/components/Payments/UPI/UpiPay.js +++ b/src/components/Payments/UPI/UpiPay.js @@ -7,7 +7,7 @@ import CheckIcon from "@mui/icons-material/Check"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; import { useSearchParams, useNavigate } from "react-router-dom"; -import api from "../../../api"; +import API from "../../../api"; function UpiPay() { const navigate = useNavigate(); @@ -22,7 +22,7 @@ function UpiPay() { async function handleConfirm() { setOpenBackdrop(true); try { - const res = await api.makePayment({ pemail, demail, doa }); + const res = await API.makePayment({ pemail, demail, doa }); if (res.data.error) { setOpenBackdrop(false); alert(res.data.errorMsg); diff --git a/src/components/Dashboards/AdminDash/Tabs/AddNew.css b/src/pages/AdminDash/Tabs/AddNew.css similarity index 100% rename from src/components/Dashboards/AdminDash/Tabs/AddNew.css rename to src/pages/AdminDash/Tabs/AddNew.css diff --git a/src/components/Dashboards/AdminDash/Tabs/AddNew.js b/src/pages/AdminDash/Tabs/AddNew.js similarity index 99% rename from src/components/Dashboards/AdminDash/Tabs/AddNew.js rename to src/pages/AdminDash/Tabs/AddNew.js index 38d9e74..d83b3e8 100644 --- a/src/components/Dashboards/AdminDash/Tabs/AddNew.js +++ b/src/pages/AdminDash/Tabs/AddNew.js @@ -1,6 +1,5 @@ import { Fragment, forwardRef, useState } from "react"; import Container from "@mui/material/Container"; -import DashBar from "../../../DashBar/DashBar"; import Snackbar from "@mui/material/Snackbar"; import MuiAlert from "@mui/material/Alert"; import Typography from "@mui/material/Typography"; @@ -8,7 +7,8 @@ import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; import { useSearchParams } from "react-router-dom"; import "./AddNew.css"; -import api from "../../../../api"; +import API from "../../../api"; +import DashBar from "../../../components/DashBar/DashBar"; const Alert = forwardRef(function Alert(props, ref) { return ; @@ -154,7 +154,7 @@ function AddNew() { }; try { - const res = await api.addNew(postData); + const res = await API.addNew(postData); if (res.data.error) { setOpenBackdrop(false); setErrorMessage(res.data.erroMsg); diff --git a/src/components/Dashboards/AdminDash/Tabs/DocList.js b/src/pages/AdminDash/Tabs/DocList.js similarity index 90% rename from src/components/Dashboards/AdminDash/Tabs/DocList.js rename to src/pages/AdminDash/Tabs/DocList.js index 03670a9..bf00e18 100644 --- a/src/components/Dashboards/AdminDash/Tabs/DocList.js +++ b/src/pages/AdminDash/Tabs/DocList.js @@ -1,14 +1,14 @@ import { Fragment, useEffect, useState } from "react"; import Container from "@mui/material/Container"; -import DashBar from "../../../DashBar/DashBar"; -import DocListCard from "../../../Cards/DocListCard"; import Grid from "@mui/material/Grid"; import Button from "@mui/material/Button"; import AddIcon from "@mui/icons-material/Add"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; import { Link } from "react-router-dom"; -import api from "../../../../api"; +import DashBar from "../../../components/DashBar/DashBar"; +import DocListCard from "../../../components/Cards/DocListCard"; +import API from "../../../api"; function DocList() { const [openBackdrop, setOpenBackdrop] = useState(false); @@ -18,13 +18,13 @@ function DocList() { async function fetchDocList() { setOpenBackdrop(true); try { - const res = await api.docList(); + const res = await API.docList(); if (res.data.error) { setOpenBackdrop(false); alert(res.data.errorMsg); } else { setOpenBackdrop(false); - setDocs(res.data); + setDocs(res.data) } } catch (error) { setOpenBackdrop(false); diff --git a/src/components/Dashboards/AdminDash/Tabs/Feedbacks.js b/src/pages/AdminDash/Tabs/Feedbacks.js similarity index 91% rename from src/components/Dashboards/AdminDash/Tabs/Feedbacks.js rename to src/pages/AdminDash/Tabs/Feedbacks.js index feece65..7ad07e7 100644 --- a/src/components/Dashboards/AdminDash/Tabs/Feedbacks.js +++ b/src/pages/AdminDash/Tabs/Feedbacks.js @@ -1,12 +1,13 @@ import { Fragment, useEffect, useState } from "react"; -import ViewFeedbackCard from "../../../Cards/ViewFeedbackCard"; + import Container from "@mui/material/Container"; import Grid from "@mui/material/Grid"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; -import DashBar from "../../../DashBar/DashBar"; -import api from "../../../../api"; +import API from "../../../api"; import Typography from "@mui/material/Typography"; +import ViewFeedbackCard from "../../../components/Cards/ViewFeedbackCard"; +import DashBar from "../../../components/DashBar/DashBar"; function Feedbacks() { const [openBackdrop, setOpenBackdrop] = useState(false); @@ -17,7 +18,7 @@ function Feedbacks() { async function fetchFeedbacks() { setOpenBackdrop(true); try { - const res = await api.patientFeedbacks(); + const res = await API.patientFeedbacks(); if (res.data.error) { setOpenBackdrop(false); alert(res.data.errorMsg); diff --git a/src/components/Dashboards/AdminDash/Tabs/GenerateStats.js b/src/pages/AdminDash/Tabs/GenerateStats.js similarity index 93% rename from src/components/Dashboards/AdminDash/Tabs/GenerateStats.js rename to src/pages/AdminDash/Tabs/GenerateStats.js index 1374655..f38598c 100644 --- a/src/components/Dashboards/AdminDash/Tabs/GenerateStats.js +++ b/src/pages/AdminDash/Tabs/GenerateStats.js @@ -1,14 +1,14 @@ import { Fragment, useEffect, useState } from "react"; import Container from "@mui/material/Container"; import Grid from "@mui/material/Grid"; -import StatsCard from "../../../Cards/StatsCard"; -import DashBar from "../../../DashBar/DashBar"; import Button from "@mui/material/Button"; import { Link } from "react-router-dom"; import FeedbackIcon from "@mui/icons-material/Feedback"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; -import api from "../../../../api"; +import API from "../../../api"; +import DashBar from "../../../components/DashBar/DashBar"; +import StatsCard from "../../../components/Cards/StatsCard"; function GenerateStats() { const [openBackdrop, setOpenBackdrop] = useState(false); @@ -22,7 +22,7 @@ function GenerateStats() { async function fetchStats() { setOpenBackdrop(true); try { - const res = await api.generateStats(); + const res = await API.generateStats(); if (res.data.error) { setOpenBackdrop(false); alert(res.data.errorMsg); diff --git a/src/components/Dashboards/AdminDash/Tabs/VerifySignUp.js b/src/pages/AdminDash/Tabs/VerifySignUp.js similarity index 90% rename from src/components/Dashboards/AdminDash/Tabs/VerifySignUp.js rename to src/pages/AdminDash/Tabs/VerifySignUp.js index fc9b708..aece656 100644 --- a/src/components/Dashboards/AdminDash/Tabs/VerifySignUp.js +++ b/src/pages/AdminDash/Tabs/VerifySignUp.js @@ -1,11 +1,13 @@ import { Fragment, useEffect, useState } from "react"; import Container from "@mui/material/Container"; -import DashBar from "../../../DashBar/DashBar"; -import VerifyCard from "../../../Cards/VerifyCard"; import Grid from "@mui/material/Grid"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; -import api from "../../../../api"; +import DashBar from "../../../components/DashBar/DashBar"; +import VerifyCard from "../../../components/Cards/VerifyCard"; +import API from "../../../api" + + function VerifySignUp() { const [openBackdrop, setOpenBackdrop] = useState(false); @@ -15,7 +17,7 @@ function VerifySignUp() { async function fetchUnverified() { setOpenBackdrop(true); try { - const res = await api.unverified(); + const res = await API.unverified(); if (res.data.error) { setOpenBackdrop(false); alert(res.data.error); diff --git a/src/components/Dashboards/AdminDash/AdminDash.js b/src/pages/AdminDash/index.js similarity index 74% rename from src/components/Dashboards/AdminDash/AdminDash.js rename to src/pages/AdminDash/index.js index 5319cbf..3cd8625 100644 --- a/src/components/Dashboards/AdminDash/AdminDash.js +++ b/src/pages/AdminDash/index.js @@ -1,4 +1,4 @@ -import Dashboard from "../Dashboard"; +import Dashboard from "../../components/Dashboards/Dashboard"; const cardTitles = [`Doctors' List`, "Generate Stats", "Verify Signup"]; diff --git a/src/components/Dashboards/DoctorDash/DoctorDash.js b/src/pages/DoctorDash/DoctorDash.js similarity index 73% rename from src/components/Dashboards/DoctorDash/DoctorDash.js rename to src/pages/DoctorDash/DoctorDash.js index a190d1b..c099f15 100644 --- a/src/components/Dashboards/DoctorDash/DoctorDash.js +++ b/src/pages/DoctorDash/DoctorDash.js @@ -1,4 +1,4 @@ -import Dashboard from "../Dashboard"; +import Dashboard from "../../components/Dashboards/Dashboard"; const cardTitles = ["Appointments", "Upload Prescription"]; diff --git a/src/components/Dashboards/DoctorDash/Tabs/Appointments.js b/src/pages/DoctorDash/Tabs/Appointments.js similarity index 92% rename from src/components/Dashboards/DoctorDash/Tabs/Appointments.js rename to src/pages/DoctorDash/Tabs/Appointments.js index b2d8977..4fdd18d 100644 --- a/src/components/Dashboards/DoctorDash/Tabs/Appointments.js +++ b/src/pages/DoctorDash/Tabs/Appointments.js @@ -1,13 +1,13 @@ import { Fragment, useEffect, useState } from "react"; import Container from "@mui/material/Container"; -import DashBar from "../../../DashBar/DashBar"; -import DocAppointmentCard from "../../../Cards/DocAppointmentCard"; import Grid from "@mui/material/Grid"; import Typography from "@mui/material/Typography"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; import jwt from "jsonwebtoken"; -import api from "../../../../api"; +import API from "../../../api"; +import DashBar from "../../../components/DashBar/DashBar"; +import DocAppointmentCard from "../../../components/Cards/DocAppointmentCard"; function Appointments() { const [openBackdrop, setOpenBackdrop] = useState(false); @@ -21,7 +21,7 @@ function Appointments() { const token = localStorage.getItem("accessToken"); const payload = token && jwt.decode(token); const demail = payload.userType === "doctor" && payload.email; - const res = await api.myAppointments(); + const res = await API.myAppointments(); if (res.data.error) { setOpenBackdrop(false); alert(res.data.errorMsg); diff --git a/src/components/Dashboards/DoctorDash/Tabs/UploadPrescription.js b/src/pages/DoctorDash/Tabs/UploadPrescription.js similarity index 92% rename from src/components/Dashboards/DoctorDash/Tabs/UploadPrescription.js rename to src/pages/DoctorDash/Tabs/UploadPrescription.js index 4f5ead8..0a4b00b 100644 --- a/src/components/Dashboards/DoctorDash/Tabs/UploadPrescription.js +++ b/src/pages/DoctorDash/Tabs/UploadPrescription.js @@ -1,13 +1,13 @@ import { Fragment, useEffect, useState } from "react"; import Container from "@mui/material/Container"; -import DashBar from "../../../DashBar/DashBar"; -import UploadPrescriptionCard from "../../../Cards/UploadPrescriptionCard"; import Grid from "@mui/material/Grid"; import Typography from "@mui/material/Typography"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; import jwt from "jsonwebtoken"; -import api from "../../../../api"; +import DashBar from "../../../components/DashBar/DashBar"; +import UploadPrescriptionCard from "../../../components/Cards/UploadPrescriptionCard"; +import API from "../../../api"; function UploadPrescription() { const [openBackdrop, setOpenBackdrop] = useState(false); @@ -21,7 +21,7 @@ function UploadPrescription() { const token = localStorage.getItem("accessToken"); const payload = token && jwt.decode(token); const demail = payload.userType === "doctor" && payload.email; - const res = await api.myAppointments(); + const res = await API.myAppointments(); if (res.data.error) { setOpenBackdrop(false); alert(res.data.errorMsg); diff --git a/src/components/HomePage/HomePage.css b/src/pages/HomePage/HomePage.css similarity index 100% rename from src/components/HomePage/HomePage.css rename to src/pages/HomePage/HomePage.css diff --git a/src/components/HomePage/HomePage.js b/src/pages/HomePage/HomePage.js similarity index 100% rename from src/components/HomePage/HomePage.js rename to src/pages/HomePage/HomePage.js diff --git a/src/components/HomePage/brain.png b/src/pages/HomePage/brain.png similarity index 100% rename from src/components/HomePage/brain.png rename to src/pages/HomePage/brain.png diff --git a/src/components/Page404/Page404.css b/src/pages/Page404/Page404.css similarity index 100% rename from src/components/Page404/Page404.css rename to src/pages/Page404/Page404.css diff --git a/src/components/Page404/Page404.js b/src/pages/Page404/Page404.js similarity index 100% rename from src/components/Page404/Page404.js rename to src/pages/Page404/Page404.js diff --git a/src/components/Page404/bg404.png b/src/pages/Page404/bg404.png similarity index 100% rename from src/components/Page404/bg404.png rename to src/pages/Page404/bg404.png diff --git a/src/components/Dashboards/PatientDash/Tabs/BookAppointment.js b/src/pages/PatientDash/Tabs/BookAppointment.js similarity index 91% rename from src/components/Dashboards/PatientDash/Tabs/BookAppointment.js rename to src/pages/PatientDash/Tabs/BookAppointment.js index b390f4a..5643726 100644 --- a/src/components/Dashboards/PatientDash/Tabs/BookAppointment.js +++ b/src/pages/PatientDash/Tabs/BookAppointment.js @@ -1,7 +1,5 @@ import { useState, useEffect, Fragment } from "react"; import Container from "@mui/material/Container"; -import DashBar from "../../../DashBar/DashBar"; -import BookingCard from "../../../Cards/BookingCard"; import Grid from "@mui/material/Grid"; import Typography from "@mui/material/Typography"; import TextField from "@mui/material/TextField"; @@ -10,7 +8,10 @@ import LocalizationProvider from "@mui/lab/LocalizationProvider"; import DatePicker from "@mui/lab/DatePicker"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; -import api from "../../../../api"; +import API from "../../../api"; +import DashBar from "../../../components/DashBar/DashBar"; +import BookingCard from "../../../components/Cards/BookingCard"; + function BookAppointment(props) { const [openBackdrop, setOpenBackdrop] = useState(false); @@ -20,7 +21,7 @@ function BookAppointment(props) { useEffect(() => { async function fetchDocList() { setOpenBackdrop(true); - const res = await api.docList(); + const res = await API.docList(); setOpenBackdrop(false); setBookingList(res.data); setNoteMsg( @@ -33,13 +34,13 @@ function BookAppointment(props) { const [value, setValue] = useState(new Date()); const [filteredList, setFilteredList] = useState( bookingList.length > 0 && - bookingList.filter((item) => item.wIds.includes(value.getDay())) + bookingList.filter((item) => item.wIds.includes(value.getDay())) ); useEffect(() => { setFilteredList( bookingList.length > 0 && - bookingList.filter((item) => item.wIds.includes(value.getDay())) + bookingList.filter((item) => item.wIds.includes(value.getDay())) ); }, [bookingList, value]); diff --git a/src/components/Dashboards/PatientDash/Tabs/CardPayment.js b/src/pages/PatientDash/Tabs/CardPayment.js similarity index 58% rename from src/components/Dashboards/PatientDash/Tabs/CardPayment.js rename to src/pages/PatientDash/Tabs/CardPayment.js index 09ea956..6f8b6fb 100644 --- a/src/components/Dashboards/PatientDash/Tabs/CardPayment.js +++ b/src/pages/PatientDash/Tabs/CardPayment.js @@ -1,4 +1,4 @@ -import CardPay from "../../../Payments/Card/CardPay"; +import CardPay from "../../../components/Payments/Card/CardPay"; function CardPaymentPatient() { return ; diff --git a/src/components/Dashboards/PatientDash/Tabs/Feedback.js b/src/pages/PatientDash/Tabs/Feedback.js similarity index 92% rename from src/components/Dashboards/PatientDash/Tabs/Feedback.js rename to src/pages/PatientDash/Tabs/Feedback.js index 3d85b54..564d12c 100644 --- a/src/components/Dashboards/PatientDash/Tabs/Feedback.js +++ b/src/pages/PatientDash/Tabs/Feedback.js @@ -1,13 +1,13 @@ import { Fragment, useEffect, useState } from "react"; import jwt from "jsonwebtoken"; import Container from "@mui/material/Container"; -import DashBar from "../../../DashBar/DashBar"; -import FeedbackCard from "../../../Cards/FeedbackCard"; import Grid from "@mui/material/Grid"; import Typography from "@mui/material/Typography"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; -import api from "../../../../api"; +import API from "../../../api"; +import DashBar from "../../../components/DashBar/DashBar"; +import FeedbackCard from "../../../components/Cards/FeedbackCard"; function Feedback() { const [openBackdrop, setOpenBackdrop] = useState(false); @@ -28,7 +28,7 @@ function Feedback() { const token = localStorage.getItem("accessToken"); const payload = token && jwt.decode(token); const ptemail = payload.userType === "patient" && payload.email; - const res = await api.myAppointments(); + const res = await API.myAppointments(); if (res.data.error) { setOpenBackdrop(false); alert(res.data.errorMsg); @@ -42,7 +42,7 @@ function Feedback() { setAppointments(appoints); setDefMsg( appoints.length === 0 && - "**You have not booked any appointment yet.**" + "**You have not booked any appointment yet.**" ); } } catch (error) { diff --git a/src/components/Dashboards/PatientDash/Tabs/MakePayment.js b/src/pages/PatientDash/Tabs/MakePayment.js similarity index 91% rename from src/components/Dashboards/PatientDash/Tabs/MakePayment.js rename to src/pages/PatientDash/Tabs/MakePayment.js index 7ca15ed..4740cce 100644 --- a/src/components/Dashboards/PatientDash/Tabs/MakePayment.js +++ b/src/pages/PatientDash/Tabs/MakePayment.js @@ -1,15 +1,15 @@ import React, { Fragment, useEffect, useState } from "react"; import Grid from "@mui/material/Grid"; import Container from "@mui/material/Container"; -import DashBar from "../../../DashBar/DashBar"; -import Dashboard from "../../Dashboard"; import { useSearchParams } from "react-router-dom"; -import api from "../../../../api"; import jwt from "jsonwebtoken"; -import DuePaymentCard from "../../../Cards/DuePaymentCard"; import Typography from "@mui/material/Typography"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; +import API from "../../../api"; +import Dashboard from "../../../components/Dashboards/Dashboard"; +import DashBar from "../../../components/DashBar/DashBar"; +import DuePaymentCard from "../../../components/Cards/DuePaymentCard"; export const PaymentContext = React.createContext(); @@ -32,7 +32,7 @@ function MakePaymentPatinet() { const token = localStorage.getItem("accessToken"); const payload = token && jwt.decode(token); const ptemail = payload.userType === "patient" && payload.email; - const res = await api.duePayment(); + const res = await API.duePayment(); if (res.data.error) { setOpenBackdrop(false); alert(res.data.errorMsg); @@ -42,7 +42,7 @@ function MakePaymentPatinet() { setDues(myUnpaid); setDefMsg( myUnpaid.length === 0 && - "**All clear here. None of your payment is due.**" + "**All clear here. None of your payment is due.**" ); } } catch (error) { diff --git a/src/components/Dashboards/PatientDash/Tabs/MyAppointments.js b/src/pages/PatientDash/Tabs/MyAppointments.js similarity index 94% rename from src/components/Dashboards/PatientDash/Tabs/MyAppointments.js rename to src/pages/PatientDash/Tabs/MyAppointments.js index 7bdf27a..e59c478 100644 --- a/src/components/Dashboards/PatientDash/Tabs/MyAppointments.js +++ b/src/pages/PatientDash/Tabs/MyAppointments.js @@ -1,7 +1,5 @@ import { Fragment, useState, useEffect } from "react"; import Container from "@mui/material/Container"; -import DashBar from "../../../DashBar/DashBar"; -import AppointmentCard from "../../../Cards/AppointmentCard"; import Grid from "@mui/material/Grid"; import Typography from "@mui/material/Typography"; import Backdrop from "@mui/material/Backdrop"; @@ -11,7 +9,10 @@ import VisibilityOffIcon from "@mui/icons-material/VisibilityOff"; import VisibilityIcon from "@mui/icons-material/Visibility"; import Tooltip from "@mui/material/Tooltip"; import jwt from "jsonwebtoken"; -import api from "../../../../api"; +import API from "../../../api"; +import DashBar from "../../../components/DashBar/DashBar"; +import AppointmentCard from "../../../components/Cards/AppointmentCard"; + function MyAppointments() { const [allAppoints, setAllAppoints] = useState([]); @@ -27,7 +28,7 @@ function MyAppointments() { const token = localStorage.getItem("accessToken"); const payload = token && jwt.decode(token); const ptemail = payload.userType === "patient" && payload.email; - const res = await api.myAppointments(); + const res = await API.myAppointments(); if (res.data.error) { setOpenBackdrop(false); alert(res.data.errorMsg); @@ -40,7 +41,7 @@ function MyAppointments() { setAllAppoints(appoints); setDefMsg( appoints.length === 0 && - "**You have not booked any appointment yet.**" + "**You have not booked any appointment yet.**" ); } } catch (error) { diff --git a/src/components/Dashboards/PatientDash/Tabs/Prescriptions.js b/src/pages/PatientDash/Tabs/Prescriptions.js similarity index 92% rename from src/components/Dashboards/PatientDash/Tabs/Prescriptions.js rename to src/pages/PatientDash/Tabs/Prescriptions.js index 883ff87..b3ac49f 100644 --- a/src/components/Dashboards/PatientDash/Tabs/Prescriptions.js +++ b/src/pages/PatientDash/Tabs/Prescriptions.js @@ -1,13 +1,14 @@ import { Fragment, useEffect, useState } from "react"; import jwt from "jsonwebtoken"; import Container from "@mui/material/Container"; -import DashBar from "../../../DashBar/DashBar"; -import PrescriptionCard from "../../../Cards/PrescriptionCard"; import Grid from "@mui/material/Grid"; import Typography from "@mui/material/Typography"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; -import api from "../../../../api"; +import API from "../../../api"; +import DashBar from "../../../components/DashBar/DashBar"; +import PrescriptionCard from "../../../components/Cards/PrescriptionCard"; + function Prescriptions() { const [prs, setPrs] = useState([]); @@ -21,7 +22,7 @@ function Prescriptions() { const token = localStorage.getItem("accessToken"); const payload = token && jwt.decode(token); const ptemail = payload.userType === "patient" && payload.email; - const res = await api.prescriptions(); + const res = await API.prescriptions(); if (res.data.error) { setOpenBackdrop(false); alert(res.data.errorMsg); diff --git a/src/components/Dashboards/PatientDash/Tabs/UpiPayment.js b/src/pages/PatientDash/Tabs/UpiPayment.js similarity index 59% rename from src/components/Dashboards/PatientDash/Tabs/UpiPayment.js rename to src/pages/PatientDash/Tabs/UpiPayment.js index 90abec2..bf4c3a6 100644 --- a/src/components/Dashboards/PatientDash/Tabs/UpiPayment.js +++ b/src/pages/PatientDash/Tabs/UpiPayment.js @@ -1,4 +1,4 @@ -import UpiPay from "../../../Payments/UPI/UpiPay"; +import UpiPay from "../../../components/Payments/UPI/UpiPay"; function UpiPaymentPatient() { return ; diff --git a/src/components/Dashboards/PatientDash/Tabs/ViewLocation.js b/src/pages/PatientDash/Tabs/ViewLocation.js similarity index 100% rename from src/components/Dashboards/PatientDash/Tabs/ViewLocation.js rename to src/pages/PatientDash/Tabs/ViewLocation.js diff --git a/src/components/Dashboards/PatientDash/PatientDash.js b/src/pages/PatientDash/index.js similarity index 79% rename from src/components/Dashboards/PatientDash/PatientDash.js rename to src/pages/PatientDash/index.js index 02bc8be..59c5576 100644 --- a/src/components/Dashboards/PatientDash/PatientDash.js +++ b/src/pages/PatientDash/index.js @@ -1,4 +1,4 @@ -import Dashboard from "../Dashboard"; +import Dashboard from "../../components/Dashboards/Dashboard"; const cardTitles = [ "View Location", diff --git a/src/components/SignIn/SignIn.css b/src/pages/SignIn/SignIn.css similarity index 100% rename from src/components/SignIn/SignIn.css rename to src/pages/SignIn/SignIn.css diff --git a/src/components/SignIn/SignIn.js b/src/pages/SignIn/SignIn.js similarity index 97% rename from src/components/SignIn/SignIn.js rename to src/pages/SignIn/SignIn.js index 8f98be9..2a8abd9 100644 --- a/src/components/SignIn/SignIn.js +++ b/src/pages/SignIn/SignIn.js @@ -1,5 +1,4 @@ import * as React from "react"; -import { AuthContext } from "../../App"; import Avatar from "@mui/material/Avatar"; import Button from "@mui/material/Button"; import CssBaseline from "@mui/material/CssBaseline"; @@ -14,8 +13,9 @@ import MuiAlert from "@mui/material/Alert"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; import { Link, useSearchParams } from "react-router-dom"; -import api from "../../api"; +import API from "../../api"; import "./SignIn.css"; +import { AuthContext } from "../../Router"; const theme = createTheme(); @@ -73,7 +73,7 @@ export default function SignIn() { }; try { - const res = await api.signin(postData); + const res = await API.signin(postData); if (res.data.error) { setOpenBackdrop(false); setErrorMsg(res.data.errorMsg); diff --git a/src/components/SignUp/SignUp.css b/src/pages/SignUp/SignUp.css similarity index 100% rename from src/components/SignUp/SignUp.css rename to src/pages/SignUp/SignUp.css diff --git a/src/components/SignUp/SignUp.js b/src/pages/SignUp/SignUp.js similarity index 99% rename from src/components/SignUp/SignUp.js rename to src/pages/SignUp/SignUp.js index 4208df6..8154fa1 100644 --- a/src/components/SignUp/SignUp.js +++ b/src/pages/SignUp/SignUp.js @@ -1,5 +1,5 @@ import { forwardRef, useState, useEffect } from "react"; -import api from "../../api"; +import API from "../../api"; import Avatar from "@mui/material/Avatar"; import Button from "@mui/material/Button"; import CssBaseline from "@mui/material/CssBaseline"; @@ -90,7 +90,7 @@ export default function SignUp() { }; try { - const res = await api.signup(postData); + const res = await API.signup(postData); if (res.data.error) { setOpenBackdrop(false); setErrorMsg(res.data.errorMsg); diff --git a/src/components/Dashboards/StaffDash/StaffDash.js b/src/pages/StaffDash/StaffDash.js similarity index 74% rename from src/components/Dashboards/StaffDash/StaffDash.js rename to src/pages/StaffDash/StaffDash.js index 88ca6be..fda67a1 100644 --- a/src/components/Dashboards/StaffDash/StaffDash.js +++ b/src/pages/StaffDash/StaffDash.js @@ -1,4 +1,4 @@ -import Dashboard from "../Dashboard"; +import Dashboard from "../../components/Dashboards/Dashboard"; const cardTitles = ["Book Appointment", "Cancel Appointment", "Make Payment"]; diff --git a/src/components/Dashboards/StaffDash/Tabs/BookAppointment.js b/src/pages/StaffDash/Tabs/BookAppointment.js similarity index 93% rename from src/components/Dashboards/StaffDash/Tabs/BookAppointment.js rename to src/pages/StaffDash/Tabs/BookAppointment.js index e1c0c45..a7e493e 100644 --- a/src/components/Dashboards/StaffDash/Tabs/BookAppointment.js +++ b/src/pages/StaffDash/Tabs/BookAppointment.js @@ -1,7 +1,5 @@ import { useState, useEffect, Fragment } from "react"; import Container from "@mui/material/Container"; -import DashBar from "../../../DashBar/DashBar"; -import BookingCard from "../../../Cards/BookingCard"; import Grid from "@mui/material/Grid"; import Typography from "@mui/material/Typography"; import TextField from "@mui/material/TextField"; @@ -10,8 +8,10 @@ import LocalizationProvider from "@mui/lab/LocalizationProvider"; import DatePicker from "@mui/lab/DatePicker"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; -import api from "../../../../api"; import Box from "@mui/material/Box"; +import API from "../../../api"; +import DashBar from "../../../components/DashBar/DashBar"; +import BookingCard from "../../../components/Cards/BookingCard"; function BookAppointmentStaff(props) { const [bookingList, setBookingList] = useState([]); @@ -22,7 +22,7 @@ function BookAppointmentStaff(props) { useEffect(() => { async function fetchDocList() { setOpenBackdrop(true); - const res = await api.docList(); + const res = await API.docList(); setOpenBackdrop(false); setBookingList(res.data); setNoteMsg( @@ -35,13 +35,13 @@ function BookAppointmentStaff(props) { const [value, setValue] = useState(new Date()); const [filteredList, setFilteredList] = useState( bookingList.length > 0 && - bookingList.filter((item) => item.wIds.includes(value.getDay())) + bookingList.filter((item) => item.wIds.includes(value.getDay())) ); useEffect(() => { setFilteredList( bookingList.length > 0 && - bookingList.filter((item) => item.wIds.includes(value.getDay())) + bookingList.filter((item) => item.wIds.includes(value.getDay())) ); }, [bookingList, value]); diff --git a/src/components/Dashboards/StaffDash/Tabs/CancelAppointment.js b/src/pages/StaffDash/Tabs/CancelAppointment.js similarity index 95% rename from src/components/Dashboards/StaffDash/Tabs/CancelAppointment.js rename to src/pages/StaffDash/Tabs/CancelAppointment.js index 8d1412c..b33e909 100644 --- a/src/components/Dashboards/StaffDash/Tabs/CancelAppointment.js +++ b/src/pages/StaffDash/Tabs/CancelAppointment.js @@ -1,7 +1,5 @@ import { Fragment, useState } from "react"; import Container from "@mui/material/Container"; -import DashBar from "../../../DashBar/DashBar"; -import AppointmentCard from "../../../Cards/AppointmentCard"; import Grid from "@mui/material/Grid"; import Typography from "@mui/material/Typography"; import Stack from "@mui/material/Stack"; @@ -9,7 +7,9 @@ import Button from "@mui/material/Button"; import TextField from "@mui/material/TextField"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; -import api from "../../../../api"; +import API from "../../../api"; +import DashBar from "../../../components/DashBar/DashBar"; +import AppointmentCard from "../../../components/Cards/AppointmentCard"; function CancelAppointment() { const [openBackdrop, setOpenBackdrop] = useState(false); @@ -34,7 +34,7 @@ function CancelAppointment() { } try { const ptemail = email; - const res = await api.myAppointments(); + const res = await API.myAppointments(); if (res.data.error) { setOpenBackdrop(false); alert(res.data.errorMsg); diff --git a/src/components/Dashboards/StaffDash/Tabs/CardPayment.js b/src/pages/StaffDash/Tabs/CardPayment.js similarity index 96% rename from src/components/Dashboards/StaffDash/Tabs/CardPayment.js rename to src/pages/StaffDash/Tabs/CardPayment.js index 93a6e50..9ba19a7 100644 --- a/src/components/Dashboards/StaffDash/Tabs/CardPayment.js +++ b/src/pages/StaffDash/Tabs/CardPayment.js @@ -7,12 +7,11 @@ import CheckIcon from "@mui/icons-material/Check"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; import { useSearchParams, useNavigate } from "react-router-dom"; -import api from "../../../../api"; +import API from "../../../api"; function CardPaymentStaff() { const [openBackdrop, setOpenBackdrop] = useState(false); const navigate = useNavigate(); - const [searchParams] = useSearchParams(); const pemail = searchParams ? searchParams.get("pemail") : null; const demail = searchParams ? searchParams.get("demail") : null; @@ -22,7 +21,7 @@ function CardPaymentStaff() { async function handleConfirm() { setOpenBackdrop(true); try { - const res = await api.makePayment({ pemail, demail, doa }); + const res = await API.makePayment({ pemail, demail, doa }); if (res.data.error) { setOpenBackdrop(false); alert(res.data.errorMsg); diff --git a/src/components/Dashboards/StaffDash/Tabs/CashPayment.js b/src/pages/StaffDash/Tabs/CashPayment.js similarity index 54% rename from src/components/Dashboards/StaffDash/Tabs/CashPayment.js rename to src/pages/StaffDash/Tabs/CashPayment.js index a5f2201..8a11d03 100644 --- a/src/components/Dashboards/StaffDash/Tabs/CashPayment.js +++ b/src/pages/StaffDash/Tabs/CashPayment.js @@ -1,4 +1,5 @@ -import CashPay from "../../../Payments/Cash/CashPay"; +import CashPay from "../../../components/Payments/Cash/CashPay"; + function CashPayment() { return ; diff --git a/src/components/Dashboards/StaffDash/Tabs/MakePayment.js b/src/pages/StaffDash/Tabs/MakePayment.js similarity index 95% rename from src/components/Dashboards/StaffDash/Tabs/MakePayment.js rename to src/pages/StaffDash/Tabs/MakePayment.js index 939c5bd..f92d6e3 100644 --- a/src/components/Dashboards/StaffDash/Tabs/MakePayment.js +++ b/src/pages/StaffDash/Tabs/MakePayment.js @@ -1,17 +1,17 @@ import React, { Fragment, useState } from "react"; import Grid from "@mui/material/Grid"; import Container from "@mui/material/Container"; -import DashBar from "../../../DashBar/DashBar"; -import Dashboard from "../../Dashboard"; import { useSearchParams } from "react-router-dom"; -import api from "../../../../api"; -import DuePaymentCard from "../../../Cards/DuePaymentCard"; import Typography from "@mui/material/Typography"; import Stack from "@mui/material/Stack"; import Button from "@mui/material/Button"; import TextField from "@mui/material/TextField"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; +import API from "../../../api"; +import Dashboard from "../../../components/Dashboards/Dashboard"; +import DashBar from "../../../components/DashBar/DashBar"; +import DuePaymentCard from "../../../components/Cards/DuePaymentCard"; export const StaffPaymentContext = React.createContext(); @@ -45,7 +45,7 @@ function MakePaymentStaff() { } try { const ptemail = email; - const res = await api.duePayment(); + const res = await API.duePayment(); if (res.data.error) { setOpenBackdrop(false); alert(res.data.errorMsg); diff --git a/src/components/Dashboards/StaffDash/Tabs/UpiPayment.js b/src/pages/StaffDash/Tabs/UpiPayment.js similarity index 58% rename from src/components/Dashboards/StaffDash/Tabs/UpiPayment.js rename to src/pages/StaffDash/Tabs/UpiPayment.js index 988762c..fa4b2a8 100644 --- a/src/components/Dashboards/StaffDash/Tabs/UpiPayment.js +++ b/src/pages/StaffDash/Tabs/UpiPayment.js @@ -1,4 +1,4 @@ -import UpiPay from "../../../Payments/UPI/UpiPay"; +import UpiPay from "../../../components/Payments/UPI/UpiPay"; function UpiPaymentStaff() { return ; diff --git a/yarn.lock b/yarn.lock index 48a4925..316d00d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1152,7 +1152,7 @@ dependencies: regenerator-runtime "^0.13.4" -"@babel/runtime@^7.12.5", "@babel/runtime@^7.13.10", "@babel/runtime@^7.16.3", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2": +"@babel/runtime@^7.12.5", "@babel/runtime@^7.13.10", "@babel/runtime@^7.16.3", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2": version "7.16.3" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.16.3.tgz#b86f0db02a04187a3c17caa77de69840165d42d5" integrity sha512-WBwekcqacdY2e9AF/Q7WLFUWmdJGJTkbjqTjoMDgXkVZ3ZRUvOPsLb5KdwISoQVsbP+DQzVZW4Zhci0DvpbNTQ== @@ -1864,6 +1864,11 @@ rc-resize-observer "^1.3.1" rc-util "^5.38.0" +"@remix-run/router@1.14.0": + version "1.14.0" + resolved "https://registry.yarnpkg.com/@remix-run/router/-/router-1.14.0.tgz#9bc39a5a3a71b81bdb310eba6def5bc3966695b7" + integrity sha512-WOHih+ClN7N8oHk9N4JUiMxQJmRVaOxcg8w7F/oHUXzJt920ekASLI/7cYX8XkntDWRhLZtsk6LbGrkgOAvi5A== + "@rollup/plugin-node-resolve@^7.1.1": version "7.1.3" resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-7.1.3.tgz#80de384edfbd7bfc9101164910f86078151a3eca" @@ -6034,13 +6039,6 @@ hex-color-regex@^1.1.0: resolved "https://registry.yarnpkg.com/hex-color-regex/-/hex-color-regex-1.1.0.tgz#4c06fccb4602fe2602b3c93df82d7e7dbf1a8a8e" integrity sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ== -history@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/history/-/history-5.1.0.tgz#2e93c09c064194d38d52ed62afd0afc9d9b01ece" - integrity sha512-zPuQgPacm2vH2xdORvGGz1wQMuHSIB56yNAy5FnLuwOwgSYyPKptJtcMm6Ev+hRGeS+GzhbmRacHzvlESbFwDg== - dependencies: - "@babel/runtime" "^7.7.6" - hmac-drbg@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" @@ -10112,20 +10110,20 @@ react-refresh@^0.8.3: resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.8.3.tgz#721d4657672d400c5e3c75d063c4a85fb2d5d68f" integrity sha512-X8jZHc7nCMjaCqoU+V2I0cOhNW+QMBwSUkeXnTi8IPe6zaRWfn60ZzvFDZqWPfmSJfjub7dDW1SP0jaHWLu/hg== -react-router-dom@^6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-6.0.2.tgz#860cefa697b9d4965eced3f91e82cdbc5995f3ad" - integrity sha512-cOpJ4B6raFutr0EG8O/M2fEoyQmwvZWomf1c6W2YXBZuFBx8oTk/zqjXghwScyhfrtnt0lANXV2182NQblRxFA== +react-router-dom@6.21.0: + version "6.21.0" + resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-6.21.0.tgz#aa4c6bc046a8e8723095bc09b3c0ab2254532712" + integrity sha512-1dUdVj3cwc1npzJaf23gulB562ESNvxf7E4x8upNJycqyUm5BRRZ6dd3LrlzhtLaMrwOCO8R0zoiYxdaJx4LlQ== dependencies: - history "^5.1.0" - react-router "6.0.2" + "@remix-run/router" "1.14.0" + react-router "6.21.0" -react-router@6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/react-router/-/react-router-6.0.2.tgz#bd2b0fa84fd1d152671e9f654d9c0b1f5a7c86da" - integrity sha512-8/Wm3Ed8t7TuedXjAvV39+c8j0vwrI5qVsYqjFr5WkJjsJpEvNSoLRUbtqSEYzqaTUj1IV+sbPJxvO+accvU0Q== +react-router@6.21.0: + version "6.21.0" + resolved "https://registry.yarnpkg.com/react-router/-/react-router-6.21.0.tgz#6fe3e59877aca3dccceec1801d26991ddf42d12b" + integrity sha512-hGZ0HXbwz3zw52pLZV3j3+ec+m/PQ9cTpBvqjFQmy2XVUWGn5MD+31oXHb6dVTxYzmAeaiUBYjkoNz66n3RGCg== dependencies: - history "^5.1.0" + "@remix-run/router" "1.14.0" react-scripts@4.0.3: version "4.0.3" From c74c81cb4ed645495fac8f8a70c744e1d9e3df40 Mon Sep 17 00:00:00 2001 From: leon666 Date: Sun, 17 Dec 2023 00:38:01 +0800 Subject: [PATCH 4/4] refactor: use antd third party library to enhance the user experience --- src/components/Cards/AppointmentCard.js | 7 ++++--- src/components/Cards/BookingCard.js | 7 ++++--- src/components/Cards/DashCard.js | 2 +- src/components/Cards/DocListCard.js | 5 +++-- src/components/Cards/DuePaymentCard.js | 7 ++++--- src/components/Cards/FeedbackCard.js | 13 +++++++------ src/components/Cards/VerifyCard.js | 13 +++++++------ src/components/DashBar/DashBar.js | 3 ++- src/components/FileUploader/FileUploader.js | 7 ++++--- src/components/Payments/Card/CardPay.js | 7 ++++--- src/components/Payments/Cash/CashPay.js | 7 ++++--- src/components/Payments/UPI/UpiPay.js | 7 ++++--- src/pages/AdminDash/Tabs/DocList.js | 5 +++-- src/pages/AdminDash/Tabs/Feedbacks.js | 5 +++-- src/pages/AdminDash/Tabs/GenerateStats.js | 5 +++-- src/pages/AdminDash/Tabs/VerifySignUp.js | 5 +++-- src/pages/DoctorDash/Tabs/Appointments.js | 5 +++-- src/pages/DoctorDash/Tabs/UploadPrescription.js | 5 +++-- src/pages/PatientDash/Tabs/Feedback.js | 5 +++-- src/pages/PatientDash/Tabs/MakePayment.js | 5 +++-- src/pages/PatientDash/Tabs/MyAppointments.js | 5 +++-- src/pages/PatientDash/Tabs/Prescriptions.js | 5 +++-- src/pages/StaffDash/Tabs/CancelAppointment.js | 7 ++++--- src/pages/StaffDash/Tabs/CardPayment.js | 7 ++++--- src/pages/StaffDash/Tabs/MakePayment.js | 7 ++++--- 25 files changed, 90 insertions(+), 66 deletions(-) diff --git a/src/components/Cards/AppointmentCard.js b/src/components/Cards/AppointmentCard.js index 68cc284..a3337ad 100644 --- a/src/components/Cards/AppointmentCard.js +++ b/src/components/Cards/AppointmentCard.js @@ -8,6 +8,7 @@ import CancelIcon from "@mui/icons-material/Cancel"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; import API from "../../api"; +import { message } from "antd"; export default function AppointmentCard(props) { const [openBackdrop, setOpenBackdrop] = useState(false); @@ -19,15 +20,15 @@ export default function AppointmentCard(props) { }); if (res.data.error) { setOpenBackdrop(false); - alert(res.data.erroMsg); + message.error(res.data.erroMsg); } else { setOpenBackdrop(false); - alert(res.data.msg); + message.error(res.data.msg); window.location.reload(); } } catch (error) { setOpenBackdrop(false); - alert(error.response.data.errorMsg); + message.error(error.response.data.errorMsg); console.log(error); } } diff --git a/src/components/Cards/BookingCard.js b/src/components/Cards/BookingCard.js index 8dc0f6e..174f9fa 100644 --- a/src/components/Cards/BookingCard.js +++ b/src/components/Cards/BookingCard.js @@ -11,6 +11,7 @@ import { useNavigate, createSearchParams } from "react-router-dom"; import jwt from "jsonwebtoken"; import API from "../../api"; +import { message } from "antd"; export default function BookingCard(props) { const [openBackdrop, setOpenBackdrop] = useState(false); @@ -27,7 +28,7 @@ export default function BookingCard(props) { if (props.linkto === "staff") { setOpenBackdrop(false); if (!validateEmail(props.ptemail)) { - alert("Enter a valid email"); + message.error("Enter a valid email"); return; } } @@ -67,7 +68,7 @@ export default function BookingCard(props) { const res = await API.bookAppointment(postData); if (res.data.error) { setOpenBackdrop(false); - alert(res.data.errorMsg); + message.error(res.data.errorMsg); } else { setOpenBackdrop(false); navigate({ @@ -81,7 +82,7 @@ export default function BookingCard(props) { } } catch (error) { setOpenBackdrop(false); - alert(error.response.data.errorMsg); + message.error(error.response.data.errorMsg); console.log(error); } } diff --git a/src/components/Cards/DashCard.js b/src/components/Cards/DashCard.js index b4dcbd3..7d09eaf 100644 --- a/src/components/Cards/DashCard.js +++ b/src/components/Cards/DashCard.js @@ -5,7 +5,7 @@ import Typography from "@mui/material/Typography"; import { useNavigate, useLocation, createSearchParams } from "react-router-dom"; import "./DashCard.css"; import { PaymentContext } from "../../pages/PatientDash/Tabs/MakePayment"; -import { StaffPaymentContext } from "../Dashboards/StaffDash/Tabs/MakePayment"; +import { StaffPaymentContext } from "../../pages/StaffDash/Tabs/MakePayment"; export default function DashCard(props) { const payment = React.useContext( diff --git a/src/components/Cards/DocListCard.js b/src/components/Cards/DocListCard.js index d2bd10d..b60d353 100644 --- a/src/components/Cards/DocListCard.js +++ b/src/components/Cards/DocListCard.js @@ -11,6 +11,7 @@ import TextField from "@mui/material/TextField"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; import API from "../../api"; +import { message } from "antd"; const styles = { @@ -46,7 +47,7 @@ export default function DocListCard(props) { const res = await API.updateFee({ docName: props.heading, fee: newFee }); if (res.data.error) { setOpenBackdrop(false); - alert(res.data.errorMsg); + message.error(res.data.errorMsg); } else { setOpenBackdrop(false); setNewFee(""); @@ -54,7 +55,7 @@ export default function DocListCard(props) { } } catch (error) { setOpenBackdrop(false); - alert(error.response.data.errorMsg); + message.error(error.response.data.errorMsg); console.log(error); } } diff --git a/src/components/Cards/DuePaymentCard.js b/src/components/Cards/DuePaymentCard.js index d7673ce..03347ea 100644 --- a/src/components/Cards/DuePaymentCard.js +++ b/src/components/Cards/DuePaymentCard.js @@ -10,6 +10,7 @@ import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; import { useNavigate, createSearchParams } from "react-router-dom"; import API from "../../api"; +import { message } from "antd"; export default function DuePaymentCard(props) { const [openBackdrop, setOpenBackdrop] = useState(false); @@ -33,15 +34,15 @@ export default function DuePaymentCard(props) { }); if (res.data.error) { setOpenBackdrop(false); - alert(res.data.erroMsg); + message.error(res.data.erroMsg); } else { setOpenBackdrop(false); - alert(res.data.msg); + message.error(res.data.msg); window.location.reload(); } } catch (error) { setOpenBackdrop(false); - alert(error.response.data.errorMsg); + message.error(error.response.data.errorMsg); console.log(error); } } diff --git a/src/components/Cards/FeedbackCard.js b/src/components/Cards/FeedbackCard.js index 2402f57..ecafa10 100644 --- a/src/components/Cards/FeedbackCard.js +++ b/src/components/Cards/FeedbackCard.js @@ -12,6 +12,7 @@ import Tooltip from "@mui/material/Tooltip"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; import API from "../../api"; +import { message } from "antd"; export default function FeedbackCard(props) { const [openBackdrop, setOpenBackdrop] = useState(false); @@ -36,15 +37,15 @@ export default function FeedbackCard(props) { }); if (res.data.error) { setOpenBackdrop(false); - alert(res.data.errorMsg); + message.error(res.data.errorMsg); } else { setOpenBackdrop(false); setSubmit(true); - alert(res.data.msg); + message.error(res.data.msg); } } catch (error) { setOpenBackdrop(false); - alert(error.response.data.errorMsg); + message.error(error.response.data.errorMsg); console.log(error); } } @@ -61,17 +62,17 @@ export default function FeedbackCard(props) { }); if (res.data.error) { setOpenBackdrop(false); - alert(res.data.errorMsg); + message.error(res.data.errorMsg); } else { setOpenBackdrop(false); setFeedbackText(""); setValue(0); setSubmit(false); - alert(res.data.msg); + message.error(res.data.msg); } } catch (error) { setOpenBackdrop(false); - alert(error.response.data.errorMsg); + message.error(error.response.data.errorMsg); console.log(error); } } diff --git a/src/components/Cards/VerifyCard.js b/src/components/Cards/VerifyCard.js index 5e6b647..c5b1eb4 100644 --- a/src/components/Cards/VerifyCard.js +++ b/src/components/Cards/VerifyCard.js @@ -11,6 +11,7 @@ import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; import { useNavigate, createSearchParams } from "react-router-dom"; import API from "../../api"; +import { message } from "antd"; const styleVerify = { backgroundColor: "#64dd17", @@ -41,7 +42,7 @@ export default function VerifyCard(props) { const res = await API.verify({ email: props.subheading }); if (res.data.error) { setOpenBackdrop(false); - alert(res.data.errorMsg); + message.error(res.data.errorMsg); } else { setOpenBackdrop(false); if (props.unvuser === "doctor") { @@ -54,14 +55,14 @@ export default function VerifyCard(props) { })}`, }); } else { - if (!alert(res.data.msg)) { + if (!message.error(res.data.msg)) { window.location.reload(); } } } } catch (error) { setOpenBackdrop(false); - alert(error.response.data.errorMsg); + message.error(error.response.data.errorMsg); console.log(error); } } @@ -72,16 +73,16 @@ export default function VerifyCard(props) { const res = await API.reject({ data: { email: props.subheading } }); if (res.data.error) { setOpenBackdrop(false); - alert(res.data.errorMsg); + message.error(res.data.errorMsg); } else { setOpenBackdrop(false); - if (!alert(res.data.msg)) { + if (!message.error(res.data.msg)) { window.location.reload(); } } } catch (error) { setOpenBackdrop(false); - alert(error.response.data.errorMsg); + message.error(error.response.data.errorMsg); console.log(error); } } diff --git a/src/components/DashBar/DashBar.js b/src/components/DashBar/DashBar.js index 8e4cd7a..da12a56 100644 --- a/src/components/DashBar/DashBar.js +++ b/src/components/DashBar/DashBar.js @@ -14,6 +14,7 @@ import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; import { useNavigate } from "react-router-dom"; import API from "../../api"; +import { message } from "antd"; export default function DashBar() { const [openBackdrop, setOpenBackdrop] = useState(false); @@ -37,7 +38,7 @@ export default function DashBar() { } catch (error) { setOpenBackdrop(false); console.error(error); - alert(error.response.data.error); + message.error(error.response.data.error); } } diff --git a/src/components/FileUploader/FileUploader.js b/src/components/FileUploader/FileUploader.js index 26c5b8c..291b232 100644 --- a/src/components/FileUploader/FileUploader.js +++ b/src/components/FileUploader/FileUploader.js @@ -7,6 +7,7 @@ import Typography from "@mui/material/Typography"; import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; import API from "../../api"; +import { message } from "antd"; const Input = styled("input")({ display: "none", @@ -50,18 +51,18 @@ export default function FileUploader(props) { const res = await API.uploadPrescription(formData); if (res.data.error) { setOpenBackdrop(false); - alert(res.data.errorMsg); + message.error(res.data.errorMsg); } else { setOpenBackdrop(false); setFileName(null); setErrFileName(null); - if (!alert(res.data.msg)) { + if (!message.error(res.data.msg)) { window.location.reload(); } } } catch (error) { setOpenBackdrop(false); - alert(error.response.data.errorMsg); + message.error(error.response.data.errorMsg); console.log(error); } } diff --git a/src/components/Payments/Card/CardPay.js b/src/components/Payments/Card/CardPay.js index ce1cbe7..13d0539 100644 --- a/src/components/Payments/Card/CardPay.js +++ b/src/components/Payments/Card/CardPay.js @@ -19,6 +19,7 @@ import "react-credit-cards/es/styles-compiled.css"; import "./CardPay.css"; import API from "../../../api"; import { useSearchParams, useNavigate } from "react-router-dom"; +import { message } from "antd"; function CardPay() { const [openBackdrop, setOpenBackdrop] = useState(false); @@ -80,14 +81,14 @@ function CardPay() { const res = await API.makePayment({ pemail, demail, doa }); if (res.data.error) { setOpenBackdrop(false); - alert(res.data.errorMsg); + message.error(res.data.errorMsg); } else { setOpenBackdrop(false); - alert(res.data.msg); + message.error(res.data.msg); } } catch (error) { setOpenBackdrop(false); - alert(error.response.data.errorMsg); + message.error(error.response.data.errorMsg); console.error(error); } setNumber(""); diff --git a/src/components/Payments/Cash/CashPay.js b/src/components/Payments/Cash/CashPay.js index 9962521..f670e12 100644 --- a/src/components/Payments/Cash/CashPay.js +++ b/src/components/Payments/Cash/CashPay.js @@ -8,6 +8,7 @@ import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; import { useSearchParams, useNavigate } from "react-router-dom"; import API from "../../../api"; +import { message } from "antd"; function CashPay() { const navigate = useNavigate(); @@ -25,15 +26,15 @@ function CashPay() { const res = await API.makePayment({ pemail, demail, doa }); if (res.data.error) { setOpenBackdrop(false); - alert(res.data.errorMsg); + message.error(res.data.errorMsg); } else { setOpenBackdrop(false); - alert(res.data.msg); + message.error(res.data.msg); setConfirm(true); } } catch (error) { setOpenBackdrop(false); - alert(error.response.data.errorMsg); + message.error(error.response.data.errorMsg); console.error(error); } } diff --git a/src/components/Payments/UPI/UpiPay.js b/src/components/Payments/UPI/UpiPay.js index 32f3f35..d6dc87c 100644 --- a/src/components/Payments/UPI/UpiPay.js +++ b/src/components/Payments/UPI/UpiPay.js @@ -8,6 +8,7 @@ import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; import { useSearchParams, useNavigate } from "react-router-dom"; import API from "../../../api"; +import { message } from "antd"; function UpiPay() { const navigate = useNavigate(); @@ -25,15 +26,15 @@ function UpiPay() { const res = await API.makePayment({ pemail, demail, doa }); if (res.data.error) { setOpenBackdrop(false); - alert(res.data.errorMsg); + message.error(res.data.errorMsg); } else { setOpenBackdrop(false); - alert(res.data.msg); + message.error(res.data.msg); setConfirm(true); } } catch (error) { setOpenBackdrop(false); - alert(error.response.data.errorMsg); + message.error(error.response.data.errorMsg); console.error(error); } } diff --git a/src/pages/AdminDash/Tabs/DocList.js b/src/pages/AdminDash/Tabs/DocList.js index bf00e18..7b701e1 100644 --- a/src/pages/AdminDash/Tabs/DocList.js +++ b/src/pages/AdminDash/Tabs/DocList.js @@ -9,6 +9,7 @@ import { Link } from "react-router-dom"; import DashBar from "../../../components/DashBar/DashBar"; import DocListCard from "../../../components/Cards/DocListCard"; import API from "../../../api"; +import { message } from "antd"; function DocList() { const [openBackdrop, setOpenBackdrop] = useState(false); @@ -21,14 +22,14 @@ function DocList() { const res = await API.docList(); if (res.data.error) { setOpenBackdrop(false); - alert(res.data.errorMsg); + message.error(res.data.errorMsg); } else { setOpenBackdrop(false); setDocs(res.data) } } catch (error) { setOpenBackdrop(false); - alert(error.response.data.errorMsg); + message.error(error.response.data.errorMsg); console.log(error); } } diff --git a/src/pages/AdminDash/Tabs/Feedbacks.js b/src/pages/AdminDash/Tabs/Feedbacks.js index 7ad07e7..2df86cb 100644 --- a/src/pages/AdminDash/Tabs/Feedbacks.js +++ b/src/pages/AdminDash/Tabs/Feedbacks.js @@ -8,6 +8,7 @@ import API from "../../../api"; import Typography from "@mui/material/Typography"; import ViewFeedbackCard from "../../../components/Cards/ViewFeedbackCard"; import DashBar from "../../../components/DashBar/DashBar"; +import { message } from "antd"; function Feedbacks() { const [openBackdrop, setOpenBackdrop] = useState(false); @@ -21,7 +22,7 @@ function Feedbacks() { const res = await API.patientFeedbacks(); if (res.data.error) { setOpenBackdrop(false); - alert(res.data.errorMsg); + message.error(res.data.errorMsg); } else { setOpenBackdrop(false); setPf(res.data); @@ -31,7 +32,7 @@ function Feedbacks() { } } catch (error) { setOpenBackdrop(false); - alert(error.response.data.errorMsg); + message.error(error.response.data.errorMsg); console.log(error); } } diff --git a/src/pages/AdminDash/Tabs/GenerateStats.js b/src/pages/AdminDash/Tabs/GenerateStats.js index f38598c..439421a 100644 --- a/src/pages/AdminDash/Tabs/GenerateStats.js +++ b/src/pages/AdminDash/Tabs/GenerateStats.js @@ -9,6 +9,7 @@ import CircularProgress from "@mui/material/CircularProgress"; import API from "../../../api"; import DashBar from "../../../components/DashBar/DashBar"; import StatsCard from "../../../components/Cards/StatsCard"; +import { message } from "antd"; function GenerateStats() { const [openBackdrop, setOpenBackdrop] = useState(false); @@ -25,7 +26,7 @@ function GenerateStats() { const res = await API.generateStats(); if (res.data.error) { setOpenBackdrop(false); - alert(res.data.errorMsg); + message.error(res.data.errorMsg); } else { setOpenBackdrop(false); setMrd(res.data.mrd); @@ -36,7 +37,7 @@ function GenerateStats() { } } catch (error) { setOpenBackdrop(false); - alert(error.response.data.errorMsg); + message.error(error.response.data.errorMsg); console.log(error); } } diff --git a/src/pages/AdminDash/Tabs/VerifySignUp.js b/src/pages/AdminDash/Tabs/VerifySignUp.js index aece656..749c885 100644 --- a/src/pages/AdminDash/Tabs/VerifySignUp.js +++ b/src/pages/AdminDash/Tabs/VerifySignUp.js @@ -6,6 +6,7 @@ import CircularProgress from "@mui/material/CircularProgress"; import DashBar from "../../../components/DashBar/DashBar"; import VerifyCard from "../../../components/Cards/VerifyCard"; import API from "../../../api" +import { message } from "antd"; @@ -20,14 +21,14 @@ function VerifySignUp() { const res = await API.unverified(); if (res.data.error) { setOpenBackdrop(false); - alert(res.data.error); + message.error(res.data.error); } else { setOpenBackdrop(false); setUnvUsers(res.data); } } catch (error) { setOpenBackdrop(false); - alert(error.response.data.errorMsg); + message.error(error.response.data.errorMsg); console.log(error); } } diff --git a/src/pages/DoctorDash/Tabs/Appointments.js b/src/pages/DoctorDash/Tabs/Appointments.js index 4fdd18d..c84cd81 100644 --- a/src/pages/DoctorDash/Tabs/Appointments.js +++ b/src/pages/DoctorDash/Tabs/Appointments.js @@ -8,6 +8,7 @@ import jwt from "jsonwebtoken"; import API from "../../../api"; import DashBar from "../../../components/DashBar/DashBar"; import DocAppointmentCard from "../../../components/Cards/DocAppointmentCard"; +import { message } from "antd"; function Appointments() { const [openBackdrop, setOpenBackdrop] = useState(false); @@ -24,7 +25,7 @@ function Appointments() { const res = await API.myAppointments(); if (res.data.error) { setOpenBackdrop(false); - alert(res.data.errorMsg); + message.error(res.data.errorMsg); } else { setOpenBackdrop(false); const appoints = res.data.filter( @@ -35,7 +36,7 @@ function Appointments() { } } catch (error) { setOpenBackdrop(false); - alert(error.response.data.errorMsg); + message.error(error.response.data.errorMsg); console.log(error); } } diff --git a/src/pages/DoctorDash/Tabs/UploadPrescription.js b/src/pages/DoctorDash/Tabs/UploadPrescription.js index 0a4b00b..f621bf9 100644 --- a/src/pages/DoctorDash/Tabs/UploadPrescription.js +++ b/src/pages/DoctorDash/Tabs/UploadPrescription.js @@ -8,6 +8,7 @@ import jwt from "jsonwebtoken"; import DashBar from "../../../components/DashBar/DashBar"; import UploadPrescriptionCard from "../../../components/Cards/UploadPrescriptionCard"; import API from "../../../api"; +import { message } from "antd"; function UploadPrescription() { const [openBackdrop, setOpenBackdrop] = useState(false); @@ -24,7 +25,7 @@ function UploadPrescription() { const res = await API.myAppointments(); if (res.data.error) { setOpenBackdrop(false); - alert(res.data.errorMsg); + message.error(res.data.errorMsg); } else { setOpenBackdrop(false); const appoints = res.data.filter( @@ -38,7 +39,7 @@ function UploadPrescription() { } } catch (error) { setOpenBackdrop(false); - alert(error.response.data.errorMsg); + message.error(error.response.data.errorMsg); console.log(error); } } diff --git a/src/pages/PatientDash/Tabs/Feedback.js b/src/pages/PatientDash/Tabs/Feedback.js index 564d12c..9233114 100644 --- a/src/pages/PatientDash/Tabs/Feedback.js +++ b/src/pages/PatientDash/Tabs/Feedback.js @@ -8,6 +8,7 @@ import CircularProgress from "@mui/material/CircularProgress"; import API from "../../../api"; import DashBar from "../../../components/DashBar/DashBar"; import FeedbackCard from "../../../components/Cards/FeedbackCard"; +import { message } from "antd"; function Feedback() { const [openBackdrop, setOpenBackdrop] = useState(false); @@ -31,7 +32,7 @@ function Feedback() { const res = await API.myAppointments(); if (res.data.error) { setOpenBackdrop(false); - alert(res.data.errorMsg); + message.error(res.data.errorMsg); } else { setOpenBackdrop(false); const appoints = res.data.filter( @@ -47,7 +48,7 @@ function Feedback() { } } catch (error) { setOpenBackdrop(false); - alert(error.response.data.errorMsg); + message.error(error.response.data.errorMsg); console.log(error); } } diff --git a/src/pages/PatientDash/Tabs/MakePayment.js b/src/pages/PatientDash/Tabs/MakePayment.js index 4740cce..1159172 100644 --- a/src/pages/PatientDash/Tabs/MakePayment.js +++ b/src/pages/PatientDash/Tabs/MakePayment.js @@ -10,6 +10,7 @@ import API from "../../../api"; import Dashboard from "../../../components/Dashboards/Dashboard"; import DashBar from "../../../components/DashBar/DashBar"; import DuePaymentCard from "../../../components/Cards/DuePaymentCard"; +import { message } from "antd"; export const PaymentContext = React.createContext(); @@ -35,7 +36,7 @@ function MakePaymentPatinet() { const res = await API.duePayment(); if (res.data.error) { setOpenBackdrop(false); - alert(res.data.errorMsg); + message.error(res.data.errorMsg); } else { setOpenBackdrop(false); const myUnpaid = res.data.filter((unp) => unp.pemail === ptemail); @@ -47,7 +48,7 @@ function MakePaymentPatinet() { } } catch (error) { setOpenBackdrop(false); - alert(error.response.data.errorMsg); + message.error(error.response.data.errorMsg); console.log(error); } } diff --git a/src/pages/PatientDash/Tabs/MyAppointments.js b/src/pages/PatientDash/Tabs/MyAppointments.js index e59c478..3f305c6 100644 --- a/src/pages/PatientDash/Tabs/MyAppointments.js +++ b/src/pages/PatientDash/Tabs/MyAppointments.js @@ -12,6 +12,7 @@ import jwt from "jsonwebtoken"; import API from "../../../api"; import DashBar from "../../../components/DashBar/DashBar"; import AppointmentCard from "../../../components/Cards/AppointmentCard"; +import { message } from "antd"; function MyAppointments() { @@ -31,7 +32,7 @@ function MyAppointments() { const res = await API.myAppointments(); if (res.data.error) { setOpenBackdrop(false); - alert(res.data.errorMsg); + message.error(res.data.errorMsg); } else { setOpenBackdrop(false); const appoints = res.data.filter( @@ -46,7 +47,7 @@ function MyAppointments() { } } catch (error) { setOpenBackdrop(false); - alert(error.response.data.errorMsg); + message.error(error.response.data.errorMsg); console.log(error); } } diff --git a/src/pages/PatientDash/Tabs/Prescriptions.js b/src/pages/PatientDash/Tabs/Prescriptions.js index b3ac49f..3a2f73a 100644 --- a/src/pages/PatientDash/Tabs/Prescriptions.js +++ b/src/pages/PatientDash/Tabs/Prescriptions.js @@ -8,6 +8,7 @@ import CircularProgress from "@mui/material/CircularProgress"; import API from "../../../api"; import DashBar from "../../../components/DashBar/DashBar"; import PrescriptionCard from "../../../components/Cards/PrescriptionCard"; +import { message } from "antd"; function Prescriptions() { @@ -25,7 +26,7 @@ function Prescriptions() { const res = await API.prescriptions(); if (res.data.error) { setOpenBackdrop(false); - alert(res.data.errorMsg); + message.error(res.data.errorMsg); } else { setOpenBackdrop(false); const prescs = res.data.filter((presc) => presc.pemail === ptemail); @@ -36,7 +37,7 @@ function Prescriptions() { } } catch (error) { setOpenBackdrop(false); - alert(error.response.data.errorMsg); + message.error(error.response.data.errorMsg); console.log(error); } } diff --git a/src/pages/StaffDash/Tabs/CancelAppointment.js b/src/pages/StaffDash/Tabs/CancelAppointment.js index b33e909..e01250f 100644 --- a/src/pages/StaffDash/Tabs/CancelAppointment.js +++ b/src/pages/StaffDash/Tabs/CancelAppointment.js @@ -10,6 +10,7 @@ import CircularProgress from "@mui/material/CircularProgress"; import API from "../../../api"; import DashBar from "../../../components/DashBar/DashBar"; import AppointmentCard from "../../../components/Cards/AppointmentCard"; +import { message } from "antd"; function CancelAppointment() { const [openBackdrop, setOpenBackdrop] = useState(false); @@ -29,7 +30,7 @@ function CancelAppointment() { setOpenBackdrop(true); if (!validateEmail(email)) { setOpenBackdrop(false); - alert("Enter a valid email!"); + message.error("Enter a valid email!"); return; } try { @@ -37,7 +38,7 @@ function CancelAppointment() { const res = await API.myAppointments(); if (res.data.error) { setOpenBackdrop(false); - alert(res.data.errorMsg); + message.error(res.data.errorMsg); } else { setOpenBackdrop(false); const appoints = res.data.filter( @@ -48,7 +49,7 @@ function CancelAppointment() { } } catch (error) { setOpenBackdrop(false); - alert(error.response.data.errorMsg); + message.error(error.response.data.errorMsg); console.log(error); } } diff --git a/src/pages/StaffDash/Tabs/CardPayment.js b/src/pages/StaffDash/Tabs/CardPayment.js index 9ba19a7..8396c85 100644 --- a/src/pages/StaffDash/Tabs/CardPayment.js +++ b/src/pages/StaffDash/Tabs/CardPayment.js @@ -8,6 +8,7 @@ import Backdrop from "@mui/material/Backdrop"; import CircularProgress from "@mui/material/CircularProgress"; import { useSearchParams, useNavigate } from "react-router-dom"; import API from "../../../api"; +import { message } from "antd"; function CardPaymentStaff() { const [openBackdrop, setOpenBackdrop] = useState(false); @@ -24,15 +25,15 @@ function CardPaymentStaff() { const res = await API.makePayment({ pemail, demail, doa }); if (res.data.error) { setOpenBackdrop(false); - alert(res.data.errorMsg); + message.error(res.data.errorMsg); } else { setOpenBackdrop(false); - alert(res.data.msg); + message.error(res.data.msg); setConfirm(true); } } catch (error) { setOpenBackdrop(false); - alert(error.response.data.errorMsg); + message.error(error.response.data.errorMsg); console.error(error); } } diff --git a/src/pages/StaffDash/Tabs/MakePayment.js b/src/pages/StaffDash/Tabs/MakePayment.js index f92d6e3..7521677 100644 --- a/src/pages/StaffDash/Tabs/MakePayment.js +++ b/src/pages/StaffDash/Tabs/MakePayment.js @@ -12,6 +12,7 @@ import API from "../../../api"; import Dashboard from "../../../components/Dashboards/Dashboard"; import DashBar from "../../../components/DashBar/DashBar"; import DuePaymentCard from "../../../components/Cards/DuePaymentCard"; +import { message } from "antd"; export const StaffPaymentContext = React.createContext(); @@ -40,7 +41,7 @@ function MakePaymentStaff() { setOpenBackdrop(true); if (!validateEmail(email)) { setOpenBackdrop(false); - alert("Enter a valid Email."); + message.error("Enter a valid Email."); return; } try { @@ -48,7 +49,7 @@ function MakePaymentStaff() { const res = await API.duePayment(); if (res.data.error) { setOpenBackdrop(false); - alert(res.data.errorMsg); + message.error(res.data.errorMsg); } else { setOpenBackdrop(false); const unpaids = res.data.filter((unp) => unp.pemail === ptemail); @@ -57,7 +58,7 @@ function MakePaymentStaff() { } } catch (error) { setOpenBackdrop(false); - alert(error.response.data.errorMsg); + message.error(error.response.data.errorMsg); console.log(error); } }