Add part of SideMenu
parent
3c868ec00f
commit
5c26efd928
|
|
@ -1,8 +1,9 @@
|
||||||
import type { Metadata } from "next";
|
import type { Metadata } from "next";
|
||||||
import { Inter } from "next/font/google";
|
import { Inter } from "next/font/google";
|
||||||
import "./globals.css";
|
import "./globals.css";
|
||||||
import { Toaster } from '@/components/ui/sonner'
|
import { Toaster } from "@/components/ui/sonner";
|
||||||
import Provider from "../utils/ReactQuery/Provider";
|
import Provider from "../utils/ReactQuery/Provider";
|
||||||
|
import ProgressBarProviders from "@/components/ProgressBar/ProgressBar";
|
||||||
|
|
||||||
const inter = Inter({ subsets: ["latin"] });
|
const inter = Inter({ subsets: ["latin"] });
|
||||||
|
|
||||||
|
|
@ -20,8 +21,9 @@ export default function RootLayout({
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<body className={inter.className}>
|
<body className={inter.className}>
|
||||||
<Provider>
|
<Provider>
|
||||||
{children}
|
<ProgressBarProviders>{children}</ProgressBarProviders>
|
||||||
<Toaster richColors/>
|
|
||||||
|
<Toaster richColors />
|
||||||
</Provider>
|
</Provider>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import React, { useState } from "react";
|
||||||
import { GoArrowLeft } from "react-icons/go";
|
import { GoArrowLeft } from "react-icons/go";
|
||||||
import { menuItems } from "@/constants";
|
import { menuItems } from "@/constants";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
const SideMenu = () => {
|
const SideMenu = () => {
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
|
|
@ -10,27 +11,43 @@ const SideMenu = () => {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`flex flex-col items-start justify-start bg-gradient-to-b from-yellow to-orange-400 h-screen rounded-l-[30px] fixed right-0 top-0 transition-all duration-700 ease-in-out
|
className={`flex flex-col items-start justify-start bg-gradient-to-b from-yellow to-orange-400 h-screen rounded-l-[30px] fixed right-0 top-0 transition-all duration-700 ease-in-out
|
||||||
${open === true ? "w-[200px]" : "w-20"} `}
|
${open === true ? "w-[200px]" : "w-[70px]"} `}
|
||||||
>
|
>
|
||||||
SideMenu
|
|
||||||
<div
|
<div
|
||||||
onClick={() => setOpen(!open)}
|
onClick={() => setOpen(!open)}
|
||||||
className={`flex items-center aspect-square bg-white rounded-full shadow-sm text-yellow cursor-pointer h-7 justify-center -left-3 absolute top-5 transition-all duration-700 ease-in-out w-7 z-[400]
|
className={`flex items-center aspect-square bg-white rounded-full shadow-[0_0_4px_1px_rgba(0,0,0,0.1)] text-yellow cursor-pointer h-8 w-8 justify-center -left-3 absolute top-5 transition-all duration-700 ease-in-out z-[400]
|
||||||
${open === true ? "rotate-180" : "rotate-0"} `}
|
${open === true ? "rotate-180" : "rotate-0"} `}
|
||||||
>
|
>
|
||||||
<GoArrowLeft className="text-yellow" />
|
<GoArrowLeft className="text-yellow" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<ul>
|
<ul className="flex flex-1 flex-col items-start justify-start pt-5 ">
|
||||||
{menuItems.map((menuItem) => (
|
{menuItems.map((menuItem) => (
|
||||||
<Link
|
<Link
|
||||||
href={menuItem.href}
|
href={menuItem.href}
|
||||||
key={menuItem.id}
|
key={menuItem.id}
|
||||||
className="flex justify-start items-center mb-3 p-2 text-white"
|
className="flex justify-start items-center mb-5 pr-4 text-white"
|
||||||
>
|
>
|
||||||
<span className="w-4 h-4">{menuItem.icon}</span>
|
<div
|
||||||
<span>{menuItem.title}</span>
|
className={cn(
|
||||||
|
"w-10 h-10 aspect-square rounded-md flex items-center justify-center transition-all duration-[0.3s]",
|
||||||
|
menuItem.id == 1 && "bg-black/30"
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<span className="w-1/2 h-1/2 aspect-square flex items-center justify-center text-white transition-all duration-[0.3s] text-lg">
|
||||||
|
{menuItem.icon}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<span
|
||||||
|
className={cn(
|
||||||
|
`text-xs text-white mr-1 transition-all overflow-hidden font-bold`,
|
||||||
|
menuItem.id == 1 && "text-black/70 text-[13px]",
|
||||||
|
menuItem.id == 2 && "font-extrabold",
|
||||||
|
open === true ? "w-auto opacity-100 " : "w-0 opacity-0"
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{menuItem.title}
|
||||||
|
</span>
|
||||||
</Link>
|
</Link>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import { AppProgressBar as ProgressBar } from "next-nprogress-bar";
|
||||||
|
|
||||||
|
const ProgressBarProviders = ({ children }: { children: React.ReactNode }) => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{children}
|
||||||
|
<ProgressBar
|
||||||
|
height="4px"
|
||||||
|
color="#29D"
|
||||||
|
options={{ showSpinner: false }}
|
||||||
|
shallowRouting
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ProgressBarProviders;
|
||||||
|
|
@ -26,29 +26,35 @@ export const VerifyInput = () => {
|
||||||
const CitizenVerifyMutation = useMutation({
|
const CitizenVerifyMutation = useMutation({
|
||||||
mutationFn: verifyCitizen,
|
mutationFn: verifyCitizen,
|
||||||
onSuccess: (res) => {
|
onSuccess: (res) => {
|
||||||
saveToken(true);
|
router.push("/RecentRequest");
|
||||||
const decodedToken = jwtDecode<any>(res.jwtToken);
|
console.log("justLogin");
|
||||||
setCookie("Shahrbin_Token", res.jwtToken);
|
|
||||||
setCookie("Shahrbin_Refresh_Token", res.refreshToken);
|
// saveToken(true);
|
||||||
const userRole =
|
// const decodedToken = jwtDecode<any>(res.jwtToken);
|
||||||
decodedToken[
|
// setCookie("Shahrbin_Token", res.jwtToken);
|
||||||
"http://schemas.microsoft.com/ws/2008/06/identity/claims/role"
|
// setCookie("Shahrbin_Refresh_Token", res.refreshToken);
|
||||||
];
|
// const userRole =
|
||||||
localStorage.setItem("Shahrbin_Role", userRole);
|
// decodedToken[
|
||||||
const justLogin = localStorage.getItem("Shahrbin_Login_State");
|
// "http://schemas.microsoft.com/ws/2008/06/identity/claims/role"
|
||||||
if (justLogin) {
|
// ];
|
||||||
// router.push("/Account/Complaints");
|
// localStorage.setItem("Shahrbin_Role", userRole);
|
||||||
router.push("/RecentRequest");
|
// const justLogin = localStorage.getItem("Shahrbin_Login_State");
|
||||||
localStorage.removeItem("Shahrbin_Login_State");
|
|
||||||
console.log("justLogin");
|
// if (justLogin) {
|
||||||
} else {
|
// // router.push("/Account/Complaints");
|
||||||
console.log("Dont justLogin");
|
// router.push("/RecentRequest");
|
||||||
// router.push("/RequestStep1");
|
// localStorage.removeItem("Shahrbin_Login_State");
|
||||||
}
|
// console.log("justLogin");
|
||||||
|
// } else {
|
||||||
|
// console.log("Dont justLogin");
|
||||||
|
// // router.push("/RequestStep1");
|
||||||
|
// }
|
||||||
},
|
},
|
||||||
onError: (err: any | string) => {
|
onError: (err: any | string) => {
|
||||||
|
console.log("Dont Login");
|
||||||
|
|
||||||
toast(<>{err.response.data.detail}</>, {
|
toast(<>{err.response.data.detail}</>, {
|
||||||
className: "!bg-red-500 !text-white",
|
className: "!bg-rose-800 !text-white flex justify-end ",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -101,7 +107,7 @@ export const VerifyInput = () => {
|
||||||
if (localStorage.getItem("CountDownCompleted")) {
|
if (localStorage.getItem("CountDownCompleted")) {
|
||||||
const otpTokenString = localStorage.getItem(
|
const otpTokenString = localStorage.getItem(
|
||||||
appConstants.SH_CT_OTP_TOKEN
|
appConstants.SH_CT_OTP_TOKEN
|
||||||
)
|
);
|
||||||
// if (otpTokenString !== null) {
|
// if (otpTokenString !== null) {
|
||||||
// resendOtpMutation.mutate({
|
// resendOtpMutation.mutate({
|
||||||
// otpToken: JSON.parse(otpTokenString),
|
// otpToken: JSON.parse(otpTokenString),
|
||||||
|
|
@ -115,11 +121,10 @@ export const VerifyInput = () => {
|
||||||
otpToken: otpToken,
|
otpToken: otpToken,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error parsing otpTokenString:', error);
|
console.error("Error parsing otpTokenString:", error);
|
||||||
// Handle the error accordingly, e.g., notify the user or handle it gracefully.
|
// Handle the error accordingly, e.g., notify the user or handle it gracefully.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.log(2);
|
console.log(2);
|
||||||
// makeRequest();
|
// makeRequest();
|
||||||
|
|
@ -209,7 +214,7 @@ export const VerifyInput = () => {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* <input type="text" className="w-full"/> */}
|
{/* <input type="text" className="w-full"/> */}
|
||||||
<div className="mx-auto w-full text-center text-xl mt-6">
|
<div className="mx-auto w-full text-center text-xl mt-6">
|
||||||
{" "}
|
{" "}
|
||||||
<CountdownTimer
|
<CountdownTimer
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,11 @@ import { TbWorld } from "react-icons/tb";
|
||||||
import { FaCogs } from "react-icons/fa";
|
import { FaCogs } from "react-icons/fa";
|
||||||
|
|
||||||
export const menuItems = [
|
export const menuItems = [
|
||||||
{ id: 1, title: "صفحه اصلی", href: "/", icon: <FaList size="full" />},
|
{ id: 1, title: "صفحه اصلی", href: "/", icon: <FaList/>},
|
||||||
{ id: 2, title: "ثبت درخواست", href: "/", icon: <FaPlus size="full" /> },
|
{ id: 2, title: "ثبت درخواست", href: "/", icon: <FaPlus /> },
|
||||||
{ id: 3, title: "درخواست های من", href: "/", icon: <PiSquaresFourFill size="full" /> },
|
{ id: 3, title: "درخواست های من", href: "/", icon: <PiSquaresFourFill /> },
|
||||||
{ id: 4, title: "نظرسنجی ها ", href: "/", icon: <FaChartBar size="full" /> },
|
{ id: 4, title: "نظرسنجی ها ", href: "/", icon: <FaChartBar /> },
|
||||||
{ id: 5, title: "اخبار", href: "/" , icon: <TbWorld size="full" /> },
|
{ id: 5, title: "اخبار", href: "/" , icon: <TbWorld /> },
|
||||||
{ id: 6, title: "تنظیمات", href: "/", icon: <FaCogs size="full" /> },
|
{ id: 6, title: "تنظیمات", href: "/", icon: <FaCogs /> },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
"jwt-decode": "^4.0.0",
|
"jwt-decode": "^4.0.0",
|
||||||
"lucide-react": "^0.365.0",
|
"lucide-react": "^0.365.0",
|
||||||
"next": "14.1.4",
|
"next": "14.1.4",
|
||||||
|
"next-nprogress-bar": "^2.3.11",
|
||||||
"next-themes": "^0.3.0",
|
"next-themes": "^0.3.0",
|
||||||
"react": "^18",
|
"react": "^18",
|
||||||
"react-countdown": "^2.3.5",
|
"react-countdown": "^2.3.5",
|
||||||
|
|
@ -3809,6 +3810,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/next-nprogress-bar": {
|
||||||
|
"version": "2.3.11",
|
||||||
|
"resolved": "https://registry.npmjs.org/next-nprogress-bar/-/next-nprogress-bar-2.3.11.tgz",
|
||||||
|
"integrity": "sha512-OjSvsQwgSWa2qBMYO478QreGG9Jt82tr4wTQptmiyzNqqjzHCyKZNkhANnzPrjuFAoelIvmruJuakODofSnvTQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"nprogress": "^0.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/next-themes": {
|
"node_modules/next-themes": {
|
||||||
"version": "0.3.0",
|
"version": "0.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/next-themes/-/next-themes-0.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/next-themes/-/next-themes-0.3.0.tgz",
|
||||||
|
|
@ -3868,6 +3877,11 @@
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/nprogress": {
|
||||||
|
"version": "0.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/nprogress/-/nprogress-0.2.0.tgz",
|
||||||
|
"integrity": "sha512-I19aIingLgR1fmhftnbWWO3dXc0hSxqHQHQb3H8m+K3TnEn/iSeTZZOyvKXWqQESMwuUVnatlCnZdLBZZt2VSA=="
|
||||||
|
},
|
||||||
"node_modules/object-assign": {
|
"node_modules/object-assign": {
|
||||||
"version": "4.1.1",
|
"version": "4.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
"jwt-decode": "^4.0.0",
|
"jwt-decode": "^4.0.0",
|
||||||
"lucide-react": "^0.365.0",
|
"lucide-react": "^0.365.0",
|
||||||
"next": "14.1.4",
|
"next": "14.1.4",
|
||||||
|
"next-nprogress-bar": "^2.3.11",
|
||||||
"next-themes": "^0.3.0",
|
"next-themes": "^0.3.0",
|
||||||
"react": "^18",
|
"react": "^18",
|
||||||
"react-countdown": "^2.3.5",
|
"react-countdown": "^2.3.5",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue