549 lines
24 KiB
TypeScript
549 lines
24 KiB
TypeScript
import {
|
|
Building2,
|
|
ChevronLeft,
|
|
CreditCard,
|
|
DollarSign,
|
|
Globe,
|
|
MessageSquare,
|
|
Palette,
|
|
Save,
|
|
Settings as SettingsIcon,
|
|
Share2,
|
|
ShieldCheck,
|
|
Sliders,
|
|
Sparkles,
|
|
Truck
|
|
} from 'lucide-react';
|
|
import { useEffect,useState } from 'react';
|
|
import { toast } from 'react-hot-toast';
|
|
import { Link } from 'react-router-dom';
|
|
import Button from '../components/ui/Button';
|
|
import Spinner from '../components/ui/Spinner';
|
|
import api from '../services/api';
|
|
|
|
|
|
|
|
import { useSearchParams } from 'react-router-dom';
|
|
|
|
export default function Settings() {
|
|
const [searchParams, setSearchParams] = useSearchParams();
|
|
const activeTabParam = (searchParams.get('tab') as 'brand' | 'contact' | 'links') || 'brand';
|
|
const [activeTab, setActiveTabState] = useState<'brand' | 'contact' | 'links'>(activeTabParam);
|
|
|
|
const setActiveTab = (tab: 'brand' | 'contact' | 'links') => {
|
|
setActiveTabState(tab);
|
|
setSearchParams(tab === 'brand' ? {} : { tab }, { replace: true });
|
|
};
|
|
|
|
useEffect(() => {
|
|
const tabFromUrl = searchParams.get('tab') as 'brand' | 'contact' | 'links';
|
|
if (tabFromUrl && tabFromUrl !== activeTab) {
|
|
setActiveTabState(tabFromUrl);
|
|
}
|
|
}, [searchParams]);
|
|
|
|
|
|
const [settings, setSettings] = useState({
|
|
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',
|
|
CONTACT_PHONE: '۰۲۱-۸۸۸۸ ۴۴۴۴',
|
|
CONTACT_PHONE_LINK: 'tel:02188884444',
|
|
CONTACT_EMAIL: 'info@canina.ir',
|
|
SOCIAL_WHATSAPP: '09120000000',
|
|
SOCIAL_INSTAGRAM: 'https://instagram.com/canina_iran',
|
|
SOCIAL_TELEGRAM: 'https://t.me/canina_iran',
|
|
CONTACT_ADDRESS: 'تهران، جردن، خیابان سعیدی، ساختمان کنینا، طبقه ۵، واحد ۱۹',
|
|
});
|
|
|
|
const [isLoading, setIsLoading] = useState(true);
|
|
const [isSaving, setIsSaving] = useState(false);
|
|
|
|
useEffect(() => {
|
|
let isSubscribed = true;
|
|
api.get('/admin/settings')
|
|
.then((response) => {
|
|
if (!isSubscribed) return;
|
|
if (response.data?.success) {
|
|
const d = response.data.data;
|
|
setSettings({
|
|
BRAND_LOGO_URL: d.BRAND_LOGO_URL || d.site_logo || '',
|
|
BRAND_LOGO_TEXT_EN: d.BRAND_LOGO_TEXT_EN || d.site_logo_text_en || 'Canina',
|
|
BRAND_LOGO_TEXT_FA: d.BRAND_LOGO_TEXT_FA || d.site_logo_text_fa || 'ایران',
|
|
BRAND_LOGO_SUBTITLE: d.BRAND_LOGO_SUBTITLE || d.site_logo_subtitle || 'نماینده رسمی CANINA PHARMA GMBH GERMANY',
|
|
ENAMAD_CODE: d.ENAMAD_CODE || '',
|
|
THEME_PRIMARY_COLOR: d.THEME_PRIMARY_COLOR || '#7c3aed',
|
|
BRAND_TYPOGRAPHY: d.BRAND_TYPOGRAPHY || 'vazirmatn',
|
|
CONTACT_PHONE: d.CONTACT_PHONE || d.contact_phone || '۰۲۱-۸۸۸۸ ۴۴۴۴',
|
|
CONTACT_PHONE_LINK: d.CONTACT_PHONE_LINK || d.contact_phone_link || 'tel:02188884444',
|
|
CONTACT_EMAIL: d.CONTACT_EMAIL || d.contact_email || 'info@canina.ir',
|
|
SOCIAL_WHATSAPP: d.SOCIAL_WHATSAPP || d.contact_whatsapp || '09120000000',
|
|
SOCIAL_INSTAGRAM: d.SOCIAL_INSTAGRAM || d.contact_instagram || 'https://instagram.com/canina_iran',
|
|
SOCIAL_TELEGRAM: d.SOCIAL_TELEGRAM || d.contact_telegram || 'https://t.me/canina_iran',
|
|
CONTACT_ADDRESS: d.CONTACT_ADDRESS || d.contact_address || 'تهران، جردن، خیابان سعیدی، ساختمان کنینا، طبقه ۵، واحد ۱۹',
|
|
});
|
|
}
|
|
})
|
|
.catch((err) => {
|
|
console.error('Failed to fetch settings', err);
|
|
})
|
|
.finally(() => {
|
|
if (isSubscribed) setIsLoading(false);
|
|
});
|
|
return () => {
|
|
isSubscribed = false;
|
|
};
|
|
}, []);
|
|
|
|
const handleSave = async (e: React.FormEvent) => {
|
|
e.preventDefault();
|
|
try {
|
|
setIsSaving(true);
|
|
await api.put('/admin/settings', settings);
|
|
toast.success('تنظیمات اصلی فروشگاه با موفقیت ذخیره شد.');
|
|
} catch (err) {
|
|
console.error('Failed to update settings', err);
|
|
toast.error('خطا در ذخیره تنظیمات');
|
|
} finally {
|
|
setIsSaving(false);
|
|
}
|
|
};
|
|
|
|
const SETTING_MODULES = [
|
|
{ title: 'پشتیبان هوشمند سایت', desc: 'فعالسازی، ارائهدهنده و مدل، نام دکمه و آیکون دستیار', path: '/settings/smart-chat', icon: MessageSquare, color: 'from-purple-600 to-purple-800', badge: 'هوشمند' },
|
|
{
|
|
title: 'روشهای پرداخت و زیبال',
|
|
desc: 'درگاه آنلاین شتاب، کیف پول کنینا، کارت به کارت و پرداخت در محل',
|
|
path: '/settings/payment-methods',
|
|
icon: CreditCard,
|
|
color: 'from-indigo-600 to-indigo-800',
|
|
badge: 'مستقل',
|
|
},
|
|
{
|
|
title: 'تنظیمات ارسال و کرایه حمل',
|
|
desc: 'هزینه پستی ثابت، سقف ارسال رایگان و حداقل مبلغ سفارش',
|
|
path: '/settings/shipping',
|
|
icon: Truck,
|
|
color: 'from-blue-600 to-blue-800',
|
|
badge: 'مستقل',
|
|
},
|
|
{
|
|
title: 'تنظیمات مالی، مالیات و خیریه',
|
|
desc: 'درصد مالیات ارزش افزوده، کمک به ردپای مهربانی و تسویه کیف پول',
|
|
path: '/settings/financial',
|
|
icon: DollarSign,
|
|
color: 'from-emerald-600 to-emerald-800',
|
|
badge: 'مالی',
|
|
},
|
|
{
|
|
title: 'تنظیمات سئو و متادیتا (SEO)',
|
|
desc: 'متاتایتل پیشفرض، متادیسکریپشن، کلمات کلیدی و OpenGraph',
|
|
path: '/settings/seo',
|
|
icon: Globe,
|
|
color: 'from-sky-600 to-sky-800',
|
|
badge: 'سئو',
|
|
},
|
|
{
|
|
title: 'تنظیمات سیستمی و کاتالوگمود',
|
|
desc: 'حالت تعمیرات، کاتالوگ آنلاین بدون خرید، خرید کاربر مهمان',
|
|
path: '/settings/system',
|
|
icon: Sliders,
|
|
color: 'from-purple-600 to-purple-800',
|
|
badge: 'سیستم',
|
|
},
|
|
{
|
|
title: 'درگاه پیامک (MeliPayamak)',
|
|
desc: 'پیکربندی وبسرویس، موجودی شارژ زنده، تست پیامک و لاگ ارسالها',
|
|
path: '/settings/sms',
|
|
icon: MessageSquare,
|
|
color: 'from-violet-600 to-violet-800',
|
|
badge: 'پیامک',
|
|
},
|
|
{
|
|
title: 'گواهی امنیتی SSL و کلیدها',
|
|
desc: 'مدیریت دامنه، کلیدهای خصوصی، سرتیفیکیت و تمدید گواهی امنیتی',
|
|
path: '/settings/ssl',
|
|
icon: ShieldCheck,
|
|
color: 'from-teal-600 to-teal-800',
|
|
badge: 'امنیت',
|
|
},
|
|
{
|
|
title: 'پرتال و همکاران عمدهفروشی (B2B)',
|
|
desc: 'درخواستهای نمایندگی، لیست پارتنرها، سقف اعتبار و کد تخفیف',
|
|
path: '/b2b',
|
|
icon: Building2,
|
|
color: 'from-amber-600 to-amber-800',
|
|
badge: 'همکاران',
|
|
},
|
|
];
|
|
|
|
return (
|
|
<div className="space-y-6 font-vazir" dir="rtl">
|
|
{/* Page Header */}
|
|
<div className="flex flex-col sm:flex-row sm:items-center justify-between gap-4">
|
|
<div>
|
|
<h2 className="text-2xl font-black text-gray-900 flex items-center gap-2">
|
|
<SettingsIcon className="w-6 h-6 text-purple-600" />
|
|
تنظیمات اصلی و هویت فروشگاه
|
|
</h2>
|
|
<p className="text-gray-500 font-medium mt-1">
|
|
مدیریت هویت بصری برند، تایپوگرافی، راههای ارتباطی و دسترسی به پنلهای تخصصی
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
{/* Tabs Navigation */}
|
|
<div className="flex items-center gap-2 bg-white p-2 rounded-2xl border border-gray-200 shadow-xs overflow-x-auto no-scrollbar">
|
|
<button
|
|
type="button"
|
|
onClick={() => setActiveTab('brand')}
|
|
className={`px-5 py-2.5 rounded-xl text-xs font-black transition-all flex items-center gap-2 cursor-pointer shrink-0 ${
|
|
activeTab === 'brand'
|
|
? 'bg-purple-600 text-white shadow-sm'
|
|
: 'text-gray-600 hover:bg-gray-50 hover:text-purple-700'
|
|
}`}
|
|
>
|
|
<Palette className="w-4 h-4" />
|
|
<span>هویت برند، لوگو و ظاهر</span>
|
|
</button>
|
|
|
|
<button
|
|
type="button"
|
|
onClick={() => setActiveTab('contact')}
|
|
className={`px-5 py-2.5 rounded-xl text-xs font-black transition-all flex items-center gap-2 cursor-pointer shrink-0 ${
|
|
activeTab === 'contact'
|
|
? 'bg-purple-600 text-white shadow-sm'
|
|
: 'text-gray-600 hover:bg-gray-50 hover:text-purple-700'
|
|
}`}
|
|
>
|
|
<Share2 className="w-4 h-4" />
|
|
<span>راههای ارتباطی و شبکههای اجتماعی</span>
|
|
</button>
|
|
|
|
<button
|
|
type="button"
|
|
onClick={() => setActiveTab('links')}
|
|
className={`px-5 py-2.5 rounded-xl text-xs font-black transition-all flex items-center gap-2 cursor-pointer shrink-0 ${
|
|
activeTab === 'links'
|
|
? 'bg-purple-600 text-white shadow-sm'
|
|
: 'text-gray-600 hover:bg-gray-50 hover:text-purple-700'
|
|
}`}
|
|
>
|
|
<Sparkles className="w-4 h-4" />
|
|
<span>دسترسی به سایر بخشهای تنظیمات ({SETTING_MODULES.length})</span>
|
|
</button>
|
|
</div>
|
|
|
|
{isLoading ? (
|
|
<div className="flex justify-center p-12">
|
|
<Spinner size="lg" className="text-purple-600" />
|
|
</div>
|
|
) : activeTab === 'brand' ? (
|
|
<form onSubmit={handleSave} className="space-y-6">
|
|
<div className="bg-white p-6 rounded-2xl shadow-sm border border-gray-200 space-y-6">
|
|
<h3 className="text-base font-black text-gray-900 border-b border-gray-100 pb-3 flex items-center gap-2">
|
|
<Palette className="w-5 h-5 text-purple-600" />
|
|
مدیریت برند، تایپوگرافی و نماد اعتماد
|
|
</h3>
|
|
|
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-5">
|
|
<div>
|
|
<label className="block text-xs font-bold text-gray-700 mb-1.5">
|
|
لینک فایل لوگوی تصویری (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-3 outline-none focus:ring-2 focus:ring-purple-500 text-xs font-mono"
|
|
placeholder="https://... یا /logo.png (اختیاری)"
|
|
dir="ltr"
|
|
/>
|
|
{settings.BRAND_LOGO_URL && (
|
|
<div className="w-11 h-11 border rounded-xl bg-gray-50 flex items-center justify-center p-1 overflow-hidden shrink-0">
|
|
<img
|
|
src={settings.BRAND_LOGO_URL}
|
|
alt="Preview"
|
|
className="max-w-full max-h-full object-contain"
|
|
/>
|
|
</div>
|
|
)}
|
|
</div>
|
|
<p className="text-[11px] text-gray-400 mt-1">
|
|
در صورت خالی بودن این فیلد، لوگوی متنی زیر در هدر، فوتر و صفحه تعمیرات استفاده خواهد شد.
|
|
</p>
|
|
</div>
|
|
|
|
<div>
|
|
<label className="block text-xs font-bold text-gray-700 mb-1.5">
|
|
متن انگلیسی لوگو (Text Logo EN) *
|
|
</label>
|
|
<input
|
|
type="text"
|
|
required
|
|
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-3 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.5">
|
|
متن فارسی لوگو (Text Logo FA) *
|
|
</label>
|
|
<input
|
|
type="text"
|
|
required
|
|
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-3 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.5">
|
|
زیرعنوان رسمی لوگو (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-3 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.5">
|
|
رنگ اصلی تم سایت (Theme Color)
|
|
</label>
|
|
<div className="flex gap-2">
|
|
<input
|
|
type="color"
|
|
value={settings.THEME_PRIMARY_COLOR}
|
|
onChange={(e) => setSettings({ ...settings, THEME_PRIMARY_COLOR: e.target.value })}
|
|
className="w-11 h-11 rounded-xl cursor-pointer border border-gray-200 p-1"
|
|
/>
|
|
<input
|
|
type="text"
|
|
value={settings.THEME_PRIMARY_COLOR}
|
|
onChange={(e) => setSettings({ ...settings, THEME_PRIMARY_COLOR: e.target.value })}
|
|
className="flex-1 border border-gray-200 rounded-xl p-3 outline-none focus:ring-2 focus:ring-purple-500 text-xs font-mono font-bold"
|
|
dir="ltr"
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
<div>
|
|
<label className="block text-xs font-bold text-gray-700 mb-1.5">
|
|
تایپوگرافی و فونت سراسری سایت
|
|
</label>
|
|
<select
|
|
value={settings.BRAND_TYPOGRAPHY}
|
|
onChange={(e) => setSettings({ ...settings, BRAND_TYPOGRAPHY: e.target.value })}
|
|
className="w-full border border-gray-200 rounded-xl p-3 outline-none focus:ring-2 focus:ring-purple-500 text-xs font-bold bg-white"
|
|
>
|
|
<option value="vazirmatn">وزیرمتن (Vazirmatn)</option>
|
|
<option value="shabnam">شبنم (Shabnam)</option>
|
|
<option value="dana">دانا (Dana)</option>
|
|
<option value="iransans">ایرانسانس (IRANSans)</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div className="md:col-span-2">
|
|
<label className="block text-xs font-bold text-gray-700 mb-1.5">
|
|
کد نماد اعتماد الکترونیکی (Enamad HTML Code)
|
|
</label>
|
|
<textarea
|
|
rows={4}
|
|
value={settings.ENAMAD_CODE}
|
|
onChange={(e) => setSettings({ ...settings, ENAMAD_CODE: e.target.value })}
|
|
placeholder="<a referrerpolicy='origin' target='_blank' href='...'><img src='...' code='...' /></a>"
|
|
className="w-full border border-gray-200 rounded-xl p-3 outline-none focus:ring-2 focus:ring-purple-500 text-xs font-mono bg-slate-50"
|
|
dir="ltr"
|
|
/>
|
|
<p className="text-[11px] text-gray-400 mt-1">
|
|
کد دریافتی از پنل اینماد را در این بخش قرار دهید تا به صورت خودکار در فوتر سایت رندر شود.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div className="flex justify-end">
|
|
<Button
|
|
type="submit"
|
|
variant="primary"
|
|
size="md"
|
|
startIcon={Save}
|
|
isLoading={isSaving}
|
|
>
|
|
ذخیره هویت برند
|
|
</Button>
|
|
</div>
|
|
</form>
|
|
) : activeTab === 'contact' ? (
|
|
<form onSubmit={handleSave} className="space-y-6">
|
|
<div className="bg-white p-6 rounded-2xl shadow-sm border border-gray-200 space-y-6">
|
|
<h3 className="text-base font-black text-gray-900 border-b border-gray-100 pb-3 flex items-center gap-2">
|
|
<Share2 className="w-5 h-5 text-purple-600" />
|
|
راههای ارتباطی، تماس و شبکههای اجتماعی
|
|
</h3>
|
|
|
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-5">
|
|
<div>
|
|
<label className="block text-xs font-bold text-gray-700 mb-1.5">
|
|
متن نمایشی تلفن پشتیبانی و فروش
|
|
</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-3 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.5">
|
|
لینک مستقیم تماس (Phone Link)
|
|
</label>
|
|
<input
|
|
type="text"
|
|
value={settings.CONTACT_PHONE_LINK}
|
|
onChange={(e) => setSettings({ ...settings, CONTACT_PHONE_LINK: e.target.value })}
|
|
placeholder="tel:02188884444"
|
|
className="w-full border border-gray-200 rounded-xl p-3 outline-none focus:ring-2 focus:ring-purple-500 text-xs font-mono"
|
|
dir="ltr"
|
|
/>
|
|
</div>
|
|
|
|
<div>
|
|
<label className="block text-xs font-bold text-gray-700 mb-1.5">ایمیل رسمی پشتیبانی</label>
|
|
<input
|
|
type="email"
|
|
value={settings.CONTACT_EMAIL}
|
|
onChange={(e) => setSettings({ ...settings, CONTACT_EMAIL: e.target.value })}
|
|
placeholder="info@canina.ir"
|
|
className="w-full border border-gray-200 rounded-xl p-3 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.5">شماره واتساپ پشتیبانی</label>
|
|
<input
|
|
type="text"
|
|
value={settings.SOCIAL_WHATSAPP}
|
|
onChange={(e) => setSettings({ ...settings, SOCIAL_WHATSAPP: e.target.value })}
|
|
placeholder="09120000000"
|
|
className="w-full border border-gray-200 rounded-xl p-3 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.5">لینک پیج اینستاگرام</label>
|
|
<input
|
|
type="text"
|
|
value={settings.SOCIAL_INSTAGRAM}
|
|
onChange={(e) => setSettings({ ...settings, SOCIAL_INSTAGRAM: e.target.value })}
|
|
placeholder="https://instagram.com/canina_iran"
|
|
className="w-full border border-gray-200 rounded-xl p-3 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.5">کانال تلگرام</label>
|
|
<input
|
|
type="text"
|
|
value={settings.SOCIAL_TELEGRAM}
|
|
onChange={(e) => setSettings({ ...settings, SOCIAL_TELEGRAM: e.target.value })}
|
|
placeholder="https://t.me/canina_iran"
|
|
className="w-full border border-gray-200 rounded-xl p-3 outline-none focus:ring-2 focus:ring-purple-500 text-xs font-bold"
|
|
dir="ltr"
|
|
/>
|
|
</div>
|
|
|
|
<div className="md:col-span-2">
|
|
<label className="block text-xs font-bold text-gray-700 mb-1.5">آدرس دفتر مرکزی</label>
|
|
<input
|
|
type="text"
|
|
value={settings.CONTACT_ADDRESS}
|
|
onChange={(e) => setSettings({ ...settings, CONTACT_ADDRESS: e.target.value })}
|
|
placeholder="تهران، جردن، ..."
|
|
className="w-full border border-gray-200 rounded-xl p-3 outline-none focus:ring-2 focus:ring-purple-500 text-xs font-bold"
|
|
dir="rtl"
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div className="flex justify-end">
|
|
<Button
|
|
type="submit"
|
|
variant="primary"
|
|
size="md"
|
|
startIcon={Save}
|
|
isLoading={isSaving}
|
|
>
|
|
ذخیره اطلاعات تماس
|
|
</Button>
|
|
</div>
|
|
</form>
|
|
|
|
) : (
|
|
/* Tab 3: Dedicated Modules Grid */
|
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-5">
|
|
{SETTING_MODULES.map((item) => {
|
|
const Icon = item.icon;
|
|
return (
|
|
<Link
|
|
key={item.path}
|
|
to={item.path}
|
|
className="bg-white p-6 rounded-3xl border border-gray-200 shadow-sm hover:shadow-xl hover:border-purple-200 transition-all flex flex-col justify-between group cursor-pointer"
|
|
>
|
|
<div className="space-y-4">
|
|
<div className="flex items-center justify-between">
|
|
<div
|
|
className={`w-12 h-12 rounded-2xl bg-gradient-to-br ${item.color} text-white flex items-center justify-center shadow-md`}
|
|
>
|
|
<Icon className="w-6 h-6" />
|
|
</div>
|
|
<span className="text-[10px] font-black px-2.5 py-1 bg-gray-100 text-gray-600 rounded-lg group-hover:bg-purple-50 group-hover:text-purple-700 transition-colors">
|
|
{item.badge}
|
|
</span>
|
|
</div>
|
|
|
|
<div>
|
|
<h4 className="font-black text-gray-900 text-base group-hover:text-purple-700 transition-colors">
|
|
{item.title}
|
|
</h4>
|
|
<p className="text-xs text-gray-500 font-medium mt-1 leading-relaxed">
|
|
{item.desc}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div className="pt-4 border-t border-gray-100 flex items-center justify-between text-xs font-black text-purple-700 mt-4">
|
|
<span>ورود به تنظیمات</span>
|
|
<ChevronLeft className="w-4 h-4 group-hover:-translate-x-1 transition-transform" />
|
|
</div>
|
|
</Link>
|
|
);
|
|
})}
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|