تغییرات کلی در backend و frontend
This commit is contained in:
1 parent
a74f4bda48
commit
3dedc89ee1
41 files changed
+2373
-1957
No files matched your search
@@ -58,55 +58,53 @@ export default function Sidebar({ isOpen, setIsOpen }: SidebarProps) {
|
||||
<>
|
||||
{/* Mobile Backdrop */}
|
||||
{isOpen && (
|
||||
<div
|
||||
<div
|
||||
className="fixed inset-0 bg-black/50 z-40 lg:hidden backdrop-blur-sm"
|
||||
onClick={() => setIsOpen(false)}
|
||||
/>
|
||||
)}
|
||||
|
||||
<aside className={`w-64 bg-white border-l border-gray-200 h-screen fixed lg:sticky top-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>
|
||||
</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;
|
||||
|
||||
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>
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</nav>
|
||||
|
||||
<div className="p-4 border-t border-gray-200">
|
||||
<button onClick={handleLogout} className="flex items-center gap-3 px-3 py-3 w-full text-red-500 hover:bg-red-50 rounded-xl transition-all font-bold">
|
||||
<LogOut className="w-5 h-5" />
|
||||
<span>خروج از حساب</span>
|
||||
</button>
|
||||
</div>
|
||||
</aside>
|
||||
<aside className={`w-64 bg-white border-l border-gray-200 h-screen fixed lg:sticky top-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>
|
||||
</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;
|
||||
|
||||
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>
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</nav>
|
||||
|
||||
<div className="p-4 border-t border-gray-200">
|
||||
<button onClick={handleLogout} className="flex items-center gap-3 px-3 py-3 w-full text-red-500 hover:bg-red-50 rounded-xl transition-all font-bold">
|
||||
<LogOut className="w-5 h-5" />
|
||||
<span>خروج از حساب</span>
|
||||
</button>
|
||||
</div>
|
||||
</aside>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -53,7 +53,7 @@ export default function Dashboard() {
|
||||
<div className="space-y-6">
|
||||
<div>
|
||||
<h2 className="text-2xl font-black text-gray-900">داشبورد</h2>
|
||||
<p className="text-gray-500 font-medium mt-1">خلاصهای از وضعیت فروشگاه کانینو</p>
|
||||
<p className="text-gray-500 font-medium mt-1">خلاصهای از وضعیت فروشگاه کانینو</p>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
|
||||
|
||||
@@ -12,7 +12,7 @@ export default function Login() {
|
||||
const handleLogin = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
setIsLoading(true);
|
||||
|
||||
|
||||
try {
|
||||
const response = await api.post('/auth/admin-login', { email, password });
|
||||
if (response.data?.success) {
|
||||
@@ -36,7 +36,7 @@ export default function Login() {
|
||||
ورود به پنل مدیریت
|
||||
</h2>
|
||||
<p className="mt-2 text-center text-sm text-gray-600 font-bold">
|
||||
کانینو | لابراتوار تخصصی مکملهای درمانی حیوانات
|
||||
کانینو | لابراتوار تخصصی مکملهای درمانی حیوانات
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ export default function Settings() {
|
||||
<SettingsIcon className="w-6 h-6 text-purple-600" />
|
||||
تنظیمات فروشگاه
|
||||
</h2>
|
||||
<p className="text-gray-500 font-medium mt-1">مدیریت پارامترهای اصلی و سیستمی کانینو</p>
|
||||
<p className="text-gray-500 font-medium mt-1">مدیریت پارامترهای اصلی و سیستمی کانینو</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -65,21 +65,21 @@ export default function Settings() {
|
||||
<div className="flex justify-center p-12"><Spinner size="lg" className="text-purple-600" /></div>
|
||||
) : (
|
||||
<form onSubmit={handleSave} className="grid grid-cols-1 lg:grid-cols-2 gap-6">
|
||||
|
||||
|
||||
{/* Financial Settings */}
|
||||
<div className="bg-white p-6 rounded-2xl shadow-sm border border-gray-200 space-y-6">
|
||||
<h3 className="text-lg font-bold text-gray-900 border-b border-gray-100 pb-4 flex items-center gap-2">
|
||||
<Truck className="w-5 h-5 text-blue-500" />
|
||||
تنظیمات مالی و ارسال
|
||||
</h3>
|
||||
|
||||
|
||||
<div className="space-y-5">
|
||||
<div>
|
||||
<label className="block text-sm font-bold text-gray-700 mb-2">هزینه ثابت ارسال (تومان)</label>
|
||||
<input
|
||||
type="number"
|
||||
<input
|
||||
type="number"
|
||||
value={settings.SHIPPING_FEE}
|
||||
onChange={(e) => setSettings({...settings, SHIPPING_FEE: e.target.value})}
|
||||
onChange={(e) => setSettings({ ...settings, SHIPPING_FEE: e.target.value })}
|
||||
className="w-full border border-gray-200 rounded-xl p-3 outline-none focus:ring-2 focus:ring-purple-500 font-bold"
|
||||
dir="ltr"
|
||||
/>
|
||||
@@ -87,10 +87,10 @@ export default function Settings() {
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-bold text-gray-700 mb-2">حداقل مبلغ سفارش (تومان)</label>
|
||||
<input
|
||||
type="number"
|
||||
<input
|
||||
type="number"
|
||||
value={settings.MIN_ORDER_AMOUNT}
|
||||
onChange={(e) => setSettings({...settings, MIN_ORDER_AMOUNT: e.target.value})}
|
||||
onChange={(e) => setSettings({ ...settings, MIN_ORDER_AMOUNT: e.target.value })}
|
||||
className="w-full border border-gray-200 rounded-xl p-3 outline-none focus:ring-2 focus:ring-purple-500 font-bold"
|
||||
dir="ltr"
|
||||
/>
|
||||
@@ -105,14 +105,14 @@ export default function Settings() {
|
||||
<Percent className="w-5 h-5 text-green-500" />
|
||||
همکاران B2B
|
||||
</h3>
|
||||
|
||||
|
||||
<div className="space-y-5">
|
||||
<div>
|
||||
<label className="block text-sm font-bold text-gray-700 mb-2">تخفیف پیشفرض همکار (درصد)</label>
|
||||
<input
|
||||
type="number"
|
||||
<input
|
||||
type="number"
|
||||
value={settings.B2B_DISCOUNT_PERCENT}
|
||||
onChange={(e) => setSettings({...settings, B2B_DISCOUNT_PERCENT: e.target.value})}
|
||||
onChange={(e) => setSettings({ ...settings, B2B_DISCOUNT_PERCENT: e.target.value })}
|
||||
className="w-full border border-gray-200 rounded-xl p-3 outline-none focus:ring-2 focus:ring-purple-500 font-bold"
|
||||
dir="ltr"
|
||||
max="100"
|
||||
@@ -129,7 +129,7 @@ export default function Settings() {
|
||||
<ShieldAlert className="w-5 h-5 text-orange-500" />
|
||||
وضعیت سیستم
|
||||
</h3>
|
||||
|
||||
|
||||
<div className="flex items-center justify-between p-4 bg-orange-50 rounded-xl border border-orange-100">
|
||||
<div className="flex items-center gap-3">
|
||||
<AlertCircle className="w-6 h-6 text-orange-500" />
|
||||
@@ -139,11 +139,11 @@ export default function Settings() {
|
||||
</div>
|
||||
</div>
|
||||
<label className="relative inline-flex items-center cursor-pointer">
|
||||
<input
|
||||
type="checkbox"
|
||||
<input
|
||||
type="checkbox"
|
||||
className="sr-only peer"
|
||||
checked={settings.MAINTENANCE_MODE === 'true'}
|
||||
onChange={(e) => setSettings({...settings, MAINTENANCE_MODE: e.target.checked ? 'true' : 'false'})}
|
||||
onChange={(e) => setSettings({ ...settings, MAINTENANCE_MODE: e.target.checked ? 'true' : 'false' })}
|
||||
/>
|
||||
<div className="w-14 h-7 bg-gray-200 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-6 after:w-6 after:transition-all peer-checked:bg-orange-500"></div>
|
||||
</label>
|
||||
@@ -151,7 +151,7 @@ export default function Settings() {
|
||||
</div>
|
||||
|
||||
<div className="lg:col-span-2 flex justify-end">
|
||||
<button
|
||||
<button
|
||||
type="submit"
|
||||
disabled={isSaving}
|
||||
className="bg-purple-600 hover:bg-purple-700 text-white font-bold py-3 px-8 rounded-xl transition-colors flex items-center gap-2 shadow-md shadow-purple-200"
|
||||
|
||||
@@ -14,7 +14,7 @@ export default function Wiki() {
|
||||
|
||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||
const [editingTerm, setEditingTerm] = useState<any>(null);
|
||||
|
||||
|
||||
const [formData, setFormData] = useState({
|
||||
key: '',
|
||||
term: '',
|
||||
@@ -100,11 +100,11 @@ export default function Wiki() {
|
||||
<div>
|
||||
<h2 className="text-2xl font-black text-gray-900 flex items-center gap-2">
|
||||
<BookOpen className="w-6 h-6 text-purple-600" />
|
||||
دانشنامه کانینو (Wiki)
|
||||
دانشنامه کانینو (Wiki)
|
||||
</h2>
|
||||
<p className="text-gray-500 font-medium mt-1">مدیریت اصطلاحات علمی، مواد تشکیلدهنده و خواص درمانی</p>
|
||||
</div>
|
||||
<button
|
||||
<button
|
||||
onClick={() => openModal()}
|
||||
className="bg-purple-600 hover:bg-purple-700 text-white px-5 py-2.5 rounded-xl flex items-center gap-2 font-bold transition-all shadow-md shadow-purple-200"
|
||||
>
|
||||
@@ -116,9 +116,9 @@ export default function Wiki() {
|
||||
<div className="bg-white p-4 rounded-2xl shadow-sm border border-gray-200 flex flex-col sm:flex-row gap-4">
|
||||
<div className="relative flex-1">
|
||||
<Search className="w-5 h-5 absolute right-4 top-1/2 -translate-y-1/2 text-gray-400" />
|
||||
<input
|
||||
type="text"
|
||||
placeholder="جستجو در اصطلاحات..."
|
||||
<input
|
||||
type="text"
|
||||
placeholder="جستجو در اصطلاحات..."
|
||||
value={search}
|
||||
onChange={(e) => { setSearch(e.target.value); setPage(1); }}
|
||||
className="w-full pl-4 pr-12 py-3 rounded-xl border border-gray-200 focus:border-purple-500 outline-none transition-all"
|
||||
@@ -178,44 +178,44 @@ export default function Wiki() {
|
||||
<XCircle className="w-6 h-6" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="p-6 overflow-y-auto flex-1">
|
||||
<form id="wikiForm" onSubmit={handleSave} className="space-y-6">
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-bold text-gray-700">شناسه یکتا (Key) *</label>
|
||||
<input required type="text" value={formData.key} disabled={!!editingTerm} dir="ltr" onChange={(e) => setFormData({...formData, key: e.target.value})} className="w-full px-4 py-3 rounded-xl border border-gray-200 focus:border-purple-500 outline-none font-mono text-sm disabled:bg-gray-100" />
|
||||
<input required type="text" value={formData.key} disabled={!!editingTerm} dir="ltr" onChange={(e) => setFormData({ ...formData, key: e.target.value })} className="w-full px-4 py-3 rounded-xl border border-gray-200 focus:border-purple-500 outline-none font-mono text-sm disabled:bg-gray-100" />
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-bold text-gray-700">نام اصطلاح (Term) *</label>
|
||||
<input required type="text" value={formData.term} onChange={(e) => setFormData({...formData, term: e.target.value})} className="w-full px-4 py-3 rounded-xl border border-gray-200 focus:border-purple-500 outline-none" />
|
||||
<input required type="text" value={formData.term} onChange={(e) => setFormData({ ...formData, term: e.target.value })} className="w-full px-4 py-3 rounded-xl border border-gray-200 focus:border-purple-500 outline-none" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-bold text-gray-700">توضیح علمی *</label>
|
||||
<textarea required value={formData.definition} onChange={(e) => setFormData({...formData, definition: e.target.value})} rows={5} className="w-full px-4 py-3 rounded-xl border border-gray-200 focus:border-purple-500 outline-none"></textarea>
|
||||
<textarea required value={formData.definition} onChange={(e) => setFormData({ ...formData, definition: e.target.value })} rows={5} className="w-full px-4 py-3 rounded-xl border border-gray-200 focus:border-purple-500 outline-none"></textarea>
|
||||
</div>
|
||||
|
||||
<div className="space-y-4 border border-gray-200 p-4 rounded-xl bg-gray-50/50">
|
||||
<h4 className="font-bold text-purple-700 text-sm mb-2">تنظیمات سئو (SEO)</h4>
|
||||
<div className="space-y-2">
|
||||
<label className="text-xs font-bold text-gray-700">عنوان متا</label>
|
||||
<input type="text" value={formData.metaTitle} onChange={(e) => setFormData({...formData, metaTitle: e.target.value})} className="w-full px-3 py-2 rounded-lg border border-gray-200 focus:border-purple-500 outline-none text-sm" />
|
||||
<input type="text" value={formData.metaTitle} onChange={(e) => setFormData({ ...formData, metaTitle: e.target.value })} className="w-full px-3 py-2 rounded-lg border border-gray-200 focus:border-purple-500 outline-none text-sm" />
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label className="text-xs font-bold text-gray-700">کلمات کلیدی</label>
|
||||
<input type="text" value={formData.keywords} onChange={(e) => setFormData({...formData, keywords: e.target.value})} className="w-full px-3 py-2 rounded-lg border border-gray-200 focus:border-purple-500 outline-none text-sm" />
|
||||
<input type="text" value={formData.keywords} onChange={(e) => setFormData({ ...formData, keywords: e.target.value })} className="w-full px-3 py-2 rounded-lg border border-gray-200 focus:border-purple-500 outline-none text-sm" />
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label className="text-xs font-bold text-gray-700">توضیحات متا</label>
|
||||
<textarea rows={2} value={formData.metaDescription} onChange={(e) => setFormData({...formData, metaDescription: e.target.value})} className="w-full px-3 py-2 rounded-lg border border-gray-200 focus:border-purple-500 outline-none text-sm"></textarea>
|
||||
<textarea rows={2} value={formData.metaDescription} onChange={(e) => setFormData({ ...formData, metaDescription: e.target.value })} className="w-full px-3 py-2 rounded-lg border border-gray-200 focus:border-purple-500 outline-none text-sm"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="p-4 border-t border-gray-100 bg-gray-50 flex justify-end gap-3 rounded-b-2xl">
|
||||
<button type="button" onClick={() => setIsModalOpen(false)} className="px-5 py-2.5 rounded-xl font-bold text-gray-600 hover:bg-gray-200 transition-colors">انصراف</button>
|
||||
<button type="submit" form="wikiForm" className="bg-purple-600 hover:bg-purple-700 text-white px-8 py-2.5 rounded-xl font-bold transition-all shadow-md shadow-purple-200">ذخیره</button>
|
||||
|
||||
Reference in new issue
Block a user