import { useEffect, useState } from 'react' import axios from 'axios' import { X, Bot, Tag, Target, Users, Plus, Trash2, Save } from 'lucide-react' import clsx from 'clsx' interface RoboticsSettingsProps { isOpen: boolean onClose: () => void apiBase: string } export function RoboticsSettings({ isOpen, onClose, apiBase }: RoboticsSettingsProps) { const [activeTab, setActiveTab] = useState<'robotics' | 'industries' | 'roles'>('robotics') // Data States const [roboticsCategories, setRoboticsCategories] = useState([]) const [industries, setIndustries] = useState([]) const [jobRoles, setJobRoles] = useState([]) const fetchRobotics = async () => { try { const res = await axios.get(`${apiBase}/robotics/categories`); setRoboticsCategories(res.data) } catch (e) { console.error(e) } } const fetchIndustries = async () => { try { const res = await axios.get(`${apiBase}/industries`); setIndustries(res.data) } catch (e) { console.error(e) } } const fetchJobRoles = async () => { try { const res = await axios.get(`${apiBase}/job_roles`); setJobRoles(res.data) } catch (e) { console.error(e) } } useEffect(() => { if (isOpen) { fetchRobotics() fetchIndustries() fetchJobRoles() } }, [isOpen]) // Robotics Handlers const handleUpdateRobotics = async (id: number, description: string, reasoning: string) => { try { await axios.put(`${apiBase}/robotics/categories/${id}`, { description, reasoning_guide: reasoning }) fetchRobotics() } catch (e) { alert("Update failed") } } // Industry Handlers Removed (Notion SSoT) // Job Role Handlers const handleAddJobRole = async () => { try { await axios.post(`${apiBase}/job_roles`, { pattern: "New Pattern", role: "Operativer Entscheider" }); fetchJobRoles() } catch (e) { alert("Failed") } } const handleDeleteJobRole = async (id: number) => { try { await axios.delete(`${apiBase}/job_roles/${id}`); fetchJobRoles() } catch (e) { alert("Failed") } } if (!isOpen) return null return (
{/* Header */}

Settings & Classification Logic

Define how AI evaluates leads and matches roles.

{/* Tab Nav */}
{[ { id: 'robotics', label: 'Robotics Potential', icon: Bot }, { id: 'industries', label: 'Industry Focus', icon: Target }, { id: 'roles', label: 'Job Role Mapping', icon: Users }, ].map(t => ( ))}
{/* Content */}
{/* ROBOTICS TAB */} {activeTab === 'robotics' && (
{roboticsCategories.map(cat => ( ))}
)} {/* INDUSTRIES TAB */} {activeTab === 'industries' && (

Industry Verticals (Synced from Notion)

{/* Notion SSoT: Creation disabled here */}
{industries.map(ind => (
{/* Sync Indicator */} {ind.notion_id && (
SYNCED
)} {/* Top Row: Name, Status, Group */}

{ind.name}

{ind.industry_group && {ind.industry_group}} {ind.status_notion && {ind.status_notion}}
{ind.is_focus ? "Focus" : "Standard"}
{/* Description */}

{ind.description || "No definition"}

{/* Metrics Grid */}
Whale > {ind.whale_threshold || "-"}
Min Req {ind.min_requirement || "-"}
Unit {ind.core_unit || "-"}
Product {roboticsCategories.find(c => c.id === ind.primary_category_id)?.name || "-"}
{/* Keywords */} {ind.scraper_keywords && (
Keywords: {ind.scraper_keywords}
)}
))}
)} {/* JOB ROLES TAB */} {activeTab === 'roles' && (

Job Title Mapping Patterns

{jobRoles.map(role => ( ))} {jobRoles.length === 0 && ( )}
Job Title Pattern (Regex/Text) Mapped Role
No patterns defined yet.
)}
) } function CategoryCard({ category, onSave }: { category: any, onSave: any }) { const [desc, setDesc] = useState(category.description) const [guide, setGuide] = useState(category.reasoning_guide) const [isDirty, setIsDirty] = useState(false) useEffect(() => { setIsDirty(desc !== category.description || guide !== category.reasoning_guide) }, [desc, guide]) return (
{category.name}