feat(seo): cover all 15 app routes in page builder with live google serp preview box
Deploy Canina / deploy (push) Has been cancelled
Deploy Canina / deploy (push) Has been cancelled
This commit is contained in:
1 parent
47437883dd
commit
3ea1d0d8c1
12 files changed
+8689
-7911
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useEffect, useRef } from 'react';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import {
|
||||
Languages,
|
||||
Save,
|
||||
@@ -31,6 +31,13 @@ import {
|
||||
Award,
|
||||
Video,
|
||||
Info,
|
||||
Truck,
|
||||
CreditCard,
|
||||
User,
|
||||
Shield,
|
||||
Smartphone,
|
||||
Monitor,
|
||||
Sparkle,
|
||||
} from 'lucide-react';
|
||||
import { toast } from 'react-hot-toast';
|
||||
import api, { BASE_DOMAIN } from '../services/api';
|
||||
@@ -41,7 +48,7 @@ import MediaSelector from '../components/ui/MediaSelector';
|
||||
import RichTextEditor from '../components/ui/RichTextEditor';
|
||||
import IconPickerModal, { ICON_REGISTRY } from '../components/ui/IconPickerModal';
|
||||
|
||||
// Classic v1 Groupings
|
||||
// Classic v1 Groupings (Backward Compatibility)
|
||||
const V1_PAGE_TABS = [
|
||||
{ id: 'all', label: 'همه بخشها', icon: Layout },
|
||||
{ id: 'hero', label: 'بنر اصلی (Hero)', icon: Sliders },
|
||||
@@ -201,7 +208,7 @@ const V1_GROUP_PAGE_MAP: Record<string, string> = {
|
||||
interface SectionField {
|
||||
key: string;
|
||||
label: string;
|
||||
type: 'rich-text' | 'text' | 'image' | 'icon' | 'boolean';
|
||||
type: 'rich-text' | 'text' | 'image' | 'icon' | 'boolean' | 'textarea';
|
||||
description?: string;
|
||||
defaultVal?: string;
|
||||
}
|
||||
@@ -210,6 +217,7 @@ interface PageSection {
|
||||
id: string;
|
||||
title: string;
|
||||
icon: React.ComponentType<{ className?: string }>;
|
||||
isSeo?: boolean;
|
||||
fields: SectionField[];
|
||||
}
|
||||
|
||||
@@ -221,6 +229,44 @@ interface AppSitePage {
|
||||
sections: PageSection[];
|
||||
}
|
||||
|
||||
// Generate Standard SEO Section Fields for any Page
|
||||
const createSeoSection = (pagePrefix: string, pageNameFa: string, defaultMetaTitle: string, defaultMetaDesc: string): PageSection => ({
|
||||
id: 'seo',
|
||||
title: 'تنظیمات سئو و پیشنمایش گوگل (Google SERP)',
|
||||
icon: Globe,
|
||||
isSeo: true,
|
||||
fields: [
|
||||
{
|
||||
key: `${pagePrefix}_meta_title`,
|
||||
label: `عنوان صفحه در گوگل (Meta Title) - ${pageNameFa}`,
|
||||
type: 'text',
|
||||
description: 'حداکثر ۶۰ کاراکتر - عنوانی که در تب مرورگر و عنوان آبیرنگ گوگل ظاهر میشود.',
|
||||
defaultVal: defaultMetaTitle,
|
||||
},
|
||||
{
|
||||
key: `${pagePrefix}_meta_desc`,
|
||||
label: `توضیحات متا (Meta Description) - ${pageNameFa}`,
|
||||
type: 'textarea',
|
||||
description: 'حداکثر ۱۵۵ کاراکتر - چکیده محتوای صفحه برای ترغیب کلیک در نتایج جستجو.',
|
||||
defaultVal: defaultMetaDesc,
|
||||
},
|
||||
{
|
||||
key: `${pagePrefix}_keywords`,
|
||||
label: 'کلمات کلیدی سئو (Keywords)',
|
||||
type: 'text',
|
||||
description: 'کلمات کلیدی مرتبط که با کاما (,) از یکدیگر تفکیک شدهاند.',
|
||||
defaultVal: 'کنینا, مکمل تخصصی سگ و گربه, داروی پت, کنینا آلمان',
|
||||
},
|
||||
{
|
||||
key: `${pagePrefix}_canonical`,
|
||||
label: 'آدرس کانونیکال اختصاصی (Canonical URL)',
|
||||
type: 'text',
|
||||
description: 'آدرس اصلی این صفحه جهت جلوگیری از خطای Duplicate Content در موتورهای جستجو.',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
// Full Application Pages Registry (All 15 routes from frontend/application/app)
|
||||
const SITE_PAGES: AppSitePage[] = [
|
||||
{
|
||||
id: 'home',
|
||||
@@ -228,6 +274,7 @@ const SITE_PAGES: AppSitePage[] = [
|
||||
path: '/',
|
||||
icon: Home,
|
||||
sections: [
|
||||
createSeoSection('home', 'صفحه اصلی', 'کنینا ایران | نماینده رسمی مکملهای دارویی Canina آلمان', 'فروشگاه تخصصی و نماینده انحصاری مکملهای درمانی و تقویتی سگ و گربه کنینا آلمان با فرمولاسیون دارویی و تاییدیه بالینی.'),
|
||||
{
|
||||
id: 'hero',
|
||||
title: 'بنر اصلی (Hero Banner)',
|
||||
@@ -314,10 +361,11 @@ const SITE_PAGES: AppSitePage[] = [
|
||||
},
|
||||
{
|
||||
id: 'shop',
|
||||
title: 'فروشگاه و کاتالوگ (Shop & Catalog)',
|
||||
title: 'فروشگاه و محصولات (Shop)',
|
||||
path: '/shop',
|
||||
icon: ShoppingBag,
|
||||
sections: [
|
||||
createSeoSection('shop', 'فروشگاه', 'فروشگاه مکملهای تخصصی سگ و گربه | کنینا ایران', 'خرید آنلاین انواع مکملهای دارویی مفاصل، پوست و مو، گوارش و ویتامینه سگ و گربه با تضمین اصالت کالا و مشاوره بالینی.'),
|
||||
{
|
||||
id: 'shop_header',
|
||||
title: 'هدر و فیلترهای فروشگاه',
|
||||
@@ -333,65 +381,98 @@ const SITE_PAGES: AppSitePage[] = [
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'advisor',
|
||||
title: 'مشاور هوشمند سلامت پت (Smart Advisor)',
|
||||
path: '/#canino-advisor',
|
||||
icon: HelpCircle,
|
||||
id: 'catalog',
|
||||
title: 'کاتالوگ ورقزن دیجیتال (Digital Catalog)',
|
||||
path: '/catalog',
|
||||
icon: BookOpen,
|
||||
sections: [
|
||||
createSeoSection('catalog', 'کاتالوگ دیجیتال', 'کاتالوگ آنلاین و تعاملی محصولات دارویی کنینا | Canina Flipbook', 'مشاهده و مطالعه کاتالوگ جامع دارویی و مکملهای تغذیهای تخصصی کنینا با قابلیت تورق تعاملی و ثبت پیشخرید.'),
|
||||
{
|
||||
id: 'advisor_general',
|
||||
title: 'عناوین و مراحل دستیار هوشمند',
|
||||
icon: HelpCircle,
|
||||
id: 'catalog_header',
|
||||
title: 'محتوا و راهنمای کاتالوگ',
|
||||
icon: BookOpen,
|
||||
fields: [
|
||||
{ key: 'advisor_badge', label: 'بج بالای مشاور هوشمند', type: 'text' },
|
||||
{ key: 'advisor_title', label: 'عنوان مشاور هوشمند (H2)', type: 'rich-text' },
|
||||
{ key: 'advisor_subtitle', label: 'زیرعنوان و شعار تشخیصی', type: 'rich-text' },
|
||||
{ key: 'advisor_step1_title', label: 'عنوان مرحله ۱ (مشخصات پت)', type: 'text' },
|
||||
{ key: 'advisor_step1_desc', label: 'توضیحات مرحله ۱', type: 'text' },
|
||||
{ key: 'advisor_pet_name_label', label: 'برچسب نام پت', type: 'text' },
|
||||
{ key: 'advisor_pet_breed_label', label: 'برچسب نژاد پت', type: 'text' },
|
||||
{ key: 'advisor_step2_title', label: 'عنوان مرحله ۲ (سن، وزن و تحرک)', type: 'text' },
|
||||
{ key: 'advisor_step2_desc', label: 'توضیحات مرحله ۲', type: 'text' },
|
||||
{ key: 'advisor_step3_title', label: 'عنوان مرحله ۳ (علائم و پیشنهاد)', type: 'text' },
|
||||
{ key: 'advisor_step3_desc', label: 'توضیحات مرحله ۳', type: 'text' },
|
||||
{ key: 'advisor_submit_btn', label: 'متن دکمه مشاهده راهکار پیشنهادی', type: 'text' },
|
||||
{ key: 'catalog_hero_title', label: 'عنوان صفحه کاتالوگ دیجیتال (H1)', type: 'rich-text' },
|
||||
{ key: 'catalog_hero_desc', label: 'توضیحات معرفی و نحوه استفاده از کاتالوگ', type: 'rich-text' },
|
||||
{ key: 'catalog_download_btn', label: 'متن دکمه دریافت نسخه کامل PDF', type: 'text' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'wiki_blog',
|
||||
title: 'دانشنامه و وبلاگ تخصصی (Wiki & Blog)',
|
||||
path: '/wiki',
|
||||
icon: BookOpen,
|
||||
id: 'blog',
|
||||
title: 'وبلاگ و مقالات تخصصی (Blog)',
|
||||
path: '/blog',
|
||||
icon: FileText,
|
||||
sections: [
|
||||
createSeoSection('blog', 'وبلاگ', 'وبلاگ تخصصی و راهنمای سلامت حیوانات خانگی | کنینا ایران', 'جدیدترین مقالات، راهنماهای تغذیه، بیماریهای مفاصل و سلامت پت توسط تیم دامپزشکی کنینا.'),
|
||||
{
|
||||
id: 'wiki_general',
|
||||
title: 'عناوین و صفحات دانشنامه',
|
||||
icon: BookOpen,
|
||||
id: 'blog_header',
|
||||
title: 'هدر و بنر وبلاگ',
|
||||
icon: FileText,
|
||||
fields: [
|
||||
{ key: 'blog_page_title', label: 'عنوان صفحه مقالات و وبلاگ (H1)', type: 'rich-text' },
|
||||
{ key: 'blog_page_desc', label: 'توضیحات سئو و مقدمه مقالات علمی', type: 'rich-text' },
|
||||
{ key: 'blog_search_placeholder', label: 'متن کادر جستجو در مقالات', type: 'text' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'wiki',
|
||||
title: 'دانشنامه ترکیبات و داروها (Wiki)',
|
||||
path: '/wiki',
|
||||
icon: Pill,
|
||||
sections: [
|
||||
createSeoSection('wiki', 'دانشنامه', 'دانشنامه علمی ترکیبات و اصطلاحات دارویی پت | کنینا ایران', 'مرجع تخصصی اثرات بالینی، مواد تشکیلدهنده، ویتامینها و ترکیبات گیاهی به کار رفته در محصولات کنینا.'),
|
||||
{
|
||||
id: 'wiki_header',
|
||||
title: 'هدر و ناوبری دانشنامه',
|
||||
icon: Pill,
|
||||
fields: [
|
||||
{ key: 'wiki_page_title', label: 'عنوان صفحه دانشنامه (H1)', type: 'rich-text' },
|
||||
{ key: 'wiki_page_desc', label: 'توضیحات سئو دانشنامه دارویی', type: 'rich-text' },
|
||||
{ key: 'blog_page_title', label: 'عنوان صفحه مقالات و وبلاگ', type: 'rich-text' },
|
||||
{ key: 'blog_page_desc', label: 'توضیحات سئو وبلاگ', type: 'rich-text' },
|
||||
{ key: 'wiki_search_placeholder', label: 'متن جستجوی اصطلاح یا ترکیب', type: 'text' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'contact_about',
|
||||
title: 'درباره ما و تماس با ما (About & Contact)',
|
||||
id: 'about',
|
||||
title: 'درباره ما و تاریخچه برند (About Us)',
|
||||
path: '/about',
|
||||
icon: Award,
|
||||
sections: [
|
||||
createSeoSection('about', 'درباره ما', 'درباره شرکت کنینا | تاریخچه، اصالت و استانداردهای دارویی آلمان', 'آشنایی با تاریخچه شرکت Canina Pharma آلمان، تعهد به کیفیت بیولوژیک و بیش از ۳۵ سال سابقه پیشرو در سلامت حیوانات خانگی.'),
|
||||
{
|
||||
id: 'about_content',
|
||||
title: 'متن و داستان برند',
|
||||
icon: Award,
|
||||
fields: [
|
||||
{ key: 'about_page_title', label: 'عنوان صفحه درباره ما (H1)', type: 'rich-text' },
|
||||
{ key: 'about_page_subtitle', label: 'زیرعنوان و شعار اصالت', type: 'text' },
|
||||
{ key: 'about_full_history', label: 'تاریخچه کامل برند و شرکت (H2/P)', type: 'rich-text' },
|
||||
{ key: 'about_mission_title', label: 'عنوان ماموریت و تعهدات', type: 'text' },
|
||||
{ key: 'about_mission_desc', label: 'متن ماموریت سازمانی', type: 'rich-text' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'contact',
|
||||
title: 'تماس با ما و پشتیبانی (Contact)',
|
||||
path: '/contact',
|
||||
icon: PhoneCall,
|
||||
sections: [
|
||||
createSeoSection('contact', 'تماس با ما', 'تماس با کنینا ایران | مشاوره تخصصی، نشانی و پشتیبانی مشتریان', 'راههای ارتباط با دفتر مرکزی کنینا در ایران، ثبت پیام، مشاوره رایگان دارویی و شماره تماس کارشناسان.'),
|
||||
{
|
||||
id: 'contact_info',
|
||||
title: 'اطلاعات تماس و پیامها',
|
||||
icon: PhoneCall,
|
||||
fields: [
|
||||
{ key: 'contact_page_title', label: 'عنوان صفحه تماس با ما', type: 'rich-text' },
|
||||
{ key: 'contact_page_title', label: 'عنوان صفحه تماس با ما (H1)', type: 'rich-text' },
|
||||
{ key: 'contact_page_desc', label: 'توضیحات بالای فرم تماس', type: 'rich-text' },
|
||||
{ key: 'about_full_history', label: 'تاریخچه کامل برند و شرکت (H2/P)', type: 'rich-text' },
|
||||
{ key: 'contact_form_success_msg', label: 'پیام تشکر بعد از ارسال پیام', type: 'text' },
|
||||
],
|
||||
},
|
||||
],
|
||||
@@ -402,6 +483,7 @@ const SITE_PAGES: AppSitePage[] = [
|
||||
path: '/b2b',
|
||||
icon: Building2,
|
||||
sections: [
|
||||
createSeoSection('b2b', 'همکاران تجاری B2B', 'پرتال فروش عمده و نمایندگی کلینیکها و پتشاپها | کنینا ایران', 'ثبت درخواست عاملیت فروش، خرید عمده با تخفیف سازمانی ویژه دامپزشکان، کلینیکها و پتشاپهای سراسر کشور.'),
|
||||
{
|
||||
id: 'b2b_landing',
|
||||
title: 'صفحه معرفی و شرایط همکاری B2B',
|
||||
@@ -415,12 +497,67 @@ const SITE_PAGES: AppSitePage[] = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'videos',
|
||||
title: 'ویدئوها و آموزشهای تصویری (Videos)',
|
||||
path: '/videos',
|
||||
icon: Video,
|
||||
sections: [
|
||||
createSeoSection('videos', 'ویدئوهای آموزشی', 'ویدئوهای آموزشی و تجربیات بالینی مکملهای پت | کنینا ایران', 'مشاهده ویدئوهای تخصصی نحوه مصرف مکملها، نظرات دامپزشکان و راهکارهای درمانی تصویری.'),
|
||||
{
|
||||
id: 'videos_hub',
|
||||
title: 'هدر و متن صفحه ویدئوها',
|
||||
icon: Video,
|
||||
fields: [
|
||||
{ key: 'videos_page_title', label: 'عنوان صفحه ویدئوها (H1)', type: 'rich-text' },
|
||||
{ key: 'videos_page_desc', label: 'توضیحات معرفی دورهها و کلیپهای آموزشی', type: 'rich-text' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'search',
|
||||
title: 'جستجوی پیشرفته سایت (Search)',
|
||||
path: '/search',
|
||||
icon: Search,
|
||||
sections: [
|
||||
createSeoSection('search', 'جستجو', 'جستجوی هوشمند مکملها و دانشنامه | کنینا ایران', 'جستجوی سریع محصولات، مکملهای تخصصی، بیماریها و علائم بالینی سگ و گربه.'),
|
||||
{
|
||||
id: 'search_content',
|
||||
title: 'متون راهنما و کادر جستجو',
|
||||
icon: Search,
|
||||
fields: [
|
||||
{ key: 'search_results_title', label: 'عنوان نتایج جستجو', type: 'text' },
|
||||
{ key: 'search_no_results_text', label: 'متن پیام در صورت عدم یافتن نتیجه', type: 'text' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'dashboard',
|
||||
title: 'داشبورد و حساب کاربری (User Dashboard)',
|
||||
path: '/dashboard',
|
||||
icon: User,
|
||||
sections: [
|
||||
createSeoSection('dashboard', 'داشبورد کاربر', 'داشبورد کاربری و پیگیری سفارشات | کنینا ایران', 'مشاهده تاریخچه خریدها، وضعیت کیف پول، پیگیری آنلاین بستههای پستی و مدیریت پتها.'),
|
||||
{
|
||||
id: 'dashboard_content',
|
||||
title: 'عناوین و پیامهای داشبورد',
|
||||
icon: User,
|
||||
fields: [
|
||||
{ key: 'dashboard_welcome_msg', label: 'پیام خوشآمدگویی بالای داشبورد', type: 'text' },
|
||||
{ key: 'dashboard_wallet_title', label: 'عنوان کارت کیف پول کنینا', type: 'text' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'pet_profiles',
|
||||
title: 'پرونده سلامت همدم (Pet Profiles)',
|
||||
path: '/profile/pets',
|
||||
icon: Heart,
|
||||
sections: [
|
||||
createSeoSection('profile_pets', 'پرونده سلامت پت', 'پرونده الکترونیک سلامت و یادآور داروهای پت | کنینا ایران', 'مدیریت و ثبت پرونده سلامت سگ و گربه، تنظیم یادآورهای دوز دارو و تاریخچه تغذیه مکملها.'),
|
||||
{
|
||||
id: 'pet_profiles_info',
|
||||
title: 'عناوین پرونده سلامت و یادآورها',
|
||||
@@ -432,6 +569,79 @@ const SITE_PAGES: AppSitePage[] = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'checkout',
|
||||
title: 'تسویهحساب و فاکتور نهایی (Checkout)',
|
||||
path: '/checkout',
|
||||
icon: CreditCard,
|
||||
sections: [
|
||||
createSeoSection('checkout', 'تسویهحساب', 'تکمیل سفارش و درگاه پرداخت امن | کنینا ایران', 'انتخاب آدرس تحویل، انتخاب روش پرداخت و تسویهحساب سریع و امن سفارشات کنینا.'),
|
||||
{
|
||||
id: 'checkout_content',
|
||||
title: 'پیامها و راهنمای تسویه',
|
||||
icon: CreditCard,
|
||||
fields: [
|
||||
{ key: 'checkout_step1_title', label: 'عنوان مرحله انتخاب آدرس', type: 'text' },
|
||||
{ key: 'checkout_step2_title', label: 'عنوان مرحله شیوه پرداخت', type: 'text' },
|
||||
{ key: 'checkout_charity_notice', label: 'متن توضیح طرح ردپای مهربانی در فاکتور', type: 'text' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'track',
|
||||
title: 'پیگیری آنلاین سفارش و مرسوله (Track Order)',
|
||||
path: '/track',
|
||||
icon: Truck,
|
||||
sections: [
|
||||
createSeoSection('track', 'پیگیری سفارش', 'رهگیری آنلاین مرسوله پستی | کنینا ایران', 'پیگیری وضعیت بستهبندی، کد رهگیری پست پیشتاز و تاریخچه تحویل سفارشات.'),
|
||||
{
|
||||
id: 'track_content',
|
||||
title: 'متن و کادر رهگیری',
|
||||
icon: Truck,
|
||||
fields: [
|
||||
{ key: 'track_page_title', label: 'عنوان صفحه رهگیری (H1)', type: 'rich-text' },
|
||||
{ key: 'track_page_desc', label: 'توضیحات نحوه پیگیری با شماره همراه یا کد سفارش', type: 'rich-text' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'trust_seals',
|
||||
title: 'مجوزها و نمادهای اعتماد (Trust Seals)',
|
||||
path: '/trust-seals',
|
||||
icon: Shield,
|
||||
sections: [
|
||||
createSeoSection('trust_seals', 'مجوزها و اصالت', 'مجوزهای بهداشتی، گواهی اصالت و اینماد | کنینا ایران', 'بررسی تاییدیههای سازمان دامپزشکی، گواهی استاندارد آلمان و اینماد رسمی کنینا.'),
|
||||
{
|
||||
id: 'trust_seals_content',
|
||||
title: 'متن مجوزها و گواهیها',
|
||||
icon: Shield,
|
||||
fields: [
|
||||
{ key: 'trust_page_title', label: 'عنوان صفحه مجوزها (H1)', type: 'rich-text' },
|
||||
{ key: 'trust_page_desc', label: 'توضیحات و ضمانتهای بهداشتی و قانونی', type: 'rich-text' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'privacy',
|
||||
title: 'حریم خصوصی و قوانین سایت (Privacy & Terms)',
|
||||
path: '/privacy',
|
||||
icon: ShieldCheck,
|
||||
sections: [
|
||||
createSeoSection('privacy', 'حریم خصوصی', 'سیاست حفظ حریم خصوصی و شرایط استفاده | کنینا ایران', 'قوانین خرید، عودت کالا، حفاظت از اطلاعات کاربران و شرایط استفاده از خدمات کنینا.'),
|
||||
{
|
||||
id: 'privacy_content',
|
||||
title: 'متن قوانین و مقررات',
|
||||
icon: ShieldCheck,
|
||||
fields: [
|
||||
{ key: 'privacy_page_title', label: 'عنوان صفحه قوانین و مقررات (H1)', type: 'rich-text' },
|
||||
{ key: 'privacy_full_terms', label: 'متن کامل شرایط استفاده و حریم خصوصی', type: 'rich-text' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const SHARED_HEADER_FIELDS: SectionField[] = [
|
||||
@@ -465,7 +675,8 @@ export default function UITexts() {
|
||||
const [versionTab, setVersionTab] = useState<'v2' | 'v1'>('v2');
|
||||
const [v2SubTab, setV2SubTab] = useState<'header' | 'footer' | 'pages'>('pages');
|
||||
const [openPageId, setOpenPageId] = useState<string>('home');
|
||||
const [openSectionId, setOpenSectionId] = useState<string>('hero');
|
||||
const [openSectionId, setOpenSectionId] = useState<string>('seo');
|
||||
const [previewDevice, setPreviewDevice] = useState<'desktop' | 'mobile'>('desktop');
|
||||
|
||||
// State
|
||||
const [texts, setTexts] = useState<Record<string, string>>({});
|
||||
@@ -611,6 +822,14 @@ export default function UITexts() {
|
||||
onChange={(html) => setEdits({ ...edits, [field.key]: html })}
|
||||
placeholder="متن خود را وارد کنید..."
|
||||
/>
|
||||
) : field.type === 'textarea' ? (
|
||||
<textarea
|
||||
rows={3}
|
||||
value={val}
|
||||
onChange={(e) => setEdits({ ...edits, [field.key]: e.target.value })}
|
||||
placeholder={field.defaultVal || 'توضیحات خود را وارد کنید...'}
|
||||
className="w-full px-4 py-2.5 bg-white border border-gray-200 rounded-xl text-xs font-bold text-gray-900 outline-none focus:ring-2 focus:ring-purple-500 leading-relaxed"
|
||||
/>
|
||||
) : field.type === 'image' ? (
|
||||
<div className="space-y-3">
|
||||
<div className="flex gap-2">
|
||||
@@ -721,10 +940,10 @@ export default function UITexts() {
|
||||
<div>
|
||||
<h1 className="text-2xl font-black text-gray-900 flex items-center gap-3">
|
||||
<Languages className="w-7 h-7 text-purple-600" />
|
||||
مدیریت محتوا و ویرایشگر صفحات (Page Builder v2)
|
||||
مدیریت جامع صفحات و ویرایشگر سئو (Page Builder v2)
|
||||
</h1>
|
||||
<p className="text-xs text-gray-500 font-bold mt-1">
|
||||
ویرایشگر جامع و زنده متون سئو، تگهای عناوین، تصاویر بنرها و آیکونهای لوسید در تمام بخشها
|
||||
پوشش کامل تمام {SITE_PAGES.length} صفحه برنامه شامل پیشنمایش زنده در گوگل (Google SERP)، ویرایشگر متن، تصاویر و آیکونها
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -758,7 +977,7 @@ export default function UITexts() {
|
||||
}`}
|
||||
>
|
||||
<Sparkles className="w-4 h-4 text-amber-300" />
|
||||
<span>ویرایشگر پیشرفته صفحات (Page Builder v2)</span>
|
||||
<span>ویرایشگر پیشرفته صفحات ({SITE_PAGES.length} صفحه فعال)</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
@@ -775,7 +994,7 @@ export default function UITexts() {
|
||||
</div>
|
||||
|
||||
<div className="text-[11px] text-gray-400 font-bold px-3">
|
||||
{versionTab === 'v2' ? 'نسخه مدرن آکاردئونی تفکیکشده' : 'نسخه پشتیبان فهرستی'}
|
||||
{versionTab === 'v2' ? 'نسخه مدرن آکاردئونی تفکیکشده به همراه Google SERP' : 'نسخه پشتیبان فهرستی'}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -793,7 +1012,7 @@ export default function UITexts() {
|
||||
}`}
|
||||
>
|
||||
<Layout className="w-4 h-4" />
|
||||
<span>صفحات سایت (Site Pages Accordion)</span>
|
||||
<span>تمام صفحات فروشگاه ({SITE_PAGES.length} صفحه تفکیکشده)</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
@@ -873,6 +1092,28 @@ export default function UITexts() {
|
||||
const isOpen = openPageId === page.id;
|
||||
const activeSection = page.sections.find((s) => s.id === openSectionId) || page.sections[0];
|
||||
|
||||
// Dynamic SEO Preview Derived Values
|
||||
const seoTitleKey = `${page.id}_meta_title`;
|
||||
const seoDescKey = `${page.id}_meta_desc`;
|
||||
const seoCanonicalKey = `${page.id}_canonical`;
|
||||
|
||||
const pageMetaTitle =
|
||||
edits[seoTitleKey] ??
|
||||
texts[seoTitleKey] ??
|
||||
page.sections.find((s) => s.id === 'seo')?.fields[0]?.defaultVal ??
|
||||
`${page.title} | کنینا ایران`;
|
||||
|
||||
const pageMetaDesc =
|
||||
edits[seoDescKey] ??
|
||||
texts[seoDescKey] ??
|
||||
page.sections.find((s) => s.id === 'seo')?.fields[1]?.defaultVal ??
|
||||
`مشاهده و بررسی آنلاین ${page.title} در وبسایت رسمی کنینا ایران با ضمانت اصالت کالا و مشاوره دارویی.`;
|
||||
|
||||
const pageCanonical =
|
||||
edits[seoCanonicalKey] ??
|
||||
texts[seoCanonicalKey] ??
|
||||
`https://canina.ir${page.path === '/' ? '' : page.path}`;
|
||||
|
||||
return (
|
||||
<div
|
||||
key={page.id}
|
||||
@@ -906,7 +1147,7 @@ export default function UITexts() {
|
||||
|
||||
<div className="flex items-center gap-3">
|
||||
<span className="text-xs font-bold px-3 py-1 bg-white rounded-xl border border-gray-200 text-gray-600">
|
||||
{page.sections.length} بخش
|
||||
{page.sections.length} بخش (شامل سئو)
|
||||
</span>
|
||||
<ChevronDown
|
||||
className={`w-5 h-5 text-gray-400 transition-transform duration-200 ${
|
||||
@@ -933,31 +1174,156 @@ export default function UITexts() {
|
||||
onClick={() => setOpenSectionId(sec.id)}
|
||||
className={`px-4 py-2 rounded-xl text-xs font-black transition-all flex items-center gap-2 cursor-pointer shrink-0 border ${
|
||||
isSecActive
|
||||
? 'bg-purple-600 text-white border-purple-600 shadow-sm'
|
||||
? sec.isSeo
|
||||
? 'bg-sky-600 text-white border-sky-600 shadow-sm'
|
||||
: 'bg-purple-600 text-white border-purple-600 shadow-sm'
|
||||
: 'bg-gray-50 text-gray-700 border-gray-200 hover:bg-gray-100'
|
||||
}`}
|
||||
>
|
||||
<SecIcon className="w-3.5 h-3.5" />
|
||||
<span>{sec.title}</span>
|
||||
{sec.isSeo && (
|
||||
<span className="text-[10px] bg-white/20 px-1.5 py-0.2 rounded font-mono">
|
||||
Google
|
||||
</span>
|
||||
)}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Active Section Fields Grid */}
|
||||
<div className="space-y-4">
|
||||
<div className="flex items-center gap-2 pb-2">
|
||||
<span className="w-2 h-2 rounded-full bg-purple-600" />
|
||||
<h4 className="text-sm font-black text-gray-800">
|
||||
فیلدهای محتوایی: {activeSection.title}
|
||||
</h4>
|
||||
</div>
|
||||
{/* If Active Section is SEO: Render Google SERP Live Preview Box Side-by-Side */}
|
||||
{activeSection.isSeo ? (
|
||||
<div className="grid grid-cols-1 lg:grid-cols-12 gap-6 items-start">
|
||||
{/* Left/Main Column: SEO Inputs */}
|
||||
<div className="lg:col-span-7 space-y-4">
|
||||
<div className="flex items-center gap-2 pb-2">
|
||||
<span className="w-2.5 h-2.5 rounded-full bg-sky-600" />
|
||||
<h4 className="text-sm font-black text-gray-800">
|
||||
فیلدهای متادیتای سئو (SEO Meta Tags)
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-6 md:grid-cols-2">
|
||||
{activeSection.fields.map((f) => renderField(f))}
|
||||
<div className="space-y-4">
|
||||
{activeSection.fields.map((f) => renderField(f))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Right Column: Google SERP Preview Box */}
|
||||
<div className="lg:col-span-5 lg:sticky lg:top-4 bg-slate-50 border border-slate-200 rounded-3xl p-5 space-y-4 shadow-xs">
|
||||
<div className="flex items-center justify-between border-b border-slate-200 pb-3">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="w-7 h-7 rounded-lg bg-white border border-slate-200 flex items-center justify-center shadow-xs">
|
||||
<Globe className="w-4 h-4 text-sky-600" />
|
||||
</div>
|
||||
<span className="text-xs font-black text-slate-800">پیشنمایش در گوگل</span>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-1 bg-white p-1 rounded-xl border border-slate-200">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setPreviewDevice('desktop')}
|
||||
className={`p-1.5 rounded-lg transition-colors cursor-pointer ${
|
||||
previewDevice === 'desktop'
|
||||
? 'bg-sky-50 text-sky-700 font-bold'
|
||||
: 'text-gray-400 hover:text-gray-600'
|
||||
}`}
|
||||
title="نمای دسکتاپ"
|
||||
>
|
||||
<Monitor className="w-3.5 h-3.5" />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setPreviewDevice('mobile')}
|
||||
className={`p-1.5 rounded-lg transition-colors cursor-pointer ${
|
||||
previewDevice === 'mobile'
|
||||
? 'bg-sky-50 text-sky-700 font-bold'
|
||||
: 'text-gray-400 hover:text-gray-600'
|
||||
}`}
|
||||
title="نمای موبایل"
|
||||
>
|
||||
<Smartphone className="w-3.5 h-3.5" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Google Snippet Card */}
|
||||
<div
|
||||
className={`bg-white rounded-2xl border border-slate-200 p-4 shadow-sm text-right font-sans space-y-2 transition-all ${
|
||||
previewDevice === 'mobile' ? 'max-w-[340px] mx-auto border-sky-200' : ''
|
||||
}`}
|
||||
dir="rtl"
|
||||
>
|
||||
{/* Breadcrumbs / Domain */}
|
||||
<div className="flex items-center gap-2 text-xs text-[#202124]">
|
||||
<div className="w-5 h-5 rounded-full bg-slate-100 flex items-center justify-center text-[10px] font-bold text-slate-700 border">
|
||||
C
|
||||
</div>
|
||||
<div className="flex flex-col truncate">
|
||||
<span className="font-bold text-slate-900 text-[11px]">کنینا ایران - Canina</span>
|
||||
<span className="text-[10px] text-slate-500 font-mono" dir="ltr">
|
||||
{pageCanonical}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Title */}
|
||||
<h4 className="text-[17px] text-[#1a0dab] hover:underline cursor-pointer leading-tight font-medium font-sans select-none line-clamp-2">
|
||||
{pageMetaTitle}
|
||||
</h4>
|
||||
|
||||
{/* Snippet */}
|
||||
<p className="text-xs text-[#4d5156] leading-relaxed font-sans select-none break-words line-clamp-3">
|
||||
{pageMetaDesc}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Live Metrics & Length Warning Indicators */}
|
||||
<div className="space-y-2 text-[11px] font-bold text-slate-600 pt-2 border-t border-slate-200">
|
||||
<div className="flex items-center justify-between">
|
||||
<span>طول عنوان (Meta Title):</span>
|
||||
<span
|
||||
className={`px-2 py-0.5 rounded-lg ${
|
||||
pageMetaTitle.length > 60
|
||||
? 'bg-amber-100 text-amber-800'
|
||||
: 'bg-emerald-100 text-emerald-800'
|
||||
}`}
|
||||
>
|
||||
{pageMetaTitle.length} / ۶۰ کاراکتر
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-between">
|
||||
<span>طول توضیحات (Description):</span>
|
||||
<span
|
||||
className={`px-2 py-0.5 rounded-lg ${
|
||||
pageMetaDesc.length > 160
|
||||
? 'bg-amber-100 text-amber-800'
|
||||
: 'bg-emerald-100 text-emerald-800'
|
||||
}`}
|
||||
>
|
||||
{pageMetaDesc.length} / ۱۶۰ کاراکتر
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
/* Non-SEO Content Section Grid */
|
||||
<div className="space-y-4">
|
||||
<div className="flex items-center gap-2 pb-2">
|
||||
<span className="w-2 h-2 rounded-full bg-purple-600" />
|
||||
<h4 className="text-sm font-black text-gray-800">
|
||||
فیلدهای محتوایی: {activeSection.title}
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-6 md:grid-cols-2">
|
||||
{activeSection.fields.map((f) => renderField(f))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user