feat(ui): dynamic logo customization, centralized contact links, hero slider, banner placements, reorganized admin sidebar & ui-texts save fix
Deploy Canina / deploy (push) Has been cancelled
Deploy Canina / deploy (push) Has been cancelled
This commit is contained in:
1 parent
2fca778930
commit
2d594c5d69
34 files changed
+126746
-9764
No files matched your search
@@ -1,63 +1,50 @@
|
||||
import { useState, useEffect, useRef } from 'react';
|
||||
import { Link, useLocation } from 'react-router-dom';
|
||||
import { Users, ShoppingCart, Tag, Settings, TrendingUp, FolderTree, FileText, BookOpen, Heart, Package, LayoutDashboard, Languages, Image, Video, PhoneCall, Sparkles, MessageSquareQuote, FlaskConical, Building2, Globe, DollarSign, Sliders, MessageSquare, Receipt, CreditCard } from 'lucide-react';
|
||||
import {
|
||||
LayoutDashboard,
|
||||
TrendingUp,
|
||||
ShoppingCart,
|
||||
Receipt,
|
||||
Package,
|
||||
FolderTree,
|
||||
Tag,
|
||||
Sparkles,
|
||||
FileText,
|
||||
Users,
|
||||
Heart,
|
||||
MessageSquare,
|
||||
Building2,
|
||||
PhoneCall,
|
||||
Image,
|
||||
FlaskConical,
|
||||
MessageSquareQuote,
|
||||
BookOpen,
|
||||
Video,
|
||||
Settings,
|
||||
ShieldCheck,
|
||||
Languages,
|
||||
DollarSign,
|
||||
Sliders,
|
||||
Globe,
|
||||
ChevronDown,
|
||||
Star,
|
||||
Layers,
|
||||
} from 'lucide-react';
|
||||
import api from '../services/api';
|
||||
|
||||
const menuGroups = [
|
||||
{
|
||||
title: 'اصلی',
|
||||
items: [
|
||||
{ icon: LayoutDashboard, label: 'داشبورد', path: '/' },
|
||||
{ icon: TrendingUp, label: 'گزارشات', path: '/reports' },
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'فروشگاه و تخصصی',
|
||||
items: [
|
||||
{ icon: ShoppingCart, label: 'سفارشات', path: '/orders' },
|
||||
{ icon: Receipt, label: 'تراکنشها و لاگ پرداخت', path: '/transactions' },
|
||||
{ icon: Package, label: 'محصولات', path: '/products' },
|
||||
{ icon: MessageSquare, label: 'نظرات محصولات', path: '/reviews' },
|
||||
{ icon: FolderTree, label: 'دستهبندیها', path: '/categories' },
|
||||
{ icon: Tag, label: 'کدهای تخفیف', path: '/coupons' },
|
||||
{ icon: Sparkles, label: 'مشاور هوشمند', path: '/smart-advisor' },
|
||||
{ icon: FileText, label: 'نسخههای پزشکی', path: '/prescriptions' },
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'مدیریت و همکاران B2B',
|
||||
items: [
|
||||
{ icon: Users, label: 'کاربران', path: '/users' },
|
||||
{ icon: Heart, label: 'حیوانات (Pets)', path: '/pets' },
|
||||
{ icon: MessageSquare, label: 'تیکتها & مشاوره دامپزشک', path: '/tickets' },
|
||||
{ icon: Building2, label: 'مدیریت B2B & عمده', path: '/b2b' },
|
||||
{ icon: PhoneCall, label: 'تماس با ما & اطلاعات', path: '/contact' },
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'محتوا و دانشنامه',
|
||||
items: [
|
||||
{ icon: Image, label: 'بنرها و اسلایدرها', path: '/banners' },
|
||||
{ icon: FlaskConical, label: 'دانشنامه ترکیبات', path: '/ingredients' },
|
||||
{ icon: MessageSquareQuote, label: 'نظرات و گواهیها', path: '/testimonials' },
|
||||
{ icon: FileText, label: 'وبلاگ', path: '/blogs' },
|
||||
{ icon: BookOpen, label: 'دانشنامه عمومی', path: '/wiki' },
|
||||
{ icon: Video, label: 'مدیریت ویدئوها', path: '/videos' },
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'سیستم و تنظیمات',
|
||||
items: [
|
||||
{ icon: Settings, label: 'تنظیمات کلی', path: '/settings' },
|
||||
{ icon: MessageSquare, label: 'تنظیمات پیامک', path: '/settings/sms' },
|
||||
{ icon: Globe, label: 'تنظیمات سئو', path: '/settings/seo' },
|
||||
{ icon: DollarSign, label: 'تنظیمات مالی & ارسال', path: '/settings/financial' },
|
||||
{ icon: Sliders, label: 'تنظیمات سیستمی', path: '/settings/system' },
|
||||
{ icon: Languages, label: 'متون رابط کاربری', path: '/ui-texts' },
|
||||
{ icon: Image, label: 'مدیریت رسانه', path: '/media' },
|
||||
]
|
||||
}
|
||||
];
|
||||
interface SubMenuItem {
|
||||
icon: React.ComponentType<{ className?: string }>;
|
||||
label: string;
|
||||
path: string;
|
||||
badge?: string | number;
|
||||
}
|
||||
|
||||
interface MenuGroup {
|
||||
id: string;
|
||||
title: string;
|
||||
icon: React.ComponentType<{ className?: string }>;
|
||||
items: SubMenuItem[];
|
||||
}
|
||||
|
||||
interface SidebarProps {
|
||||
isOpen: boolean;
|
||||
@@ -69,12 +56,17 @@ export default function Sidebar({ isOpen, setIsOpen }: SidebarProps) {
|
||||
const [newOrdersCount, setNewOrdersCount] = useState(0);
|
||||
const intervalRef = useRef<ReturnType<typeof setInterval> | null>(null);
|
||||
|
||||
// Auto-close sidebar on mobile navigation
|
||||
useEffect(() => {
|
||||
setIsOpen(false);
|
||||
}, [location.pathname, setIsOpen]);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchOrdersCount = async () => {
|
||||
try {
|
||||
const response = await api.get('/admin/dashboard/stats');
|
||||
if (response.data?.success) {
|
||||
setNewOrdersCount(response.data.data.newOrders);
|
||||
setNewOrdersCount(response.data.data.newOrders || 0);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Failed to fetch stats in sidebar', err);
|
||||
@@ -87,6 +79,106 @@ export default function Sidebar({ isOpen, setIsOpen }: SidebarProps) {
|
||||
};
|
||||
}, []);
|
||||
|
||||
const menuGroups: MenuGroup[] = [
|
||||
{
|
||||
id: 'main',
|
||||
title: 'داشبورد و تحلیل داده',
|
||||
icon: LayoutDashboard,
|
||||
items: [
|
||||
{ icon: LayoutDashboard, label: 'نمای کلی داشبورد', path: '/' },
|
||||
{ icon: TrendingUp, label: 'گزارشات و تحلیل فروش', path: '/reports' },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'orders',
|
||||
title: 'سفارشات و مالی',
|
||||
icon: ShoppingCart,
|
||||
items: [
|
||||
{
|
||||
icon: ShoppingCart,
|
||||
label: 'مدیریت سفارشات',
|
||||
path: '/orders',
|
||||
badge: newOrdersCount > 0 ? newOrdersCount : undefined,
|
||||
},
|
||||
{ icon: Receipt, label: 'تراکنشها و لاگ پرداخت', path: '/transactions' },
|
||||
{ icon: DollarSign, label: 'تنظیمات مالی و ارسال', path: '/settings/financial' },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'products',
|
||||
title: 'محصولات و کاتالوگ',
|
||||
icon: Package,
|
||||
items: [
|
||||
{ icon: Package, label: 'لیست محصولات', path: '/products' },
|
||||
{ icon: Star, label: 'نظرات و امتیازات', path: '/reviews' },
|
||||
{ icon: FolderTree, label: 'دستهبندیهای تخصصی', path: '/categories' },
|
||||
{ icon: Tag, label: 'کدهای تخفیف', path: '/coupons' },
|
||||
{ icon: Sparkles, label: 'مشاور هوشمند بالینی', path: '/smart-advisor' },
|
||||
{ icon: FileText, label: 'نسخههای دریافتی', path: '/prescriptions' },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'crm',
|
||||
title: 'کاربران و همکاران',
|
||||
icon: Users,
|
||||
items: [
|
||||
{ icon: Users, label: 'مدیریت کاربران', path: '/users' },
|
||||
{ icon: Heart, label: 'پرونده پتها (همدمها)', path: '/pets' },
|
||||
{ icon: MessageSquare, label: 'تیکتها و مشاوره تخصصی', path: '/tickets' },
|
||||
{ icon: Building2, label: 'پرتال B2B و همکاران', path: '/b2b' },
|
||||
{ icon: PhoneCall, label: 'اطلاعات تماس و پیامها', path: '/contact' },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'content',
|
||||
title: 'محتوا و دانشنامه',
|
||||
icon: Layers,
|
||||
items: [
|
||||
{ icon: Image, label: 'بنرها و اسلایدرها', path: '/banners' },
|
||||
{ icon: FileText, label: 'وبلاگ و مقالات', path: '/blogs' },
|
||||
{ icon: FlaskConical, label: 'دانشنامه ترکیبات', path: '/ingredients' },
|
||||
{ icon: BookOpen, label: 'دانشنامه عمومی و علمی', path: '/wiki' },
|
||||
{ icon: MessageSquareQuote, label: 'نظرات و گواهی متخصصان', path: '/testimonials' },
|
||||
{ icon: Video, label: 'ویدئوها و آموزشها', path: '/videos' },
|
||||
{ icon: Image, label: 'کتابخانه رسانه', path: '/media' },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'settings',
|
||||
title: 'سیستم و تنظیمات',
|
||||
icon: Settings,
|
||||
items: [
|
||||
{ icon: Settings, label: 'تنظیمات اصلی فروشگاه', path: '/settings' },
|
||||
{ icon: Languages, label: 'متون رابط کاربری', path: '/ui-texts' },
|
||||
{ icon: MessageSquare, label: 'درگاه پیامک (MeliPayamak)', path: '/settings/sms' },
|
||||
{ icon: ShieldCheck, label: 'گواهی SSL و امنیت', path: '/settings/ssl' },
|
||||
{ icon: Globe, label: 'تنظیمات سئو (SEO)', path: '/settings/seo' },
|
||||
{ icon: Sliders, label: 'تنظیمات سیستمی پیشرفته', path: '/settings/system' },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
// Auto expand active group
|
||||
const [expandedGroups, setExpandedGroups] = useState<Record<string, boolean>>(() => {
|
||||
const initial: Record<string, boolean> = {};
|
||||
menuGroups.forEach((g) => {
|
||||
const hasActive = g.items.some(
|
||||
(item) =>
|
||||
location.pathname === item.path ||
|
||||
(item.path !== '/' && location.pathname.startsWith(item.path))
|
||||
);
|
||||
initial[g.id] = hasActive || g.id === 'main' || g.id === 'orders';
|
||||
});
|
||||
return initial;
|
||||
});
|
||||
|
||||
const toggleGroup = (groupId: string) => {
|
||||
setExpandedGroups((prev) => ({
|
||||
...prev,
|
||||
[groupId]: !prev[groupId],
|
||||
}));
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* Mobile Backdrop */}
|
||||
@@ -97,43 +189,100 @@ export default function Sidebar({ isOpen, setIsOpen }: SidebarProps) {
|
||||
/>
|
||||
)}
|
||||
|
||||
<aside className={`w-64 bg-white border-l border-gray-200 h-screen fixed lg:fixed lg:right-0 lg:top-0 lg:bottom-0 flex flex-col font-vazir shadow-sm z-50 transform transition-transform duration-300 ease-in-out ${isOpen ? 'translate-x-0' : 'translate-x-full lg:translate-x-0'
|
||||
}`}>
|
||||
<div className="h-16 flex items-center justify-center border-b border-gray-200 shrink-0">
|
||||
<h1 className="text-xl font-black text-purple-600">کنینا | ادمینپنل</h1>
|
||||
<aside
|
||||
className={`w-64 bg-white border-l border-gray-200 h-screen fixed lg:fixed lg:right-0 lg:top-0 lg:bottom-0 flex flex-col font-vazir shadow-sm z-50 transform transition-transform duration-300 ease-in-out ${
|
||||
isOpen ? 'translate-x-0' : 'translate-x-full lg:translate-x-0'
|
||||
}`}
|
||||
>
|
||||
{/* Header */}
|
||||
<div className="h-16 flex items-center justify-between px-5 border-b border-gray-200 shrink-0 bg-white">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="w-8 h-8 rounded-xl bg-purple-600 flex items-center justify-center text-white font-black text-sm italic shadow-md">
|
||||
C
|
||||
</div>
|
||||
<span className="text-base font-black text-gray-900">کنینا | ادمینپنل</span>
|
||||
</div>
|
||||
<span className="text-[10px] bg-purple-50 text-purple-700 font-bold px-2 py-0.5 rounded-md border border-purple-200">
|
||||
v2.4
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<nav className="flex-1 overflow-y-auto py-4 px-3 space-y-6">
|
||||
{menuGroups.map((group, idx) => (
|
||||
<div key={idx}>
|
||||
<h3 className="px-3 mb-2 text-xs font-black text-gray-400 uppercase tracking-wider">{group.title}</h3>
|
||||
<div className="space-y-1">
|
||||
{group.items.map((item) => {
|
||||
const isActive = location.pathname === item.path || (item.path !== '/' && location.pathname.startsWith(item.path));
|
||||
const Icon = item.icon;
|
||||
{/* Menu Navigation */}
|
||||
<nav className="flex-1 overflow-y-auto py-3 px-3 space-y-2">
|
||||
{menuGroups.map((group) => {
|
||||
const GroupIcon = group.icon;
|
||||
const isExpanded = !!expandedGroups[group.id];
|
||||
const hasActiveChild = group.items.some(
|
||||
(item) =>
|
||||
location.pathname === item.path ||
|
||||
(item.path !== '/' && location.pathname.startsWith(item.path))
|
||||
);
|
||||
|
||||
return (
|
||||
<Link
|
||||
key={item.path}
|
||||
to={item.path}
|
||||
className={`flex items-center gap-3 px-3 py-2.5 rounded-xl transition-all font-bold ${isActive
|
||||
? 'bg-purple-50 text-purple-600'
|
||||
: 'text-gray-500 hover:bg-gray-50 hover:text-gray-900'
|
||||
}`}
|
||||
>
|
||||
<Icon className="w-5 h-5" />
|
||||
<span>{item.label}</span>
|
||||
{item.label === 'سفارشات' && newOrdersCount > 0 && (
|
||||
<span className="mr-auto bg-purple-600 text-white text-[11px] font-black px-2 py-0.5 rounded-full min-w-[20px] text-center">
|
||||
{newOrdersCount}
|
||||
</span>
|
||||
)}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
return (
|
||||
<div key={group.id} className="rounded-2xl overflow-hidden bg-gray-50/50 border border-gray-100">
|
||||
{/* Group Accordion Header */}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => toggleGroup(group.id)}
|
||||
className={`w-full flex items-center justify-between px-3 py-2.5 text-xs font-black transition-all ${
|
||||
hasActiveChild ? 'text-purple-700 bg-purple-50/70' : 'text-gray-600 hover:bg-gray-100/60'
|
||||
}`}
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
<GroupIcon className={`w-4 h-4 ${hasActiveChild ? 'text-purple-600' : 'text-gray-400'}`} />
|
||||
<span>{group.title}</span>
|
||||
</div>
|
||||
<ChevronDown
|
||||
className={`w-4 h-4 transition-transform duration-200 text-gray-400 ${
|
||||
isExpanded ? 'rotate-180' : ''
|
||||
}`}
|
||||
/>
|
||||
</button>
|
||||
|
||||
{/* Submenu Items */}
|
||||
{isExpanded && (
|
||||
<div className="p-1 space-y-0.5 bg-white border-t border-gray-100">
|
||||
{group.items.map((item) => {
|
||||
const isActive =
|
||||
location.pathname === item.path ||
|
||||
(item.path !== '/' && location.pathname.startsWith(item.path));
|
||||
const Icon = item.icon;
|
||||
|
||||
return (
|
||||
<Link
|
||||
key={item.path}
|
||||
to={item.path}
|
||||
onClick={() => setIsOpen(false)}
|
||||
className={`flex items-center justify-between px-3 py-2 rounded-xl text-xs font-bold transition-all ${
|
||||
isActive
|
||||
? 'bg-purple-600 text-white shadow-sm shadow-purple-600/30'
|
||||
: 'text-gray-600 hover:bg-purple-50/50 hover:text-purple-700'
|
||||
}`}
|
||||
>
|
||||
<div className="flex items-center gap-2.5">
|
||||
<Icon className={`w-4 h-4 ${isActive ? 'text-white' : 'text-gray-400'}`} />
|
||||
<span>{item.label}</span>
|
||||
</div>
|
||||
|
||||
{item.badge !== undefined && (
|
||||
<span
|
||||
className={`text-[10px] font-black px-1.5 py-0.5 rounded-full min-w-[18px] text-center ${
|
||||
isActive
|
||||
? 'bg-white text-purple-700'
|
||||
: 'bg-purple-600 text-white'
|
||||
}`}
|
||||
>
|
||||
{item.badge}
|
||||
</span>
|
||||
)}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
</aside>
|
||||
</>
|
||||
|
||||
@@ -239,7 +239,17 @@ export default function BannersManager() {
|
||||
</td>
|
||||
<td className="py-4 px-6">
|
||||
<span className="inline-block px-3 py-1 bg-purple-50 text-purple-700 text-xs font-bold rounded-lg border border-purple-100">
|
||||
{banner.position === 'home_hero' ? 'اسلایدر هیرو اصلی' : banner.position === 'category_top' ? 'بالای دستهبندی' : 'سایدبار'}
|
||||
{banner.position === 'home_hero'
|
||||
? 'اسلایدر هیرو اصلی'
|
||||
: banner.position === 'home_middle'
|
||||
? 'بنر میانی صفحه نخست'
|
||||
: banner.position === 'home_bottom'
|
||||
? 'بنر عریض پایین خانه'
|
||||
: banner.position === 'shop_top'
|
||||
? 'بالای فروشگاه و کاتالوگ'
|
||||
: banner.position === 'category_top'
|
||||
? 'بالای دستهبندی'
|
||||
: 'سایدبار'}
|
||||
</span>
|
||||
</td>
|
||||
<td className="py-4 px-6 text-gray-500 font-mono text-xs dir-ltr text-right">
|
||||
@@ -354,8 +364,11 @@ export default function BannersManager() {
|
||||
className="w-full px-4 py-2.5 rounded-xl border border-gray-200 focus:border-purple-500 outline-none text-sm font-bold bg-white"
|
||||
>
|
||||
<option value="home_hero">اسلایدر هیرو اصلی (home_hero)</option>
|
||||
<option value="home_middle">بنر میانی صفحه نخست (home_middle)</option>
|
||||
<option value="home_bottom">بنر عریض پایین خانه (home_bottom)</option>
|
||||
<option value="shop_top">بالای فروشگاه و کاتالوگ (shop_top)</option>
|
||||
<option value="category_top">بالای دستهبندی (category_top)</option>
|
||||
<option value="sidebar">سایدبار (sidebar)</option>
|
||||
<option value="product_sidebar">سایدبار صفحات محصول و مقالات (product_sidebar)</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -25,12 +25,16 @@ export default function Settings() {
|
||||
ZIBAL_SANDBOX: 'true',
|
||||
FRONTEND_URL: 'https://canina.ir',
|
||||
CONTACT_PHONE: '۰۲۱-۸۸۸۸ ۴۴۴۴',
|
||||
CONTACT_PHONE_LINK: 'tel:02188884444',
|
||||
CONTACT_EMAIL: 'info@canina-iran.com',
|
||||
SOCIAL_WHATSAPP: '09120000000',
|
||||
SOCIAL_INSTAGRAM: 'https://instagram.com/canina_iran',
|
||||
SOCIAL_TELEGRAM: 'https://t.me/canina_iran',
|
||||
CONTACT_ADDRESS: 'تهران، جردن، خیابان سعیدی، ساختمان کنینا، طبقه ۵، واحد ۱۹',
|
||||
BRAND_LOGO_URL: '/logo.png',
|
||||
BRAND_LOGO_URL: '',
|
||||
BRAND_LOGO_TEXT_EN: 'Canina',
|
||||
BRAND_LOGO_TEXT_FA: 'ایران',
|
||||
BRAND_LOGO_SUBTITLE: 'نماینده رسمی CANINA PHARMA GMBH GERMANY',
|
||||
ENAMAD_CODE: '',
|
||||
THEME_PRIMARY_COLOR: '#7c3aed',
|
||||
BRAND_TYPOGRAPHY: 'vazirmatn',
|
||||
@@ -62,13 +66,17 @@ export default function Settings() {
|
||||
ZIBAL_MERCHANT: response.data.data.ZIBAL_MERCHANT || 'zibal',
|
||||
ZIBAL_SANDBOX: response.data.data.ZIBAL_SANDBOX || 'true',
|
||||
FRONTEND_URL: response.data.data.FRONTEND_URL || 'https://canina.ir',
|
||||
CONTACT_PHONE: response.data.data.CONTACT_PHONE || '۰۲۱-۸۸۸۸ ۴۴۴۴',
|
||||
CONTACT_EMAIL: response.data.data.CONTACT_EMAIL || 'info@canina-iran.com',
|
||||
SOCIAL_WHATSAPP: response.data.data.SOCIAL_WHATSAPP || '09120000000',
|
||||
SOCIAL_INSTAGRAM: response.data.data.SOCIAL_INSTAGRAM || 'https://instagram.com/canina_iran',
|
||||
SOCIAL_TELEGRAM: response.data.data.SOCIAL_TELEGRAM || 'https://t.me/canina_iran',
|
||||
CONTACT_ADDRESS: response.data.data.CONTACT_ADDRESS || 'تهران، جردن، خیابان سعیدی، ساختمان کنینا، طبقه ۵، واحد ۱۹',
|
||||
BRAND_LOGO_URL: response.data.data.BRAND_LOGO_URL || '/logo.png',
|
||||
CONTACT_PHONE: response.data.data.CONTACT_PHONE || response.data.data.contact_phone || '۰۲۱-۸۸۸۸ ۴۴۴۴',
|
||||
CONTACT_PHONE_LINK: response.data.data.CONTACT_PHONE_LINK || response.data.data.contact_phone_link || 'tel:02188884444',
|
||||
CONTACT_EMAIL: response.data.data.CONTACT_EMAIL || response.data.data.contact_email || 'info@canina-iran.com',
|
||||
SOCIAL_WHATSAPP: response.data.data.SOCIAL_WHATSAPP || response.data.data.contact_whatsapp || '09120000000',
|
||||
SOCIAL_INSTAGRAM: response.data.data.SOCIAL_INSTAGRAM || response.data.data.contact_instagram || 'https://instagram.com/canina_iran',
|
||||
SOCIAL_TELEGRAM: response.data.data.SOCIAL_TELEGRAM || response.data.data.contact_telegram || 'https://t.me/canina_iran',
|
||||
CONTACT_ADDRESS: response.data.data.CONTACT_ADDRESS || response.data.data.contact_address || 'تهران، جردن، خیابان سعیدی، ساختمان کنینا، طبقه ۵، واحد ۱۹',
|
||||
BRAND_LOGO_URL: response.data.data.BRAND_LOGO_URL || response.data.data.site_logo || '',
|
||||
BRAND_LOGO_TEXT_EN: response.data.data.BRAND_LOGO_TEXT_EN || response.data.data.site_logo_text_en || 'Canina',
|
||||
BRAND_LOGO_TEXT_FA: response.data.data.BRAND_LOGO_TEXT_FA || response.data.data.site_logo_text_fa || 'ایران',
|
||||
BRAND_LOGO_SUBTITLE: response.data.data.BRAND_LOGO_SUBTITLE || response.data.data.site_logo_subtitle || 'نماینده رسمی CANINA PHARMA GMBH GERMANY',
|
||||
ENAMAD_CODE: response.data.data.ENAMAD_CODE || '',
|
||||
THEME_PRIMARY_COLOR: response.data.data.THEME_PRIMARY_COLOR || '#7c3aed',
|
||||
BRAND_TYPOGRAPHY: response.data.data.BRAND_TYPOGRAPHY || 'vazirmatn',
|
||||
@@ -334,16 +342,30 @@ export default function Settings() {
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label className="block text-xs font-bold text-gray-700 mb-1">تلفن پشتیبانی و فروش</label>
|
||||
<label className="block text-xs font-bold text-gray-700 mb-1">متن نمایشی تلفن پشتیبانی و فروش</label>
|
||||
<input
|
||||
type="text"
|
||||
value={settings.CONTACT_PHONE}
|
||||
onChange={(e) => setSettings({ ...settings, CONTACT_PHONE: e.target.value })}
|
||||
placeholder="مثال: ۰۲۱-۸۸۸۸۴۴۴۴ یا ۰۹۲۱۲۳۴۵۶۷۸"
|
||||
className="w-full border border-gray-200 rounded-xl p-2.5 outline-none focus:ring-2 focus:ring-purple-500 text-xs font-bold"
|
||||
dir="ltr"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-xs font-bold text-gray-700 mb-1">لینک مستقیم تماس (Phone Link)</label>
|
||||
<input
|
||||
type="text"
|
||||
value={settings.CONTACT_PHONE_LINK}
|
||||
onChange={(e) => setSettings({ ...settings, CONTACT_PHONE_LINK: e.target.value })}
|
||||
placeholder="مثال: tel:+982188884444 یا tel:09212345678"
|
||||
className="w-full border border-gray-200 rounded-xl p-2.5 outline-none focus:ring-2 focus:ring-purple-500 text-xs font-mono"
|
||||
dir="ltr"
|
||||
/>
|
||||
<p className="text-[10px] text-gray-400 mt-1">لینکی که با کلیک روی شماره تلفن در سایت باز میشود (مثلاً شماره بینالمللی یا لینک تماس).</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-xs font-bold text-gray-700 mb-1">ایمیل رسمی پشتیبانی</label>
|
||||
<input
|
||||
@@ -410,14 +432,14 @@ export default function Settings() {
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label className="block text-xs font-bold text-gray-700 mb-1">لینک لوگوی برند (Brand Logo URL)</label>
|
||||
<label className="block text-xs font-bold text-gray-700 mb-1">لینک لوگوی تصویری (Brand Logo Image URL)</label>
|
||||
<div className="flex gap-2">
|
||||
<input
|
||||
type="text"
|
||||
value={settings.BRAND_LOGO_URL}
|
||||
onChange={(e) => setSettings({ ...settings, BRAND_LOGO_URL: e.target.value })}
|
||||
className="flex-1 border border-gray-200 rounded-xl p-2.5 outline-none focus:ring-2 focus:ring-purple-500 text-xs font-mono"
|
||||
placeholder="https://... یا /logo.png"
|
||||
placeholder="https://... یا /logo.png (اختیاری)"
|
||||
dir="ltr"
|
||||
/>
|
||||
{settings.BRAND_LOGO_URL && (
|
||||
@@ -426,7 +448,41 @@ export default function Settings() {
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<p className="text-[10px] text-gray-400 mt-1">این لوگو در صورت پر بودن، جایگزین تایپوگرافی هدر سایت در اپلیکیشن خواهد شد.</p>
|
||||
<p className="text-[10px] text-gray-400 mt-1">در صورت خالی بودن، لوگوی متنی زیر در هدر، فوتر و صفحه تعمیرات استفاده خواهد شد.</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-xs font-bold text-gray-700 mb-1">متن انگلیسی لوگو (Text Logo EN)</label>
|
||||
<input
|
||||
type="text"
|
||||
value={settings.BRAND_LOGO_TEXT_EN}
|
||||
onChange={(e) => setSettings({ ...settings, BRAND_LOGO_TEXT_EN: e.target.value })}
|
||||
placeholder="Canina"
|
||||
className="w-full border border-gray-200 rounded-xl p-2.5 outline-none focus:ring-2 focus:ring-purple-500 text-xs font-bold"
|
||||
dir="ltr"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-xs font-bold text-gray-700 mb-1">متن فارسی لوگو (Text Logo FA)</label>
|
||||
<input
|
||||
type="text"
|
||||
value={settings.BRAND_LOGO_TEXT_FA}
|
||||
onChange={(e) => setSettings({ ...settings, BRAND_LOGO_TEXT_FA: e.target.value })}
|
||||
placeholder="ایران"
|
||||
className="w-full border border-gray-200 rounded-xl p-2.5 outline-none focus:ring-2 focus:ring-purple-500 text-xs font-bold"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-xs font-bold text-gray-700 mb-1">زیرعنوان رسمی لوگو (Logo Subtitle)</label>
|
||||
<input
|
||||
type="text"
|
||||
value={settings.BRAND_LOGO_SUBTITLE}
|
||||
onChange={(e) => setSettings({ ...settings, BRAND_LOGO_SUBTITLE: e.target.value })}
|
||||
placeholder="نماینده رسمی CANINA PHARMA GMBH GERMANY"
|
||||
className="w-full border border-gray-200 rounded-xl p-2.5 outline-none focus:ring-2 focus:ring-purple-500 text-xs font-bold"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="md:col-span-2">
|
||||
|
||||
@@ -159,14 +159,24 @@ export default function UITexts() {
|
||||
const value = edits[key] ?? texts[key] ?? '';
|
||||
setSaving(key);
|
||||
try {
|
||||
await api.put(`/settings/ui-texts/${key}`, { value });
|
||||
await api.put(`/settings/ui-texts/${encodeURIComponent(key)}`, { value });
|
||||
setTexts(prev => ({ ...prev, [key]: value }));
|
||||
setSavedKey(key);
|
||||
toast.success('ذخیرهسازی با موفقیت انجام شد');
|
||||
setTimeout(() => setSavedKey(null), 2000);
|
||||
} catch (e) {
|
||||
} catch (e: any) {
|
||||
console.error('Failed to save UI text:', e);
|
||||
toast.error('خطا در ذخیرهسازی');
|
||||
try {
|
||||
// Fallback to PATCH if PUT fails
|
||||
await api.patch(`/settings/ui-texts/${encodeURIComponent(key)}`, { value });
|
||||
setTexts(prev => ({ ...prev, [key]: value }));
|
||||
setSavedKey(key);
|
||||
toast.success('ذخیرهسازی با موفقیت انجام شد');
|
||||
setTimeout(() => setSavedKey(null), 2000);
|
||||
} catch (err: any) {
|
||||
const errorMsg = err?.response?.data?.message || e?.response?.data?.message || 'خطا در ذخیرهسازی';
|
||||
toast.error(typeof errorMsg === 'string' ? errorMsg : 'خطا در ذخیرهسازی');
|
||||
}
|
||||
} finally {
|
||||
setSaving(null);
|
||||
}
|
||||
@@ -182,7 +192,7 @@ export default function UITexts() {
|
||||
});
|
||||
const fileUrl = res.data.url || res.data.fileUrl;
|
||||
setEdits(prev => ({ ...prev, [key]: fileUrl }));
|
||||
await api.put(`/settings/ui-texts/${key}`, { value: fileUrl });
|
||||
await api.put(`/settings/ui-texts/${encodeURIComponent(key)}`, { value: fileUrl });
|
||||
setTexts(prev => ({ ...prev, [key]: fileUrl }));
|
||||
setSavedKey(key);
|
||||
toast.success('تصویر با موفقیت آپلود شد');
|
||||
|
||||
@@ -5,6 +5,7 @@ import Hero from "../components/Hero";
|
||||
import SmartAdvisor from "../components/SmartAdvisor";
|
||||
import FeaturedProducts from "../components/FeaturedProducts";
|
||||
import VetGallery from "../components/VetGallery";
|
||||
import BannerPlacement from "../components/BannerPlacement";
|
||||
import Link from 'next/link';
|
||||
import { toPersian } from "../lib/utils";
|
||||
import { useSettingsStore } from "../lib/store/settingsStore";
|
||||
@@ -58,6 +59,7 @@ export default function HomeClient({ initialData }: HomeClientProps) {
|
||||
<>
|
||||
<Hero banners={heroBanners} />
|
||||
<SmartAdvisor rules={rules} />
|
||||
<BannerPlacement banners={banners} position="home_middle" />
|
||||
<FeaturedProducts />
|
||||
<VetGallery testimonials={testimonials} />
|
||||
|
||||
@@ -158,6 +160,9 @@ export default function HomeClient({ initialData }: HomeClientProps) {
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{/* Bottom Banner Placement */}
|
||||
<BannerPlacement banners={banners} position="home_bottom" />
|
||||
|
||||
{/* Call to Action */}
|
||||
<section className="bg-canina-blue py-12 relative overflow-hidden font-sans">
|
||||
<div className="absolute inset-0 opacity-10">
|
||||
|
||||
@@ -28,6 +28,8 @@ import {
|
||||
import { useCartStore } from "../lib/store/cartStore";
|
||||
import { useSettingsStore } from "../lib/store/settingsStore";
|
||||
import SafeImage from "./SafeImage";
|
||||
import BannerPlacement from "./BannerPlacement";
|
||||
import { Banner } from "../lib/types";
|
||||
|
||||
const ICON_MAP: Record<string, React.ReactNode> = {
|
||||
joints: <HeartPulse className="w-4 h-4" />,
|
||||
@@ -248,11 +250,15 @@ export default function ArchivePage({
|
||||
const [symptomSearch, setSymptomSearch] = useState("");
|
||||
const [categories, setCategories] = useState<{ id: string; label: string; icon: React.ReactNode }[]>([]);
|
||||
const [symptoms, setSymptoms] = useState<string[]>([]);
|
||||
const [banners, setBanners] = useState<Banner[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
const loadFilters = async () => {
|
||||
const loadFiltersAndBanners = async () => {
|
||||
try {
|
||||
const filters = await productService.getActiveFilters();
|
||||
const [filters, bannerData] = await Promise.all([
|
||||
productService.getActiveFilters(),
|
||||
productService.getBanners()
|
||||
]);
|
||||
const mapped = [
|
||||
{ id: "all", label: "همه محصولات", icon: <Activity className="w-4 h-4" /> },
|
||||
...filters.categories.map(c => ({
|
||||
@@ -263,11 +269,14 @@ export default function ArchivePage({
|
||||
];
|
||||
setCategories(mapped);
|
||||
setSymptoms(filters.symptoms);
|
||||
if (Array.isArray(bannerData)) {
|
||||
setBanners(bannerData);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Failed to load active filters:", e);
|
||||
console.error("Failed to load active filters or banners:", e);
|
||||
}
|
||||
};
|
||||
loadFilters();
|
||||
loadFiltersAndBanners();
|
||||
}, []);
|
||||
|
||||
const CATEGORY_LABELS = useMemo(() => {
|
||||
@@ -416,6 +425,9 @@ export default function ArchivePage({
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Shop Top Banner Placement */}
|
||||
<BannerPlacement banners={banners} position="shop_top" className="!px-0 !py-2 mb-6" />
|
||||
|
||||
<div className="flex flex-col lg:flex-row gap-8">
|
||||
|
||||
{/* Mobile Overlay Backdrop */}
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
/* eslint-disable @next/next/no-img-element */
|
||||
"use client";
|
||||
import React from "react";
|
||||
import Link from "next/link";
|
||||
import { Banner } from "../lib/types";
|
||||
|
||||
interface BannerPlacementProps {
|
||||
banners: Banner[];
|
||||
position: "home_middle" | "home_bottom" | "shop_top" | "category_top" | "product_sidebar";
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export default function BannerPlacement({
|
||||
banners,
|
||||
position,
|
||||
className = "",
|
||||
}: BannerPlacementProps) {
|
||||
const filteredBanners = (banners || []).filter(
|
||||
(b) => b.position === position && b.isActive !== false && b.imageUrl
|
||||
);
|
||||
|
||||
if (!filteredBanners || filteredBanners.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Multi-column layout for home_middle if 2 or more banners exist
|
||||
if (position === "home_middle") {
|
||||
return (
|
||||
<section className={`py-8 max-w-7xl mx-auto px-4 sm:px-6 font-vazir ${className}`}>
|
||||
<div
|
||||
className={`grid gap-6 ${
|
||||
filteredBanners.length > 1 ? "grid-cols-1 md:grid-cols-2" : "grid-cols-1"
|
||||
}`}
|
||||
>
|
||||
{filteredBanners.map((banner) => {
|
||||
const cardContent = (
|
||||
<div className="group relative rounded-3xl overflow-hidden shadow-lg hover:shadow-2xl transition-all duration-300 border border-medical-gray-100 bg-white">
|
||||
<div className="aspect-[16/7] sm:aspect-[16/6] md:aspect-[16/7] overflow-hidden bg-medical-gray-100 relative">
|
||||
<img
|
||||
src={banner.imageUrl}
|
||||
alt={banner.title || "کنینا بنر"}
|
||||
className="w-full h-full object-cover group-hover:scale-105 transition-transform duration-500"
|
||||
loading="lazy"
|
||||
/>
|
||||
{(banner.title || banner.subtitle) && (
|
||||
<div className="absolute inset-0 bg-gradient-to-t from-black/80 via-black/30 to-transparent p-6 flex flex-col justify-end text-white text-right">
|
||||
{banner.title && (
|
||||
<h4 className="text-lg sm:text-xl font-black mb-1 leading-tight">
|
||||
{banner.title}
|
||||
</h4>
|
||||
)}
|
||||
{banner.subtitle && (
|
||||
<p className="text-xs sm:text-sm text-medical-gray-200 font-bold opacity-90 line-clamp-2">
|
||||
{banner.subtitle}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
if (banner.linkUrl) {
|
||||
const isExternal = banner.linkUrl.startsWith("http");
|
||||
if (isExternal) {
|
||||
return (
|
||||
<a
|
||||
key={banner.id}
|
||||
href={banner.linkUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="block"
|
||||
>
|
||||
{cardContent}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<Link key={banner.id} href={banner.linkUrl} className="block">
|
||||
{cardContent}
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
return <div key={banner.id}>{cardContent}</div>;
|
||||
})}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
// Wide banner layout for home_bottom and shop_top
|
||||
if (position === "home_bottom" || position === "shop_top" || position === "category_top") {
|
||||
return (
|
||||
<section className={`py-6 max-w-7xl mx-auto px-4 sm:px-6 font-vazir ${className}`}>
|
||||
<div className="space-y-6">
|
||||
{filteredBanners.map((banner) => {
|
||||
const cardContent = (
|
||||
<div className="group relative rounded-3xl overflow-hidden shadow-xl hover:shadow-2xl transition-all duration-300 border border-medical-gray-200 bg-white">
|
||||
<div className="aspect-[21/6] sm:aspect-[21/5] min-h-[140px] sm:min-h-[180px] overflow-hidden bg-medical-gray-100 relative">
|
||||
<img
|
||||
src={banner.imageUrl}
|
||||
alt={banner.title || "کنینا"}
|
||||
className="w-full h-full object-cover group-hover:scale-103 transition-transform duration-500"
|
||||
loading="lazy"
|
||||
/>
|
||||
{(banner.title || banner.subtitle) && (
|
||||
<div className="absolute inset-0 bg-gradient-to-l from-black/80 via-black/40 to-transparent p-6 sm:p-10 flex flex-col justify-center text-white text-right">
|
||||
{banner.title && (
|
||||
<h4 className="text-xl sm:text-3xl font-black mb-2 leading-tight">
|
||||
{banner.title}
|
||||
</h4>
|
||||
)}
|
||||
{banner.subtitle && (
|
||||
<p className="text-xs sm:text-base text-medical-gray-200 font-bold max-w-xl">
|
||||
{banner.subtitle}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
if (banner.linkUrl) {
|
||||
const isExternal = banner.linkUrl.startsWith("http");
|
||||
if (isExternal) {
|
||||
return (
|
||||
<a
|
||||
key={banner.id}
|
||||
href={banner.linkUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="block"
|
||||
>
|
||||
{cardContent}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<Link key={banner.id} href={banner.linkUrl} className="block">
|
||||
{cardContent}
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
return <div key={banner.id}>{cardContent}</div>;
|
||||
})}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
// Sidebar Banner Layout
|
||||
return (
|
||||
<div className={`space-y-4 font-vazir ${className}`}>
|
||||
{filteredBanners.map((banner) => {
|
||||
const cardContent = (
|
||||
<div className="group relative rounded-2xl overflow-hidden shadow-md hover:shadow-xl transition-all duration-300 border border-medical-gray-200 bg-white">
|
||||
<div className="aspect-[4/3] overflow-hidden bg-medical-gray-100 relative">
|
||||
<img
|
||||
src={banner.imageUrl}
|
||||
alt={banner.title || "بنر کنینا"}
|
||||
className="w-full h-full object-cover group-hover:scale-105 transition-transform duration-500"
|
||||
loading="lazy"
|
||||
/>
|
||||
{banner.title && (
|
||||
<div className="absolute inset-0 bg-gradient-to-t from-black/80 to-transparent p-4 flex flex-col justify-end text-white text-right">
|
||||
<span className="text-xs font-black">{banner.title}</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
if (banner.linkUrl) {
|
||||
const isExternal = banner.linkUrl.startsWith("http");
|
||||
if (isExternal) {
|
||||
return (
|
||||
<a
|
||||
key={banner.id}
|
||||
href={banner.linkUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="block"
|
||||
>
|
||||
{cardContent}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<Link key={banner.id} href={banner.linkUrl} className="block">
|
||||
{cardContent}
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
return <div key={banner.id}>{cardContent}</div>;
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
/* eslint-disable @next/next/no-img-element */
|
||||
"use client";
|
||||
import React from "react";
|
||||
import Link from "next/link";
|
||||
import { useSettingsStore } from "../lib/store/settingsStore";
|
||||
|
||||
interface BrandLogoProps {
|
||||
className?: string;
|
||||
isDarkBackground?: boolean;
|
||||
href?: string;
|
||||
size?: "sm" | "md" | "lg";
|
||||
}
|
||||
|
||||
export default function BrandLogo({
|
||||
className = "",
|
||||
isDarkBackground = false,
|
||||
href = "/",
|
||||
size = "md",
|
||||
}: BrandLogoProps) {
|
||||
const getText = useSettingsStore((state) => state.getText);
|
||||
|
||||
const logoUrl = getText("site_logo", "");
|
||||
const textEn = getText("site_logo_text_en", "Canina");
|
||||
const textFa = getText("site_logo_text_fa", "ایران");
|
||||
const subtitle = getText(
|
||||
"site_logo_subtitle",
|
||||
"نماینده رسمی CANINA PHARMA GMBH GERMANY"
|
||||
);
|
||||
|
||||
const iconSizes = {
|
||||
sm: "w-8 h-8 text-base rounded-xl",
|
||||
md: "w-10 h-10 sm:w-12 sm:h-12 text-xl sm:text-2xl rounded-2xl",
|
||||
lg: "w-14 h-14 sm:w-16 sm:h-16 text-2xl sm:text-3xl rounded-3xl",
|
||||
};
|
||||
|
||||
const titleSizes = {
|
||||
sm: "text-sm sm:text-base",
|
||||
md: "text-base sm:text-2xl",
|
||||
lg: "text-xl sm:text-3xl",
|
||||
};
|
||||
|
||||
const content = (
|
||||
<div className={`flex items-center gap-2.5 sm:gap-3 group shrink-0 ${className}`}>
|
||||
{logoUrl ? (
|
||||
<img
|
||||
src={logoUrl}
|
||||
alt={`${textEn} ${textFa}`}
|
||||
className="h-10 sm:h-12 w-auto max-w-[160px] sm:max-w-[200px] object-contain shrink-0"
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
<div
|
||||
className={`${iconSizes[size]} bg-canina-blue flex items-center justify-center text-white font-black group-hover:bg-medical-gray-900 transition-all shadow-md italic shrink-0`}
|
||||
>
|
||||
{textEn.charAt(0).toUpperCase() || "C"}
|
||||
</div>
|
||||
<div className="flex flex-col justify-center">
|
||||
<span
|
||||
className={`${titleSizes[size]} font-black italic font-sans flex items-center gap-1 leading-none pl-1 whitespace-nowrap ${
|
||||
isDarkBackground ? "text-white" : "text-canina-blue"
|
||||
}`}
|
||||
>
|
||||
{textEn}
|
||||
{textFa && (
|
||||
<span
|
||||
className={`text-[11px] sm:text-sm not-italic font-bold border-r pr-1.5 mr-0.5 font-vazir ${
|
||||
isDarkBackground
|
||||
? "text-medical-gray-200 border-white/20"
|
||||
: "text-medical-gray-700 border-medical-gray-300"
|
||||
}`}
|
||||
>
|
||||
{textFa}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
{subtitle && (
|
||||
<span
|
||||
className={`hidden sm:block text-[8px] sm:text-[9px] font-bold uppercase tracking-wider leading-tight mt-1 whitespace-nowrap ${
|
||||
isDarkBackground ? "text-medical-gray-400" : "text-medical-gray-400"
|
||||
}`}
|
||||
>
|
||||
{subtitle}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
if (href) {
|
||||
return (
|
||||
<Link href={href} className="inline-block">
|
||||
{content}
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
return content;
|
||||
}
|
||||
@@ -217,11 +217,11 @@ export default function CheckoutPage() {
|
||||
</p>
|
||||
<div className="flex flex-col sm:flex-row gap-3 pt-2">
|
||||
<a
|
||||
href="tel:02188888888"
|
||||
href={getText('contact_phone_link', `tel:${getText('contact_phone', '02188884444').replace(/[^0-9+]/g, '')}`)}
|
||||
className="flex-1 px-4 py-3 bg-canina-blue hover:bg-canina-dark text-white rounded-xl text-xs font-black transition-all shadow-md flex items-center justify-center gap-2"
|
||||
>
|
||||
<Phone className="w-4 h-4" />
|
||||
<span>تماس با پشتیبانی</span>
|
||||
<span>تماس با پشتیبانی ({getText('contact_phone', '۰۲۱-۸۸۸۸۴۴۴۴')})</span>
|
||||
</a>
|
||||
<button
|
||||
onClick={() => router.push('/shop')}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { Phone, Mail, MapPin, Instagram, ShieldCheck, Globe, ArrowUp, Download } from "lucide-react";
|
||||
import { useSettingsStore } from "../lib/store/settingsStore";
|
||||
import BrandLogo from "./BrandLogo";
|
||||
import Link from "next/link";
|
||||
|
||||
import { NavigationTarget } from "../lib/types";
|
||||
@@ -53,22 +54,21 @@ export default function Footer({
|
||||
|
||||
{/* Brand Presence */}
|
||||
<div className="space-y-8">
|
||||
<Link href="/" className="flex items-center gap-3 cursor-pointer group">
|
||||
<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-white font-extrabold text-2xl tracking-tighter leading-none italic font-sans">Canina <span className="text-sm not-italic font-medium border-l-2 border-white/20 pl-2 ml-2 font-shabnam">{getText('brand_name_fa', "ایران")}</span></span>
|
||||
<span className="text-[10px] text-slate-400 font-bold uppercase tracking-widest leading-none mt-1.5 font-shabnam">{getText('brand_subtitle', "نماینده رسمی Canina Pharma GmbH آلمان")}</span>
|
||||
</div>
|
||||
</Link>
|
||||
<BrandLogo isDarkBackground size="lg" />
|
||||
<p className="text-sm text-slate-300 leading-relaxed font-medium">
|
||||
{getText('footer_brand_desc', "تدارک هوشمندانه سلامت برای همراهان وفادار شما. واردکننده انحصاری مکملهای درمانی با گرید دارویی اختصاصی از آلمان با سابقه ۴۰ سال نوآوری.")}
|
||||
</p>
|
||||
<div className="flex gap-4">
|
||||
{[Instagram, Globe].map((Icon, i) => (
|
||||
<a key={i} href="#" className="w-10 h-10 bg-white/10 rounded-xl flex items-center justify-center hover:bg-canina-blue hover:text-white transition-all text-slate-300">
|
||||
<Icon className="w-5 h-5" />
|
||||
</a>
|
||||
))}
|
||||
{getText('contact_instagram', '') && (
|
||||
<a href={getText('contact_instagram', '#')} target="_blank" rel="noopener noreferrer" className="w-10 h-10 bg-white/10 rounded-xl flex items-center justify-center hover:bg-canina-blue hover:text-white transition-all text-slate-300">
|
||||
<Instagram className="w-5 h-5" />
|
||||
</a>
|
||||
)}
|
||||
{getText('contact_telegram', '') && (
|
||||
<a href={getText('contact_telegram', '#')} target="_blank" rel="noopener noreferrer" className="w-10 h-10 bg-white/10 rounded-xl flex items-center justify-center hover:bg-canina-blue hover:text-white transition-all text-slate-300">
|
||||
<Globe className="w-5 h-5" />
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -132,24 +132,24 @@ export default function Footer({
|
||||
<h4 className="text-xl font-bold text-white border-b-2 border-canina-blue pb-2 max-w-max font-lalezar">{getText('footer_contact_title', "اطلاعات تماس نمایندگی")}</h4>
|
||||
<div className="grid md:grid-cols-2 gap-8">
|
||||
<div className="space-y-6">
|
||||
<div className="flex gap-4 group">
|
||||
<a href={getText('contact_phone_link', `tel:${getText('contact_phone', '02188884444').replace(/[^0-9+]/g, '')}`)} className="flex gap-4 group hover:opacity-90 transition-opacity">
|
||||
<div className="w-12 h-12 bg-white/5 rounded-2xl flex items-center justify-center text-blue-400 group-hover:scale-110 transition-transform flex-shrink-0">
|
||||
<Phone className="w-6 h-6" />
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-[11px] text-slate-400 font-extrabold uppercase mb-1">{getText('footer_phone_label', "خط ویژه فروش")}</p>
|
||||
<p className="text-lg font-extrabold tracking-widest text-left text-slate-200" dir="ltr">{getText('CONTACT_PHONE', getText('footer_phone', "۰۲۱-۸۸۸۸ ۴۴۴۴"))}</p>
|
||||
<p className="text-lg font-extrabold tracking-widest text-left text-slate-200" dir="ltr">{getText('contact_phone', "۰۲۱-۸۸۸۸۴۴۴۴")}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex gap-4 group">
|
||||
</a>
|
||||
<a href={`mailto:${getText('contact_email', 'info@canina.ir')}`} className="flex gap-4 group hover:opacity-90 transition-opacity">
|
||||
<div className="w-12 h-12 bg-white/5 rounded-2xl flex items-center justify-center text-blue-400 group-hover:scale-110 transition-transform flex-shrink-0">
|
||||
<Mail className="w-6 h-6" />
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-[11px] text-slate-400 font-extrabold uppercase mb-1">{getText('footer_email_label', "مکاتبات رسمی")}</p>
|
||||
<p className="text-sm font-bold text-slate-300">{getText('CONTACT_EMAIL', getText('footer_email', "info@canina-iran.com"))}</p>
|
||||
<p className="text-sm font-bold text-slate-300">{getText('contact_email', "info@canina.ir")}</p>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div className="flex gap-4 group">
|
||||
@@ -158,7 +158,7 @@ export default function Footer({
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-[11px] text-slate-400 font-extrabold uppercase mb-1">{getText('footer_address_label', "دفتر مرکزی")}</p>
|
||||
<p className="text-sm font-bold leading-relaxed text-slate-300">{getText('CONTACT_ADDRESS', getText('footer_address', "تهران، جردن، خیابان سعیدی، ساختمان کنینا، طبقه ۵، واحد ۱۹"))}</p>
|
||||
<p className="text-sm font-bold leading-relaxed text-slate-300">{getText('contact_address', "تهران، جردن، خیابان سعیدی، ساختمان کنینا، طبقه ۵، واحد ۱۹")}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -12,6 +12,7 @@ import { toast } from "sonner";
|
||||
import AuthModal from "./AuthModal";
|
||||
import PrescriptionUploadModal from "./PrescriptionUploadModal";
|
||||
import TickerBanner from "./TickerBanner";
|
||||
import BrandLogo from "./BrandLogo";
|
||||
import { cn } from "../lib/utils";
|
||||
import { productService } from "../lib/services/productService";
|
||||
|
||||
@@ -149,30 +150,7 @@ export default function Header({
|
||||
{isMobileMenuOpen ? <X className="w-6 h-6" /> : <Menu className="w-6 h-6" />}
|
||||
</button>
|
||||
|
||||
<Link href="/" className="flex items-center gap-2 sm:gap-3 group shrink-0">
|
||||
{(getText('BRAND_LOGO_URL', '') || getText('site_logo', '')) ? (
|
||||
<img
|
||||
src={getText('BRAND_LOGO_URL', '') || getText('site_logo', '')}
|
||||
alt={getText('brand_name_fa', "کنینا ایران")}
|
||||
className="h-10 sm:h-12 w-auto max-w-[140px] sm:max-w-[180px] object-contain shrink-0"
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
<div className="w-10 h-10 sm:w-12 sm:h-12 min-w-[40px] min-h-[40px] sm:min-w-[48px] sm:min-h-[48px] bg-canina-blue rounded-2xl flex items-center justify-center text-white font-bold text-xl sm:text-2xl group-hover:bg-medical-gray-900 transition-all shadow-md italic shrink-0">C</div>
|
||||
<div className="flex flex-col justify-center">
|
||||
<span className="text-canina-blue font-black text-base sm:text-2xl italic font-sans flex items-center gap-1 leading-none pl-1 whitespace-nowrap">
|
||||
Canina
|
||||
<span className="text-[11px] sm:text-sm not-italic font-medium border-r border-medical-gray-300 pr-1.5 mr-0.5 font-vazir text-medical-gray-700">
|
||||
{getText('brand_name_fa', "ایران")}
|
||||
</span>
|
||||
</span>
|
||||
<span className="hidden sm:block text-[9px] text-medical-gray-400 font-bold uppercase tracking-wider leading-tight mt-1 whitespace-nowrap">
|
||||
نماینده رسمی CANINA PHARMA GMBH GERMANY
|
||||
</span>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</Link>
|
||||
<BrandLogo />
|
||||
</div>
|
||||
|
||||
{/* Center Search Input (Desktop) */}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
/* eslint-disable @next/next/no-img-element */
|
||||
"use client";
|
||||
import { motion, animate } from "motion/react";
|
||||
import { ChevronLeft, Globe, ShieldCheck, Calendar } from "lucide-react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { motion, AnimatePresence, animate } from "motion/react";
|
||||
import { ChevronLeft, ChevronRight, Globe, ShieldCheck, Calendar, ArrowLeft } from "lucide-react";
|
||||
import { useEffect, useState, useRef } from "react";
|
||||
import { toPersian } from "../lib/utils";
|
||||
import { useSettingsStore } from "../lib/store/settingsStore";
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { Banner } from "../lib/types";
|
||||
|
||||
function StatCounter({ target }: { target: number }) {
|
||||
const [displayValue, setDisplayValue] = useState(0);
|
||||
@@ -12,7 +14,7 @@ function StatCounter({ target }: { target: number }) {
|
||||
useEffect(() => {
|
||||
const controls = animate(0, target, {
|
||||
duration: 3,
|
||||
ease: [0.16, 1, 0.3, 1], // Custom cubic-bezier for a more polished feel
|
||||
ease: [0.16, 1, 0.3, 1],
|
||||
onUpdate: (latest) => setDisplayValue(Math.round(latest))
|
||||
});
|
||||
return controls.stop;
|
||||
@@ -35,28 +37,55 @@ function StatCounter({ target }: { target: number }) {
|
||||
);
|
||||
}
|
||||
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { Banner } from "../lib/types";
|
||||
|
||||
export default function Hero({ banners = [], onShopNavigate }: { banners?: Banner[]; onShopNavigate?: () => void }) {
|
||||
const router = useRouter();
|
||||
const getText = useSettingsStore((state) => state?.getText || ((_k: string, fb: string) => fb));
|
||||
const isInitialized = useSettingsStore((state) => state?.isInitialized ?? false);
|
||||
const [mounted, setMounted] = useState(false);
|
||||
const [currentSlide, setCurrentSlide] = useState(0);
|
||||
const [isPaused, setIsPaused] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
setMounted(true);
|
||||
}, []);
|
||||
|
||||
const defaultTitle = banners.length > 0 && banners[0].title ? banners[0].title : "تخصص آلمانی در خدمت\nسلامت پتهای خانگی";
|
||||
const defaultSubtitle = banners.length > 0 && banners[0].subtitle ? banners[0].subtitle : 'از سال ۱۹۸۴، شرکت Canina pharma GmbH در برگیش گلادباخ آلمان، با بهرهگیری از مواد اولیه طبیعی و فرآیندهای پیشرفته، استاندارد طلایی مکملهای دامپزشکی را تعریف میکند. کنینا نماینده رسمی این برند در ایران است.';
|
||||
const heroBanners = banners.filter(b => b.isActive !== false && b.imageUrl);
|
||||
const totalSlides = heroBanners.length;
|
||||
|
||||
// Auto-advance slider
|
||||
useEffect(() => {
|
||||
if (totalSlides <= 1 || isPaused) return;
|
||||
const interval = setInterval(() => {
|
||||
setCurrentSlide(prev => (prev + 1) % totalSlides);
|
||||
}, 5000);
|
||||
return () => clearInterval(interval);
|
||||
}, [totalSlides, isPaused]);
|
||||
|
||||
const activeBanner = totalSlides > 0 ? heroBanners[currentSlide] : null;
|
||||
|
||||
const defaultTitle = activeBanner?.title || (banners.length > 0 && banners[0].title ? banners[0].title : "تخصص آلمانی در خدمت\nسلامت پتهای خانگی");
|
||||
const defaultSubtitle = activeBanner?.subtitle || (banners.length > 0 && banners[0].subtitle ? banners[0].subtitle : 'از سال ۱۹۸۴، شرکت Canina pharma GmbH در برگیش گلادباخ آلمان، با بهرهگیری از مواد اولیه طبیعی و فرآیندهای پیشرفته، استاندارد طلایی مکملهای دامپزشکی را تعریف میکند. کنینا نماینده رسمی این برند در ایران است.');
|
||||
|
||||
const title = (mounted && isInitialized ? getText('hero_title', '') : '') || defaultTitle;
|
||||
const subtitle = (mounted && isInitialized ? getText('hero_desc', '') : '') || defaultSubtitle;
|
||||
const titleParts = title.split('\n');
|
||||
|
||||
const activeImageUrl = activeBanner?.imageUrl || (mounted && isInitialized ? getText('hero_image_url', '') : '') || (banners.length > 0 && banners[0].imageUrl ? banners[0].imageUrl : "/assets/images/hero-section-image.png");
|
||||
|
||||
const handleNextSlide = () => {
|
||||
if (totalSlides > 1) {
|
||||
setCurrentSlide(prev => (prev + 1) % totalSlides);
|
||||
}
|
||||
};
|
||||
|
||||
const handlePrevSlide = () => {
|
||||
if (totalSlides > 1) {
|
||||
setCurrentSlide(prev => (prev - 1 + totalSlides) % totalSlides);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<section className="relative overflow-hidden bg-white py-20 lg:py-32 border-b border-medical-gray-100">
|
||||
<section className="relative overflow-hidden bg-white py-16 lg:py-28 border-b border-medical-gray-100">
|
||||
{/* Background patterns */}
|
||||
<div className="absolute top-0 left-0 w-full h-full opacity-[0.03] pointer-events-none select-none overflow-hidden">
|
||||
<div className="absolute top-0 right-0 w-[800px] h-[800px] bg-canina-blue rounded-full blur-[120px] -mr-96 -mt-96" />
|
||||
@@ -119,56 +148,114 @@ export default function Hero({ banners = [], onShopNavigate }: { banners?: Banne
|
||||
</motion.div>
|
||||
</div>
|
||||
|
||||
{/* Visual Element */}
|
||||
<div className="lg:w-1/2 relative">
|
||||
{/* Visual Element & Interactive Slider */}
|
||||
<div
|
||||
className="lg:w-1/2 relative w-full max-w-lg lg:max-w-none mx-auto"
|
||||
onMouseEnter={() => setIsPaused(true)}
|
||||
onMouseLeave={() => setIsPaused(false)}
|
||||
>
|
||||
<motion.div
|
||||
initial={{ opacity: 0, scale: 0.9, rotate: -5 }}
|
||||
initial={{ opacity: 0, scale: 0.9, rotate: -3 }}
|
||||
animate={{ opacity: 1, scale: 1, rotate: 0 }}
|
||||
transition={{ duration: 1, ease: "easeOut" }}
|
||||
transition={{ duration: 0.8, ease: "easeOut" }}
|
||||
className="relative z-10"
|
||||
>
|
||||
<div className="aspect-square bg-gradient-to-br from-slate-200 to-slate-300 rounded-[2.5rem] overflow-hidden border-4 border-white shadow-2xl relative">
|
||||
<img
|
||||
src={(mounted && isInitialized ? getText('hero_image_url', '') : '') || (banners.length > 0 && banners[0].imageUrl ? banners[0].imageUrl : "/assets/images/hero-section-image.png")}
|
||||
alt={banners.length > 0 ? banners[0].title : "Canina Pharma Germany"}
|
||||
className="w-full h-full object-cover"
|
||||
loading="eager"
|
||||
referrerPolicy="no-referrer"
|
||||
/>
|
||||
<div className="absolute bottom-0 left-0 right-0 p-8 bg-gradient-to-t from-black/80 to-transparent text-white text-right">
|
||||
<div className="aspect-square bg-gradient-to-br from-slate-200 to-slate-300 rounded-[2.5rem] overflow-hidden border-4 border-white shadow-2xl relative group">
|
||||
<AnimatePresence mode="wait">
|
||||
<motion.img
|
||||
key={activeImageUrl}
|
||||
src={activeImageUrl}
|
||||
alt={activeBanner?.title || "Canina Pharma Germany"}
|
||||
initial={{ opacity: 0, scale: 1.05 }}
|
||||
animate={{ opacity: 1, scale: 1 }}
|
||||
exit={{ opacity: 0, scale: 0.98 }}
|
||||
transition={{ duration: 0.5 }}
|
||||
className="w-full h-full object-cover"
|
||||
loading="eager"
|
||||
referrerPolicy="no-referrer"
|
||||
/>
|
||||
</AnimatePresence>
|
||||
|
||||
{/* Gradient overlay and slide caption */}
|
||||
<div className="absolute bottom-0 left-0 right-0 p-6 sm:p-8 bg-gradient-to-t from-black/85 via-black/40 to-transparent text-white text-right">
|
||||
<div className="text-sm font-medium mb-1 opacity-80 uppercase tracking-widest text-[10px]">
|
||||
{mounted && isInitialized ? getText('hero_image_badge', "سرآمد علمی در پزشکی پتها") : "سرآمد علمی در پزشکی پتها"}
|
||||
</div>
|
||||
<div className="text-xl font-bold italic tracking-tighter">
|
||||
{mounted && isInitialized ? getText('hero_image_title', "مکملهای تایید شده دامپزشکی با گواهی IFS") : "مکملهای تایید شده دامپزشکی با گواهی IFS"}
|
||||
<div className="text-lg sm:text-xl font-bold italic tracking-tighter">
|
||||
{activeBanner?.title || (mounted && isInitialized ? getText('hero_image_title', "مکملهای تایید شده دامپزشکی با گواهی IFS") : "مکملهای تایید شده دامپزشکی با گواهی IFS")}
|
||||
</div>
|
||||
{activeBanner?.linkUrl && (
|
||||
<a
|
||||
href={activeBanner.linkUrl}
|
||||
className="inline-flex items-center gap-1 text-xs text-canina-gold hover:underline font-bold mt-2"
|
||||
>
|
||||
<span>اطلاعات بیشتر و خرید</span>
|
||||
<ArrowLeft className="w-3.5 h-3.5" />
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Quality Badge inside the image container to prevent text collision */}
|
||||
{/* Slider Navigation Arrows (shown if multiple slides exist) */}
|
||||
{totalSlides > 1 && (
|
||||
<>
|
||||
<button
|
||||
onClick={handlePrevSlide}
|
||||
className="absolute right-4 top-1/2 -translate-y-1/2 w-10 h-10 rounded-full bg-black/40 hover:bg-black/70 text-white backdrop-blur-md flex items-center justify-center transition-all opacity-0 group-hover:opacity-100 z-30"
|
||||
aria-label="اسلاید قبلی"
|
||||
>
|
||||
<ChevronRight className="w-5 h-5" />
|
||||
</button>
|
||||
<button
|
||||
onClick={handleNextSlide}
|
||||
className="absolute left-4 top-1/2 -translate-y-1/2 w-10 h-10 rounded-full bg-black/40 hover:bg-black/70 text-white backdrop-blur-md flex items-center justify-center transition-all opacity-0 group-hover:opacity-100 z-30"
|
||||
aria-label="اسلاید بعدی"
|
||||
>
|
||||
<ChevronLeft className="w-5 h-5" />
|
||||
</button>
|
||||
|
||||
{/* Dot Indicators */}
|
||||
<div className="absolute bottom-4 left-1/2 -translate-x-1/2 flex items-center gap-2 z-30 bg-black/40 backdrop-blur-md px-3 py-1.5 rounded-full">
|
||||
{heroBanners.map((_, idx) => (
|
||||
<button
|
||||
key={idx}
|
||||
onClick={() => setCurrentSlide(idx)}
|
||||
className={`transition-all rounded-full ${
|
||||
currentSlide === idx
|
||||
? "w-6 h-2 bg-canina-gold"
|
||||
: "w-2 h-2 bg-white/60 hover:bg-white"
|
||||
}`}
|
||||
aria-label={`اسلاید ${idx + 1}`}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Quality Badge inside the image container */}
|
||||
<motion.div
|
||||
animate={{ rotate: 360 }}
|
||||
transition={{ duration: 20, repeat: Infinity, ease: "linear" }}
|
||||
className="absolute top-6 right-6 lg:top-8 lg:right-8 z-20 w-24 h-24 lg:w-28 lg:h-28 bg-white shadow-2xl rounded-full p-2 border-2 border-dashed border-canina-blue flex items-center justify-center text-center"
|
||||
className="absolute top-6 right-6 lg:top-8 lg:right-8 z-20 w-20 h-20 lg:w-24 lg:h-24 bg-white shadow-2xl rounded-full p-2 border-2 border-dashed border-canina-blue flex items-center justify-center text-center"
|
||||
>
|
||||
<div className="flex flex-col items-center">
|
||||
<span className="text-xl lg:text-2xl font-black text-canina-blue leading-none tracking-tighter">DE</span>
|
||||
<span className="text-[7px] lg:text-[8px] font-bold text-medical-gray-500 uppercase tracking-widest mt-0.5 leading-tight">
|
||||
{mounted && isInitialized ? getText('hero_quality_standard', "استاندارد کیفی آلمان (IFS & HACCP)") : "استاندارد کیفی آلمان (IFS & HACCP)"}
|
||||
<span className="text-lg lg:text-xl font-black text-canina-blue leading-none tracking-tighter">DE</span>
|
||||
<span className="text-[6px] lg:text-[7px] font-bold text-medical-gray-500 uppercase tracking-widest mt-0.5 leading-tight">
|
||||
{mounted && isInitialized ? getText('hero_quality_standard', "استاندارد کیفی آلمان") : "استاندارد کیفی آلمان"}
|
||||
</span>
|
||||
</div>
|
||||
</motion.div>
|
||||
|
||||
{/* 3D Action Badge clarifying the 3D mark */}
|
||||
<div className="absolute bottom-28 right-6 bg-canina-gold text-medical-gray-900 px-4 py-2 rounded-2xl text-xs font-black shadow-2xl z-20 flex items-center gap-1.5 font-vazir border border-white/20 select-none animate-bounce">
|
||||
{/* 3D Action Badge */}
|
||||
<div className="absolute bottom-24 right-6 bg-canina-gold text-medical-gray-900 px-3.5 py-1.5 rounded-2xl text-xs font-black shadow-2xl z-20 flex items-center gap-1.5 font-vazir border border-white/20 select-none animate-bounce">
|
||||
<span className="text-sm">✨</span>
|
||||
<span>فرمول ۳کاره (تاثیر سهبعدی)</span>
|
||||
<span>فرمول ۳کاره</span>
|
||||
</div>
|
||||
</div>
|
||||
</motion.div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Stats - 3 side-by-side cards with centered text on all screens */}
|
||||
{/* Stats */}
|
||||
<div className="max-w-7xl mx-auto px-2 sm:px-4 relative">
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import React from "react";
|
||||
import { Wrench, Phone, ShieldCheck, Clock } from "lucide-react";
|
||||
import { useSettingsStore } from "../lib/store/settingsStore";
|
||||
import BrandLogo from "./BrandLogo";
|
||||
|
||||
export default function MaintenancePage() {
|
||||
const getText = useSettingsStore((state) => state.getText);
|
||||
@@ -13,8 +14,8 @@ export default function MaintenancePage() {
|
||||
);
|
||||
const badge = getText("maintenance_badge", "سامانه در حال بهروزرسانی و ارتقا");
|
||||
const eta = getText("maintenance_eta", "زمان تقریبی بازگشایی: کمتر از ۲ ساعت آینده");
|
||||
const phone = getText("maintenance_contact_phone", "۰۲۱-۸۸۸۸۸۸۸۸");
|
||||
const rawPhone = phone.replace(/[^0-9]/g, "");
|
||||
const phone = getText("contact_phone", getText("maintenance_contact_phone", "۰۲۱-۸۸۸۸۴۴۴۴"));
|
||||
const phoneLink = getText("contact_phone_link", getText("maintenance_contact_phone_link", `tel:${phone.replace(/[^0-9+]/g, "") || "02188884444"}`));
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-medical-gray-900 text-white flex flex-col items-center justify-center p-6 text-center font-vazir relative overflow-hidden" dir="rtl">
|
||||
@@ -23,8 +24,13 @@ export default function MaintenancePage() {
|
||||
<div className="absolute bottom-10 right-10 w-80 h-80 bg-canina-gold/10 rounded-full blur-3xl pointer-events-none" />
|
||||
|
||||
<div className="relative z-10 max-w-xl mx-auto space-y-6">
|
||||
<div className="w-24 h-24 bg-white/10 border border-white/20 rounded-3xl mx-auto flex items-center justify-center text-canina-gold shadow-2xl backdrop-blur-md">
|
||||
<Wrench className="w-12 h-12 animate-bounce" />
|
||||
{/* Brand Logo */}
|
||||
<div className="flex justify-center mb-2">
|
||||
<BrandLogo isDarkBackground size="lg" href="" />
|
||||
</div>
|
||||
|
||||
<div className="w-20 h-20 bg-white/10 border border-white/20 rounded-3xl mx-auto flex items-center justify-center text-canina-gold shadow-2xl backdrop-blur-md">
|
||||
<Wrench className="w-10 h-10 animate-bounce" />
|
||||
</div>
|
||||
|
||||
<span className="inline-block px-4 py-1.5 bg-canina-gold/20 text-canina-gold border border-canina-gold/30 rounded-full text-xs font-black tracking-widest uppercase">
|
||||
@@ -48,7 +54,7 @@ export default function MaintenancePage() {
|
||||
|
||||
<div className="pt-2 flex flex-col sm:flex-row items-center justify-center gap-4">
|
||||
<a
|
||||
href={`tel:${rawPhone || "02188888888"}`}
|
||||
href={phoneLink}
|
||||
className="w-full sm:w-auto px-6 py-3.5 bg-canina-blue hover:bg-canina-dark text-white font-black text-xs rounded-xl flex items-center justify-center gap-2 shadow-lg transition-all"
|
||||
>
|
||||
<Phone className="w-4 h-4" />
|
||||
|
||||
@@ -693,11 +693,11 @@ export default function ProductPage({ productSlug }: { productSlug: string }) {
|
||||
{isCartDisabled ? (
|
||||
<div className="space-y-3">
|
||||
<a
|
||||
href="tel:02188888888"
|
||||
href={getText('contact_phone_link', `tel:${getText('contact_phone', '02188884444').replace(/[^0-9+]/g, '')}`)}
|
||||
className="w-full flex items-center justify-center gap-2 px-4 bg-canina-blue text-white rounded-2xl h-16 font-black text-sm hover:bg-canina-dark transition-all shadow-xl shadow-canina-blue/20 font-vazir"
|
||||
>
|
||||
<Phone className="w-5 h-5" />
|
||||
<span>مشاوره و استعلام خرید</span>
|
||||
<span>مشاوره و استعلام خرید ({getText('contact_phone', '۰۲۱-۸۸۸۸۴۴۴۴')})</span>
|
||||
</a>
|
||||
<p className="text-[11px] text-medical-gray-400 font-bold text-center">
|
||||
خرید آنلاین در حالت کاتالوگ موقتاً غیرفعال است
|
||||
@@ -916,7 +916,7 @@ export default function ProductPage({ productSlug }: { productSlug: string }) {
|
||||
<div className="flex items-center gap-2 flex-1 max-w-[240px]">
|
||||
{isCartDisabled ? (
|
||||
<a
|
||||
href="tel:02188888888"
|
||||
href={getText('contact_phone_link', `tel:${getText('contact_phone', '02188884444').replace(/[^0-9+]/g, '')}`)}
|
||||
className="flex-1 bg-canina-blue text-white py-2.5 px-3 rounded-xl font-black text-xs hover:bg-canina-dark transition-all flex items-center justify-center gap-1.5 shadow-md shadow-canina-blue/20 whitespace-nowrap"
|
||||
>
|
||||
<Phone className="w-4 h-4" />
|
||||
|
||||
@@ -251,6 +251,16 @@ export class ProductService {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
public async getBanners(): Promise<any[]> {
|
||||
try {
|
||||
const response = await api.get('/banners');
|
||||
return response.data || [];
|
||||
} catch (error) {
|
||||
console.error("[ProductService] Failed to fetch banners:", error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const productService = ProductService.getInstance();
|
||||
@@ -54,17 +54,34 @@ export const useSettingsStore = create<SettingsStore>()((set, get) => ({
|
||||
}
|
||||
},
|
||||
getText: (key, fallback) => {
|
||||
const value = get().texts[key];
|
||||
if (value === undefined || value === null) {
|
||||
const texts = get().texts;
|
||||
if (!texts) return fallback;
|
||||
const value =
|
||||
texts[key] ??
|
||||
texts[key.toLowerCase()] ??
|
||||
texts[key.toUpperCase()];
|
||||
if (value === undefined || value === null || value === '') {
|
||||
// Special aliases
|
||||
if (key === 'contact_phone') return texts['CONTACT_PHONE'] || texts['footer_phone'] || texts['maintenance_contact_phone'] || fallback;
|
||||
if (key === 'contact_phone_link') return texts['CONTACT_PHONE_LINK'] || texts['maintenance_contact_phone_link'] || (texts['contact_phone'] ? `tel:${texts['contact_phone'].replace(/[^0-9+]/g, '')}` : fallback);
|
||||
if (key === 'site_logo') return texts['BRAND_LOGO_URL'] || texts['brand_logo_url'] || fallback;
|
||||
if (key === 'site_logo_text_en') return texts['BRAND_LOGO_TEXT_EN'] || fallback;
|
||||
if (key === 'site_logo_text_fa') return texts['BRAND_LOGO_TEXT_FA'] || texts['brand_name_fa'] || fallback;
|
||||
if (key === 'site_logo_subtitle') return texts['BRAND_LOGO_SUBTITLE'] || texts['brand_subtitle'] || fallback;
|
||||
return fallback;
|
||||
}
|
||||
return value;
|
||||
},
|
||||
getBoolean: (key, fallback) => {
|
||||
const value = get().texts[key];
|
||||
if (value === undefined || value === null) {
|
||||
const texts = get().texts;
|
||||
if (!texts) return fallback;
|
||||
const value =
|
||||
texts[key] ??
|
||||
texts[key.toLowerCase()] ??
|
||||
texts[key.toUpperCase()];
|
||||
if (value === undefined || value === null || value === '') {
|
||||
return fallback;
|
||||
}
|
||||
return value === 'true' || value === '1';
|
||||
return value === 'true' || value === '1' || (value as unknown) === true;
|
||||
}
|
||||
}));
|
||||
Reference in new issue
Block a user