import React, { useEffect, useRef } from 'react'; import { View, Text, Animated, StyleSheet } from 'react-native'; import { darkTheme, lightTheme } from '../theme'; interface LiveStatusIndicatorProps { status: string; // e.g., "thinking", "searching the web", "saying", "thought" isDark?: boolean; } const LiveStatusIndicator: React.FC = ({ status, isDark = true }) => { const theme = isDark ? darkTheme : lightTheme; const rainbowAnimValue = useRef(new Animated.Value(0)).current; // Animate rainbow gradient useEffect(() => { rainbowAnimValue.setValue(0); const animation = Animated.loop( Animated.timing(rainbowAnimValue, { toValue: 1, duration: 3000, useNativeDriver: false, }) ); animation.start(); return () => animation.stop(); }, []); // Special cases for past tense verbs (don't use "is") const isPastTense = status === 'thought'; const displayText = isPastTense ? status : `is ${status}`; return ( ( co {displayText}) ); }; const styles = StyleSheet.create({ container: { flexDirection: 'row', alignItems: 'baseline', paddingVertical: 4, marginBottom: 12, }, text: { fontSize: 24, fontFamily: 'Lexend_400Regular', }, coText: { fontSize: 24, fontFamily: 'Lexend_700Bold', }, }); export default React.memo(LiveStatusIndicator);