- {/* Out of Stock Badge */}
{product.stock === 0 && (
- {/* Add to Cart Button - показывается при hover */}
{isHovered && product.stock > 0 && (
diff --git a/components/layout/ui/ActionButtons.tsx b/components/layout/ui/ActionButtons.tsx
index 902bf93..cf870ae 100644
--- a/components/layout/ui/ActionButtons.tsx
+++ b/components/layout/ui/ActionButtons.tsx
@@ -16,6 +16,7 @@ import { useCart, useFavorites, useOrders } from "@/lib/hooks";
import { Skeleton } from "@/components/ui/skeleton";
import { useTranslations } from "next-intl";
import { useLogout } from "@/lib/hooks/useAuth";
+import { CartIcon, FavoriteIcon, OrderIcon, ProfileIcon } from "@/components/icons";
interface ActionButtonsProps {
isAuthenticated: boolean;
@@ -70,21 +71,21 @@ export default function ActionButtons({
const buttons: ActionButtonData[] = useMemo(() => [
{
- icon:
,
+ icon:
,
label: t("common.orders"),
href: "/orders",
badgeCount: ordersCount,
isLoading: ordersLoading,
},
{
- icon:
,
+ icon:
,
label: t("common.favorites"),
href: "/favorites",
badgeCount: favoritesCount,
isLoading: favoritesLoading,
},
{
- icon:
,
+ icon:
,
label: t("common.cart"),
href: "/cart",
badgeCount: cartCount,
@@ -101,7 +102,7 @@ export default function ActionButtons({
@@ -118,7 +119,7 @@ export default function ActionButtons({
) : (
)}
diff --git a/components/layout/ui/AuthDialog.tsx b/components/layout/ui/AuthDialog.tsx
index 422e51c..ad07be7 100644
--- a/components/layout/ui/AuthDialog.tsx
+++ b/components/layout/ui/AuthDialog.tsx
@@ -6,7 +6,7 @@ import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import { toast } from "sonner";
-import Logo from "@/public/logo.png";
+import Logo from "@/public/logo.webp";
import { useLogin, useVerifyToken } from "@/lib/hooks/useAuth";
import { useTranslations } from "next-intl";
diff --git a/components/layout/ui/SearchBar.tsx b/components/layout/ui/SearchBar.tsx
index 30eea7d..fcf8f93 100644
--- a/components/layout/ui/SearchBar.tsx
+++ b/components/layout/ui/SearchBar.tsx
@@ -13,6 +13,7 @@ import {
import { useRouter } from "next/navigation";
import { useSearchProducts } from "@/features/search/hooks/useSearch";
import Image from "next/image";
+import { SearchIcon } from "@/components/icons";
interface SearchBarProps {
isMobile: boolean;
@@ -158,7 +159,7 @@ export default function SearchBar({
size="icon"
className="h-auto hover:bg-[#005bff] cursor-pointer bg-transparent flex items-center mr-1.5 text-white"
>
-
+
diff --git a/context/AuthWrapper.tsx b/context/AuthWrapper.tsx
index 84ead5f..4b7ae08 100644
--- a/context/AuthWrapper.tsx
+++ b/context/AuthWrapper.tsx
@@ -4,6 +4,7 @@ import { useEffect, type ReactNode } from "react";
import { useRouter, usePathname } from "next/navigation";
import { useAuthStatus, useGetGuestToken } from "@/lib/hooks/useAuth";
import { useUserProfile } from "@/features/profile/hooks/useUserProfile";
+import Preloader from "@/components/PageLoader/PreLoader";
interface AuthWrapperProps {
children: ReactNode;
@@ -58,12 +59,7 @@ export default function AuthWrapper({
if (isLoading || (requireAuth && !isAuthenticated)) {
return (
-
);
}
diff --git a/features/favorites/hooks/useFavorites.ts b/features/favorites/hooks/useFavorites.ts
index 69398e4..0dea131 100644
--- a/features/favorites/hooks/useFavorites.ts
+++ b/features/favorites/hooks/useFavorites.ts
@@ -2,69 +2,148 @@ import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
import { apiClient } from "@/lib/api";
import type { Favorite } from "@/lib/types/api";
-// Response tiplerini tanımlayalım
interface FavoritesResponse {
data?: Favorite[];
[key: string]: any;
}
-interface FavoriteActionResponse {
- data?: string | Favorite[];
- [key: string]: any;
-}
-
-// Response'u transform eden yardımcı fonksiyon
function transformFavoritesResponse(response: any): Favorite[] {
if (typeof response === "object" && response.data) {
return response.data;
}
-
if (typeof response === "string") {
try {
const parsed = JSON.parse(response);
return parsed.data || [];
- } catch (error) {
- console.error("Failed to parse favorites response:", error);
+ } catch {
return [];
}
}
-
return [];
}
-function transformActionResponse(response: any, defaultValue: string): string {
- if (typeof response === "object" && response.data) {
- return response.data;
- }
+// Fetch ALL favorite products (handle pagination on backend)
+async function fetchAllFavorites(): Promise