diff --git a/dev-dist/sw.js b/dev-dist/sw.js index c8fe26e..5c0a65a 100644 --- a/dev-dist/sw.js +++ b/dev-dist/sw.js @@ -82,7 +82,7 @@ define(['./workbox-54d0af47'], (function (workbox) { 'use strict'; "revision": "3ca0b8505b4bec776b69afdba2768812" }, { "url": "index.html", - "revision": "0.7mpt2f2te58" + "revision": "0.4goaulr6o2o" }], {}); workbox.cleanupOutdatedCaches(); workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), { diff --git a/src/App.tsx b/src/App.tsx index 7b53971..0ba553c 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -5,6 +5,7 @@ import DefaultLayout from "./Layouts/DefaultLayout"; import Login from "./Pages/Login"; import { RouteLink } from "./Routes/Routes"; import LoginOtp from "./Pages/OnBoarding/LoginOtp"; +import CreatePass from "./Pages/OnBoarding/CreatePass"; function App() { const context = useContext(GlobalStateContext); @@ -17,6 +18,7 @@ function App() { } /> } /> + }/> { const titles: { [key: string]: string } = { '/': 'Dashboard', '/manage-user/register-user': 'Manage User', - '/manage-user/deactivate-accounts': 'Manage User', + '/manage-user/active-user': 'Manage User', '/manage-post': 'Manage Post', '/manage-sub-admin': 'Manage Sub Admin', '/manage-jobs': 'Manage Jobs', diff --git a/src/Contexts/GlobalStateProvider.tsx b/src/Contexts/GlobalStateProvider.tsx index 9a839de..1f2c713 100644 --- a/src/Contexts/GlobalStateProvider.tsx +++ b/src/Contexts/GlobalStateProvider.tsx @@ -5,7 +5,7 @@ import GlobalStateContext from './GlobalStateContext'; const GlobalStateProvider = ({ children }:{children:ReactNode}) => { - const [isAuthenticate, setIsAuthenticate] = useState(false); + const [isAuthenticate, setIsAuthenticate] = useState(true); return ( diff --git a/src/Layouts/DefaultLayout.tsx b/src/Layouts/DefaultLayout.tsx index cac6cd9..face04c 100644 --- a/src/Layouts/DefaultLayout.tsx +++ b/src/Layouts/DefaultLayout.tsx @@ -3,53 +3,199 @@ import React, { FC } from "react"; import { RiNotificationLine } from "react-icons/ri"; import { NavLink, useLocation, useNavigate } from "react-router-dom"; import { nav } from "../Routes/Nav"; -import logo from '../assets/logo.svg'; -import { AccordionItem, AccordionItemContent, AccordionItemTrigger, AccordionRoot } from "../components/ui/accordion"; +import logo from "../assets/logo.svg"; +import { + AccordionItem, + AccordionItemContent, + AccordionItemTrigger, + AccordionRoot, +} from "../components/ui/accordion"; import { Avatar } from "../components/ui/avatar"; import { getTitle } from "../Constants/Constants"; const DefaultLayout: FC<{ children: React.ReactNode }> = ({ children }) => { - const navigate = useNavigate() - const location = useLocation() - const headerTitle = getTitle(location?.pathname) + const navigate = useNavigate(); + const location = useLocation(); + const headerTitle = getTitle(location?.pathname); console.log(location); - - - - - - return ( - - - - + + + - - {nav?.map(({ title, path, Icon, type, children, initPath }, index) => type === 'single' ? - {title} : - - - navigate(path)} gap={0} style={{ cursor: 'pointer', borderRadius: '8px', padding: '5px', width: '100%', display: 'flex', alignItems: 'center', border: '1px solid #ffffff', backgroundColor:'#fff',color:'#000', fontSize: '14px', fontWeight:'normal' }}> {title} - {children?.map(({ title, path, Icon }, index) => navigate(path)} style={{ marginTop: 6, cursor: 'pointer', borderRadius: '8px', padding: '6px', width: '100%', display: 'flex', alignItems: 'center', gap: 6, border: '1px solid #ffffff', backgroundColor:'#fff',color:'#000' }} > {title})} - - )} + + {nav?.map(({ title, path, Icon, type, children, initPath }, index) => + type === "single" ? ( + + {" "} + + {title} + + + ) : ( + + + navigate(path)} + gap={0} + style={{ + cursor: "pointer", + borderRadius: "8px", + padding: "5px", + width: "100%", + display: "flex", + alignItems: "center", + border: "1px solid #ffffff", + backgroundColor: "#fff", + color: "#000", + fontSize: "14px", + fontWeight: "normal", + }} + > + {" "} + + + {title} + + + {children?.map(({ title, path, Icon }, index) => ( + navigate(path)} + style={{ + marginTop: 6, + cursor: "pointer", + borderRadius: "8px", + padding: "6px", + width: "100%", + display: "flex", + alignItems: "center", + gap: 6, + border: "1px solid #ffffff", + backgroundColor: "#fff", + color: "#000", + }} + > + {" "} + + {title} + + + ))} + + + ) + )} - - - {headerTitle} - - - navigate('/profile')} > - - - Ritesh Pandey - ritesh.pandey@wdimails.com - - + + + + {headerTitle} + + + + navigate("/profile")}> + + + + Ritesh Pandey + + ritesh.pandey@wdimails.com + + {children} diff --git a/src/Pages/Login.tsx b/src/Pages/Login.tsx index ea2c5dd..5c37c55 100644 --- a/src/Pages/Login.tsx +++ b/src/Pages/Login.tsx @@ -1,96 +1,127 @@ -import { Center, HStack, Image, Input, Text, VStack } from "@chakra-ui/react" -import { useContext, useState } from "react" -import { useForm } from "react-hook-form" -import GlobalStateContext from "../Contexts/GlobalStateContext" -import logo from '../assets/logo.svg' -import { Button } from "../components/ui/button" -import { Field } from "../components/ui/field" -import { Toaster, toaster } from "../components/ui/toaster" +import { Center, HStack, Image, Input, Text, VStack } from "@chakra-ui/react"; +import { useContext, useState } from "react"; +import { useForm } from "react-hook-form"; +import GlobalStateContext from "../Contexts/GlobalStateContext"; +import logo from "../assets/logo.svg"; +import { Button } from "../components/ui/button"; +import { Field } from "../components/ui/field"; +import { Toaster, toaster } from "../components/ui/toaster"; +import { LuUser } from "react-icons/lu"; interface FormValues { - mobileNumber: number + mobileNumber: number; } const Login = () => { - - const [isLoading, setIsLoading] = useState(false) + 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((data) => { - setIsLoading(true) + setIsLoading(true); if (data?.mobileNumber === 1234567890) { setTimeout(() => { setIsAuthenticate(true); - setIsLoading(false) + setIsLoading(false); }, 3000); // 3-second delay - } else { toaster.create({ title: `Invalid Credentials`, type: "error", - }) - setIsLoading(false) + }); + setIsLoading(false); } }); - return ( - - - - - - - + + + - - - - - - -
+ +
+
+ + + LOGIN + + + + + - - -
- - LOGIN - - - - - {/* Forget password */} + Forget password - + Forgot password - -
- ) -} + ); +}; -export default Login \ No newline at end of file +export default Login; diff --git a/src/Pages/ManageUser/RegisterUsers/RegisterUsers.tsx b/src/Pages/ManageUser/RegisterUsers/RegisterUsers.tsx index 312e8d9..4388fbe 100644 --- a/src/Pages/ManageUser/RegisterUsers/RegisterUsers.tsx +++ b/src/Pages/ManageUser/RegisterUsers/RegisterUsers.tsx @@ -1,236 +1,233 @@ -import { Box, HStack, Input, Stack, Table, Text } from '@chakra-ui/react' -import MainFrame from '../../../components/MainFrame' -import { InputGroup } from '../../../components/ui/input-group' -import { LuSearch } from 'react-icons/lu' -import DataTable from '../../../components/DataTable' +import { Box, HStack, Input, Stack, Table, Text } from "@chakra-ui/react"; +import MainFrame from "../../../components/MainFrame"; +import { InputGroup } from "../../../components/ui/input-group"; +import { LuSearch } from "react-icons/lu"; +import DataTable from "../../../components/DataTable"; +// Table setup +const tableHeadRow = [ + "Sr. No", + "First Name", + "Mobile number", + "Gender", + "DOB", + "Type of User", + "Language", + "Status", + "Action", +]; - - - // Table setup - const tableHeadRow = [ - "Sr. No", - "First Name", - "Mobile number", - "Gender", - "DOB", - "Type of User", - "Language", - "Status", - "Action", - ]; - - - - const usersData:any[] = [ - { - "Sr. No": 1, - "First Name": "Ritesh", - "Mobile number": "9876543210", - "Gender": "Male", - "DOB": "15-01-1990", - "Type of User": "Admin", - "Language": "English", - "Status": "Active", - "Action": "Edit/Delete", - }, - { - 'Sr. No': 2, - "First Name": "Anjali", - "Mobile number": "9123456789", - "Gender": "Female", - "DOB": "21-06-1995", - "Type of User": "Customer", - "Language": "Hindi", - "Status": "Inactive", - "Action": "Edit/Delete", - }, - { - 'Sr. No': 3, - "First Name": "Rajesh", - "Mobile number": "9871234560", - "Gender": "Male", - "DOB": "12-12-1985", - "Type of User": "Vendor", - "Language": "English", - "Status": "Active", - "Action": "Edit/Delete", - }, - { - 'Sr. No': 4, - "First Name": "Priya", - "Mobile number": "9988776655", - "Gender": "Female", - "DOB": "05-05-1998", - "Type of User": "Customer", - "Language": "Tamil", - "Status": "Active", - "Action": "Edit/Delete", - }, - { - 'Sr. No': 5, - "First Name": "Amit", - "Mobile number": "8899665544", - "Gender": "Male", - "DOB": "03-03-1992", - "Type of User": "Admin", - "Language": "Gujarati", - "Status": "Inactive", - "Action": "Edit/Delete", - }, - { - 'Sr. No': 6, - "First Name": "Amit", - "Mobile number": "8899665544", - "Gender": "Male", - "DOB": "03-03-1992", - "Type of User": "Admin", - "Language": "Gujarati", - "Status": "Inactive", - "Action": "Edit/Delete", - }, - { - 'Sr. No': 7, - "First Name": "Amit", - "Mobile number": "8899665544", - "Gender": "Male", - "DOB": "03-03-1992", - "Type of User": "Admin", - "Language": "Gujarati", - "Status": "Inactive", - "Action": "Edit/Delete", - }, - { - 'Sr. No': 5, - "First Name": "Amit", - "Mobile number": "8899665544", - "Gender": "Male", - "DOB": "03-03-1992", - "Type of User": "Admin", - "Language": "Gujarati", - "Status": "Inactive", - "Action": "Edit/Delete", - }, - { - 'Sr. No': 6, - "First Name": "Amit", - "Mobile number": "8899665544", - "Gender": "Male", - "DOB": "03-03-1992", - "Type of User": "Admin", - "Language": "Gujarati", - "Status": "Inactive", - "Action": "Edit/Delete", - }, - { - 'Sr. No': 7, - "First Name": "Amit", - "Mobile number": "8899665544", - "Gender": "Male", - "DOB": "03-03-1992", - "Type of User": "Admin", - "Language": "Gujarati", - "Status": "Inactive", - "Action": "Edit/Delete", - }, - { - 'Sr. No': 8, - "First Name": "Amit", - "Mobile number": "8899665544", - "Gender": "Male", - "DOB": "03-03-1992", - "Type of User": "Admin", - "Language": "Gujarati", - "Status": "Inactive", - "Action": "Edit/Delete", - }, - { - 'Sr. No': 9, - "First Name": "Amit", - "Mobile number": "8899665544", - "Gender": "Male", - "DOB": "03-03-1992", - "Type of User": "Admin", - "Language": "Gujarati", - "Status": "Inactive", - "Action": "Edit/Delete", - }, - { - 'Sr. No': 10, - "First Name": "Amit", - "Mobile number": "8899665544", - "Gender": "Male", - "DOB": "03-03-1992", - "Type of User": "Admin", - "Language": "Gujarati", - "Status": "Inactive", - "Action": "Edit/Delete", - }, - { - 'Sr. No': 11, - "First Name": "Amit", - "Mobile number": "8899665544", - "Gender": "Male", - "DOB": "03-03-1992", - "Type of User": "Admin", - "Language": "Gujarati", - "Status": "Inactive", - "Action": "Edit/Delete", - }, - { - 'Sr. No': 12, - "First Name": "Amit", - "Mobile number": "8899665544", - "Gender": "Male", - "DOB": "03-03-1992", - "Type of User": "Admin", - "Language": "Gujarati", - "Status": "Inactive", - "Action": "Edit/Delete", - }, - { - 'Sr. No': 13, - "First Name": "Amit", - "Mobile number": "8899665544", - "Gender": "Male", - "DOB": "03-03-1992", - "Type of User": "Admin", - "Language": "Gujarati", - "Status": "Inactive", - "Action": "Edit/Delete", - }, - ]; - +const usersData: any[] = [ + { + "Sr. No": 1, + "First Name": "Ritesh", + "Mobile number": "9876543210", + Gender: "Male", + DOB: "15-01-1990", + "Type of User": "Admin", + Language: "English", + Status: "Active", + Action: "Edit/Delete", + }, + { + "Sr. No": 2, + "First Name": "Anjali", + "Mobile number": "9123456789", + Gender: "Female", + DOB: "21-06-1995", + "Type of User": "Customer", + Language: "Hindi", + Status: "Inactive", + Action: "Edit/Delete", + }, + { + "Sr. No": 3, + "First Name": "Rajesh", + "Mobile number": "9871234560", + Gender: "Male", + DOB: "12-12-1985", + "Type of User": "Vendor", + Language: "English", + Status: "Active", + Action: "Edit/Delete", + }, + { + "Sr. No": 4, + "First Name": "Priya", + "Mobile number": "9988776655", + Gender: "Female", + DOB: "05-05-1998", + "Type of User": "Customer", + Language: "Tamil", + Status: "Active", + Action: "Edit/Delete", + }, + { + "Sr. No": 5, + "First Name": "Amit", + "Mobile number": "8899665544", + Gender: "Male", + DOB: "03-03-1992", + "Type of User": "Admin", + Language: "Gujarati", + Status: "Inactive", + Action: "Edit/Delete", + }, + { + "Sr. No": 6, + "First Name": "Amit", + "Mobile number": "8899665544", + Gender: "Male", + DOB: "03-03-1992", + "Type of User": "Admin", + Language: "Gujarati", + Status: "Inactive", + Action: "Edit/Delete", + }, + { + "Sr. No": 7, + "First Name": "Amit", + "Mobile number": "8899665544", + Gender: "Male", + DOB: "03-03-1992", + "Type of User": "Admin", + Language: "Gujarati", + Status: "Inactive", + Action: "Edit/Delete", + }, + { + "Sr. No": 5, + "First Name": "Amit", + "Mobile number": "8899665544", + Gender: "Male", + DOB: "03-03-1992", + "Type of User": "Admin", + Language: "Gujarati", + Status: "Inactive", + Action: "Edit/Delete", + }, + { + "Sr. No": 6, + "First Name": "Amit", + "Mobile number": "8899665544", + Gender: "Male", + DOB: "03-03-1992", + "Type of User": "Admin", + Language: "Gujarati", + Status: "Inactive", + Action: "Edit/Delete", + }, + { + "Sr. No": 7, + "First Name": "Amit", + "Mobile number": "8899665544", + Gender: "Male", + DOB: "03-03-1992", + "Type of User": "Admin", + Language: "Gujarati", + Status: "Inactive", + Action: "Edit/Delete", + }, + { + "Sr. No": 8, + "First Name": "Amit", + "Mobile number": "8899665544", + Gender: "Male", + DOB: "03-03-1992", + "Type of User": "Admin", + Language: "Gujarati", + Status: "Inactive", + Action: "Edit/Delete", + }, + { + "Sr. No": 9, + "First Name": "Amit", + "Mobile number": "8899665544", + Gender: "Male", + DOB: "03-03-1992", + "Type of User": "Admin", + Language: "Gujarati", + Status: "Inactive", + Action: "Edit/Delete", + }, + { + "Sr. No": 10, + "First Name": "Amit", + "Mobile number": "8899665544", + Gender: "Male", + DOB: "03-03-1992", + "Type of User": "Admin", + Language: "Gujarati", + Status: "Inactive", + Action: "Edit/Delete", + }, + { + "Sr. No": 11, + "First Name": "Amit", + "Mobile number": "8899665544", + Gender: "Male", + DOB: "03-03-1992", + "Type of User": "Admin", + Language: "Gujarati", + Status: "Inactive", + Action: "Edit/Delete", + }, + { + "Sr. No": 12, + "First Name": "Amit", + "Mobile number": "8899665544", + Gender: "Male", + DOB: "03-03-1992", + "Type of User": "Admin", + Language: "Gujarati", + Status: "Inactive", + Action: "Edit/Delete", + }, + { + "Sr. No": 13, + "First Name": "Amit", + "Mobile number": "8899665544", + Gender: "Male", + DOB: "03-03-1992", + "Type of User": "Admin", + Language: "Gujarati", + Status: "Inactive", + Action: "Edit/Delete", + }, +]; const RegisterUsers = () => { - return ( - - Register User + + + Register User + - - + } - w={'100%'} - color={'#000'} - > - - - - + bgSize={"xs"} + flex="1" + startElement={} + w={"100%"} + color={"#000"} + > + + + + - - - - - - + - ) -} + ); +}; -export default RegisterUsers \ No newline at end of file +export default RegisterUsers; diff --git a/src/Pages/OnBoarding/CreatePass.tsx b/src/Pages/OnBoarding/CreatePass.tsx new file mode 100644 index 0000000..0fd60ac --- /dev/null +++ b/src/Pages/OnBoarding/CreatePass.tsx @@ -0,0 +1,149 @@ +import { Center, HStack, Image, Input, Text, VStack } from "@chakra-ui/react"; +import { useContext, useState } from "react"; +import { useForm } from "react-hook-form"; +import GlobalStateContext from "../../Contexts/GlobalStateContext"; +import logo from "../../assets/logo.svg"; +import { Button } from "../../components/ui/button"; +import { Field } from "../../components/ui/field"; +import { Toaster, toaster } from "../../components/ui/toaster"; + +interface FormValues { + password: string; + confirmPassword: string; +} + +const CreatePass = () => { + const [isLoading, setIsLoading] = useState(false); + const context = useContext(GlobalStateContext); + if (!context) { + throw new Error("App must be used within a GlobalStateProvider"); + } + const { setIsAuthenticate } = context; + const { + register, + handleSubmit, + formState: { errors }, + } = useForm(); + + const onSubmit = handleSubmit((data) => { + setIsLoading(true); + if (data?.password === "password123") { + setTimeout(() => { + setIsAuthenticate(true); + setIsLoading(false); + }, 3000); + } else { + toaster.create({ + title: `Invalid Credentials`, + type: "error", + }); + setIsLoading(false); + } + }); + + return ( + + + + + + +
+ +
+ +
+ + + create a password + + + + + + + + + value === getValues("password") || "Passwords do not match", + })} + placeholder="Confirm your password" + /> + + + + Forgot password + + +
+ +
+
+ ); +}; + +export default CreatePass; diff --git a/src/Pages/OnBoarding/LoginOtp.tsx b/src/Pages/OnBoarding/LoginOtp.tsx index 3fa635a..b5c9b7e 100644 --- a/src/Pages/OnBoarding/LoginOtp.tsx +++ b/src/Pages/OnBoarding/LoginOtp.tsx @@ -1,4 +1,4 @@ -import { Center, HStack, Image, Input, Text, VStack } from "@chakra-ui/react"; +import { Center, HStack, Image, Input, Text, VStack } from "@chakra-ui/react"; import { useContext, useState } from "react"; import { useForm } from "react-hook-form"; import GlobalStateContext from "../../Contexts/GlobalStateContext"; @@ -106,6 +106,16 @@ const LoginOtp = () => { + + Resend OTP +