diff --git a/dev-dist/sw.js b/dev-dist/sw.js index b003956..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.jlpvaemfr1" + "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 fa6affb..0ba553c 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,24 +1,44 @@ -import { useContext } from 'react'; +import { useContext } from "react"; import { Route, BrowserRouter as Router, Routes } from "react-router-dom"; -import GlobalStateContext from './Contexts/GlobalStateContext'; -import DefaultLayout from './Layouts/DefaultLayout'; -import Login from './Pages/Login'; -import { RouteLink } from './Routes/Routes'; +import GlobalStateContext from "./Contexts/GlobalStateContext"; +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); - if (!context) throw new Error('App must be used within a GlobalStateProvider'); - const { isAuthenticate } = context; +function App() { + const context = useContext(GlobalStateContext); + if (!context) + throw new Error("App must be used within a GlobalStateProvider"); + const { isAuthenticate } = context; - return ( - - - } /> - {RouteLink.map(({ path, Component }, index) => (} />))}) : ()} /> - } /> - - - ); -} + return ( + + + } /> + } /> + }/> + + + {RouteLink.map(({ path, Component }, index) => ( + } /> + ))} + + + ) : ( + + ) + } + /> + } /> + + + ); +} export default App; diff --git a/src/Constants/Constants.tsx b/src/Constants/Constants.tsx new file mode 100644 index 0000000..b897aeb --- /dev/null +++ b/src/Constants/Constants.tsx @@ -0,0 +1,19 @@ +export const getTitle = (location: string): string => { + const titles: { [key: string]: string } = { + '/': 'Dashboard', + '/manage-user/register-user': 'Manage User', + '/manage-user/active-user': 'Manage User', + '/manage-post': 'Manage Post', + '/manage-sub-admin': 'Manage Sub Admin', + '/manage-jobs': 'Manage Jobs', + '/manage-contact-us': 'Manage Contact Us', + '/manage-cms/faq': 'Manage CMS', + '/manage-cms/about-us': 'Manage CMS', + '/manage-cms/privacy-policy': 'Manage CMS', + '/manage-cms/terms-and-condition': 'Manage CMS', + '/profile': 'My Profile', + }; + + return titles[location] || 'Page Not Found'; + }; + \ No newline at end of file diff --git a/src/Layouts/DefaultLayout.tsx b/src/Layouts/DefaultLayout.tsx index cd9428a..face04c 100644 --- a/src/Layouts/DefaultLayout.tsx +++ b/src/Layouts/DefaultLayout.tsx @@ -3,44 +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 navigate = useNavigate(); + const location = useLocation(); + const headerTitle = getTitle(location?.pathname); + console.log(location); return ( - - - - + + + - - {nav?.map(({ title, path, Icon, type, children }, 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', }}> {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} + + + ))} + + + ) + )} - - - - navigate('/profile')} > - - - Ritesh Pandey - ritesh.pandey@wdimails.com - + + + + {headerTitle} + + + + navigate("/profile")}> + + + + Ritesh Pandey + + ritesh.pandey@wdimails.com + + {children} diff --git a/src/Pages/Dashboard/AgencyName.tsx b/src/Pages/Dashboard/AgencyName.tsx new file mode 100644 index 0000000..9941623 --- /dev/null +++ b/src/Pages/Dashboard/AgencyName.tsx @@ -0,0 +1,103 @@ +import { Box, HStack, Image, Input, Stack, Text } from "@chakra-ui/react"; +import React, { useState, useEffect } from "react"; +import { Button } from "../../components/ui/button"; +import { IoAddSharp } from "react-icons/io5"; +import delateIcon from "../../assets/deleteIcon.png"; +import { FaClockRotateLeft } from "react-icons/fa6"; + +interface Todo { + id: number; + text: string; + completed: boolean; + timestamp: string; +} + +const AgencyName: React.FC = () => { + const [todos, setTodos] = useState([]); + const [input, setInput] = useState(""); + + + const getCurrentTime = () => { + const now = new Date(); + return now.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }); + }; + + + const addTodo = () => { + if (input.trim() === "") return; + setTodos([...todos, { id: Date.now(), text: input, completed: false, timestamp: getCurrentTime() }]); + setInput(""); + }; + + // Delete a task + const deleteTodo = (id: number) => { + setTodos(todos.filter((todo) => todo.id !== id)); + }; + + useEffect(() => { + const savedTodos = localStorage.getItem("todos"); + if (savedTodos) { + setTodos(JSON.parse(savedTodos)); + } + }, []); // Runs only on mount + + // 🔹 Save todos to localStorage whenever they change + useEffect(() => { + if (todos.length > 0) { + localStorage.setItem("todos", JSON.stringify(todos)); + } + }, [todos]); // Runs when `todos` changes + + + return ( + + + + Add Agency Name + + + + setInput(e.target.value)} + placeholder="Add a task..." + backgroundColor={"#fff"} + size={"sm"} + w={"100%"} + p={2} + mb={4} + /> + {todos.map((todo) => ( + + {todo.text} + + + + {todo.timestamp} + + deleteTodo(todo.id)} + bg={"none"} + color={"#22222299"} + cursor={'pointer'} + > + + + + + ))} + + ); +}; + +export default AgencyName; diff --git a/src/Pages/Dashboard/Dashboard.tsx b/src/Pages/Dashboard/Dashboard.tsx index d063737..a322836 100644 --- a/src/Pages/Dashboard/Dashboard.tsx +++ b/src/Pages/Dashboard/Dashboard.tsx @@ -1,7 +1,10 @@ +import MainFrame from "../../components/MainFrame" const Dashboard = () => { return ( -
Dashboard
+ + + ) } 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/ManageCMS/AboutUs/AboutUs.tsx b/src/Pages/ManageCMS/AboutUs/AboutUs.tsx new file mode 100644 index 0000000..c16d6d9 --- /dev/null +++ b/src/Pages/ManageCMS/AboutUs/AboutUs.tsx @@ -0,0 +1,11 @@ +import MainFrame from '../../../components/MainFrame' + +const AboutUs = () => { + return ( + + + + ) +} + +export default AboutUs \ No newline at end of file diff --git a/src/Pages/ManageCMS/AboutUs/AboutUsAddModel.tsx b/src/Pages/ManageCMS/AboutUs/AboutUsAddModel.tsx new file mode 100644 index 0000000..75b9c73 --- /dev/null +++ b/src/Pages/ManageCMS/AboutUs/AboutUsAddModel.tsx @@ -0,0 +1,53 @@ +import { FaRegEdit } from "react-icons/fa" +import { DialogBody, DialogCloseTrigger, DialogContent, DialogFooter, DialogHeader, DialogRoot, DialogTitle, DialogTrigger } from "../../../components/ui/dialog" +import { Field, Stack, Text, Textarea } from "@chakra-ui/react" +import { Button } from "../../../components/ui/button" + +function AboutUsAddModel() { + return ( + + + + {/* */} + + + + + + + Edit + + + + + + + AboutUs +