"use client"; import ProfileSidebar from "@/components/Profile/ProfileSidebar"; import { usePathname } from "next/navigation"; import Checkauth from "@/HOC/Checkauth"; import Notifications from "../Notifications/Notifications"; import Profile from "@/components/Profile/Profile"; import MyAds from "../MyAds/MyAds"; import Favorites from "../Favorites/Favorites"; import Transactions from "../Transactions/Transactions"; import Reviews from "../Reviews/Reviews"; import BreadCrumb from "@/components/BreadCrumb/BreadCrumb"; import Chat from "../Chat/Chat"; import Layout from "@/components/Layout/Layout"; import ProfileSubscription from "../Subscription/ProfileSubscription"; import JobApplications from "../JobApplications/JobApplications"; import { t } from "@/utils"; import { useMediaQuery } from "usehooks-ts"; import BlockedUsersMenu from "../Chat/BlockedUsersMenu"; import { cn } from "@/lib/utils"; const ProfileDashboard = () => { const pathname = usePathname(); const isNotifications = pathname === "/notifications"; const isSubscriptions = pathname === "/user-subscription"; const isProfile = pathname === "/profile"; const isAds = pathname === "/my-ads"; const isFavorite = pathname === "/favorites"; const isTransaction = pathname === "/transactions"; const isReviews = pathname === "/reviews"; const isChat = pathname == "/chat"; const isJobApplications = pathname == "/job-applications"; const isLargeScreen = useMediaQuery("(min-width: 992px)"); const isSmallerThanLaptop = useMediaQuery("(max-width: 1200px)"); const renderHeading = () => { if (isProfile) { return t("myProfile"); } else if (isNotifications) { return t("notifications"); } else if (isSubscriptions) { return t("subscription"); } else if (isAds) { return t("myAds"); } else if (isFavorite) { return t("myFavorites"); } else if (isTransaction) { return t("myTransaction"); } else if (isReviews) { return t("reviews"); } else if (isChat) { return "chat"; } else if (isJobApplications) { return t("jobApplications"); } }; const renderContent = () => { if (isProfile) { return ; } else if (isNotifications) { return ; } else if (isSubscriptions) { return ; } else if (isAds) { return ; } else if (isFavorite) { return ; } else if (isTransaction) { return ; } else if (isReviews) { return ; } else if (isChat) { return ; } else if (isJobApplications) { return ; } }; const breadCrumbTitle = renderHeading(); return (
{isChat && isSmallerThanLaptop ? (

{renderHeading()}

) : (

{renderHeading()}

)}
{isLargeScreen && (
)}
{renderContent()}
); }; export default Checkauth(ProfileDashboard);