Skip to content

Commit 995c5ed

Browse files
committed
Make input into a box
1 parent eb215f2 commit 995c5ed

File tree

3 files changed

+74
-64
lines changed

3 files changed

+74
-64
lines changed

cli/src/chat.tsx

Lines changed: 57 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import type { SendMessageTimerEvent } from './hooks/use-send-message'
4242
import { logger } from './utils/logger'
4343
import type { SendMessageFn } from './types/contracts/send-message'
4444
import type { ScrollBoxRenderable } from '@opentui/core'
45+
import { BORDER_CHARS } from './utils/ui-constants'
4546

4647
const MAX_VIRTUALIZED_TOP_LEVEL = 60
4748
const VIRTUAL_OVERSCAN = 12
@@ -820,67 +821,74 @@ export const App = ({
820821
</text>
821822
</box>
822823
)}
823-
<Separator width={separatorWidth} />
824-
{agentMode === 'PLAN' && hasReceivedPlanResponse && (
825-
<BuildModeButtons
826-
theme={theme}
827-
onBuildFast={handleBuildFast}
828-
onBuildMax={handleBuildMax}
829-
/>
830-
)}
831-
{slashContext.active && slashSuggestionItems.length > 0 ? (
832-
<SuggestionMenu
833-
items={slashSuggestionItems}
834-
selectedIndex={slashSelectedIndex}
835-
maxVisible={10}
836-
prefix="/"
837-
/>
838-
) : null}
839-
{!slashContext.active &&
840-
mentionContext.active &&
841-
agentSuggestionItems.length > 0 ? (
842-
<SuggestionMenu
843-
items={agentSuggestionItems}
844-
selectedIndex={agentSelectedIndex}
845-
maxVisible={10}
846-
prefix="@"
847-
/>
848-
) : null}
849824
<box
850825
style={{
851-
flexDirection: 'row',
852-
alignItems: 'center',
853826
width: '100%',
827+
borderStyle: 'single',
828+
borderColor: theme.secondary,
829+
customBorderChars: BORDER_CHARS,
854830
}}
855831
>
856-
<box style={{ flexGrow: 1, minWidth: 0 }}>
857-
<MultilineInput
858-
value={inputValue}
859-
onChange={setInputValue}
860-
onSubmit={handleSubmit}
861-
placeholder="Share your thoughts and press Enter…"
862-
focused={inputFocused}
863-
maxHeight={5}
864-
width={inputWidth}
865-
onKeyIntercept={handleSuggestionMenuKey}
866-
textAttributes={theme.messageTextAttributes}
867-
ref={inputRef}
832+
{agentMode === 'PLAN' && hasReceivedPlanResponse && (
833+
<BuildModeButtons
834+
theme={theme}
835+
onBuildFast={handleBuildFast}
836+
onBuildMax={handleBuildMax}
868837
/>
869-
</box>
838+
)}
839+
{slashContext.active && slashSuggestionItems.length > 0 ? (
840+
<SuggestionMenu
841+
items={slashSuggestionItems}
842+
selectedIndex={slashSelectedIndex}
843+
maxVisible={10}
844+
prefix="/"
845+
/>
846+
) : null}
847+
{!slashContext.active &&
848+
mentionContext.active &&
849+
agentSuggestionItems.length > 0 ? (
850+
<SuggestionMenu
851+
items={agentSuggestionItems}
852+
selectedIndex={agentSelectedIndex}
853+
maxVisible={10}
854+
prefix="@"
855+
/>
856+
) : null}
870857
<box
871858
style={{
872-
flexShrink: 0,
873-
paddingLeft: 2,
859+
flexDirection: 'row',
860+
alignItems: 'center',
861+
width: '100%',
874862
}}
875863
>
876-
<AgentModeToggle
877-
mode={agentMode}
878-
onToggle={toggleAgentMode}
879-
onSelectMode={setAgentMode}
880-
/>
864+
<box style={{ flexGrow: 1, minWidth: 0 }}>
865+
<MultilineInput
866+
value={inputValue}
867+
onChange={setInputValue}
868+
onSubmit={handleSubmit}
869+
placeholder="Share your thoughts and press Enter…"
870+
focused={inputFocused}
871+
maxHeight={5}
872+
width={inputWidth}
873+
onKeyIntercept={handleSuggestionMenuKey}
874+
textAttributes={theme.messageTextAttributes}
875+
ref={inputRef}
876+
/>
877+
</box>
878+
<box
879+
style={{
880+
flexShrink: 0,
881+
paddingLeft: 2,
882+
}}
883+
>
884+
<AgentModeToggle
885+
mode={agentMode}
886+
onToggle={toggleAgentMode}
887+
onSelectMode={setAgentMode}
888+
/>
889+
</box>
881890
</box>
882891
</box>
883-
<Separator width={separatorWidth} />
884892
{/* Agent status line - right-aligned under toggle */}
885893
{showAgentDisplayName && loadedAgentsData && (
886894
<box

cli/src/components/agent-branch-item.tsx

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { TextAttributes, type BorderCharacters } from '@opentui/core'
22
import React, { type ReactNode } from 'react'
33

44
import { useTheme } from '../hooks/use-theme'
5+
import { BORDER_CHARS } from '../utils/ui-constants'
56

67
interface AgentBranchItemProps {
78
name: string
@@ -19,20 +20,6 @@ interface AgentBranchItemProps {
1920
titleSuffix?: string
2021
}
2122

22-
const containerBorderChars: BorderCharacters = {
23-
topLeft: '╭',
24-
topRight: '╮',
25-
bottomLeft: '╰',
26-
bottomRight: '╯',
27-
horizontal: '─',
28-
vertical: '│',
29-
topT: '┬',
30-
bottomT: '┴',
31-
leftT: '├',
32-
rightT: '┤',
33-
cross: '┼',
34-
}
35-
3623
export const AgentBranchItem = ({
3724
name,
3825
content,
@@ -178,7 +165,7 @@ export const AgentBranchItem = ({
178165
border
179166
borderStyle="single"
180167
borderColor={toggleFrameColor}
181-
customBorderChars={containerBorderChars}
168+
customBorderChars={BORDER_CHARS}
182169
style={{
183170
flexDirection: 'column',
184171
gap: 0,

cli/src/utils/ui-constants.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { BorderCharacters } from "@opentui/core"
2+
3+
export const BORDER_CHARS: BorderCharacters = {
4+
topLeft: '╭',
5+
topRight: '╮',
6+
bottomLeft: '╰',
7+
bottomRight: '╯',
8+
horizontal: '─',
9+
vertical: '│',
10+
topT: '┬',
11+
bottomT: '┴',
12+
leftT: '├',
13+
rightT: '┤',
14+
cross: '┼',
15+
}

0 commit comments

Comments
 (0)