"""
Reusable UI components
"""
import gradio as gr
from typing import Dict, List, Optional, Callable
def create_metric_card(title: str, value: str, is_critical: bool = False) -> gr.HTML:
"""Create a styled metric card"""
color = "#FF6B6B" if is_critical else "#4ECDC4"
bg_color = "rgba(255,107,107,0.1)" if is_critical else "rgba(78,205,196,0.1)"
html = f"""
"""
return gr.HTML(value=html)
def create_business_impact_section(impact_data: Dict[str, str]) -> gr.HTML:
"""Create business impact section"""
html = ""
html += "
💰 Business Impact
"
for key, value in impact_data.items():
is_loss = any(word in key.lower() for word in ['loss', 'impact', 'violation'])
icon = "📉" if is_loss else "📊"
html += f"""
{icon} {key}
{value}
"""
html += "
"
return gr.HTML(value=html)
def create_approval_workflow(requires_approval: bool = True) -> gr.HTML:
"""Create approval workflow visualization"""
if requires_approval:
html = """
Status: ✅ Approved & Executed
"""
else:
html = """
🤖 → ⚡
ARF directly executes with safety guardrails
Status: ✅ Auto-Executed Successfully
"""
return gr.HTML(value=html)
def create_roi_comparison_table() -> gr.HTML:
"""Create ROI comparison table"""
html = """
📊 Capability Comparison
| Feature |
OSS (Free) |
Enterprise |
| Execution |
❌ Advisory only |
✅ Autonomous |
| Learning |
❌ None |
✅ Continuous |
| ROI Measurement |
❌ No ROI |
✅ 5.2× average |
| Payback Period |
N/A |
✅ 2-3 months |
"""
return gr.HTML(value=html)