Skip to content

Commit a80d89b

Browse files
committed
style(ui): 优化界面样式和主题配色细节
- 移除 App 组件中无用的 theme 依赖以减少重渲染 - 为状态提示文字添加左边距增强视觉效果 - 调整 DropdownMenu 组件中选中项标签字体加粗改为普通 - 修改 MessageView 中状态行的颜色由 theme.text 改为 theme.primary - 更换 MessageView 中文本符号以提升美观度 - 更新主题色板中的 success、error、info 颜色值以及边框和渐变色 - PromptInput 组件中多处添加 marginLeft 进行缩进优化 - 根据焦点状态动态调整输入框底部边框颜色 - 在 SessionList 中根据搜索状态调整提示文字颜色为主色或次色
1 parent 5196b02 commit a80d89b

6 files changed

Lines changed: 22 additions & 22 deletions

File tree

src/ui/components/DropdownMenu/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ const DropdownMenu = React.memo(function DropdownMenu({
161161
<Box width={labelColumnWidth} flexShrink={0}>
162162
<Text color={isActive ? effectiveActiveColor : undefined} wrap="truncate-end">
163163
{isActive ? "> " : " "}
164-
{item.selected !== undefined ? (item.selected ? "●" : "○") : null} <Text bold>{item.label}</Text>
164+
{item.selected !== undefined ? (item.selected ? "●" : "○") : null} <Text>{item.label}</Text>
165165
{item.statusIndicator ? (
166166
<Text color={item.statusIndicator.color}> {item.statusIndicator.symbol}</Text>
167167
) : null}

src/ui/components/MessageView/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ export function MessageView({ message, collapsed, width = 80 }: MessageViewProps
4646
if (collapsed !== false) {
4747
return (
4848
<Box marginLeft={1} marginBottom={1} marginY={0}>
49-
<StatusLine width={width} bulletColor={theme.text} name="Thinking" params={summary} />
49+
<StatusLine width={width} bulletColor={theme.primary} name="Thinking" params={summary} />
5050
</Box>
5151
);
5252
}
5353
return (
5454
<Box marginLeft={1} flexDirection="column" marginBottom={1} marginY={0}>
55-
<StatusLine width={width} bulletColor={theme.text} name="Thinking" params={content ? "" : summary} />
55+
<StatusLine width={width} bulletColor={theme.primary} name="Thinking" params={content ? "" : summary} />
5656
<Box flexDirection="column" marginLeft={2}>
5757
{content ? <Text dimColor>{renderMarkdown(content)}</Text> : null}
5858
</Box>
@@ -165,7 +165,7 @@ function StatusLine({
165165
<Box gap={1} width={containerWidth}>
166166
<Box alignSelf="stretch">
167167
<Text key="bullet" color={bulletColor}>
168-
168+
169169
</Text>
170170
</Box>
171171
<Box flexGrow={1} width={contentWidth} gap={1}>

src/ui/theme/presets.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import type { ThemeTokens } from "./types";
44
export const DEFAULT_THEME: ThemeTokens = {
55
primary: "#229ac3",
66
secondary: "#229ac3e6",
7-
success: "#52c41a",
8-
error: "#f5222d",
7+
success: "#1a7f37",
8+
error: "#d1242f",
99
warning: "#fa8c16",
10-
info: "#2f54eb",
10+
info: "#0969da",
1111
text: "#3D4149",
1212
textDim: "#646A71",
1313
code: "#787f8a",
14-
border: "#ABADB1",
15-
gradients: ["#229ac3", "#7c3aed"],
14+
border: "#999",
15+
gradients: ["#229ac3", "#8250df"],
1616
};
1717

1818
/** 预设主题映射表 */

src/ui/views/App.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -636,9 +636,7 @@ function App({ projectRoot, initialPrompt, onRestart }: AppProps): React.ReactEl
636636
return [welcomeItem, ...messages];
637637
}
638638
return messages;
639-
// theme 作为依赖确保主题切换时 Static 子组件重渲染
640-
// eslint-disable-next-line react-hooks/exhaustive-deps
641-
}, [mode, showWelcome, view, messages, welcomeItem, theme]);
639+
}, [mode, showWelcome, view, messages, welcomeItem]);
642640

643641
const handleQuestionAnswers = useCallback(
644642
(answers: AskUserQuestionAnswers) => {
@@ -723,12 +721,12 @@ function App({ projectRoot, initialPrompt, onRestart }: AppProps): React.ReactEl
723721
}}
724722
</Static>
725723
{statusLine ? (
726-
<Box>
724+
<Box marginLeft={2}>
727725
<Text dimColor>{statusLine}</Text>
728726
</Box>
729727
) : null}
730728
{errorLine ? (
731-
<Box>
729+
<Box marginLeft={2}>
732730
<Text color={theme.error}>Error: {errorLine}</Text>
733731
</Box>
734732
) : null}

src/ui/views/PromptInput.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -722,19 +722,21 @@ export const PromptInput = React.memo(function PromptInput({
722722
[showMenu, showSkillsDropdown, showModelDropdown, openRawModelDropdown, showFileMentionMenu]
723723
);
724724

725+
const isFocused = useMemo(() => !disabled && hasTerminalFocus, [disabled, hasTerminalFocus]);
726+
725727
const matchedCommand = slashToken ? findExactSlashCommand(slashItems, slashToken) : null;
726728
const inlineHint = matchedCommand?.args ? ` ${matchedCommand.args.join(ARGS_SEPARATOR)}` : "";
727729

728730
return (
729731
<Box flexDirection="column" width={screenWidth}>
730732
{imageUrls.length > 0 ? (
731-
<Box>
733+
<Box marginLeft={2}>
732734
<Text color={theme.info}>{formatImageAttachmentStatus(imageUrls.length)}</Text>
733735
<Text dimColor>{` (${IMAGE_ATTACHMENT_CLEAR_HINT})`}</Text>
734736
</Box>
735737
) : null}
736738
{selectedSkills.length > 0 ? (
737-
<Box>
739+
<Box marginLeft={2}>
738740
<Text color={theme.info} wrap="truncate-end">
739741
{formatSelectedSkillsStatus(selectedSkills)}
740742
</Text>
@@ -748,12 +750,10 @@ export const PromptInput = React.memo(function PromptInput({
748750
borderBottom={true}
749751
borderLeft={false}
750752
borderRight={false}
751-
borderColor={theme.border}
753+
borderColor={isFocused ? theme.primary : theme.border}
752754
>
753755
<PromptPrefixLine busy={busy} />
754-
<Text>
755-
{renderBufferWithCursor(buffer, !disabled && hasTerminalFocus, placeholder, pastesRef.current, theme.warning)}
756-
</Text>
756+
<Text>{renderBufferWithCursor(buffer, isFocused, placeholder, pastesRef.current, theme.warning)}</Text>
757757
{inlineHint ? <Text dimColor>{inlineHint}</Text> : null}
758758
</Box>
759759
<RawModelDropdown
@@ -792,7 +792,7 @@ export const PromptInput = React.memo(function PromptInput({
792792
/>
793793
<SlashCommandMenu width={screenWidth} items={slashMenu} activeIndex={menuIndex} />
794794
{!showFooterText && (
795-
<Box>
795+
<Box marginLeft={2}>
796796
<Text dimColor>{footerText}</Text>
797797
</Box>
798798
)}

src/ui/views/SessionList.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,9 @@ export function SessionList({ sessions, onSelect, onCancel, onDelete }: Props):
211211
</Box>
212212
{/* Search bar */}
213213
<Box marginTop={hasActiveSearch || searchQuery ? 0 : 0}>
214-
<Text dimColor>{searchQuery ? `Search: ${searchQuery}` : "Type to search\u2026"}</Text>
214+
<Text dimColor color={searchQuery ? theme.primary : theme.textDim}>
215+
{searchQuery ? `Search: ${searchQuery}` : "Type to search\u2026"}
216+
</Text>
215217
{searchQuery ? <Text bold>|</Text> : null}
216218
</Box>
217219
</Box>

0 commit comments

Comments
 (0)