diff --git a/frontend/admin-panel/src/components/ui/MediaSelector.tsx b/frontend/admin-panel/src/components/ui/MediaSelector.tsx index 2befb4dd..0d2d7b3e 100644 --- a/frontend/admin-panel/src/components/ui/MediaSelector.tsx +++ b/frontend/admin-panel/src/components/ui/MediaSelector.tsx @@ -202,6 +202,23 @@ export default function MediaSelector({ isOpen, onClose, onSelect, multiple = fa const files = Array.from(e.dataTransfer.files); if (files.length === 0) return; + const ALLOWED_MIME_TYPES = ['image/jpeg', 'image/png', 'image/webp', 'image/svg+xml', 'image/gif', 'application/pdf']; + const MAX_FILE_SIZE = 15 * 1024 * 1024; // 15MB + + const validFiles = files.filter(f => { + if (!ALLOWED_MIME_TYPES.includes(f.type) && !f.type.startsWith('image/')) { + toast.error(`فرمت فایل ${f.name} مجاز نمی‌باشد.`); + return false; + } + if (f.size > MAX_FILE_SIZE) { + toast.error(`حجم فایل ${f.name} بیش از حد مجاز (حداکثر ۱۵ مگابایت) است.`); + return false; + } + return true; + }); + + if (validFiles.length === 0) return; + setIsUploading(true); let successCount = 0; try { diff --git a/frontend/application/app/ClientLayout.tsx b/frontend/application/app/ClientLayout.tsx index d5f8d746..66a8a01a 100644 --- a/frontend/application/app/ClientLayout.tsx +++ b/frontend/application/app/ClientLayout.tsx @@ -176,7 +176,7 @@ export default function ClientLayout({ children }: { children: React.ReactNode } onSearch={handleSearch} onB2BOpen={() => setB2BPortalOpen(true)} /> -
+
{children}
{!isUtilityRoute &&