cleaned code from logs and some comments
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
import { useState, useEffect, useCallback } from "react";
|
||||
import Link from "next/link";
|
||||
import Image from "next/image";
|
||||
import { X, Search, Store, User as UserIcon } from "lucide-react";
|
||||
import { X, Search, User as UserIcon } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import Logo from "@/public/logo.webp";
|
||||
import CategoryMenu from "./ui/CategoryMenu";
|
||||
@@ -70,14 +70,14 @@ export default function Header({ locale = "ru" }: HeaderProps) {
|
||||
|
||||
<Button
|
||||
onClick={toggleCategoryMenu}
|
||||
className="hidden gap-2 rounded-lg font-bold lg:flex hover:bg-[#005bff] bg-[#005bff] text-white"
|
||||
className="cursor-pointer hidden gap-2 rounded-lg font-bold lg:flex hover:bg-[#005bff] bg-[#005bff] text-white"
|
||||
size="lg"
|
||||
>
|
||||
{isCategoryOpen ? <X className="h-5 w-5" /> : <CategoryIcon />}
|
||||
{t("common.catalog")}
|
||||
</Button>
|
||||
|
||||
<div className="flex items-center gap-2 sm:hidden">
|
||||
<div className="flex items-center gap-2 sm:hidden cursor-pointer">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
|
||||
@@ -46,7 +46,6 @@ export default function MobileBottomNav({
|
||||
|
||||
const { data: categories = [] } = useCategories();
|
||||
|
||||
// OPTIMIZED: Use event-driven cart count instead of full cart data
|
||||
const cartCount = useCartCount();
|
||||
|
||||
const { data: favoritesData } = useFavorites();
|
||||
@@ -61,12 +60,6 @@ export default function MobileBottomNav({
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
console.log("[MobileBottomNav] Profile clicked", {
|
||||
authLoading,
|
||||
isAuthenticated,
|
||||
hasOnLoginClick: !!onLoginClick,
|
||||
});
|
||||
|
||||
if (authLoading) {
|
||||
return;
|
||||
}
|
||||
@@ -75,10 +68,8 @@ export default function MobileBottomNav({
|
||||
router.push(`/${locale}/me`);
|
||||
} else {
|
||||
if (onLoginClick) {
|
||||
console.log("[MobileBottomNav] Calling parent onLoginClick");
|
||||
onLoginClick();
|
||||
} else {
|
||||
console.log("[MobileBottomNav] Using local login dialog");
|
||||
setIsLoginOpen(true);
|
||||
}
|
||||
}
|
||||
@@ -86,7 +77,6 @@ export default function MobileBottomNav({
|
||||
|
||||
const handleNavigation = (path: string) => (e: React.MouseEvent) => {
|
||||
e.preventDefault();
|
||||
console.log("[MobileBottomNav] Navigating to:", path);
|
||||
router.push(path);
|
||||
};
|
||||
|
||||
@@ -103,7 +93,6 @@ export default function MobileBottomNav({
|
||||
size="sm"
|
||||
className="flex-col gap-0.5 h-auto px-2 py-2"
|
||||
onClick={() => {
|
||||
console.log("[MobileBottomNav] Catalog clicked");
|
||||
setIsCategoryOpen(true);
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -122,7 +122,7 @@ const cartCount = useCartCount()
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="flex-col gap-0.5 h-auto px-2 py-2"
|
||||
className="flex-col cursor-pointer gap-0.5 h-auto px-2 py-2"
|
||||
>
|
||||
<ProfileIcon />
|
||||
<span className="text-xs text-gray-700">{t("profile")}</span>
|
||||
@@ -143,7 +143,7 @@ const cartCount = useCartCount()
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="flex-col gap-0.5 h-auto px-2 py-2"
|
||||
className="flex-col cursor-pointer gap-0.5 h-auto px-2 py-2"
|
||||
onClick={onAuthClick}
|
||||
>
|
||||
<ProfileIcon />
|
||||
|
||||
@@ -140,7 +140,7 @@ export default function AuthDialog({ isOpen, onClose }: AuthDialogProps) {
|
||||
|
||||
<Button
|
||||
onClick={otpSent ? handleLogin : handleSendOtp}
|
||||
className="w-full h-12 rounded-xl font-bold text-base bg-[#005bff] hover:bg-[#0041c4]"
|
||||
className="w-full cursor-pointer h-12 rounded-xl font-bold text-base bg-[#005bff] hover:bg-[#0041c4]"
|
||||
size="lg"
|
||||
disabled={isLoginLoading || isVerifyLoading}
|
||||
>
|
||||
|
||||
@@ -92,9 +92,9 @@ export default function SearchBar({
|
||||
<button
|
||||
key={product.id}
|
||||
onClick={() => handleProductClick(product.id)}
|
||||
className="w-full flex items-center gap-3 p-3 hover:bg-gray-50 transition-colors border-b last:border-b-0"
|
||||
className="w-full cursor-pointer flex items-center gap-3 p-3 hover:bg-gray-50 transition-colors border-b last:border-b-0"
|
||||
>
|
||||
<div className="relative w-16 h-16 flex-shrink-0">
|
||||
<div className="relative w-16 h-16 shrink-0">
|
||||
<Image
|
||||
src={product.thumbnail}
|
||||
alt={product.name}
|
||||
@@ -157,7 +157,7 @@ export default function SearchBar({
|
||||
</div>
|
||||
<Button
|
||||
size="icon"
|
||||
className="h-auto hover:bg-[#005bff] cursor-pointer bg-transparent flex items-center mr-1.5 text-white"
|
||||
className="h-auto hover:bg-[#005bff] cursor-pointer bg-transparent flex items-center mr-1.5 text-white"
|
||||
>
|
||||
<SearchIcon />
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user