import React, { useState, useEffect } from 'react'; import { Shield, Zap, Clock, Activity, Send } from 'lucide-react'; import styles from './RuleModal.module.css'; import type { EscalationRule } from '@nexus/shared'; interface RuleModalProps { rule?: EscalationRule | null; onClose: () => void; onSave: (data: any) => void; loading?: boolean; } export const RuleModal: React.FC = ({ rule, onClose, onSave, loading }) => { const [formData, setFormData] = useState({ name: '', priority_level: 'P0', threshold_minutes: 30, action: 'NOTIFY_LEAD', is_active: true }); useEffect(() => { if (rule) { setFormData({ name: rule.name, priority_level: rule.priority_level, threshold_minutes: rule.threshold_minutes, action: rule.action, is_active: rule.is_active }); } }, [rule]); const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); onSave(formData); }; return (
e.stopPropagation()}>
LOGIC CONFIGURATOR

{rule ? 'Edit Escalation Protocol' : 'Initialize New Protocol'}

Define automated hierarchy and conditional triggers.

1. PROTOCOL IDENTITY
setFormData({ ...formData, name: e.target.value })} required />
2. TARGET TIER
3. THRESHOLD
setFormData({ ...formData, threshold_minutes: parseInt(e.target.value) })} min="1" required /> MINUTES
4. TRIGGERED ACTION
LOGIC PREVIEW
IF RESOLUTION > {formData.threshold_minutes} MINS ➔ {formData.action.replace('_', ' ')}
ACTIVATE IMMEDIATELY
); };