import React, { useCallback } from "react"; import { Pressable, Text, View } from "react-native"; import { SafeAreaView } from "react-native-safe-area-context"; import { router } from "expo-router"; import { useChat } from "../contexts/ChatContext"; import { useConnection } from "../contexts/ConnectionContext"; import { MessageList } from "../components/chat/MessageList"; import { InputBar } from "../components/chat/InputBar"; import { CommandBar } from "../components/chat/CommandBar"; import { StatusDot } from "../components/ui/StatusDot"; export default function ChatScreen() { const { messages, sendTextMessage, sendVoiceMessage, clearMessages } = useChat(); const { status } = useConnection(); const handleCommand = useCallback( (command: string) => { if (command === "/clear") { clearMessages(); return; } sendTextMessage(command); }, [sendTextMessage, clearMessages] ); const handleSendVoice = useCallback( (audioUri: string, durationMs: number) => { sendVoiceMessage(audioUri, durationMs); }, [sendVoiceMessage] ); return ( {/* Header */} PAILot {status === "connected" ? "Connected" : status === "connecting" ? "Connecting..." : "Offline"} router.push("/settings")} className="w-9 h-9 items-center justify-center rounded-full bg-pai-bg-tertiary" hitSlop={{ top: 4, bottom: 4, left: 4, right: 4 }} > ⚙️ {/* Message list */} {messages.length === 0 ? ( 🛩 PAILot Voice-first AI communicator.{"\n"}Hold the mic button to talk. ) : ( )} {/* Command bar */} {/* Input bar */} ); }