ModeTool.tsx 807 B

12345678910111213141516171819202122232425262728
  1. import { Box, Text } from "ink"
  2. import * as theme from "../../theme.js"
  3. import { Icon } from "../Icon.js"
  4. import type { ToolRendererProps } from "./types.js"
  5. import { getToolIconName } from "./utils.js"
  6. export function ModeTool({ toolData }: ToolRendererProps) {
  7. const iconName = getToolIconName(toolData.tool)
  8. const mode = toolData.mode || ""
  9. const isSwitch = toolData.tool.includes("switch") || toolData.tool.includes("Switch")
  10. return (
  11. <Box flexDirection="row" gap={1} paddingX={1} marginBottom={1}>
  12. <Icon name={iconName} color={theme.toolHeader} />
  13. {isSwitch && mode && (
  14. <Box gap={1}>
  15. <Text color={theme.dimText}>Switching to</Text>
  16. <Text color={theme.userHeader} bold>
  17. {mode}
  18. </Text>
  19. <Text color={theme.dimText}>mode</Text>
  20. </Box>
  21. )}
  22. </Box>
  23. )
  24. }