diff --git a/components/CallUs.tsx b/components/CallUs.tsx
index a380618..52f2f75 100644
--- a/components/CallUs.tsx
+++ b/components/CallUs.tsx
@@ -14,16 +14,21 @@ import { useQuery } from "@tanstack/react-query";
export default function CallUs(props: any) {
const { position, zoom } = props;
-
+ const { data, isLoading, isError, refetch } = useQuery({
+ queryKey: ["WebContents", "CallUs"],
+ queryFn: () => getSingleWebContents("CallUs"),
+ refetchOnWindowFocus: false,
+ });
+ console.log(data);
+ const fetchedContent = data?.content || "";
return (
-
+
-
{/*
*/}
- {/* */}
+ {/* */}
{/*
*/}
-
-
+
+ {/*
{callUsItems.map((item) => {
return (
@@ -59,7 +64,7 @@ export default function CallUs(props: any) {
);
})}
-
+
*/}
);
diff --git a/components/ComplainsDetails.tsx b/components/ComplainsDetails.tsx
index 6b8cef8..b41cf42 100644
--- a/components/ComplainsDetails.tsx
+++ b/components/ComplainsDetails.tsx
@@ -116,6 +116,8 @@ export default function ComplainsDetails({
mutationFn: postComplaintTracking,
onSuccess: (res) => {
setOpen(false);
+ localStorage.removeItem("trackingNumber2");
+ localStorage.removeItem("password2");
},
onError: (err: any | string) => {
toast(<>{err.response.data.detail}>, {
@@ -143,7 +145,7 @@ export default function ComplainsDetails({
getComplaintMutation.mutate({
Data: { trackingNumber: tk, password: pw },
});
- }
+ }
}, []);
data = getComplaintMutation?.data;
diff --git a/components/FollowResult.tsx b/components/FollowResult.tsx
index eb639c3..1f978da 100644
--- a/components/FollowResult.tsx
+++ b/components/FollowResult.tsx
@@ -78,7 +78,6 @@ export default function FollowResult() {
>
diff --git a/components/Navbar.tsx b/components/Navbar.tsx
index 90719b2..9936c71 100644
--- a/components/Navbar.tsx
+++ b/components/Navbar.tsx
@@ -3,13 +3,13 @@
import React, { useEffect, useState } from "react";
import { Input } from "./ui/input";
import Image from "next/image";
-import { menuItems } from "@/constants";
+import { authorizedMenuItems, menuItems } from "@/constants";
import Link from "next/link";
import Login from "./Login";
import { Button } from "./ui/button";
import { usePathname } from "next/navigation";
import TopNav from "./TopNav";
-import { isAuthorized } from "@/lib/utils";
+import { cn, isAuthorized } from "@/lib/utils";
import useToken from "@/store/useToken";
import { DropdownMenu } from "@radix-ui/react-dropdown-menu";
import ProfileDropDown from "./ProfileDropDown";
@@ -30,7 +30,7 @@ export default function Navbar() {
setAuth(false);
}
}, [isAuth, token]);
-
+ console.log(pathname);
return (
{/*
*/}
@@ -53,36 +53,73 @@ export default function Navbar() {
className="fixed z-[100] left-0 shadow-4xl right-0 top-[4rem] p-5 bg-white border-b-2 shadow-md"
>
- {menuItems.map((item, idx, array) => {
- // const { Icon } = item;
- const lastItem = array.length - 1;
- return (
-
- setOpen((prev) => !prev)}
- className={`flex items-center justify-between w-full p-3 rounded-xl text-white
+ {auth ? (
+ <>
+ {authorizedMenuItems.map((item, idx, array) => {
+ // const { Icon } = item;
+ const lastItem = array.length - 1;
+ return (
+
+ setOpen((prev) => !prev)}
+ className={`flex items-center justify-between w-full p-3 rounded-xl text-white
${lastItem === idx ? "bg-yellow" : "bg-blue"} `}
- href={item.href}
- >
-
- {item.name}
-
- {/* */}
-
-
- );
- })}
+ href={item.href}
+ >
+
+ {item.name}
+
+ {/* */}
+
+
+ );
+ })}
+ >
+ ) : (
+ <>
+ {menuItems.map((item, idx, array) => {
+ // const { Icon } = item;
+ const lastItem = array.length - 1;
+ return (
+
+ setOpen((prev) => !prev)}
+ className={`flex items-center justify-between w-full p-3 rounded-xl text-white
+ ${lastItem === idx ? "bg-yellow" : "bg-blue"} `}
+ href={item.href}
+ >
+
+ {item.name}
+
+ {/* */}
+
+
+ );
+ })}
+ >
+ )}
)}
@@ -107,17 +144,45 @@ export default function Navbar() {
- {menuItems.map((item, index, array) => {
- if (array.length - 1 !== index) {
- return (
-
-
{item.name}
-
- );
- } else {
- return <>>;
- }
- })}
+ {auth ? (
+ <>
+ {authorizedMenuItems.map((item, index, array) => {
+ return (
+
+
{item.name}
+
+ );
+ })}
+ >
+ ) : (
+ <>
+ {menuItems.map((item, index, array) => {
+ if (array.length - 1 !== index) {
+ return (
+
+
+ {item.name}
+
+
+ );
+ }
+ })}
+ >
+ )}
{auth ? (
diff --git a/components/News.tsx b/components/News.tsx
index b8e491d..2def7b8 100644
--- a/components/News.tsx
+++ b/components/News.tsx
@@ -6,6 +6,7 @@ import { useQuery } from "@tanstack/react-query";
import Image from "next/image";
import Link from "next/link";
import { convertFullTime } from "@/lib/utils";
+import { useRouter } from "next/navigation";
interface News {
id: string;
image: {
@@ -27,11 +28,11 @@ interface News {
}
export default function News() {
+ const router = useRouter();
const { data, isLoading, isError, refetch } = useQuery({
queryKey: ["News"],
queryFn: () => getNews(),
});
-
return (
@@ -44,8 +45,9 @@ export default function News() {
return (
router.push(`/News/${item.id}`)}
className="w-full lg:w-[48%] border rounded-lg flex flex-row shadow-md hover:shadow-none transition-all
- h-[20em] sm:h-[15em] max-sm:flex-col max-sm:gap-[3px]"
+ h-[20em] sm:h-[15em] max-sm:flex-col max-sm:gap-[3px] cursor-pointer"
>
state.saveToken);
return (
-
-