import React from 'react'
import { Box, Text } from 'ink'
import { usePermissionContext } from '../context/PermissionContext'
import { getTheme } from '../utils/theme'
interface ModeIndicatorProps {
showTransitionCount?: boolean
}
export function ModeIndicator({
showTransitionCount = false,
}: ModeIndicatorProps) {
const { currentMode, permissionContext, getModeConfig } =
usePermissionContext()
const theme = getTheme()
const modeConfig = getModeConfig()
// Don't show indicator for default mode unless explicitly requested
if (currentMode === 'default' && !showTransitionCount) {
return null
}
return (
{modeConfig.icon} {modeConfig.label}
{modeConfig.description}
Press Shift+Tab to cycle modes
{showTransitionCount && (
Switches: {permissionContext.metadata.transitionCount}
)}
{currentMode === 'plan' && (
Available tools: {permissionContext.allowedTools.join(', ')}
Use exit_plan_mode tool when ready to execute
)}
)
}
function getThemeColor(colorName: string, theme: any): string {
const colorMap: Record = {
blue: theme.primary || 'blue',
green: theme.success || 'green',
yellow: theme.warning || 'yellow',
red: theme.error || 'red',
}
return colorMap[colorName] || colorName
}
// Compact mode indicator for status bar
export function CompactModeIndicator() {
const { currentMode, getModeConfig } = usePermissionContext()
const modeConfig = getModeConfig()
const theme = getTheme()
if (currentMode === 'default') {
return null
}
return (
{modeConfig.icon} {modeConfig.name}
)
}