chore(workspace): eradicate all tsc errors and eslint warnings across frontend, admin, and backend
Deploy Canina / deploy (push) Failing after 29s
Deploy Canina / deploy (push) Failing after 29s
This commit is contained in:
1 parent
4659a7b1de
commit
9f11d8fb2d
98 files changed
+1272
-1009
No files matched your search
@@ -1,6 +1,5 @@
|
||||
"use client";
|
||||
import React, { useState, useRef, useEffect } from "react";
|
||||
import { Search, ChevronDown, Menu, X, Pill, ShieldCheck, HeartPulse, Sparkles, ShoppingBag, User, PlusCircle, Check, Building2, LogIn, Wallet, LogOut, MapPin, FileHeart, Dog, Cat, BookOpen, FileText, Video, Award, PhoneCall, HelpCircle, Activity } from "lucide-react";
|
||||
import { Search, ChevronDown, Menu, X, Pill, ShieldCheck, HeartPulse, Sparkles, ShoppingBag, User, Check, Building2, LogIn, LogOut, FileHeart, Dog, BookOpen, FileText, Video, Award, PhoneCall, Activity } from "lucide-react";
|
||||
import { motion, AnimatePresence } from "motion/react";
|
||||
import Link from "next/link";
|
||||
import { useCartStore } from "../lib/store/cartStore";
|
||||
@@ -8,7 +7,6 @@ import { usePetStore } from "../lib/store/usePetStore";
|
||||
import { useUserStore } from "../lib/store/userStore";
|
||||
import { useSettingsStore } from "../lib/store/settingsStore";
|
||||
import { toast } from "sonner";
|
||||
import HeaderButton from "./HeaderButton";
|
||||
import AuthModal from "./AuthModal";
|
||||
import PrescriptionUploadModal from "./PrescriptionUploadModal";
|
||||
import TickerBanner from "./TickerBanner";
|
||||
@@ -25,9 +23,6 @@ const MENU_ICONS: Record<string, React.ReactNode> = {
|
||||
import { NavigationTarget } from "../lib/types";
|
||||
|
||||
export default function Header({
|
||||
onNavigate = () => {},
|
||||
onShopNavigate = () => {},
|
||||
currentView = 'home',
|
||||
onCartOpen = () => {},
|
||||
onSearch = () => {},
|
||||
onB2BOpen = () => {}
|
||||
@@ -41,10 +36,8 @@ export default function Header({
|
||||
}) {
|
||||
const [isMegaMenuOpen, setIsMegaMenuOpen] = useState(false);
|
||||
const [activeDropdown, setActiveDropdown] = useState<string | null>(null);
|
||||
const [isSearchFocused, setIsSearchFocused] = useState(false);
|
||||
const [isAuthModalOpen, setIsAuthModalOpen] = useState(false);
|
||||
const [isPrescriptionModalOpen, setIsPrescriptionModalOpen] = useState(false);
|
||||
const [isPetSwitcherOpen, setIsPetSwitcherOpen] = useState(false);
|
||||
const [isProfileMenuOpen, setIsProfileMenuOpen] = useState(false);
|
||||
const userProfileRef = useRef<HTMLDivElement>(null);
|
||||
const [searchQuery, setSearchQuery] = useState("");
|
||||
@@ -82,15 +75,13 @@ export default function Header({
|
||||
}
|
||||
]);
|
||||
|
||||
const petMenuRef = useRef<HTMLDivElement>(null);
|
||||
const [isMounted, setIsMounted] = useState(false);
|
||||
useEffect(() => {
|
||||
setIsMounted(true);
|
||||
Promise.resolve().then(() => setIsMounted(true));
|
||||
}, []);
|
||||
const { getTotalItems } = useCartStore();
|
||||
const { pets, activePetId, setActivePet, getActivePet } = usePetStore();
|
||||
const { role, isLoggedIn, logout, profile } = useUserStore();
|
||||
const activePet = getActivePet();
|
||||
const { pets, activePetId, setActivePet } = usePetStore();
|
||||
const { isLoggedIn, logout, profile } = useUserStore();
|
||||
const getText = useSettingsStore(state => state.getText);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -98,16 +89,15 @@ export default function Header({
|
||||
try {
|
||||
const data = await productService.getNavigationFilters();
|
||||
if (data && data.length > 0) {
|
||||
const mapped = data.map(item => ({
|
||||
setMenuItems(data.map(item => ({
|
||||
id: item.slug,
|
||||
title: item.name,
|
||||
icon: MENU_ICONS[item.slug] || <Pill className="w-5 h-5" />,
|
||||
solutions: item.symptoms || []
|
||||
}));
|
||||
setMenuItems(mapped);
|
||||
})));
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Failed to load navigation filters:", e);
|
||||
} catch (err) {
|
||||
console.error('Failed to load navigation filters:', err);
|
||||
}
|
||||
};
|
||||
loadNavFilters();
|
||||
@@ -115,9 +105,6 @@ export default function Header({
|
||||
|
||||
useEffect(() => {
|
||||
function handleClickOutside(event: MouseEvent) {
|
||||
if (petMenuRef.current && !petMenuRef.current.contains(event.target as Node)) {
|
||||
setIsPetSwitcherOpen(false);
|
||||
}
|
||||
if (userProfileRef.current && !userProfileRef.current.contains(event.target as Node)) {
|
||||
setIsProfileMenuOpen(false);
|
||||
}
|
||||
@@ -130,7 +117,6 @@ export default function Header({
|
||||
e.preventDefault();
|
||||
if (searchQuery.trim()) {
|
||||
onSearch(searchQuery);
|
||||
setIsSearchFocused(false);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -255,7 +241,7 @@ export default function Header({
|
||||
)}
|
||||
>
|
||||
<div className="flex items-center gap-2 truncate">
|
||||
<span className="text-sm">{(p.type === 'سگ' || p.type === ('dog' as any)) ? '🐶' : '🐱'}</span>
|
||||
<span className="text-sm">{(p.type === 'سگ' || (p.type as string) === 'dog') ? '🐶' : '🐱'}</span>
|
||||
<span className="truncate">{p.name}</span>
|
||||
</div>
|
||||
{p.id === activePetId && <Check className="w-3.5 h-3.5 shrink-0" />}
|
||||
|
||||
Reference in new issue
Block a user