diff --git a/src/Contexts/GlobalStateContext.tsx b/src/Contexts/GlobalStateContext.tsx index 8c7e0cd..6015cbb 100644 --- a/src/Contexts/GlobalStateContext.tsx +++ b/src/Contexts/GlobalStateContext.tsx @@ -2,11 +2,12 @@ import { createContext, Dispatch, SetStateAction } from 'react'; // Define the shape of your context value -type GlobalStateContextType = { +export interface GlobalStateContextType { isAuthenticate: boolean; setIsAuthenticate: Dispatch>; -}; - + isBarLoading: boolean; + setIsBarLoading: Dispatch>; +} // Create the context with a default value of `undefined` const GlobalStateContext = createContext(undefined); diff --git a/src/Contexts/GlobalStateProvider.tsx b/src/Contexts/GlobalStateProvider.tsx index 105a8cb..82b7d9a 100644 --- a/src/Contexts/GlobalStateProvider.tsx +++ b/src/Contexts/GlobalStateProvider.tsx @@ -1,14 +1,21 @@ -import { ReactNode, useState } from 'react'; -import GlobalStateContext from './GlobalStateContext'; - +import { ReactNode, useState } from "react"; +import GlobalStateContext from "./GlobalStateContext"; const GlobalStateProvider = ({ children }: { children: ReactNode }) => { const [isAuthenticate, setIsAuthenticate] = useState(true); + const [isBarLoading, setIsBarLoading] = useState(false); // ✅ Fixed typo + + return ( - + {children} ); diff --git a/src/Layouts/DefaultLayout.tsx b/src/Layouts/DefaultLayout.tsx index ac7cd29..7dd0c7d 100644 --- a/src/Layouts/DefaultLayout.tsx +++ b/src/Layouts/DefaultLayout.tsx @@ -24,7 +24,7 @@ const DefaultLayout: FC<{ children: React.ReactNode }> = ({ children }) => { if (!context) { throw new Error('App must be used within a GlobalStateProvider'); } - const { setIsAuthenticate } = context; + const { setIsAuthenticate, isBarLoading } = context; const [ logOutAdmin ] = useLogOutMutation() @@ -48,7 +48,7 @@ const DefaultLayout: FC<{ children: React.ReactNode }> = ({ children }) => { return ( - + @@ -56,9 +56,9 @@ const DefaultLayout: FC<{ children: React.ReactNode }> = ({ children }) => { - {nav?.map(({ title, path, Icon, type, children }, index) => type === 'single' ? + {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', }}> {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:'#919198' }} > {title})} diff --git a/src/Pages/ManageCMS/AboutUs/AboutUs.tsx b/src/Pages/ManageCMS/AboutUs/AboutUs.tsx index 901287a..066943b 100644 --- a/src/Pages/ManageCMS/AboutUs/AboutUs.tsx +++ b/src/Pages/ManageCMS/AboutUs/AboutUs.tsx @@ -1,9 +1,10 @@ -import { Box, HStack, Skeleton, Text, VStack } from "@chakra-ui/react"; +import { Badge, HStack, Text, VStack } from "@chakra-ui/react"; import MainFrame from "../../../components/MainFrame" import AboutUsAddModel from "../../ManageCMS/AboutUs/AboutUsAddModel"; import { useGetAboutUsQuery } from "../../../Redux/Service/manage.aboutus.service"; import { Spinner } from "../../../components/Sipnner/Spinner"; -import PrivacyPolicySkeleton from "../PrivacyPolicy/PrivacyPolicySkeleton"; +import GlobalStateContext from "../../../Contexts/GlobalStateContext"; +import { useContext, useEffect } from "react"; @@ -16,14 +17,19 @@ const AboutUs = () => { console.log(data); console.log('===================================='); + const context = useContext(GlobalStateContext); + if (!context) throw new Error('App must be used within a GlobalStateProvider'); + + const { setIsBarLoading } = context; + useEffect(() => { + setIsBarLoading(isFetching) + }, [data]) return ( - - - - {isLoading ? : - - {data?.data?.map(({ id, content }, index) => + + {isLoading || isFetching ? + : data?.data?.map(({ id, content, about_language }) => { px={0} > - About Us - - {/* */} - - - - - {/* Render multiple skeletons or content based on loading state */} - {isFetching || !content ? ( - - ) : ( - - {content} + About Us 🎓 {about_language?.language_name} - )} + + + + + {content} + + )} - } + ) } diff --git a/src/Pages/ManageCMS/AboutUs/AboutUsAddModel.tsx b/src/Pages/ManageCMS/AboutUs/AboutUsAddModel.tsx index cee36c1..e7621b8 100644 --- a/src/Pages/ManageCMS/AboutUs/AboutUsAddModel.tsx +++ b/src/Pages/ManageCMS/AboutUs/AboutUsAddModel.tsx @@ -48,10 +48,12 @@ function AboutUsAddModel() { bgColor="#EEEEEE" color="black" border="none" - pl={1} + p={2} fontSize="12px" - height="100px" // Increased height for better usability + height="140px" // Increased height for better usability pt={1.5} + resize={'none'} + _focusVisible={{ outline: 'none' }} /> @@ -74,4 +76,4 @@ function AboutUsAddModel() { ); } -export default AboutUsAddModel; \ No newline at end of file +export default AboutUsAddModel; diff --git a/src/Pages/ManageCMS/FAQ/EditDetails.tsx b/src/Pages/ManageCMS/FAQ/EditDetails.tsx index ee9a64e..d088351 100644 --- a/src/Pages/ManageCMS/FAQ/EditDetails.tsx +++ b/src/Pages/ManageCMS/FAQ/EditDetails.tsx @@ -1,64 +1,79 @@ -import { TbEdit } from "react-icons/tb"; -import { Button } from "../../../components/ui/button" -import { DialogBody, DialogCloseTrigger, DialogContent, DialogFooter, DialogHeader, DialogRoot, DialogTitle, DialogTrigger } from "../../../components/ui/dialog" -import { Field, Grid, Icon, Input, Stack, Text, Textarea } from "@chakra-ui/react" -import { FaRegEdit } from "react-icons/fa"; +import { Button } from "../../../components/ui/button"; +import { + DialogBody, + DialogCloseTrigger, + DialogContent, + DialogFooter, + DialogHeader, + DialogRoot, + DialogTitle, + DialogTrigger, +} from "../../../components/ui/dialog"; +import { Field, Input, Stack, Textarea } from "@chakra-ui/react"; +import Edit from "../../../components/ActionIcons/Edit"; function EditDetails() { - return ( + return ( + + + + - - - - - - {/* */} + + + + Edit Details + + - + + + + + Questions + + - + Answer + +