import re

with open('src/components/self-dev/ExecutionMonitor.tsx', 'r') as f:
    content = f.read()

# Fix the condition that shows "No Approved Tasks"
old = "  // Empty queue state\n  if (stats.totalTasks === 0) {"
new = "  // Empty queue state\n  if (stats.totalTasks === 0 && stats.approvedTasks === 0 && stats.executingTasks === 0) {"
content = content.replace(old, new)

# Fix stats destructuring to include approvedTasks
old = """  const stats = status?.stats || {
    totalTasks: 0,
    completedTasks: 0,
    executingTasks: 0,
    approvedTasks: 0,
    pendingTasks: 0,
    skippedTasks: 0
  };"""
new = """  const stats = status?.stats || {
    totalTasks: 0,
    completedTasks: 0,
    executingTasks: 0,
    approvedTasks: 0,
    pendingTasks: 0,
    skippedTasks: 0
  };"""
# Already has correct fallback, just fix condition
content = content.replace(
  "  if (stats.approvedTasks === 0 && stats.executingTasks === 0) {",
  "  if (stats.totalTasks === 0 && !stats.approvedTasks && !stats.executingTasks) {"
)

with open('src/components/self-dev/ExecutionMonitor.tsx', 'w') as f:
    f.write(content)
    
print("Done - fixed condition")
