refactor(builder): remove dead component settings UI

Each component defined a .craft.related.settings panel that was never
rendered -- the right panel renders only GuidedStyles (per-type
*StylePanel components), never .related.settings. Removed all dead
settings components across every component, their settings-only helpers
(including the dead uploadToWhp/showBrowser/handleBrowse asset-browse
blocks in Logo/Navbar/VideoBlock/FeaturesGrid, and CtasEditor in
_cta-helpers), and dropped the now-empty related keys. Render output,
.craft props/rules, and toHtml statics are unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-12 13:16:53 -07:00
parent 4674a99ec9
commit 65a10a1ef9
40 changed files with 10 additions and 6718 deletions
-172
View File
@@ -1,7 +1,6 @@
import React, { CSSProperties, useState } from 'react';
import { useNode, UserComponent } from '@craftjs/core';
import { cssPropsToString } from '../../utils/style-helpers';
import { AnchorIdField } from '../../ui/AnchorIdField';
import { escapeHtml, escapeAttr } from '../../utils/escape';
interface TabItem {
@@ -102,174 +101,6 @@ export const Tabs: UserComponent<TabsProps> = ({
);
};
/* ---------- Settings panel ---------- */
const TabsSettings: React.FC = () => {
const { actions: { setProp }, props } = useNode((node) => ({
props: node.data.props as TabsProps,
}));
const tabs = props.tabs || defaultTabs;
const inputStyle: CSSProperties = {
width: '100%', padding: '3px 6px', background: '#27272a', color: '#e4e4e7',
border: '1px solid #3f3f46', borderRadius: 4, fontSize: 11,
};
const labelStyle: CSSProperties = { fontSize: 11, color: '#a1a1aa', display: 'block', marginBottom: 6 };
const updateTab = (index: number, field: keyof TabItem, value: string) => {
setProp((p: TabsProps) => {
const updated = [...(p.tabs || defaultTabs)];
updated[index] = { ...updated[index], [field]: value };
p.tabs = updated;
});
};
const addTab = () => {
setProp((p: TabsProps) => {
p.tabs = [...(p.tabs || defaultTabs), { label: 'New Tab', content: 'Tab content goes here.' }];
});
};
const removeTab = (index: number) => {
setProp((p: TabsProps) => {
const updated = [...(p.tabs || defaultTabs)];
updated.splice(index, 1);
p.tabs = updated;
});
};
const colorSwatches = ['#3b82f6', '#8b5cf6', '#10b981', '#f59e0b', '#ef4444', '#18181b', '#ffffff', '#f1f5f9'];
return (
<div style={{ padding: '12px', display: 'flex', flexDirection: 'column', gap: '14px' }}>
<AnchorIdField />
<div>
<label style={labelStyle}>Active Tab Background</label>
<div style={{ display: 'flex', gap: 4, flexWrap: 'wrap' }}>
{colorSwatches.map((c) => (
<button
key={c}
onClick={() => setProp((p: TabsProps) => { p.activeTabBg = c; })}
style={{
width: 24, height: 24, borderRadius: 4, border: '1px solid #3f3f46',
backgroundColor: c, cursor: 'pointer',
outline: props.activeTabBg === c ? '2px solid #3b82f6' : 'none',
outlineOffset: 1,
}}
/>
))}
</div>
</div>
<div>
<label style={labelStyle}>Active Tab Text Color</label>
<div style={{ display: 'flex', gap: 4, flexWrap: 'wrap' }}>
{['#ffffff', '#18181b', '#1f2937', '#e2e8f0'].map((c) => (
<button
key={c}
onClick={() => setProp((p: TabsProps) => { p.activeTabColor = c; })}
style={{
width: 24, height: 24, borderRadius: 4, border: '1px solid #3f3f46',
backgroundColor: c, cursor: 'pointer',
outline: props.activeTabColor === c ? '2px solid #3b82f6' : 'none',
outlineOffset: 1,
}}
/>
))}
</div>
</div>
<div>
<label style={labelStyle}>Inactive Tab Background</label>
<div style={{ display: 'flex', gap: 4, flexWrap: 'wrap' }}>
{['#f1f5f9', '#e2e8f0', '#f8fafc', '#ffffff', '#27272a', '#18181b'].map((c) => (
<button
key={c}
onClick={() => setProp((p: TabsProps) => { p.inactiveTabBg = c; })}
style={{
width: 24, height: 24, borderRadius: 4, border: '1px solid #3f3f46',
backgroundColor: c, cursor: 'pointer',
outline: props.inactiveTabBg === c ? '2px solid #3b82f6' : 'none',
outlineOffset: 1,
}}
/>
))}
</div>
</div>
<div>
<label style={labelStyle}>Inactive Tab Text Color</label>
<div style={{ display: 'flex', gap: 4, flexWrap: 'wrap' }}>
{['#64748b', '#94a3b8', '#18181b', '#ffffff'].map((c) => (
<button
key={c}
onClick={() => setProp((p: TabsProps) => { p.inactiveTabColor = c; })}
style={{
width: 24, height: 24, borderRadius: 4, border: '1px solid #3f3f46',
backgroundColor: c, cursor: 'pointer',
outline: props.inactiveTabColor === c ? '2px solid #3b82f6' : 'none',
outlineOffset: 1,
}}
/>
))}
</div>
</div>
<div>
<label style={labelStyle}>Content Background</label>
<div style={{ display: 'flex', gap: 4, flexWrap: 'wrap' }}>
{['#ffffff', '#f8fafc', '#f1f5f9', '#18181b', '#1e293b'].map((c) => (
<button
key={c}
onClick={() => setProp((p: TabsProps) => { p.contentBg = c; })}
style={{
width: 24, height: 24, borderRadius: 4, border: '1px solid #3f3f46',
backgroundColor: c, cursor: 'pointer',
outline: props.contentBg === c ? '2px solid #3b82f6' : 'none',
outlineOffset: 1,
}}
/>
))}
</div>
</div>
<div>
<label style={labelStyle}>Tabs</label>
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
{tabs.map((tab, i) => (
<div key={i} style={{ background: '#1e1e22', borderRadius: 6, padding: 8, display: 'flex', flexDirection: 'column', gap: 4 }}>
<div style={{ display: 'flex', gap: 4 }}>
<input type="text" value={tab.label} onChange={(e) => updateTab(i, 'label', e.target.value)} placeholder="Label" style={{ ...inputStyle, flex: 1 }} />
<button
onClick={() => removeTab(i)}
style={{ padding: '2px 6px', fontSize: 11, background: '#ef4444', color: '#fff', border: 'none', borderRadius: 4, cursor: 'pointer' }}
>
X
</button>
</div>
<textarea
value={tab.content}
onChange={(e) => updateTab(i, 'content', e.target.value)}
placeholder="Content"
rows={2}
style={{ ...inputStyle, resize: 'vertical' }}
/>
</div>
))}
</div>
<button
onClick={addTab}
style={{ marginTop: 6, width: '100%', padding: '6px', fontSize: 11, background: '#27272a', color: '#e4e4e7', border: '1px solid #3f3f46', borderRadius: 4, cursor: 'pointer' }}
>
+ Add Tab
</button>
</div>
</div>
);
};
/* ---------- Craft config ---------- */
Tabs.craft = {
@@ -289,9 +120,6 @@ Tabs.craft = {
canMoveIn: () => false,
canMoveOut: () => true,
},
related: {
settings: TabsSettings,
},
};
/* ---------- HTML export ---------- */