@@ -26,7 +26,7 @@ import {
2626 useState ,
2727 type RefObject ,
2828} from "react" ;
29- import { ActivityIndicator , Alert , Platform , Pressable , View , type ViewStyle } from "react-native" ;
29+ import { Alert , Platform , Pressable , View , type ViewStyle } from "react-native" ;
3030import { FilePreviewModal , type FilePreviewSource } from "../../components/FilePreviewModal" ;
3131import {
3232 composerAttachmentUploadBlockReason ,
@@ -113,7 +113,6 @@ export interface ThreadComposerProps {
113113 readonly contentMaxWidth ?: number ;
114114 readonly bottomInset ?: number ;
115115 readonly connectionState : RemoteClientConnectionState ;
116- readonly connectionError : string | null ;
117116 readonly environmentLabel : string | null ;
118117 readonly selectedThread : OrchestrationThreadShell ;
119118 readonly hasCompactableConversation : boolean ;
@@ -134,7 +133,6 @@ export interface ThreadComposerProps {
134133 readonly onUpdateModelSelection : ( modelSelection : ModelSelection ) => void ;
135134 readonly onUpdateRuntimeMode : ( runtimeMode : RuntimeMode ) => void ;
136135 readonly onUpdateInteractionMode : ( interactionMode : ProviderInteractionMode ) => void ;
137- readonly onReconnectEnvironment : ( ) => void ;
138136 readonly onExpandedChange ?: ( expanded : boolean ) => void ;
139137 /** Fires on editor focus/blur; hosts use it to vet stale keyboard state. */
140138 readonly onEditorFocusChange ?: ( focused : boolean ) => void ;
@@ -226,72 +224,6 @@ export function ComposerSurface(props: {
226224 ) ;
227225}
228226
229- type ComposerStatusPillState = {
230- readonly kind : "unavailable" | "reconnecting" ;
231- readonly label : string ;
232- } ;
233-
234- function composerConnectionStatus ( input : {
235- readonly connectionError : string | null ;
236- readonly connectionState : RemoteClientConnectionState ;
237- readonly environmentLabel : string | null ;
238- } ) : ComposerStatusPillState | null {
239- const environmentLabel = input . environmentLabel ?? "Environment" ;
240-
241- switch ( input . connectionState ) {
242- case "connecting" :
243- case "reconnecting" :
244- return {
245- kind : "reconnecting" ,
246- label :
247- input . connectionError === null
248- ? `Reconnecting to ${ environmentLabel } ...`
249- : `Failed to connect. Retrying ${ environmentLabel } ...` ,
250- } ;
251- case "offline" :
252- return { kind : "unavailable" , label : "You are offline" } ;
253- case "error" :
254- return {
255- kind : "unavailable" ,
256- label : input . connectionError
257- ? `Failed to connect to ${ environmentLabel } : ${ input . connectionError } `
258- : `Failed to connect to ${ environmentLabel } ` ,
259- } ;
260- case "available" :
261- return { kind : "unavailable" , label : `${ environmentLabel } is not connected` } ;
262- case "connected" :
263- return null ;
264- }
265- }
266-
267- const ComposerConnectionStatusPill = memo ( function ComposerConnectionStatusPill ( props : {
268- readonly onPress : ( ) => void ;
269- readonly status : ComposerStatusPillState ;
270- } ) {
271- const isReconnecting = props . status . kind === "reconnecting" ;
272- return (
273- < View className = "absolute inset-x-0 bottom-full items-center pb-2" pointerEvents = "box-none" >
274- < Pressable
275- accessibilityRole = "button"
276- onPress = { props . onPress }
277- className = "max-w-full flex-row items-center gap-2 rounded-full bg-card px-3 py-2 shadow-sm active:opacity-70"
278- >
279- { isReconnecting ? (
280- < ActivityIndicator size = "small" colorClassName = { "accent-icon-muted" } />
281- ) : (
282- < View className = "h-2 w-2 rounded-full bg-red-500" />
283- ) }
284- < Text
285- className = "max-w-[260px] text-sm font-t3-bold leading-snug text-foreground"
286- numberOfLines = { 1 }
287- >
288- { props . status . label }
289- </ Text >
290- </ Pressable >
291- </ View >
292- ) ;
293- } ) ;
294-
295227export const ThreadComposer = memo ( function ThreadComposer ( props : ThreadComposerProps ) {
296228 const navigation = useNavigation ( ) ;
297229 const foregroundColor = useUniwindTheme ( ) [ "--color-foreground" ] ;
@@ -337,11 +269,6 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposer
337269 const modelUnavailable =
338270 props . connectionState === "connected" &&
339271 isModelSelectionUnavailable ( props . serverConfig , currentModelSelection ) ;
340- const connectionStatus = composerConnectionStatus ( {
341- connectionError : props . connectionError ,
342- connectionState : props . connectionState ,
343- environmentLabel : props . environmentLabel ,
344- } ) ;
345272 const selectedProviderStatus = useMemo ( ( ) => {
346273 if ( ! props . serverConfig ) return null ;
347274 return (
@@ -640,13 +567,6 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposer
640567 </ View >
641568 ) : null }
642569
643- { connectionStatus ? (
644- < ComposerConnectionStatusPill
645- status = { connectionStatus }
646- onPress = { props . onReconnectEnvironment }
647- />
648- ) : null }
649-
650570 { modelUnavailable ? (
651571 < Pressable accessibilityRole = "button" className = "px-3 py-2" onPress = { openSettings } >
652572 < Text className = "text-xs text-foreground" > Model unavailable. Open model settings.</ Text >
0 commit comments