refactor: rename isInputActive to isPaneFocused for clarity

The prop represents whether the pane/panel is focused, not whether the
text input is focused. Rename across all 5 files to match the caller
names and reduce confusion.
This commit is contained in:
Mohamed Boudra
2026-04-15 10:36:36 +07:00
parent 3fe79535cc
commit fc96b260d1
5 changed files with 15 additions and 15 deletions
@@ -63,7 +63,7 @@ type ImageListUpdater = ImageAttachment[] | ((prev: ImageAttachment[]) => ImageA
interface AgentInputAreaProps { interface AgentInputAreaProps {
agentId: string; agentId: string;
serverId: string; serverId: string;
isInputActive: boolean; isPaneFocused: boolean;
onSubmitMessage?: (payload: MessagePayload) => Promise<void>; onSubmitMessage?: (payload: MessagePayload) => Promise<void>;
/** Externally controlled loading state. When true, disables the submit button. */ /** Externally controlled loading state. When true, disables the submit button. */
isSubmitLoading?: boolean; isSubmitLoading?: boolean;
@@ -98,7 +98,7 @@ const MOBILE_MESSAGE_PLACEHOLDER = "Message, @files, /commands";
export function AgentInputArea({ export function AgentInputArea({
agentId, agentId,
serverId, serverId,
isInputActive, isPaneFocused,
onSubmitMessage, onSubmitMessage,
isSubmitLoading = false, isSubmitLoading = false,
blurOnSubmit = false, blurOnSubmit = false,
@@ -421,7 +421,7 @@ export function AgentInputArea({
const handleKeyboardAction = useCallback( const handleKeyboardAction = useCallback(
(action: KeyboardActionDefinition): boolean => { (action: KeyboardActionDefinition): boolean => {
if (!isInputActive) { if (!isPaneFocused) {
return false; return false;
} }
@@ -461,7 +461,7 @@ export function AgentInputArea({
return false; return false;
} }
}, },
[isInputActive], [isPaneFocused],
); );
useKeyboardActionHandler({ useKeyboardActionHandler({
@@ -475,9 +475,9 @@ export function AgentInputArea({
"message-input.voice-toggle", "message-input.voice-toggle",
"message-input.voice-mute-toggle", "message-input.voice-mute-toggle",
], ],
enabled: isInputActive, enabled: isPaneFocused,
priority: isMessageInputFocused ? 200 : 100, priority: isMessageInputFocused ? 200 : 100,
isActive: () => isInputActive, isActive: () => isPaneFocused,
handle: handleKeyboardAction, handle: handleKeyboardAction,
}); });
@@ -736,7 +736,7 @@ export function AgentInputArea({
autoFocus={autoFocus && isDesktopWebBreakpoint} autoFocus={autoFocus && isDesktopWebBreakpoint}
autoFocusKey={`${serverId}:${agentId}`} autoFocusKey={`${serverId}:${agentId}`}
disabled={isSubmitLoading} disabled={isSubmitLoading}
isInputActive={isInputActive} isPaneFocused={isPaneFocused}
leftContent={leftContent} leftContent={leftContent}
beforeVoiceContent={beforeVoiceContent} beforeVoiceContent={beforeVoiceContent}
rightContent={rightContent} rightContent={rightContent}
@@ -77,8 +77,8 @@ export interface MessageInputProps {
autoFocus?: boolean; autoFocus?: boolean;
autoFocusKey?: string; autoFocusKey?: string;
disabled?: boolean; disabled?: boolean;
/** True when this input is the active composer. Used to gate global hotkeys and stop dictation when hidden. */ /** True when this composer's pane is focused. Used to gate global hotkeys and stop dictation when hidden. */
isInputActive?: boolean; isPaneFocused?: boolean;
/** Content to render on the left side of the button row (e.g., AgentStatusBar) */ /** Content to render on the left side of the button row (e.g., AgentStatusBar) */
leftContent?: React.ReactNode; leftContent?: React.ReactNode;
/** Content to render on the right side before the voice button (e.g., context window meter) */ /** Content to render on the right side before the voice button (e.g., context window meter) */
@@ -208,7 +208,7 @@ export const MessageInput = forwardRef<MessageInputRef, MessageInputProps>(funct
autoFocus = false, autoFocus = false,
autoFocusKey, autoFocusKey,
disabled = false, disabled = false,
isInputActive = true, isPaneFocused = true,
leftContent, leftContent,
beforeVoiceContent, beforeVoiceContent,
rightContent, rightContent,
@@ -431,7 +431,7 @@ export const MessageInput = forwardRef<MessageInputRef, MessageInputProps>(funct
onError: handleDictationError, onError: handleDictationError,
canStart: canStartDictation, canStart: canStartDictation,
canConfirm: canConfirmDictation, canConfirm: canConfirmDictation,
autoStopWhenHidden: { isVisible: isInputActive }, autoStopWhenHidden: { isVisible: isPaneFocused },
enableDuration: true, enableDuration: true,
}); });
@@ -1031,7 +1031,7 @@ export const MessageInput = forwardRef<MessageInputRef, MessageInputProps>(funct
autoFocus={isWeb && autoFocus} autoFocus={isWeb && autoFocus}
/> />
{inputScrollbar} {inputScrollbar}
{isWeb && isInputActive && !isInputFocused && !value && focusInputKeys ? ( {isWeb && isPaneFocused && !isInputFocused && !value && focusInputKeys ? (
<Text style={styles.focusHintText} pointerEvents="none"> <Text style={styles.focusHintText} pointerEvents="none">
{formatShortcut(focusInputKeys[0], getShortcutOs())} to focus {formatShortcut(focusInputKeys[0], getShortcutOs())} to focus
</Text> </Text>
+1 -1
View File
@@ -762,7 +762,7 @@ function AgentPanelBody({
<AgentInputArea <AgentInputArea
agentId={agentId} agentId={agentId}
serverId={serverId} serverId={serverId}
isInputActive={isPaneFocused} isPaneFocused={isPaneFocused}
value={agentInputDraft.text} value={agentInputDraft.text}
onChangeText={agentInputDraft.setText} onChangeText={agentInputDraft.setText}
images={agentInputDraft.images} images={agentInputDraft.images}
@@ -1232,7 +1232,7 @@ function DraftAgentScreenContent({
<AgentInputArea <AgentInputArea
agentId={draftAgentIdRef.current} agentId={draftAgentIdRef.current}
serverId={selectedServerId ?? ""} serverId={selectedServerId ?? ""}
isInputActive={isFocused} isPaneFocused={isFocused}
onSubmitMessage={handleCreateFromInput} onSubmitMessage={handleCreateFromInput}
isSubmitLoading={isSubmitting} isSubmitLoading={isSubmitting}
blurOnSubmit={true} blurOnSubmit={true}
@@ -342,7 +342,7 @@ export function WorkspaceDraftAgentTab({
<AgentInputArea <AgentInputArea
agentId={tabId} agentId={tabId}
serverId={serverId} serverId={serverId}
isInputActive={isPaneFocused} isPaneFocused={isPaneFocused}
onSubmitMessage={handleCreateFromInput} onSubmitMessage={handleCreateFromInput}
isSubmitLoading={isSubmitting} isSubmitLoading={isSubmitting}
blurOnSubmit={true} blurOnSubmit={true}