Skip to content

Commit 07b7270

Browse files
committed
Make arrows and header more compact
1 parent b3c9c59 commit 07b7270

File tree

3 files changed

+62
-53
lines changed

3 files changed

+62
-53
lines changed

cli/src/components/ask-user/components/question-header.tsx

Lines changed: 45 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -38,68 +38,61 @@ export const QuestionHeader: React.FC<QuestionHeaderProps> = ({
3838
<box
3939
style={{
4040
flexDirection: 'row',
41-
justifyContent: 'space-between',
41+
gap: 1,
4242
alignItems: 'center',
4343
marginBottom: 1,
4444
}}
4545
>
46-
{/* Left side: Question counter and progress */}
47-
<box style={{ flexDirection: 'column', gap: 0 }}>
48-
<box style={{ flexDirection: 'row', gap: 0 }}>
49-
<text style={{ fg: theme.secondary }}>
50-
{isOnConfirmScreen ? 'Ready to submit' : `Question ${currentIndex + 1} of ${totalQuestions}`}
51-
</text>
52-
</box>
53-
<ProgressIndicator
54-
currentIndex={currentIndex}
55-
answeredStates={answeredStates}
56-
isOnConfirmScreen={isOnConfirmScreen}
57-
onNavigate={onNavigate}
58-
onNavigateToConfirm={onNavigateToConfirm}
59-
/>
60-
</box>
61-
62-
{/* Right side: Navigation buttons */}
63-
<box style={{ flexDirection: 'row', gap: 1 }}>
64-
<Button
65-
onClick={onPrev}
46+
{/* Left arrow */}
47+
<Button
48+
onClick={onPrev}
49+
style={{
50+
borderStyle: 'single',
51+
borderColor: isFirstQuestion ? theme.muted : theme.secondary,
52+
customBorderChars: BORDER_CHARS,
53+
paddingLeft: 1,
54+
paddingRight: 1,
55+
}}
56+
>
57+
<text
6658
style={{
67-
borderStyle: 'single',
68-
borderColor: isFirstQuestion ? theme.muted : theme.secondary,
69-
customBorderChars: BORDER_CHARS,
70-
paddingLeft: 1,
71-
paddingRight: 1,
59+
fg: isFirstQuestion ? theme.muted : theme.foreground,
60+
attributes: isFirstQuestion ? undefined : TextAttributes.BOLD,
7261
}}
7362
>
74-
<text
75-
style={{
76-
fg: isFirstQuestion ? theme.muted : theme.foreground,
77-
attributes: isFirstQuestion ? undefined : TextAttributes.BOLD,
78-
}}
79-
>
80-
81-
</text>
82-
</Button>
83-
<Button
84-
onClick={onNext}
63+
64+
</text>
65+
</Button>
66+
67+
{/* Progress breadcrumbs */}
68+
<ProgressIndicator
69+
currentIndex={currentIndex}
70+
answeredStates={answeredStates}
71+
isOnConfirmScreen={isOnConfirmScreen}
72+
onNavigate={onNavigate}
73+
onNavigateToConfirm={onNavigateToConfirm}
74+
/>
75+
76+
{/* Right arrow */}
77+
<Button
78+
onClick={onNext}
79+
style={{
80+
borderStyle: 'single',
81+
borderColor: isLastQuestion ? theme.muted : theme.secondary,
82+
customBorderChars: BORDER_CHARS,
83+
paddingLeft: 1,
84+
paddingRight: 1,
85+
}}
86+
>
87+
<text
8588
style={{
86-
borderStyle: 'single',
87-
borderColor: isLastQuestion ? theme.muted : theme.secondary,
88-
customBorderChars: BORDER_CHARS,
89-
paddingLeft: 1,
90-
paddingRight: 1,
89+
fg: isLastQuestion ? theme.muted : theme.foreground,
90+
attributes: isLastQuestion ? undefined : TextAttributes.BOLD,
9191
}}
9292
>
93-
<text
94-
style={{
95-
fg: isLastQuestion ? theme.muted : theme.foreground,
96-
attributes: isLastQuestion ? undefined : TextAttributes.BOLD,
97-
}}
98-
>
99-
100-
</text>
101-
</Button>
102-
</box>
93+
94+
</text>
95+
</Button>
10396
</box>
10497
)
10598
}

cli/src/components/ask-user/index.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export interface MultipleChoiceFormProps {
2424
onSelectAnswer: (questionIndex: number, optionIndex: number) => void
2525
onOtherTextChange: (questionIndex: number, text: string) => void
2626
onSubmit: (finalAnswers?: (number | number[])[], finalOtherTexts?: string[]) => void
27+
onQuestionChange?: (currentIndex: number, totalQuestions: number, isOnConfirmScreen: boolean) => void
2728
width: number
2829
}
2930

@@ -34,12 +35,18 @@ export const MultipleChoiceForm: React.FC<MultipleChoiceFormProps> = ({
3435
onSelectAnswer,
3536
onOtherTextChange,
3637
onSubmit,
38+
onQuestionChange,
3739
width,
3840
}) => {
3941
const theme = useTheme()
4042
const [currentQuestionIndex, setCurrentQuestionIndex] = useState(0)
4143
const [isOnConfirmScreen, setIsOnConfirmScreen] = useState(false)
4244

45+
// Notify parent when question changes
46+
React.useEffect(() => {
47+
onQuestionChange?.(currentQuestionIndex, questions.length, isOnConfirmScreen)
48+
}, [currentQuestionIndex, questions.length, isOnConfirmScreen, onQuestionChange])
49+
4350
// Computed values
4451
const currentQuestion = questions[currentQuestionIndex]
4552
const isLastQuestion = currentQuestionIndex === questions.length - 1

cli/src/components/chat-input-bar.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,12 @@ export const ChatInputBar = ({
178178
inputMode === 'default' ? inputPlaceholder : modeConfig.placeholder
179179
const borderColor = theme[modeConfig.color]
180180

181+
const [askUserTitle, setAskUserTitle] = React.useState(' Action Required ')
182+
181183
if (askUserState) {
182184
return (
183185
<box
184-
title=" Action Required "
186+
title={askUserTitle}
185187
titleAlignment="center"
186188
style={{
187189
width: '100%',
@@ -197,6 +199,13 @@ export const ChatInputBar = ({
197199
onSelectAnswer={updateAskUserAnswer}
198200
onOtherTextChange={updateAskUserOtherText}
199201
onSubmit={handleFormSubmit}
202+
onQuestionChange={(currentIndex, totalQuestions, isOnConfirmScreen) => {
203+
if (isOnConfirmScreen) {
204+
setAskUserTitle(' Ready to submit ')
205+
} else {
206+
setAskUserTitle(` Question ${currentIndex + 1} of ${totalQuestions} `)
207+
}
208+
}}
200209
width={inputWidth}
201210
/>
202211
</box>

0 commit comments

Comments
 (0)