import { useState } from 'react' import { Card, Button, Input, Select, Modal, Badge } from '../components/ui' interface Rule { id: string name: string enabled: boolean trigger: string actions: string[] runs: number } const mockRules: Rule[] = [ { id: '1', name: 'Auto-assign critical tickets', enabled: true, trigger: 'When priority is Critical', actions: ['Assign to On-Call', 'Send Slack notification'], runs: 23 }, { id: '2', name: 'Close stale tickets', enabled: true, trigger: 'When ticket has no activity for 14 days', actions: ['Add comment', 'Close ticket'], runs: 45 }, { id: '3', name: 'Escalate high priority', enabled: false, trigger: 'When high priority ticket is open for 24h', actions: ['Send email to manager'], runs: 12 }, ] export default function Automation() { const [rules, setRules] = useState(mockRules) const [showCreate, setShowCreate] = useState(false) const toggleRule = (id: string) => { setRules(rules.map(r => r.id === id ? { ...r, enabled: !r.enabled } : r)) } return (

Automation

Automate repetitive tasks with rules

{/* Stats */}
{rules.length}
Total Rules
{rules.filter(r => r.enabled).length}
Active Rules
{rules.reduce((a, r) => a + r.runs, 0)}
Total Runs
{/* Rules List */}
{rules.map(rule => (

{rule.name}

{rule.enabled ? 'Active' : 'Disabled'}

{rule.trigger}

{rule.actions.map((action, i) => ( {action} ))}
{rule.runs}
runs
))}
{/* Create Modal */} setShowCreate(false)} title="Create Automation Rule" size="lg">