This commit is contained in:
@@ -4,7 +4,7 @@ import { useGetProfile } from "@/app/[name]/(Profile)/profile/hooks/userProfileD
|
||||
import { glassSurfaceNav } from "@/lib/styles/glassSurface";
|
||||
import clsx from "clsx";
|
||||
import type { Icon } from "iconsax-react";
|
||||
import { Bag2, Heart, Home2, NotificationStatus, Reserve } from "iconsax-react";
|
||||
import { Bag2, Heart, Home2, InfoCircle, Reserve } from "iconsax-react";
|
||||
import Link from "next/link";
|
||||
import { useParams, usePathname, useRouter } from "next/navigation";
|
||||
import { toastLoginRequired } from "../Toast";
|
||||
@@ -51,7 +51,7 @@ function BottomNavBar({ onPagerClick }: BottomNavBarProps) {
|
||||
const isHomeActive = pathname === `/${name}`;
|
||||
const isFavoriteActive = pathname.startsWith(`/${name}/favorite`);
|
||||
const isPagerActive = pathname.includes("/pager");
|
||||
const isNotificationsActive = pathname.startsWith(`/${name}/notifications`);
|
||||
const isAboutActive = pathname.startsWith(`/${name}/about`);
|
||||
const isCartActive = pathname.startsWith(`/${name}/cart`);
|
||||
|
||||
const handleFavoritesClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
|
||||
@@ -64,21 +64,12 @@ function BottomNavBar({ onPagerClick }: BottomNavBarProps) {
|
||||
}
|
||||
};
|
||||
|
||||
const handleNotificationClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
|
||||
e.preventDefault();
|
||||
if (isSuccess) {
|
||||
router.push(`/${name}/notifications`);
|
||||
} else {
|
||||
toastLoginRequired(() => router.push(`/${name}/auth`), "error");
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={glassSurfaceNav("mx-auto w-full rounded-full flex items-center h-14 max-w-md gap-2.5")}>
|
||||
<NavItem href={`/${name}`} isActive={isHomeActive} Icon={Home2} />
|
||||
<NavItem href={`/${name}/favorite`} isActive={isFavoriteActive} onClick={handleFavoritesClick} Icon={Heart} />
|
||||
{onPagerClick ? <NavItem isActive={isPagerActive} onButtonClick={onPagerClick} Icon={Reserve} /> : <NavItem href={`/${name}/pager`} isActive={isPagerActive} Icon={Reserve} />}
|
||||
<NavItem href={`/${name}/notifications`} isActive={isNotificationsActive} onClick={handleNotificationClick} Icon={NotificationStatus} />
|
||||
<NavItem href={`/${name}/about`} isActive={isAboutActive} Icon={InfoCircle} />
|
||||
<NavItem href={`/${name}/cart`} isActive={isCartActive} Icon={Bag2} />
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user