import React, { useState } from 'react'; const ACTIONS = [ { type: 'reply', icon: '↩', label: 'Reply', desc: 'Personally respond and handle', color: '#3b82f6', bg: 'rgba(59,130,246,0.15)', hoverBg: 'rgba(59,130,246,0.25)', }, { type: 'schedule', icon: '📅', label: 'Schedule', desc: 'Book a meeting slot', color: '#8b5cf6', bg: 'rgba(139,92,246,0.15)', hoverBg: 'rgba(139,92,246,0.25)', }, { type: 'delegate', icon: '→', label: 'Delegate', desc: 'Assign to team member', color: '#f97316', bg: 'rgba(249,115,22,0.15)', hoverBg: 'rgba(249,115,22,0.25)', }, { type: 'ignore', icon: '✕', label: 'Ignore', desc: 'Skip this item', color: '#64748b', bg: 'rgba(100,116,139,0.15)', hoverBg: 'rgba(100,116,139,0.25)', }, ]; export default function ActionPanel({ selectedEmail, onAction, done, loading }) { const [hoveredAction, setHoveredAction] = useState(null); const [lastAction, setLastAction] = useState(null); const handleAction = (actionType) => { if (!selectedEmail || done || loading) return; setLastAction(actionType); onAction({ type: actionType, email_id: selectedEmail.id }); setTimeout(() => setLastAction(null), 600); }; const isDisabled = !selectedEmail || done || loading; return (
⚡ Actions
{selectedEmail ? (
SELECTED
{selectedEmail.subject}
{selectedEmail.sender.split('<')[0].trim()}
) : (
👆 Select an email
from the inbox
)}
{ACTIONS.map(action => { const isActive = lastAction === action.type; const isHovered = hoveredAction === action.type; return ( ); })}
{done && (
Simulation Complete
)}
); }