favorite list

This commit is contained in:
hamid zarghami
2025-12-22 17:08:22 +03:30
parent e3bfe65d9c
commit bee8127450
5 changed files with 166 additions and 3 deletions
+14 -3
View File
@@ -7,18 +7,20 @@ import BottomNavHighlightLink from './BottomNavLinkBig'
import PagerIcon from '../icons/PagerIcon'
import BagIcon from '../icons/BagIcon'
import HeartIcon from '../icons/HeartIcon'
import { useParams, usePathname } from 'next/navigation'
import { useParams, usePathname, useRouter } from 'next/navigation'
import HomeIcon from '../icons/HomeIcon'
import { useTranslation } from 'react-i18next';
import { useCart } from '@/app/[name]/(Dialogs)/cart/hook/useCart';
import { Building } from 'iconsax-react';
import clsx from 'clsx';
import { useGetProfile } from '@/app/[name]/(Profile)/profile/hooks/userProfileData';
type BottomNavBarProps = {
onPagerClick?: () => void;
};
function BottomNavBar({ onPagerClick }: BottomNavBarProps) {
const params = useParams();
const { name } = params;
const pathname = usePathname();
@@ -27,7 +29,8 @@ function BottomNavBar({ onPagerClick }: BottomNavBarProps) {
const buildingVariant = React.useMemo(() => {
return (isAboutRoute ? 'Bold' : 'Outline') as 'Bold' | 'Outline';
}, [isAboutRoute]);
const { isSuccess } = useGetProfile()
const router = useRouter()
const { t } = useTranslation('common', {
keyPrefix: 'BottomNavbar'
});
@@ -39,6 +42,14 @@ function BottomNavBar({ onPagerClick }: BottomNavBarProps) {
}, 0);
}, [items]);
const handleFavoritesClick = () => {
if (isSuccess) {
router.push('/favorites');
} else {
router.push(`/${name}/auth`);
}
}
return (
<div className="fixed bottom-0 left-0 w-full bg-transparent pointer-events-none">
<div className="max-w-md mx-auto w-full aspect-436/104 relative z-30">
@@ -111,7 +122,7 @@ function BottomNavBar({ onPagerClick }: BottomNavBarProps) {
{t('about')}
</span>
</Link>
<BottomNavLink href={'/auth'} icon={<HeartIcon width={20} height={20} />} value={t('Favorites')} />
<BottomNavLink href="#" onClick={handleFavoritesClick} icon={<HeartIcon width={20} height={20} />} value={t('Favorites')} />
</nav>
</foreignObject>