feat: restore profile pets dropdown, fix logout handler, cleanup task titles, fix maintenance guard, add catalog settings & shipping fee calculation
Deploy Canina / deploy (push) Waiting to run

This commit is contained in:
parsa aghaei committed 2026-08-05 14:17:13 +03:30
1 parent c79b0fa394
commit 81a2837c04
5 files changed
+196 -40

No files matched your search

@@ -190,7 +190,10 @@ export default function Topbar({ toggleMenu }: TopbarProps) {
</button>
<div className="border-t border-gray-100 my-1"></div>
<button
onClick={handleLogout}
onClick={() => {
setShowUserMenu(false);
handleLogout();
}}
className="w-full text-right px-3 py-2 text-xs font-bold text-red-600 hover:bg-red-50 rounded-xl transition-colors flex items-center justify-between"
>
<span>خروج از حساب</span>
+73 -19
View File
@@ -11,6 +11,10 @@ export default function Settings() {
B2B_DISCOUNT_PERCENT: '',
MAINTENANCE_MODE: 'false',
CATALOG_ONLY_MODE: 'false',
CATALOG_SHOW_PRICES: 'true',
CATALOG_ALLOW_CART: 'false',
CATALOG_ALLOW_CHECKOUT: 'false',
CATALOG_PREORDER_BTN: 'false',
CHARITY_ROUND_STEP: '10000',
PAY_GATEWAY_CARD_ENABLE: 'true',
PAY_GATEWAY_WALLET_ENABLE: 'true',
@@ -41,6 +45,10 @@ export default function Settings() {
B2B_DISCOUNT_PERCENT: response.data.data.B2B_DISCOUNT_PERCENT || '0',
MAINTENANCE_MODE: response.data.data.MAINTENANCE_MODE || 'false',
CATALOG_ONLY_MODE: response.data.data.CATALOG_ONLY_MODE || 'false',
CATALOG_SHOW_PRICES: response.data.data.CATALOG_SHOW_PRICES || 'true',
CATALOG_ALLOW_CART: response.data.data.CATALOG_ALLOW_CART || 'false',
CATALOG_ALLOW_CHECKOUT: response.data.data.CATALOG_ALLOW_CHECKOUT || 'false',
CATALOG_PREORDER_BTN: response.data.data.CATALOG_PREORDER_BTN || 'false',
CHARITY_ROUND_STEP: response.data.data.CHARITY_ROUND_STEP || '10000',
PAY_GATEWAY_CARD_ENABLE: response.data.data.PAY_GATEWAY_CARD_ENABLE || 'true',
PAY_GATEWAY_WALLET_ENABLE: response.data.data.PAY_GATEWAY_WALLET_ENABLE || 'true',
@@ -320,11 +328,11 @@ export default function Settings() {
</div>
</div>
{/* Brand Identity & Theme Settings (TASK-2.15) */}
{/* Brand Identity & Theme Settings */}
<div className="bg-white p-6 rounded-2xl shadow-sm border border-gray-200 space-y-6 lg:col-span-2">
<h3 className="text-lg font-bold text-gray-900 border-b border-gray-100 pb-4 flex items-center gap-2">
<SettingsIcon className="w-5 h-5 text-purple-600" />
مدیریت هویت برند، نمادها و ظاهر سایت (TASK-2.15)
مدیریت هویت برند، نمادها و ظاهر سایت
</h3>
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
@@ -386,11 +394,11 @@ export default function Settings() {
</div>
</div>
{/* System Settings (TASK-2.14) */}
{/* System Settings */}
<div className="bg-white p-6 rounded-2xl shadow-sm border border-gray-200 space-y-6 lg:col-span-2">
<h3 className="text-lg font-bold text-gray-900 border-b border-gray-100 pb-4 flex items-center gap-2">
<ShieldAlert className="w-5 h-5 text-orange-500" />
وضعیت سیستم و کنترل حالت کاتالوگ (TASK-2.14)
وضعیت سیستم و کنترل حالت کاتالوگ
</h3>
<div className="space-y-4">
@@ -413,23 +421,69 @@ export default function Settings() {
</label>
</div>
<div className="flex items-center justify-between p-4 bg-purple-50 rounded-xl border border-purple-100">
<div className="flex items-center gap-3">
<AlertCircle className="w-6 h-6 text-purple-600" />
<div>
<h4 className="font-bold text-gray-900 text-sm">حالت کاتالوگ بدون خرید (Catalog Only Mode)</h4>
<p className="text-xs text-gray-600 mt-0.5">با فعال‌سازی این گزینه، دکمه‌های افزودن به سبد خرید غیرفعال شده و سایت به کاتالوگ آنلاین تبدیل می‌شود.</p>
<div className="p-4 bg-purple-50 rounded-xl border border-purple-100 space-y-4">
<div className="flex items-center justify-between">
<div className="flex items-center gap-3">
<AlertCircle className="w-6 h-6 text-purple-600" />
<div>
<h4 className="font-bold text-gray-900 text-sm">حالت کاتالوگ بدون خرید (Catalog Only Mode)</h4>
<p className="text-xs text-gray-600 mt-0.5">با فعال‌سازی این گزینه، فروش مستقیم کالا غیرفعال شده و سایت به کاتالوگ هوشمند آنلاین تبدیل می‌شود.</p>
</div>
</div>
<label className="relative inline-flex items-center cursor-pointer">
<input
type="checkbox"
className="sr-only peer"
checked={settings.CATALOG_ONLY_MODE === 'true'}
onChange={(e) => setSettings({ ...settings, CATALOG_ONLY_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-purple-600"></div>
</label>
</div>
<label className="relative inline-flex items-center cursor-pointer">
<input
type="checkbox"
className="sr-only peer"
checked={settings.CATALOG_ONLY_MODE === 'true'}
onChange={(e) => setSettings({ ...settings, CATALOG_ONLY_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-purple-600"></div>
</label>
{settings.CATALOG_ONLY_MODE === 'true' && (
<div className="pt-3 border-t border-purple-200/60 grid grid-cols-1 md:grid-cols-2 gap-3 text-xs">
<label className="flex items-center gap-2 font-bold text-gray-800 cursor-pointer">
<input
type="checkbox"
checked={settings.CATALOG_SHOW_PRICES === 'true'}
onChange={(e) => setSettings({ ...settings, CATALOG_SHOW_PRICES: e.target.checked ? 'true' : 'false' })}
className="rounded text-purple-600 focus:ring-purple-500"
/>
<span>نمایش قیمت محصولات در حالت کاتالوگ</span>
</label>
<label className="flex items-center gap-2 font-bold text-gray-800 cursor-pointer">
<input
type="checkbox"
checked={settings.CATALOG_ALLOW_CART === 'true'}
onChange={(e) => setSettings({ ...settings, CATALOG_ALLOW_CART: e.target.checked ? 'true' : 'false' })}
className="rounded text-purple-600 focus:ring-purple-500"
/>
<span>امکان افزودن به سبد خرید</span>
</label>
<label className="flex items-center gap-2 font-bold text-gray-800 cursor-pointer">
<input
type="checkbox"
checked={settings.CATALOG_ALLOW_CHECKOUT === 'true'}
onChange={(e) => setSettings({ ...settings, CATALOG_ALLOW_CHECKOUT: e.target.checked ? 'true' : 'false' })}
className="rounded text-purple-600 focus:ring-purple-500"
/>
<span>امکان ورود به صفحه تسویه‌حساب (ثبت فاکتور)</span>
</label>
<label className="flex items-center gap-2 font-bold text-gray-800 cursor-pointer">
<input
type="checkbox"
checked={settings.CATALOG_PREORDER_BTN === 'true'}
onChange={(e) => setSettings({ ...settings, CATALOG_PREORDER_BTN: e.target.checked ? 'true' : 'false' })}
className="rounded text-purple-600 focus:ring-purple-500"
/>
<span>نمایش دکمه «ثبت پیش‌خرید» به جای ثبت سفارش</span>
</label>
</div>
)}
</div>
</div>
</div>