From ad0acaccc280467dbe0b8f200eb95d779a856f45 Mon Sep 17 00:00:00 2001 From: devops Date: Sun, 18 Oct 2026 18:34:52 +0000 Subject: [PATCH] refactor(admin): extract ProductFaqTab component from monolithic Products.tsx [FE-020] --- .../src/components/products/ProductFaqTab.tsx | 147 +++++++++++++++++ frontend/admin-panel/src/pages/Products.tsx | 153 +----------------- 2 files changed, 154 insertions(+), 146 deletions(-) create mode 100644 frontend/admin-panel/src/components/products/ProductFaqTab.tsx diff --git a/frontend/admin-panel/src/components/products/ProductFaqTab.tsx b/frontend/admin-panel/src/components/products/ProductFaqTab.tsx new file mode 100644 index 00000000..cb8b9808 --- /dev/null +++ b/frontend/admin-panel/src/components/products/ProductFaqTab.tsx @@ -0,0 +1,147 @@ +import React from 'react'; +import { HelpCircle, Plus, Trash2 } from 'lucide-react'; +import Button from '../ui/Button'; + +interface ProductFaqTabProps { + activeTab: string; + formData: any; + setFormData: React.Dispatch>; +} + +export const ProductFaqTab: React.FC = ({ + activeTab, + formData, + setFormData, +}) => { + return ( +
+ {/* Top FAQ Controls */} +
+
+
+

+ + بخش پرسش و پاسخ‌های متداول محصول (Product FAQs) +

+

مدیریت آکاردئون پرسش‌های متداول در صفحه کالا و ثبت خودکار در سئوی گوگل (FAQPage Schema)

+
+
+ + + {formData.showFaqs ? 'بخش FAQ فعال است' : 'بخش FAQ غیرفعال است'} + +
+
+ +
+ + + +
+
+ + {/* FAQs List */} +
+ {(!formData.faqs || formData.faqs.length === 0) ? ( +
+ +

هیچ پرسش و پاسخی برای این محصول تعریف نشده است.

+

با کلیک روی دکمه «افزودن سوال جدید» یا «درج سوالات پیشنهادی»، متداول‌ترین پرسش‌های خریداران را ثبت کنید.

+
+ ) : ( + formData.faqs.map((faq: any, index: number) => ( +
+
+ + پرسش شماره {index + 1} + + +
+ +
+ + { + const newFaqs = [...formData.faqs]; + newFaqs[index].question = e.target.value; + setFormData({ ...formData, faqs: newFaqs }); + }} + placeholder="مثال: نحوه مصرف همراه با غذاست یا با معده خالی؟" + className="w-full px-4 py-2.5 rounded-xl border border-gray-200 focus:border-purple-500 outline-none text-xs font-bold" + dir="rtl" + /> +
+ +
+ +