diff --git a/app/(base)/pcp/page.tsx b/app/(base)/pcp/page.tsx
index 40b86eb..fe9a7fe 100644
--- a/app/(base)/pcp/page.tsx
+++ b/app/(base)/pcp/page.tsx
@@ -21,6 +21,7 @@ import BookIcon from "@/components/icons/BookIcon";
import ArticleIcon from "@/components/icons/ArticleIcon";
import Link from "next/link";
import ChevronRightIcon from "@/components/icons/ChevronRightIcon";
+import Loader from "@/components/Loader";
const statusOptions = [
{ label: "Pending", color: "bg-red-500", value: "PENDING" },
@@ -96,7 +97,11 @@ const PCP = () => {
}
if (projectsQuery.isLoading) {
- return
loading...
;
+ return (
+
+ );
}
return (
diff --git a/components/Notifications.tsx b/components/Notifications.tsx
index ff17afb..110c4b7 100644
--- a/components/Notifications.tsx
+++ b/components/Notifications.tsx
@@ -1,7 +1,7 @@
"use client";
import { Menu, Transition } from "@headlessui/react";
-import { Fragment, useState } from "react";
+import { Fragment, useEffect, useState } from "react";
import CloseIcon from "./icons/CloseIcon";
import NotificationIcon from "./icons/NotificationIcon";
import NotificationCard from "./NotificationCard";
@@ -19,6 +19,19 @@ const Notifications = () => {
const [showRulerModal, setShowRulerModal] = useState(false);
const [notificationId, setNotificationId] = useState(0);
+ useEffect(() => {
+ const onClickOutsideButton = (e: MouseEvent) => {
+ const clickOnIcon =
+ (e.target as HTMLElement) ===
+ document.getElementById("user-profile-photo");
+ if (!clickOnIcon) setIsActive(false);
+ else if (clickOnIcon && isActive) setIsActive(true);
+ else setIsActive(false);
+ };
+ document.addEventListener("click", onClickOutsideButton);
+ return () => document.removeEventListener("click", onClickOutsideButton);
+ }, [isActive]);
+
const notificationsQuery = useQuery({
queryKey: ["notifications"],
queryFn: () => getNotifications(),
diff --git a/components/UserIconNavbar.tsx b/components/UserIconNavbar.tsx
index d40678c..1160a7c 100644
--- a/components/UserIconNavbar.tsx
+++ b/components/UserIconNavbar.tsx
@@ -27,13 +27,16 @@ const UserIconNavbar = ({ path }: UserIconInterface) => {
useEffect(() => {
const onClickOutsideButton = (e: MouseEvent) => {
- if (!(e.target as HTMLElement).closest(".group")) {
- setIsClicked(false);
- }
+ const clickOnIcon =
+ (e.target as HTMLElement) ===
+ document.getElementById("user-profile-photo");
+ if (!clickOnIcon) setIsClicked(false);
+ else if (clickOnIcon && isClicked) setIsClicked(true);
+ else setIsClicked(false);
};
document.addEventListener("click", onClickOutsideButton);
return () => document.removeEventListener("click", onClickOutsideButton);
- }, []);
+ }, [isClicked]);
return (
<>
@@ -46,7 +49,6 @@ const UserIconNavbar = ({ path }: UserIconInterface) => {