feat: dynamic UI texts system + admin panel editor + Vazirmatn local font + bug fixes

- Add getText() system for all homepage sections (Header, Hero, FeaturedProducts, SmartAdvisor, VetGallery, Footer)
- Add UITexts admin page in frontend/admin-panel with search, group collapse, per-key save
- Add seed-ui-texts.ts with 102 texts in 9 groups
- Add local VazirmatnVariable.woff2 font, remove CDN + Inter references
- Fix hero image path, productService return type { data, meta }
- Fix ArchivePage pagination + CATEGORIES list + breadcrumbs
- Fix BlogPage/Wiki page links + brightness-0 invert removal
- Fix IngredientWiki search + product links + placeholder
- Fix all getProducts() callers for { data } destructuring
- Fix sitemap.ts, CartDrawer, B2BPortal, CheckoutPage type issues
- Add .gitignore for /fonts/ and /backend/uploads/
This commit is contained in:
parsa aghaei committed 2026-07-11 17:19:55 +03:30
1 parent ab7ed279c8
commit 1a0c98a34e
26 files changed
+653 -132

No files matched your search

+24 -22
View File
@@ -5,6 +5,7 @@ import { motion, AnimatePresence } from "motion/react";
import { useCartStore } from "../lib/store/cartStore";
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";
@@ -66,6 +67,7 @@ export default function Header({
const { pets, activePetId, setActivePet, getActivePet } = usePetStore();
const { role, isLoggedIn, logout, profile } = useUserStore();
const activePet = getActivePet();
const getText = useSettingsStore(state => state.getText);
// Click Outside logic
useEffect(() => {
@@ -92,7 +94,7 @@ export default function Header({
<div className="bg-canina-gold text-canina-dark text-xs font-black py-2.5 text-center font-vazir tracking-wider flex items-center justify-center gap-2">
<span>🚚</span>
<span>ارسال رایگان برای سفارش‌های بالای ۱۵۰ هزار تومان</span>
<span>{getText('shipping_notice', "ارسال رایگان برای سفارش‌های بالای ۱۵۰ هزار تومان")}</span>
</div>
<header className="sticky top-0 z-50 bg-white/95 backdrop-blur-md border-b border-medical-gray-100 shadow-sm">
@@ -117,8 +119,8 @@ export default function Header({
>
<div className="w-12 h-12 bg-canina-blue rounded-2xl flex items-center justify-center text-white font-bold text-2xl group-hover:bg-medical-gray-900 transition-all shadow-xl shadow-canina-blue/20 italic">C</div>
<div className="flex flex-col">
<span className="text-canina-blue font-black text-2xl tracking-tighter leading-none italic font-inter">Canina <span className="text-sm not-italic font-medium border-l-2 border-medical-gray-100 pl-2 ml-2 font-vazir">ایران</span></span>
<span className="text-[10px] text-medical-gray-400 font-bold uppercase tracking-widest leading-none mt-1.5 font-vazir">نماینده رسمی Canina Pharma GmbH آلمان</span>
<span className="text-canina-blue font-black text-2xl tracking-tighter leading-none italic font-sans">Canina <span className="text-sm not-italic font-medium border-l-2 border-medical-gray-100 pl-2 ml-2 font-vazir">{getText('brand_name_fa', "ایران")}</span></span>
<span className="text-[10px] text-medical-gray-400 font-bold uppercase tracking-widest leading-none mt-1.5 font-vazir">{getText('brand_subtitle', "نماینده رسمی Canina Pharma GmbH آلمان")}</span>
</div>
</div>
</div>
@@ -131,7 +133,7 @@ export default function Header({
onMouseLeave={() => setIsMegaMenuOpen(false)}
>
<button className={`flex items-center justify-center gap-1.5 px-4 py-3 rounded-xl text-sm font-black transition-all whitespace-nowrap focus-visible:ring-4 focus-visible:ring-canina-blue/30 focus-visible:outline-none min-h-[48px] ${isMegaMenuOpen ? 'bg-medical-gray-50 text-canina-blue' : 'text-medical-gray-600 hover:bg-medical-gray-50 hover:text-canina-blue'} font-vazir`}>
راهکارهای درمانی
{getText('nav_solutions', "راهکارهای درمانی")}
<ChevronDown className={`w-4 h-4 transition-transform duration-300 ${isMegaMenuOpen ? 'rotate-180' : ''}`} />
</button>
@@ -181,10 +183,10 @@ export default function Header({
</div>
{[
{ id: 'shop', label: 'محصولات تخصصی', action: () => onShopNavigate() },
{ id: 'wiki', label: 'دانشنامه علمی', action: () => onNavigate('wiki') },
{ id: 'blog', label: 'مجله سلامت پت', action: () => onNavigate('blog') },
{ id: 'profile', label: 'شناسنامه پتها', action: () => onNavigate({ view: 'profile', subview: 'index' }) }
{ id: 'shop', label: getText('nav_products', 'محصولات تخصصی'), action: () => onShopNavigate() },
{ id: 'wiki', label: getText('nav_wiki', 'دانشنامه علمی'), action: () => onNavigate('wiki') },
{ id: 'blog', label: getText('nav_blog', 'مجله سلامت پت'), action: () => onNavigate('blog') },
{ id: 'profile', label: getText('nav_pet_profiles', 'شناسنامه پتها'), action: () => onNavigate({ view: 'profile', subview: 'index' }) }
].map((item) => (
<button
key={item.id}
@@ -217,11 +219,11 @@ export default function Header({
value={searchQuery}
onChange={e => setSearchQuery(e.target.value)}
onBlur={() => !searchQuery && setIsSearchFocused(false)}
placeholder="جستجوی محصولات، مقالات سلامت و..."
placeholder={getText('nav_search_placeholder', "جستجوی محصولات، مقالات سلامت و...")}
className="w-full bg-transparent px-4 py-2 text-[12px] font-bold outline-none font-vazir text-medical-gray-900"
/>
<button type="submit" className="px-4 py-2 bg-canina-blue text-white text-[10px] font-black hover:bg-medical-gray-900 transition-colors">
جستجو
{getText('nav_search_button', "جستجو")}
</button>
</form>
</motion.div>
@@ -282,7 +284,7 @@ export default function Header({
exit={{ opacity: 0, y: 10, scale: 0.95 }}
className="absolute top-[125%] left-0 w-72 bg-white border border-medical-gray-100 shadow-2xl rounded-[1.5rem] p-5 z-50 pointer-events-auto"
>
<div className="text-[9px] font-black text-medical-gray-400 uppercase tracking-[0.2em] mb-4 pr-1">تغییر پت یا مدیریت حساب</div>
<div className="text-[9px] font-black text-medical-gray-400 uppercase tracking-[0.2em] mb-4 pr-1">{getText('nav_pet_switcher_title', "تغییر پت یا مدیریت حساب")}</div>
<div className="space-y-1 mb-4">
{pets.map(pet => (
<div
@@ -334,21 +336,21 @@ export default function Header({
className="w-full flex items-center gap-3 p-3 text-canina-blue hover:bg-canina-blue/5 rounded-xl transition-all text-[12px] font-black font-vazir"
>
<PlusCircle className="w-5 h-5" />
ثبت همدم (Pet) جدید
{getText('nav_register_pet', "ثبت همدم (Pet) جدید")}
</button>
<button
onClick={() => { onNavigate({ view: "user-dashboard" }); setIsPetSwitcherOpen(false); }}
className="w-full flex items-center gap-3 p-3 text-medical-gray-600 hover:bg-medical-gray-50 rounded-xl transition-all text-[12px] font-bold font-vazir"
>
<Wallet className="w-5 h-5" />
کیف پول و سفارشات
{getText('nav_wallet_orders', "کیف پول و سفارشات")}
</button>
<button
onClick={() => { logout(); setIsPetSwitcherOpen(false); }}
className="w-full flex items-center gap-3 p-3 text-red-500 hover:bg-red-50 rounded-xl transition-all text-[12px] font-bold font-vazir mt-1"
>
<LogOut className="w-5 h-5" />
خروج از حساب کانینا
{getText('nav_logout', "خروج از حساب کانینا")}
</button>
</div>
</motion.div>
@@ -363,7 +365,7 @@ export default function Header({
onClick={() => setIsAuthModalOpen(true)}
icon={<LogIn className="w-5 h-5" />}
>
ورود / ثبت‌نام
{getText('nav_login', "ورود / ثبت‌نام")}
</HeaderButton>
)}
@@ -374,7 +376,7 @@ export default function Header({
badge={getTotalItems()}
icon={<ShoppingBag className="w-6 h-6" />}
>
<div className="text-[8px] font-black tracking-tight whitespace-nowrap mt-0.5">سبد خرید</div>
<div className="text-[8px] font-black tracking-tight whitespace-nowrap mt-0.5">{getText('nav_cart', "سبد خرید")}</div>
</HeaderButton>
</div>
</div>
@@ -405,7 +407,7 @@ export default function Header({
<div className="flex items-center justify-between border-b border-medical-gray-100 pb-4">
<div className="flex items-center gap-3">
<div className="w-10 h-10 bg-canina-blue rounded-xl flex items-center justify-center text-white font-bold text-xl italic">C</div>
<span className="text-canina-blue font-black text-xl italic font-inter">Canina</span>
<span className="text-canina-blue font-black text-xl italic font-sans">Canina</span>
</div>
<button
onClick={() => setIsMobileMenuOpen(false)}
@@ -423,7 +425,7 @@ export default function Header({
onClick={() => setIsMobileSolutionsOpen(!isMobileSolutionsOpen)}
className="w-full flex items-center justify-between px-4 py-3 rounded-xl text-sm font-black text-medical-gray-600 hover:bg-medical-gray-50 transition-all font-vazir"
>
<span>راهکارهای درمانی</span>
<span>{getText('nav_solutions', "راهکارهای درمانی")}</span>
<ChevronDown className={`w-4 h-4 transition-transform duration-300 ${isMobileSolutionsOpen ? 'rotate-180' : ''}`} />
</button>
<AnimatePresence>
@@ -469,10 +471,10 @@ export default function Header({
</div>
{[
{ id: 'shop', label: 'محصولات تخصصی', action: () => onShopNavigate() },
{ id: 'wiki', label: 'دانشنامه علمی', action: () => onNavigate('wiki') },
{ id: 'blog', label: 'مجله سلامت پت', action: () => onNavigate('blog') },
{ id: 'profile', label: 'شناسنامه پتها', action: () => onNavigate({ view: 'profile', subview: 'index' }) }
{ id: 'shop', label: getText('nav_products', 'محصولات تخصصی'), action: () => onShopNavigate() },
{ id: 'wiki', label: getText('nav_wiki', 'دانشنامه علمی'), action: () => onNavigate('wiki') },
{ id: 'blog', label: getText('nav_blog', 'مجله سلامت پت'), action: () => onNavigate('blog') },
{ id: 'profile', label: getText('nav_pet_profiles', 'شناسنامه پتها'), action: () => onNavigate({ view: 'profile', subview: 'index' }) }
].map((item) => (
<button
key={item.id}