Fix sats output

This commit is contained in:
2026-01-30 03:05:57 +00:00
parent fb44304275
commit 2c40a7ad73
2 changed files with 61 additions and 39 deletions

Binary file not shown.

View File

@@ -12,6 +12,53 @@
import React, { useState, useEffect, useCallback } from 'react'; import React, { useState, useEffect, useCallback } from 'react';
import { Box, Text, useInput } from 'ink'; import { Box, Text, useInput } from 'ink';
import TextInput from 'ink-text-input'; import TextInput from 'ink-text-input';
/**
* Isolated Variable Input Component.
* This component handles its own input without interference from parent useInput hooks.
*/
interface VariableInputFieldProps {
variable: { id: string; name: string; type: string; hint?: string; value: string };
index: number;
isFocused: boolean;
onChange: (index: number, value: string) => void;
onSubmit: () => void;
borderColor: string;
focusColor: string;
}
function VariableInputField({
variable,
index,
isFocused,
onChange,
onSubmit,
borderColor,
focusColor,
}: VariableInputFieldProps): React.ReactElement {
return (
<Box flexDirection="column" marginBottom={1}>
<Text color={focusColor}>{variable.name}</Text>
{variable.hint && (
<Text color={borderColor} dimColor>({variable.hint})</Text>
)}
<Box
borderStyle="single"
borderColor={isFocused ? focusColor : borderColor}
paddingX={1}
marginTop={1}
>
<TextInput
value={variable.value}
onChange={value => onChange(index, value)}
onSubmit={onSubmit}
focus={isFocused}
placeholder={`Enter ${variable.name}...`}
/>
</Box>
</Box>
);
}
import { StepIndicator, type Step } from '../components/ProgressBar.js'; import { StepIndicator, type Step } from '../components/ProgressBar.js';
import { Button } from '../components/Button.js'; import { Button } from '../components/Button.js';
import { useNavigation } from '../hooks/useNavigation.js'; import { useNavigation } from '../hooks/useNavigation.js';
@@ -498,24 +545,9 @@ export function ActionWizardScreen(): React.ReactElement {
} }
}, [focusedInput, variables.length]); }, [focusedInput, variables.length]);
// Handle Tab key when in TextInput mode (separate from main useInput to allow Tab navigation) // Keyboard handler - COMPLETELY DISABLED when TextInput has focus
useInput((input, key) => { // This allows TextInput to receive character input without interference
if (key.tab) { // When TextInput is focused, use Enter to navigate (handled by onSubmit callback)
if (focusedInput < variables.length - 1) {
setFocusedInput(prev => prev + 1);
} else {
setFocusArea('buttons');
setFocusedButton('next');
}
}
// Escape to go back to content from anywhere
if (key.escape && focusArea === 'buttons') {
setFocusArea('content');
}
}, { isActive: textInputHasFocus });
// Handle keyboard navigation for non-TextInput modes
// IMPORTANT: Disable when TextInput should have focus to allow character input
useInput((input, key) => { useInput((input, key) => {
// Tab to switch between content and buttons // Tab to switch between content and buttons
if (key.tab) { if (key.tab) {
@@ -630,31 +662,21 @@ export function ActionWizardScreen(): React.ReactElement {
<Text color={colors.text} bold>Enter required values:</Text> <Text color={colors.text} bold>Enter required values:</Text>
<Box marginTop={1} flexDirection="column"> <Box marginTop={1} flexDirection="column">
{variables.map((variable, index) => ( {variables.map((variable, index) => (
<Box key={variable.id} flexDirection="column" marginBottom={1}> <VariableInputField
<Text color={colors.primary}>{variable.name}</Text> key={variable.id}
{variable.hint && ( variable={variable}
<Text color={colors.textMuted} dimColor>({variable.hint})</Text> index={index}
)} isFocused={focusArea === 'content' && focusedInput === index}
<Box onChange={updateVariable}
borderStyle="single"
borderColor={focusArea === 'content' && focusedInput === index ? colors.focus : colors.border}
paddingX={1}
marginTop={1}
>
<TextInput
value={variable.value}
onChange={value => updateVariable(index, value)}
onSubmit={handleTextInputSubmit} onSubmit={handleTextInputSubmit}
focus={focusArea === 'content' && focusedInput === index} borderColor={colors.border as string}
placeholder={`Enter ${variable.name}...`} focusColor={colors.primary as string}
/> />
</Box>
</Box>
))} ))}
</Box> </Box>
<Box marginTop={1}> <Box marginTop={1}>
<Text color={colors.textMuted} dimColor> <Text color={colors.textMuted} dimColor>
Enter: Next field Tab: Go to buttons Type your value, then press Enter to continue
</Text> </Text>
</Box> </Box>
</Box> </Box>