From 87999be3d2d9ce32dab277615a767d7eda266333 Mon Sep 17 00:00:00 2001 From: devops Date: Sun, 18 Oct 2026 17:55:37 +0000 Subject: [PATCH] fix(frontend): comprehensive SEO, A11y, media upload validation, and logging enhancements [FE-013 to FE-022] --- .../src/components/ui/MediaSelector.tsx | 17 +++++++++++++++++ frontend/application/app/ClientLayout.tsx | 2 +- frontend/application/app/error.tsx | 4 +++- frontend/application/app/layout.tsx | 6 ++++++ frontend/application/app/search/page.tsx | 1 + frontend/application/app/sitemap.ts | 7 +------ frontend/application/components/Hero.tsx | 1 + frontend/application/components/ProductPage.tsx | 4 ++-- .../application/components/SmartAdvisor.tsx | 8 ++++++-- frontend/application/lib/seo.ts | 4 ++++ 10 files changed, 42 insertions(+), 12 deletions(-) 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 &&