chore(builder): remove GuidedStyles classification cruft
Drop the computed-but-unused resolvedName/resolverMap, anchor the hero regex (/^hero/i) so it stops matching any type name containing "hero", and remove the isContainer alternations for the now-deleted HeaderZone/FooterZone components. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useEditor } from '@craftjs/core';
|
import { useEditor } from '@craftjs/core';
|
||||||
import { componentResolver } from '../../components/resolver';
|
|
||||||
import { SiteDesignPanel } from './SiteDesignPanel';
|
import { SiteDesignPanel } from './SiteDesignPanel';
|
||||||
import { useSitesmithModal } from '../../state/SitesmithContext';
|
import { useSitesmithModal } from '../../state/SitesmithContext';
|
||||||
import { buildSitesmithTarget } from '../../utils/sitesmith-target';
|
import { buildSitesmithTarget } from '../../utils/sitesmith-target';
|
||||||
@@ -31,27 +30,21 @@ import {
|
|||||||
================================================================ */
|
================================================================ */
|
||||||
|
|
||||||
export const GuidedStyles: React.FC = () => {
|
export const GuidedStyles: React.FC = () => {
|
||||||
const resolverMap = componentResolver as Record<string, any>;
|
|
||||||
const { open: openSitesmith } = useSitesmithModal();
|
const { open: openSitesmith } = useSitesmithModal();
|
||||||
const { query } = useEditor();
|
const { query } = useEditor();
|
||||||
|
|
||||||
const { selected, selectedType, nodeProps, resolvedName } = useEditor((state) => {
|
const { selected, selectedType, nodeProps } = useEditor((state) => {
|
||||||
const currentNodeId = state.events.selected
|
const currentNodeId = state.events.selected
|
||||||
? Array.from(state.events.selected)[0]
|
? Array.from(state.events.selected)[0]
|
||||||
: undefined;
|
: undefined;
|
||||||
let selectedType: string | null = null;
|
let selectedType: string | null = null;
|
||||||
let nodeProps: Record<string, any> = {};
|
let nodeProps: Record<string, any> = {};
|
||||||
let resolvedName: string | null = null;
|
|
||||||
|
|
||||||
if (currentNodeId) {
|
if (currentNodeId) {
|
||||||
const node = state.nodes[currentNodeId];
|
const node = state.nodes[currentNodeId];
|
||||||
if (node) {
|
if (node) {
|
||||||
selectedType = node.data.displayName || node.data.name || null;
|
selectedType = node.data.displayName || node.data.name || null;
|
||||||
nodeProps = node.data.props || {};
|
nodeProps = node.data.props || {};
|
||||||
const nodeType = node.data.type as any;
|
|
||||||
if (nodeType && typeof nodeType === 'object' && nodeType.resolvedName) {
|
|
||||||
resolvedName = nodeType.resolvedName;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +52,6 @@ export const GuidedStyles: React.FC = () => {
|
|||||||
selected: currentNodeId || null,
|
selected: currentNodeId || null,
|
||||||
selectedType,
|
selectedType,
|
||||||
nodeProps,
|
nodeProps,
|
||||||
resolvedName,
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -75,8 +67,8 @@ export const GuidedStyles: React.FC = () => {
|
|||||||
const isButton = /^button$/i.test(typeName);
|
const isButton = /^button$/i.test(typeName);
|
||||||
const isImage = /^image$/i.test(typeName);
|
const isImage = /^image$/i.test(typeName);
|
||||||
const isBgSection = /^background section$/i.test(typeName);
|
const isBgSection = /^background section$/i.test(typeName);
|
||||||
const isContainer = /^container$|^section$|^columns$|^header zone$|^footer zone$/i.test(typeName);
|
const isContainer = /^container$|^section$|^columns$/i.test(typeName);
|
||||||
const isHero = /hero/i.test(typeName);
|
const isHero = /^hero/i.test(typeName);
|
||||||
const isNav = /^menu$|^logo$|^navbar$|^footer$/i.test(typeName);
|
const isNav = /^menu$|^logo$|^navbar$|^footer$/i.test(typeName);
|
||||||
const isMedia = /^video$|^gallery$|^map$|^content slider$/i.test(typeName);
|
const isMedia = /^video$|^gallery$|^map$|^content slider$/i.test(typeName);
|
||||||
const isForm = /^form$|^input$|^textarea$|^subscribe|^contact form$|^submit button$|^search bar$/i.test(typeName);
|
const isForm = /^form$|^input$|^textarea$|^subscribe|^contact form$|^submit button$|^search bar$/i.test(typeName);
|
||||||
|
|||||||
Reference in New Issue
Block a user