From 8508af37c7443c528cc2ea75188eff98076ac67e Mon Sep 17 00:00:00 2001 From: "IGNY8 VPS (Salman)" Date: Tue, 18 Nov 2025 08:38:59 +0000 Subject: [PATCH] Refactor Dropdown Handlers and Update WordPress Integration - Updated dropdown onChange handlers across multiple components to use direct value passing instead of event target value for improved clarity and consistency. - Changed `url` to `site_url` in WordPress integration configuration for better semantic clarity. - Enhanced Vite configuration to include `fast-deep-equal` for compatibility with `react-dnd`. - Updated navigation paths in `SiteContentEditor` and `SiteList` for consistency with new routing structure. --- backend/celerybeat-schedule | Bin 16384 -> 16384 bytes .../integration/PlatformSelector.tsx | 2 +- .../components/publishing/PublishingRules.tsx | 8 ++--- .../components/sites/TemplateCustomizer.tsx | 30 ++++++++-------- .../sites/WordPressIntegrationCard.tsx | 5 ++- .../sites/WordPressIntegrationModal.tsx | 4 +-- frontend/src/pages/Sites/Editor.tsx | 2 +- frontend/src/pages/Sites/List.tsx | 24 ++++++------- frontend/src/pages/Sites/PostEditor.tsx | 4 +-- frontend/src/pages/Sites/Settings.tsx | 33 +++++++++++++----- frontend/src/services/integration.api.ts | 9 ++--- frontend/vite.config.ts | 4 +-- 12 files changed, 69 insertions(+), 56 deletions(-) diff --git a/backend/celerybeat-schedule b/backend/celerybeat-schedule index f7b27e357bf4be784a02f5a2665a0e4a74233ff6..741a7355faf57a04a8125055db2c4bfa9a6cf1a5 100644 GIT binary patch delta 30 mcmZo@U~Fh$+@NT}&mqUaz~DY5L$qy5&=l|8n+;4Za038_-3g5V delta 30 mcmZo@U~Fh$+@NT}&uY%Vz~DF~L$qy5&=l`En+;4Za038`XbFA* diff --git a/frontend/src/components/integration/PlatformSelector.tsx b/frontend/src/components/integration/PlatformSelector.tsx index 8128fc59..85631413 100644 --- a/frontend/src/components/integration/PlatformSelector.tsx +++ b/frontend/src/components/integration/PlatformSelector.tsx @@ -22,7 +22,7 @@ export default function PlatformSelector({ value, onChange, disabled }: Platform onChange(e.target.value)} + onChange={(optionValue) => onChange(optionValue)} disabled={disabled} placeholder="Select platform" /> diff --git a/frontend/src/components/publishing/PublishingRules.tsx b/frontend/src/components/publishing/PublishingRules.tsx index a98da0fd..39a16777 100644 --- a/frontend/src/components/publishing/PublishingRules.tsx +++ b/frontend/src/components/publishing/PublishingRules.tsx @@ -142,8 +142,8 @@ export default function PublishingRules({ rules, onChange }: PublishingRulesProp - handleUpdateRule(rule.id, 'content_type', e.target.value) + onChange={(value) => + handleUpdateRule(rule.id, 'content_type', value) } /> @@ -153,8 +153,8 @@ export default function PublishingRules({ rules, onChange }: PublishingRulesProp - handleUpdateRule(rule.id, 'trigger', e.target.value) + onChange={(value) => + handleUpdateRule(rule.id, 'trigger', value) } /> diff --git a/frontend/src/components/sites/TemplateCustomizer.tsx b/frontend/src/components/sites/TemplateCustomizer.tsx index 0d855a5e..4d74e571 100644 --- a/frontend/src/components/sites/TemplateCustomizer.tsx +++ b/frontend/src/components/sites/TemplateCustomizer.tsx @@ -133,7 +133,7 @@ export default function TemplateCustomizer({ { value: 'fullwidth', label: 'Full Width' }, ]} value={customization.layout} - onChange={(e) => updateCustomization({ layout: e.target.value })} + onChange={(value) => updateCustomization({ layout: value })} /> @@ -147,7 +147,7 @@ export default function TemplateCustomizer({ { value: 'minimal', label: 'Minimal' }, ]} value={customization.headerStyle} - onChange={(e) => updateCustomization({ headerStyle: e.target.value })} + onChange={(value) => updateCustomization({ headerStyle: value })} /> @@ -161,7 +161,7 @@ export default function TemplateCustomizer({ { value: 'none', label: 'No Footer' }, ]} value={customization.footerStyle} - onChange={(e) => updateCustomization({ footerStyle: e.target.value })} + onChange={(value) => updateCustomization({ footerStyle: value })} /> @@ -175,7 +175,7 @@ export default function TemplateCustomizer({ { value: 'none', label: 'No Sidebar' }, ]} value={customization.sidebarPosition} - onChange={(e) => updateCustomization({ sidebarPosition: e.target.value as 'left' | 'right' | 'none' })} + onChange={(value) => updateCustomization({ sidebarPosition: value as 'left' | 'right' | 'none' })} /> )} @@ -196,7 +196,7 @@ export default function TemplateCustomizer({ { value: 'auto', label: 'Auto (System)' }, ]} value={customization.colorScheme} - onChange={(e) => updateCustomization({ colorScheme: e.target.value })} + onChange={(value) => updateCustomization({ colorScheme: value })} /> @@ -271,7 +271,7 @@ export default function TemplateCustomizer({ { value: 'custom', label: 'Custom' }, ]} value={customization.typography} - onChange={(e) => updateCustomization({ typography: e.target.value })} + onChange={(value) => updateCustomization({ typography: value })} /> @@ -285,9 +285,9 @@ export default function TemplateCustomizer({ { value: 'xlarge', label: 'Extra Large' }, ]} value={customization.customStyles?.headingSize || 'medium'} - onChange={(e) => + onChange={(value) => updateCustomization({ - customStyles: { ...customization.customStyles, headingSize: e.target.value }, + customStyles: { ...customization.customStyles, headingSize: value }, }) } /> @@ -302,9 +302,9 @@ export default function TemplateCustomizer({ { value: 'large', label: 'Large (18px)' }, ]} value={customization.customStyles?.bodySize || 'medium'} - onChange={(e) => + onChange={(value) => updateCustomization({ - customStyles: { ...customization.customStyles, bodySize: e.target.value }, + customStyles: { ...customization.customStyles, bodySize: value }, }) } /> @@ -327,7 +327,7 @@ export default function TemplateCustomizer({ { value: 'spacious', label: 'Spacious' }, ]} value={customization.spacing} - onChange={(e) => updateCustomization({ spacing: e.target.value })} + onChange={(value) => updateCustomization({ spacing: value })} /> @@ -341,9 +341,9 @@ export default function TemplateCustomizer({ { value: 'large', label: 'Large' }, ]} value={customization.customStyles?.sectionPadding || 'medium'} - onChange={(e) => + onChange={(value) => updateCustomization({ - customStyles: { ...customization.customStyles, sectionPadding: e.target.value }, + customStyles: { ...customization.customStyles, sectionPadding: value }, }) } /> @@ -360,9 +360,9 @@ export default function TemplateCustomizer({ { value: 'full', label: 'Full Width' }, ]} value={customization.customStyles?.containerWidth || 'lg'} - onChange={(e) => + onChange={(value) => updateCustomization({ - customStyles: { ...customization.customStyles, containerWidth: e.target.value }, + customStyles: { ...customization.customStyles, containerWidth: value }, }) } /> diff --git a/frontend/src/components/sites/WordPressIntegrationCard.tsx b/frontend/src/components/sites/WordPressIntegrationCard.tsx index 04323f84..19991aee 100644 --- a/frontend/src/components/sites/WordPressIntegrationCard.tsx +++ b/frontend/src/components/sites/WordPressIntegrationCard.tsx @@ -17,8 +17,7 @@ interface WordPressIntegration { sync_status: 'success' | 'failed' | 'pending'; last_sync_at?: string; config_json?: { - url?: string; - username?: string; + site_url?: string; }; } @@ -75,7 +74,7 @@ export default function WordPressIntegrationCard({ WordPress Integration

- {integration.config_json?.url || 'WordPress Site'} + {integration.config_json?.site_url || 'WordPress Site'}

diff --git a/frontend/src/components/sites/WordPressIntegrationModal.tsx b/frontend/src/components/sites/WordPressIntegrationModal.tsx index 46343c7e..8548f728 100644 --- a/frontend/src/components/sites/WordPressIntegrationModal.tsx +++ b/frontend/src/components/sites/WordPressIntegrationModal.tsx @@ -4,10 +4,10 @@ */ import React, { useState } from 'react'; import { X, Globe, AlertCircle } from 'lucide-react'; -import Modal from '../ui/modal/Modal'; +import { Modal } from '../ui/modal'; import Button from '../ui/button/Button'; import Label from '../form/Label'; -import Input from '../form/input/Input'; +import Input from '../form/input/InputField'; import Checkbox from '../form/input/Checkbox'; import { useToast } from '../ui/toast/ToastContainer'; diff --git a/frontend/src/pages/Sites/Editor.tsx b/frontend/src/pages/Sites/Editor.tsx index fd9f0cbd..a74a0b28 100644 --- a/frontend/src/pages/Sites/Editor.tsx +++ b/frontend/src/pages/Sites/Editor.tsx @@ -144,7 +144,7 @@ export default function SiteContentEditor() {

No pages found in this blueprint

- diff --git a/frontend/src/pages/Sites/List.tsx b/frontend/src/pages/Sites/List.tsx index c039ea26..2f982060 100644 --- a/frontend/src/pages/Sites/List.tsx +++ b/frontend/src/pages/Sites/List.tsx @@ -5,7 +5,7 @@ */ import React, { useState, useEffect } from 'react'; import { useNavigate } from 'react-router-dom'; -import { PlusIcon, EditIcon, SettingsIcon, EyeIcon, TrashIcon, FilterIcon, SearchIcon, PlugIcon, FileTextIcon } from 'lucide-react'; +import { PlusIcon, EditIcon, SettingsIcon, EyeIcon, TrashIcon, FilterIcon, SearchIcon, PlugIcon, FileTextIcon, MoreVerticalIcon, Building2Icon } from 'lucide-react'; import PageMeta from '../../components/common/PageMeta'; import { Card } from '../../components/ui/card'; import Button from '../../components/ui/button/Button'; @@ -515,10 +515,6 @@ export default function SiteList() {

-
@@ -595,7 +591,7 @@ export default function SiteList() { setHostingTypeFilter(e.target.value)} + onChange={(value) => setHostingTypeFilter(value)} /> @@ -607,7 +603,7 @@ export default function SiteList() { setStatusFilter(e.target.value)} + onChange={(value) => setStatusFilter(value)} /> @@ -619,7 +615,7 @@ export default function SiteList() { setIntegrationFilter(e.target.value)} + onChange={(value) => setIntegrationFilter(value)} /> @@ -738,19 +734,21 @@ export default function SiteList() { variant="outline" size="sm" onClick={() => handleSettings(site.id)} - className="shadow-theme-xs inline-flex h-9 w-9 items-center justify-center rounded-lg border border-gray-300 text-gray-700 dark:border-gray-700 dark:text-gray-400" + className="shadow-theme-xs inline-flex h-9 items-center justify-center rounded-lg border border-gray-300 text-gray-700 dark:border-gray-700 dark:text-gray-400 px-3" title="Configure Sectors" > - + + Sectors setContent({ ...content, content_type: e.target.value })} + onChange={(value) => setContent({ ...content, content_type: value })} /> @@ -336,7 +336,7 @@ export default function PostEditor() { setContent({ ...content, status: e.target.value })} + onChange={(value) => setContent({ ...content, status: value })} /> diff --git a/frontend/src/pages/Sites/Settings.tsx b/frontend/src/pages/Sites/Settings.tsx index 0b910ab8..9a0ecd57 100644 --- a/frontend/src/pages/Sites/Settings.tsx +++ b/frontend/src/pages/Sites/Settings.tsx @@ -225,7 +225,10 @@ export default function SiteSettings() {
@@ -325,7 +340,7 @@ export default function SiteSettings() { setFormData({ ...formData, hosting_type: e.target.value })} + onChange={(value) => setFormData({ ...formData, hosting_type: value })} /> @@ -572,8 +587,8 @@ export default function SiteSettings() { initialData={ wordPressIntegration ? { - url: wordPressIntegration.config_json?.url || '', - username: wordPressIntegration.config_json?.username || '', + url: wordPressIntegration.config_json?.site_url || '', + username: wordPressIntegration.credentials_json?.username || '', app_password: '', // Never show password is_active: wordPressIntegration.is_active, sync_enabled: wordPressIntegration.sync_enabled, diff --git a/frontend/src/services/integration.api.ts b/frontend/src/services/integration.api.ts index 4d64382b..5533a18f 100644 --- a/frontend/src/services/integration.api.ts +++ b/frontend/src/services/integration.api.ts @@ -10,6 +10,7 @@ export interface SiteIntegration { platform: 'wordpress' | 'shopify' | 'custom'; platform_type: 'cms' | 'ecommerce' | 'custom_api'; config_json: Record; + credentials_json?: Record; is_active: boolean; sync_enabled: boolean; last_sync_at?: string; @@ -23,7 +24,7 @@ export interface CreateIntegrationData { platform: 'wordpress' | 'shopify' | 'custom'; platform_type?: 'cms' | 'ecommerce' | 'custom_api'; config_json: Record; - credentials?: Record; + credentials_json?: Record; is_active?: boolean; sync_enabled?: boolean; } @@ -126,10 +127,10 @@ export const integrationApi = { platform: 'wordpress', platform_type: 'cms', config_json: { - url: data.url, - username: data.username, + site_url: data.url, }, - credentials: { + credentials_json: { + username: data.username, app_password: data.app_password, }, is_active: data.is_active ?? true, diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 61507973..331232a5 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -120,6 +120,8 @@ export default defineConfig(({ mode, command }) => { "zustand/middleware", // Required for persist middleware used in stores // Include apexcharts for proper module resolution (skip during marketing-only build) ...(isMarketingBuild ? [] : ["apexcharts", "react-apexcharts"]), + // Force include fast-deep-equal for react-dnd compatibility + "fast-deep-equal", ], // Exclude heavy dependencies that are only used in specific pages // They will be lazy-loaded when needed @@ -132,8 +134,6 @@ export default defineConfig(({ mode, command }) => { "@fullcalendar/timegrid", "@react-jvectormap/core", "@react-jvectormap/world", - "react-dnd", - "react-dnd-html5-backend", "swiper", ], esbuildOptions: {