@@ -311,6 +383,133 @@ function Field({ label, children }) {
)
}
+function RulesEditor({ doRules, dontRules, onChange }) {
+ const [doInput, setDoInput] = useState('')
+ const [dontInput, setDontInput] = useState('')
+
+ const addDo = () => { const v = doInput.trim(); if (v && !doRules.includes(v)) { onChange([...doRules, v], dontRules) }; setDoInput('') }
+ const addDont = () => { const v = dontInput.trim(); if (v && !dontRules.includes(v)) { onChange(doRules, [...dontRules, v]) }; setDontInput('') }
+ const removeDo = (i) => onChange(doRules.filter((_, idx) => idx !== i), dontRules)
+ const removeDont = (i) => onChange(doRules, dontRules.filter((_, idx) => idx !== i))
+
+ return (
+
+
+
+
+ setDoInput(e.target.value)}
+ onKeyDown={e => { if (e.key === 'Enter') { e.preventDefault(); addDo() } }}
+ placeholder="Es. Usa sempre il tu" style={{ ...inputStyle, flex: 1, fontSize: '0.82rem' }}
+ onFocus={e => e.target.style.borderColor = 'var(--ink)'} onBlur={e => e.target.style.borderColor = 'var(--border)'} />
+
+
+ {doRules.map((r, i) => (
+
+ ✓
+ {r}
+
+
+ ))}
+
+
+
+
+ setDontInput(e.target.value)}
+ onKeyDown={e => { if (e.key === 'Enter') { e.preventDefault(); addDont() } }}
+ placeholder="Es. Non usare 'rivoluzionario'" style={{ ...inputStyle, flex: 1, fontSize: '0.82rem' }}
+ onFocus={e => e.target.style.borderColor = 'var(--ink)'} onBlur={e => e.target.style.borderColor = 'var(--border)'} />
+
+
+ {dontRules.map((r, i) => (
+
+ ✗
+ {r}
+
+
+ ))}
+
+
+ )
+}
+
+function HashtagProfileEditor({ profiles, onChange }) {
+ const [activeTab, setActiveTab] = useState('instagram')
+ const [tagInput, setTagInput] = useState('')
+
+ const getProfile = (platform) => profiles[platform] || { always: [], max_generated: 12 }
+ const setProfile = (platform, profile) => onChange({ ...profiles, [platform]: profile })
+
+ const addTag = (platform) => {
+ let tag = tagInput.trim()
+ if (!tag) return
+ if (!tag.startsWith('#')) tag = `#${tag}`
+ const p = getProfile(platform)
+ if (!p.always.includes(tag)) {
+ setProfile(platform, { ...p, always: [...p.always, tag] })
+ }
+ setTagInput('')
+ }
+
+ const removeTag = (platform, idx) => {
+ const p = getProfile(platform)
+ setProfile(platform, { ...p, always: p.always.filter((_, i) => i !== idx) })
+ }
+
+ const profile = getProfile(activeTab)
+
+ return (
+
+
+ {HASHTAG_PLATFORMS.map(p => (
+
+ ))}
+
+
+
+ setTagInput(e.target.value)}
+ onKeyDown={e => { if (e.key === 'Enter') { e.preventDefault(); addTag(activeTab) } }}
+ placeholder={`Hashtag fisso per ${activeTab}…`} style={{ ...inputStyle, flex: 1, fontSize: '0.82rem' }}
+ onFocus={e => e.target.style.borderColor = 'var(--ink)'} onBlur={e => e.target.style.borderColor = 'var(--border)'} />
+
+
+
+ {profile.always.length > 0 ? (
+
+ {profile.always.map((tag, i) => (
+
+ {tag}
+
+
+ ))}
+
+ ) : (
+
+ Nessun hashtag fisso per {activeTab}. L'AI genererà tutti gli hashtag automaticamente.
+
+ )}
+
+
+
+ setProfile(activeTab, { ...profile, max_generated: parseInt(e.target.value) || 0 })}
+ style={{ ...inputStyle, width: 80, fontSize: '0.82rem' }} />
+
+
+ )
+}
+
+const miniLabelStyle = { display: 'block', fontSize: '0.68rem', fontWeight: 700, letterSpacing: '0.08em', textTransform: 'uppercase', color: 'var(--ink-muted)', marginBottom: '0.35rem' }
+const btnSmall = { padding: '0.35rem 0.65rem', fontSize: '0.8rem', fontWeight: 600, border: 'none', cursor: 'pointer', fontFamily: "'DM Sans', sans-serif", backgroundColor: 'var(--cream-dark)', color: 'var(--ink-light)' }
+
const inputStyle = {
width: '100%', padding: '0.625rem 0.875rem',
border: '1px solid var(--border)', borderRadius: 0,