From 50078e4cd70bc71b684c5db534eaceaa6ae38266 Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Fri, 7 Feb 2025 19:41:47 +0530
Subject: [PATCH 1/4] =?UTF-8?q?[=20update=20=F0=9F=91=8D=20]?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Pages/ManageContact/ManageContact.tsx | 1 -
src/Pages/ManageContact/PendingRequests.tsx | 166 +++++++------
.../RegisterUsers/RegisterUsers.tsx | 6 +-
src/Pages/SubAdmin/AddModel.tsx | 4 +-
src/Pages/SubAdmin/ViewSubAdmin.tsx | 4 +-
src/components/EditSubAdmin.tsx | 223 ++++++++++++------
6 files changed, 254 insertions(+), 150 deletions(-)
diff --git a/src/Pages/ManageContact/ManageContact.tsx b/src/Pages/ManageContact/ManageContact.tsx
index 1207bf7..07458b7 100644
--- a/src/Pages/ManageContact/ManageContact.tsx
+++ b/src/Pages/ManageContact/ManageContact.tsx
@@ -25,7 +25,6 @@ const managepost: any[] = [
"Action": (
-
),
})),
diff --git a/src/Pages/ManageContact/PendingRequests.tsx b/src/Pages/ManageContact/PendingRequests.tsx
index 23d566b..9356979 100644
--- a/src/Pages/ManageContact/PendingRequests.tsx
+++ b/src/Pages/ManageContact/PendingRequests.tsx
@@ -1,77 +1,105 @@
-import { Button } from "../../components/ui/button"
-import { DialogBody, DialogCloseTrigger, DialogContent, DialogFooter, DialogHeader, DialogRoot, DialogTitle, DialogTrigger } from "../../components/ui/dialog"
-import { Field, HStack, Input, Stack, Textarea, } from "@chakra-ui/react"
+import { Button } from "../../components/ui/button";
+import {
+ DialogBody,
+ DialogCloseTrigger,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogRoot,
+ DialogTitle,
+ DialogTrigger,
+} from "../../components/ui/dialog";
+import { Badge, Field, HStack, Input, Stack, Textarea } from "@chakra-ui/react";
function PendingRequests() {
- return (
+ return (
+
+
+
+ Answer request
+
+
-
-
-
- {/* */}
+
+
+
+ Pending Requests
+
+
-
+
+
+
+
+ Request Type
+
+
-
+ Solution
+
+
+
+
+
+
+
+
+
+
+
-
-
-
- Request Type
-
-
- Solution
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- )
+
+
+
+ );
}
-export default PendingRequests
\ No newline at end of file
+export default PendingRequests;
diff --git a/src/Pages/ManageUsers/RegisterUsers/RegisterUsers.tsx b/src/Pages/ManageUsers/RegisterUsers/RegisterUsers.tsx
index 4bf7247..abfb571 100644
--- a/src/Pages/ManageUsers/RegisterUsers/RegisterUsers.tsx
+++ b/src/Pages/ManageUsers/RegisterUsers/RegisterUsers.tsx
@@ -1,17 +1,13 @@
import { Box, HStack, Image, Input, Text } from "@chakra-ui/react";
import MainFrame from "../../../components/MainFrame";
import AlertDailog from "../../../components/AlertDailog";
-import { NavLink } from "react-router-dom";
import { RiDeleteBin5Line } from "react-icons/ri";
import DataTable from "../../../components/DataTable";
import { Switch } from "../../../components/ui/switch";
import { InputGroup } from "../../../components/ui/input-group";
import { LuSearch } from "react-icons/lu";
-import { BiEdit } from "react-icons/bi";
import ViewRegisterUsers from "./ViewRegisterUsers";
import EditRegisterUsers from "./EditRegisterUsers";
-import { Button } from "../../../components/ui/button";
-import { IoMdAdd } from "react-icons/io";
import AddRegisterUsers from "./AddRegisterUsers";
const tableHeadRow = [
@@ -74,7 +70,7 @@ const RegisterUsers = () => {
Register Users
-
+
diff --git a/src/Pages/SubAdmin/AddModel.tsx b/src/Pages/SubAdmin/AddModel.tsx
index 403549b..5fab47e 100644
--- a/src/Pages/SubAdmin/AddModel.tsx
+++ b/src/Pages/SubAdmin/AddModel.tsx
@@ -12,7 +12,7 @@ function AddModel() {
{/* */}
-
+
@@ -65,7 +65,7 @@ function AddModel() {
-
diff --git a/src/Pages/SubAdmin/ViewSubAdmin.tsx b/src/Pages/SubAdmin/ViewSubAdmin.tsx
index d3f45b8..83f953f 100644
--- a/src/Pages/SubAdmin/ViewSubAdmin.tsx
+++ b/src/Pages/SubAdmin/ViewSubAdmin.tsx
@@ -67,9 +67,9 @@ function ViewSubAdmin() {
-
+ {/*
Save
-
+ */}
diff --git a/src/components/EditSubAdmin.tsx b/src/components/EditSubAdmin.tsx
index 767022d..9b826a4 100644
--- a/src/components/EditSubAdmin.tsx
+++ b/src/components/EditSubAdmin.tsx
@@ -1,79 +1,160 @@
-import { Button } from "./ui/button"
-import { DialogBody, DialogCloseTrigger, DialogContent, DialogFooter, DialogHeader, DialogRoot, DialogTitle, DialogTrigger } from "./ui/dialog"
-import { Field, Grid, Heading, Input, Stack, Text } from "@chakra-ui/react"
-import { Checkbox } from "./ui/checkbox"
+import { Button } from "./ui/button";
+import {
+ DialogBody,
+ DialogCloseTrigger,
+ DialogContent,
+ DialogFooter,
+ DialogHeader,
+ DialogRoot,
+ DialogTitle,
+ DialogTrigger,
+} from "./ui/dialog";
+import { Field, Grid, Heading, Input, Stack, Text } from "@chakra-ui/react";
+import { Checkbox } from "./ui/checkbox";
import { FaRegEdit } from "react-icons/fa";
function EditSubAdmin() {
- return (
+ return (
+
+
+
+
+
+ {/* */}
+
-
-
-
-
-
- {/* */}
+
+
+
+ Edit Sub Admin Account
+
+
-
+
+
+
+
+ First Name
+
+
+
+ First Name
+
+
+
+ Last Name
+
+
-
-
- Edit Sub Admin Account
-
+
+ DOB
+
+
-
-
-
-
- First Name
-
- First Name
-
- Last Name
-
-
- DOB
-
-
- Gender
-
- Permissions
-
-
-
- Dashboard
- Manage contact us
- manage User
- Manage CMS
- Manage Post
- Manage Reports
- manage Sub-Admin
- My profile
- Manage Jobs
- manage feedbacks
- Manage community
- Notification
-
-
-
-
-
- Save
-
-
-
-
-
-
-
- )
+
+ Gender
+
+
+
+ Permissions
+
+
+
+
+ Dashboard
+
+
+ Manage contact us
+
+
+ manage User
+
+
+ Manage CMS
+
+
+ Manage Post
+
+
+ Manage Reports
+
+
+ manage Sub-Admin
+
+
+ My profile
+
+
+ Manage Jobs{" "}
+
+
+ manage feedbacks
+
+
+ Manage community{" "}
+
+
+ Notification
+
+
+
+
+
+
+ Save
+
+
+
+
+
+ );
}
-export default EditSubAdmin
\ No newline at end of file
+export default EditSubAdmin;
From 9e3918b2eb69ab2f1f35181078425ecc052452cd Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Mon, 10 Feb 2025 12:06:42 +0530
Subject: [PATCH 2/4] [ Insall Redux ]
---
package-lock.json | 57 ++++++++++++++++++++++++++++++++++++++++++++++-
package.json | 1 +
2 files changed, 57 insertions(+), 1 deletion(-)
diff --git a/package-lock.json b/package-lock.json
index f18c84e..e686bae 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -11,6 +11,7 @@
"@chakra-ui/react": "^3.2.3",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.0",
+ "@reduxjs/toolkit": "^2.5.1",
"chart.js": "^4.4.7",
"framer-motion": "^11.18.0",
"next-themes": "^0.4.4",
@@ -1670,7 +1671,6 @@
},
"node_modules/@clack/prompts/node_modules/is-unicode-supported": {
"version": "1.3.0",
- "extraneous": true,
"inBundle": true,
"license": "MIT",
"engines": {
@@ -2722,6 +2722,30 @@
"node": ">=14"
}
},
+ "node_modules/@reduxjs/toolkit": {
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.5.1.tgz",
+ "integrity": "sha512-UHhy3p0oUpdhnSxyDjaRDYaw8Xra75UiLbCiRozVPHjfDwNYkh0TsVm/1OmTW8Md+iDAJmYPWUKMvsMc2GtpNg==",
+ "license": "MIT",
+ "dependencies": {
+ "immer": "^10.0.3",
+ "redux": "^5.0.1",
+ "redux-thunk": "^3.1.0",
+ "reselect": "^5.1.0"
+ },
+ "peerDependencies": {
+ "react": "^16.9.0 || ^17.0.0 || ^18 || ^19",
+ "react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0"
+ },
+ "peerDependenciesMeta": {
+ "react": {
+ "optional": true
+ },
+ "react-redux": {
+ "optional": true
+ }
+ }
+ },
"node_modules/@rollup/plugin-babel": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/@rollup/plugin-babel/-/plugin-babel-5.3.1.tgz",
@@ -6710,6 +6734,16 @@
"node": ">= 4"
}
},
+ "node_modules/immer": {
+ "version": "10.1.1",
+ "resolved": "https://registry.npmjs.org/immer/-/immer-10.1.1.tgz",
+ "integrity": "sha512-s2MPrmjovJcoMaHtx6K11Ra7oD05NT97w1IC5zpMkT6Atjr7H8LjaDd81iIxUYpMKSRRNMJE703M1Fhr/TctHw==",
+ "license": "MIT",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/immer"
+ }
+ },
"node_modules/import-fresh": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz",
@@ -8198,6 +8232,21 @@
"url": "https://github.com/sponsors/jonschlinkert"
}
},
+ "node_modules/redux": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz",
+ "integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==",
+ "license": "MIT"
+ },
+ "node_modules/redux-thunk": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-3.1.0.tgz",
+ "integrity": "sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw==",
+ "license": "MIT",
+ "peerDependencies": {
+ "redux": "^5.0.0"
+ }
+ },
"node_modules/reflect.getprototypeof": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz",
@@ -8329,6 +8378,12 @@
"node": ">=0.10.0"
}
},
+ "node_modules/reselect": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/reselect/-/reselect-5.1.1.tgz",
+ "integrity": "sha512-K/BG6eIky/SBpzfHZv/dd+9JBFiS4SWV7FIujVyJRux6e45+73RaUHXLmIR1f7WOMaQ0U1km6qwklRQxpJJY0w==",
+ "license": "MIT"
+ },
"node_modules/resolve": {
"version": "1.22.10",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz",
diff --git a/package.json b/package.json
index ca92e73..bc49935 100644
--- a/package.json
+++ b/package.json
@@ -13,6 +13,7 @@
"@chakra-ui/react": "^3.2.3",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.0",
+ "@reduxjs/toolkit": "^2.5.1",
"chart.js": "^4.4.7",
"framer-motion": "^11.18.0",
"next-themes": "^0.4.4",
From f7e76c8fc0ceeb6f8dd5e5fb2ab9b80a93a8d7e0 Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Mon, 10 Feb 2025 12:30:06 +0530
Subject: [PATCH 3/4] [ working ... ]
---
package-lock.json | 62 ++---------------
src/Pages/Login.tsx | 166 +++++++++++++++++++++++++++-----------------
2 files changed, 109 insertions(+), 119 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 1d95b8a..9005efe 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1922,7 +1922,6 @@
"cpu": [
"ppc64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -1939,7 +1938,6 @@
"cpu": [
"arm"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -1956,7 +1954,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -1973,7 +1970,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -1990,7 +1986,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2007,7 +2002,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2024,7 +2018,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2041,7 +2034,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2058,7 +2050,6 @@
"cpu": [
"arm"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2075,7 +2066,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2092,7 +2082,6 @@
"cpu": [
"ia32"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2109,7 +2098,6 @@
"cpu": [
"loong64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2126,7 +2114,6 @@
"cpu": [
"mips64el"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2143,7 +2130,6 @@
"cpu": [
"ppc64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2160,7 +2146,6 @@
"cpu": [
"riscv64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2177,7 +2162,6 @@
"cpu": [
"s390x"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2194,7 +2178,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2211,7 +2194,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2228,7 +2210,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2245,7 +2226,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2262,7 +2242,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2279,7 +2258,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2296,7 +2274,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2313,7 +2290,6 @@
"cpu": [
"ia32"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2330,7 +2306,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2925,7 +2900,6 @@
"cpu": [
"arm"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2939,7 +2913,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2953,7 +2926,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2967,7 +2939,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2981,7 +2952,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -2995,7 +2965,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -3009,7 +2978,6 @@
"cpu": [
"arm"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -3023,7 +2991,6 @@
"cpu": [
"arm"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -3037,7 +3004,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -3051,7 +3017,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -3065,7 +3030,6 @@
"cpu": [
"loong64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -3079,7 +3043,6 @@
"cpu": [
"ppc64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -3093,7 +3056,6 @@
"cpu": [
"riscv64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -3107,7 +3069,6 @@
"cpu": [
"s390x"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -3121,7 +3082,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -3135,7 +3095,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -3149,7 +3108,6 @@
"cpu": [
"arm64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -3163,7 +3121,6 @@
"cpu": [
"ia32"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -3177,7 +3134,6 @@
"cpu": [
"x64"
],
- "dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -3222,7 +3178,7 @@
"version": "7.20.5",
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz",
"integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==",
- "dev": true,
+ "devOptional": true,
"license": "MIT",
"dependencies": {
"@babel/parser": "^7.20.7",
@@ -3236,7 +3192,7 @@
"version": "7.6.8",
"resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.8.tgz",
"integrity": "sha512-ASsj+tpEDsEiFr1arWrlN6V3mdfjRMZt6LtK/Vp/kreFLnr5QH5+DhvD5nINYZXzwJvXeGq+05iUXcAzVrqWtw==",
- "dev": true,
+ "devOptional": true,
"license": "MIT",
"dependencies": {
"@babel/types": "^7.0.0"
@@ -3246,7 +3202,7 @@
"version": "7.4.4",
"resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz",
"integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==",
- "dev": true,
+ "devOptional": true,
"license": "MIT",
"dependencies": {
"@babel/parser": "^7.1.0",
@@ -3257,7 +3213,7 @@
"version": "7.20.6",
"resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.6.tgz",
"integrity": "sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg==",
- "dev": true,
+ "devOptional": true,
"license": "MIT",
"dependencies": {
"@babel/types": "^7.20.7"
@@ -3316,14 +3272,14 @@
"version": "15.7.14",
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.14.tgz",
"integrity": "sha512-gNMvNH49DJ7OJYv+KAKn0Xp45p8PLl6zo2YnvDIbTd4J6MER2BmWN49TG7n9LvkyihINxeKW8+3bfS2yDC9dzQ==",
- "dev": true,
+ "devOptional": true,
"license": "MIT"
},
"node_modules/@types/react": {
"version": "18.3.18",
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.18.tgz",
"integrity": "sha512-t4yC+vtgnkYjNSKlFx1jkAhH8LgTo2N/7Qvi83kdEaUtMDiwpbLAktKDaAMlRcJ5eSxZkH74eEGt1ky31d7kfQ==",
- "dev": true,
+ "devOptional": true,
"license": "MIT",
"dependencies": {
"@types/prop-types": "*",
@@ -5857,7 +5813,6 @@
"version": "0.24.2",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.2.tgz",
"integrity": "sha512-+9egpBW8I3CD5XPe0n6BfT5fxLzxrlDzqydF3aviG+9ni1lDC/OvMHcxqEFV0+LANZG5R1bFMWfUrjVsdwxJvA==",
- "dev": true,
"hasInstallScript": true,
"license": "MIT",
"bin": {
@@ -7735,7 +7690,6 @@
"version": "3.3.8",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz",
"integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==",
- "dev": true,
"funding": [
{
"type": "github",
@@ -8121,7 +8075,6 @@
"version": "8.4.49",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.49.tgz",
"integrity": "sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==",
- "dev": true,
"funding": [
{
"type": "opencollective",
@@ -8945,7 +8898,6 @@
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
- "dev": true,
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.10.0"
@@ -9707,7 +9659,6 @@
"version": "6.0.6",
"resolved": "https://registry.npmjs.org/vite/-/vite-6.0.6.tgz",
"integrity": "sha512-NSjmUuckPmDU18bHz7QZ+bTYhRR0iA72cs2QAxCqDpafJ0S6qetco0LB3WW2OxlMHS0JmAv+yZ/R3uPmMyGTjQ==",
- "dev": true,
"license": "MIT",
"dependencies": {
"esbuild": "^0.24.2",
@@ -9809,7 +9760,6 @@
"version": "4.34.1",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.34.1.tgz",
"integrity": "sha512-iYZ/+PcdLYSGfH3S+dGahlW/RWmsqDhLgj1BT9DH/xXJ0ggZN7xkdP9wipPNjjNLczI+fmMLmTB9pye+d2r4GQ==",
- "dev": true,
"license": "MIT",
"dependencies": {
"@types/estree": "1.0.6"
diff --git a/src/Pages/Login.tsx b/src/Pages/Login.tsx
index d71bcfe..daf9af5 100644
--- a/src/Pages/Login.tsx
+++ b/src/Pages/Login.tsx
@@ -1,107 +1,147 @@
-import { Center, HStack, Image, Input, Text, VStack } from "@chakra-ui/react"
-import axios from "axios"
-import { useContext, useState } from "react"
-import { useForm } from "react-hook-form"
-import { useDispatch } from "react-redux"
-import GlobalStateContext from "../Contexts/GlobalStateContext"
-import { setToken } from "../Redux/Service/authSlice"
-import logo from '../assets/logo.svg'
-import { Button } from "../components/ui/button"
-import { Field } from "../components/ui/field"
-import { Toaster } from "../components/ui/toaster"
+import { Center, HStack, Image, Input, Text, VStack } from "@chakra-ui/react";
+import axios from "axios";
+import { useContext, useState } from "react";
+import { useForm } from "react-hook-form";
+import { useDispatch } from "react-redux";
+import GlobalStateContext from "../Contexts/GlobalStateContext";
+import { setToken } from "../Redux/Service/authSlice";
+import logo from "../assets/logo.svg";
+import { Button } from "../components/ui/button";
+import { Field } from "../components/ui/field";
+import { Toaster } from "../components/ui/toaster";
interface FormValues {
- mobileNumber: number
- password: string
+ mobileNumber: number;
+ password: string;
}
const Login = () => {
- const dispatch = useDispatch()
- const [isLoading, setIsLoading] = useState(false)
+ const dispatch = useDispatch();
+ const [isLoading, setIsLoading] = useState(false);
const context = useContext(GlobalStateContext);
if (!context) {
- throw new Error('App must be used within a GlobalStateProvider');
+ throw new Error("App must be used within a GlobalStateProvider");
}
const { setIsAuthenticate } = context;
const {
register,
handleSubmit,
formState: { errors },
- } = useForm()
-
+ } = useForm();
const onSubmit = handleSubmit(async (data) => {
- setIsLoading(true)
+ setIsLoading(true);
try {
- const response = await axios.post(`${import.meta.env.VITE_API_URL}/v1/login`, {
- mobile_number: data.mobileNumber,
- password: data.password,
- });
- console.log('====================================');
+ const response = await axios.post(
+ `${import.meta.env.VITE_API_URL}/v1/login`,
+ {
+ mobile_number: data.mobileNumber,
+ password: data.password,
+ }
+ );
+ console.log("====================================");
console.log(response);
- console.log('====================================');
+ console.log("====================================");
dispatch(setToken(String(response.data["access-token"])));
-
} catch (error) {
console.error("Login failed", error);
}
});
-
-
-
-
return (
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+ LOGIN
+
-
-
-
-
-
- LOGIN
-
-
-
-
+
+
+
{/* Forget password */}
-
-
+
+
{/* Forget password */}
- Login
+
+ Login
+
Forgot password
-
-
- )
-}
+ );
+};
-export default Login
\ No newline at end of file
+export default Login;
From 4fa87e01b6302cc561203f61abb88dbe3a000aea Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Mon, 10 Feb 2025 19:36:14 +0530
Subject: [PATCH 4/4] [ service ]
---
src/Pages/Login.tsx | 197 ++++++++++++++++----------------------------
src/main.tsx | 34 ++++----
2 files changed, 90 insertions(+), 141 deletions(-)
diff --git a/src/Pages/Login.tsx b/src/Pages/Login.tsx
index 8670ecf..9db1596 100644
--- a/src/Pages/Login.tsx
+++ b/src/Pages/Login.tsx
@@ -1,45 +1,45 @@
-import { Center, HStack, Image, Input, Text, VStack } from "@chakra-ui/react";
-import axios from "axios";
-import { useContext, useState } from "react";
-import { useForm } from "react-hook-form";
-import { useDispatch } from "react-redux";
-import GlobalStateContext from "../Contexts/GlobalStateContext";
-import { setToken } from "../Redux/Service/authSlice";
-import logo from "../assets/logo.svg";
-import { Button } from "../components/ui/button";
-import { Field } from "../components/ui/field";
-import { Toaster } from "../components/ui/toaster";
-import { PasswordInput } from "../components/ui/password-input";
-import { useNavigate } from "react-router-dom";
+import { Center, HStack, Image, Input, Text, VStack } from "@chakra-ui/react"
+import axios from "axios"
+import { useContext, useState } from "react"
+import { useForm } from "react-hook-form"
+import { useDispatch } from "react-redux"
+import GlobalStateContext from "../Contexts/GlobalStateContext"
+import { setToken } from "../Redux/Service/authSlice"
+import logo from '../assets/logo.svg'
+import { Button } from "../components/ui/button"
+import { Field } from "../components/ui/field"
+import { Toaster } from "../components/ui/toaster"
+import { PasswordInput } from "../components/ui/password-input"
+import { useNavigate } from "react-router-dom"
interface FormValues {
- mobileNumber: number;
- password: string;
+ mobileNumber: number
+ password: string
}
const Login = () => {
- const navigate = useNavigate();
- const dispatch = useDispatch();
- const [isLoading, setIsLoading] = useState(false);
+ const navigate = useNavigate()
+ const dispatch = useDispatch()
+ const [isLoading, setIsLoading] = useState(false)
const context = useContext(GlobalStateContext);
if (!context) {
- throw new Error("App must be used within a GlobalStateProvider");
+ throw new Error('App must be used within a GlobalStateProvider');
}
const { setIsAuthenticate } = context;
const {
register,
handleSubmit,
formState: { errors },
- } = useForm();
+ } = useForm()
const onSubmit = handleSubmit(async (data) => {
setIsLoading(true);
-
+
// Encode Basic Auth Credentials
- const username = import.meta.env.VITE_USER_NAME || ""; // Replace with actual username
- const password = import.meta.env.VITE_PASSWORD || ""; // Replace with actual password
+ const username = import.meta.env.VITE_USER_NAME||''; // Replace with actual username
+ const password = import.meta.env.VITE_PASSWORD||''; // Replace with actual password
const basicAuth = `${username} : ${password}`; // Encode to Base64
-
+
try {
const res = await axios.post(
`${import.meta.env.VITE_API_URL}/login`,
@@ -56,139 +56,84 @@ const Login = () => {
);
if (res.data) {
- setIsAuthenticate(true);
- console.log("====================================");
+ setIsAuthenticate(true)
+ console.log('====================================');
console.log(res.data?.data);
- console.log("====================================");
- navigate("/");
+ console.log('====================================');
+ navigate('/')
dispatch(setToken(String(res.data?.data["access-token"])));
} else {
+
console.log("====================================");
console.log(res);
console.log("====================================");
+
}
+
} catch (error) {
if (error) {
+
console.error("Login failed", error);
- setIsLoading(false);
+ setIsLoading(false)
+
}
}
});
+
+
+
return (
-
-
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
-
-
-
- LOGIN
-
-
-
-
-
-
- LOGIN
-
-
-
-
- {/* Forget password */}
+
+
+
+
+ LOGIN
+
+
+
+
+ {/* Forget password */}
-
-
- {/* Forget password */}
+
+
+ {/* Forget password */}
-
- Login
-
+ Login
Forgot password
+
+
- );
-};
+ )
+}
-export default Login;
+export default Login
\ No newline at end of file
diff --git a/src/main.tsx b/src/main.tsx
index 5bc746e..c983e7f 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -1,23 +1,27 @@
-import React from 'react'
-import ReactDOM from 'react-dom/client'
-import App from './App'
+import React from "react";
+import ReactDOM from "react-dom/client";
+import App from "./App";
import { Provider as ReduxProvider } from "react-redux";
-import { Provider } from './components/ui/provider'
-import GlobalStateProvider from './Contexts/GlobalStateProvider'
-import './index.css'
-import { Theme } from '@chakra-ui/react'
-import { store } from './Redux/Store'
+import { Provider } from "./components/ui/provider";
+import GlobalStateProvider from "./Contexts/GlobalStateProvider";
+import "./index.css";
+import { Theme } from "@chakra-ui/react";
+import { store } from "./Redux/Store";
-ReactDOM.createRoot(document.getElementById('root')!).render(
-
- {/* ✅ Wrap with Redux Provider */}
+ReactDOM.createRoot(document.getElementById("root")!).render(
+
+
+ {" "}
+ {/* ✅ Wrap with Redux Provider */}
- {/* ✅ Wrap with Provider */}
-
-
+
+ {" "}
+ {/* ✅ Wrap with Provider */}
+
+
-)
\ No newline at end of file
+);