Skip to content

Commit 1cfcb04

Browse files
committed
Improved help banner UX
1 parent 06113e6 commit 1cfcb04

File tree

1 file changed

+69
-5
lines changed

1 file changed

+69
-5
lines changed

cli/src/components/help-banner.tsx

Lines changed: 69 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,37 @@ import React from 'react'
22

33
import { BottomBanner } from './bottom-banner'
44
import { useChatStore } from '../state/chat-store'
5+
import { useTheme } from '../hooks/use-theme'
56

67
const HELP_TIMEOUT = 60 * 1000 // 60 seconds
78

8-
/** Help banner showing keyboard shortcuts and tips. */
9+
/** Section header component for consistent styling */
10+
const SectionHeader = ({ children }: { children: React.ReactNode }) => {
11+
const theme = useTheme()
12+
return <text style={{ fg: theme.muted }}>{children}</text>
13+
}
14+
15+
/** Keyboard shortcut item */
16+
const Shortcut = ({
17+
keys,
18+
action,
19+
}: {
20+
keys: string
21+
action: string
22+
}) => {
23+
const theme = useTheme()
24+
return (
25+
<box style={{ flexDirection: 'row', gap: 1 }}>
26+
<text style={{ fg: theme.foreground }}>{keys}</text>
27+
<text style={{ fg: theme.muted }}>{action}</text>
28+
</box>
29+
)
30+
}
31+
32+
/** Help banner showing keyboard shortcuts and tips in an organized layout. */
933
export const HelpBanner = () => {
1034
const setInputMode = useChatStore((state) => state.setInputMode)
35+
const theme = useTheme()
1136

1237
// Auto-hide after timeout
1338
React.useEffect(() => {
@@ -20,10 +45,49 @@ export const HelpBanner = () => {
2045
return (
2146
<BottomBanner
2247
borderColorKey="info"
23-
text={`Shortcuts: /commands • Ctrl+C stop • Ctrl+J or Option+Enter newline • @files/agents • ↑↓ history • !bash commands
24-
25-
1 credit = 1 cent. Buy more with /buy-credits. Earn more from ads. Connect your Claude Subscription to pay for Claude models (Default and Max modes).`}
2648
onClose={() => setInputMode('default')}
27-
/>
49+
>
50+
<box style={{ flexDirection: 'column', gap: 1, flexGrow: 1 }}>
51+
{/* Shortcuts Section */}
52+
<box style={{ flexDirection: 'column', gap: 0 }}>
53+
<SectionHeader>Shortcuts</SectionHeader>
54+
<box style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 2, paddingLeft: 2 }}>
55+
<Shortcut keys="Ctrl+C / Esc" action="stop" />
56+
<Shortcut keys="Ctrl+J / Opt+Enter" action="newline" />
57+
<Shortcut keys="↑↓" action="history" />
58+
</box>
59+
</box>
60+
61+
{/* Features Section */}
62+
<box style={{ flexDirection: 'column', gap: 0 }}>
63+
<SectionHeader>Features</SectionHeader>
64+
<box style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 2, paddingLeft: 2 }}>
65+
<Shortcut keys="/" action="commands" />
66+
<Shortcut keys="@files" action="mention" />
67+
<Shortcut keys="@agents" action="use agent" />
68+
<Shortcut keys="!bash" action="run command" />
69+
</box>
70+
</box>
71+
72+
{/* Credits Section */}
73+
<box style={{ flexDirection: 'column', gap: 0 }}>
74+
<SectionHeader>Credits</SectionHeader>
75+
<box style={{ flexDirection: 'column', paddingLeft: 2 }}>
76+
<box style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 1 }}>
77+
<text style={{ fg: theme.foreground }}>1 credit = 1 cent</text>
78+
<text style={{ fg: theme.muted }}>·</text>
79+
<text style={{ fg: theme.foreground }}>/buy-credits</text>
80+
<text style={{ fg: theme.muted }}>·</text>
81+
<text style={{ fg: theme.foreground }}>/usage</text>
82+
<text style={{ fg: theme.muted }}>·</text>
83+
<text style={{ fg: theme.foreground }}>/ads:enable</text>
84+
</box>
85+
<text style={{ fg: theme.muted }}>
86+
Connect your Claude subscription for Default & Max modes
87+
</text>
88+
</box>
89+
</box>
90+
</box>
91+
</BottomBanner>
2892
)
2993
}

0 commit comments

Comments
 (0)