@@ -11,14 +11,20 @@ import {
1111} from '../utils/claude-oauth'
1212import { useTheme } from '../hooks/use-theme'
1313
14- type FlowState = 'checking' | 'not-connected' | 'waiting-for-code' | 'connected' | 'error'
14+ type FlowState =
15+ | 'checking'
16+ | 'not-connected'
17+ | 'waiting-for-code'
18+ | 'connected'
19+ | 'error'
1520
1621export const ClaudeConnectBanner = ( ) => {
1722 const setInputMode = useChatStore ( ( state ) => state . setInputMode )
1823 const theme = useTheme ( )
1924 const [ flowState , setFlowState ] = useState < FlowState > ( 'checking' )
2025 const [ error , setError ] = useState < string | null > ( null )
2126 const [ isDisconnectHovered , setIsDisconnectHovered ] = useState ( false )
27+ const [ isConnectHovered , setIsConnectHovered ] = useState ( false )
2228
2329 // Check initial connection status
2430 useEffect ( ( ) => {
@@ -58,19 +64,23 @@ export const ClaudeConnectBanner = () => {
5864
5965 return (
6066 < BottomBanner borderColorKey = "success" onClose = { handleClose } >
61- < box style = { { flexDirection : 'row' , justifyContent : 'space-between' , width : '100%' } } >
62- < text style = { { fg : theme . success } } >
63- ✓ Connected to Claude (since { connectedDate } )
64- </ text >
65- < Button
66- onClick = { handleDisconnect }
67- onMouseOver = { ( ) => setIsDisconnectHovered ( true ) }
68- onMouseOut = { ( ) => setIsDisconnectHovered ( false ) }
69- >
70- < text style = { { fg : isDisconnectHovered ? theme . error : theme . muted } } >
71- disconnect
72- </ text >
73- </ Button >
67+ < box style = { { flexDirection : 'column' , gap : 0 , flexGrow : 1 } } >
68+ < text style = { { fg : theme . success } } > ✓ Connected to Claude</ text >
69+ < box style = { { flexDirection : 'row' , gap : 2 , marginTop : 1 } } >
70+ < text style = { { fg : theme . muted } } > Since { connectedDate } </ text >
71+ < text style = { { fg : theme . muted } } > ·</ text >
72+ < Button
73+ onClick = { handleDisconnect }
74+ onMouseOver = { ( ) => setIsDisconnectHovered ( true ) }
75+ onMouseOut = { ( ) => setIsDisconnectHovered ( false ) }
76+ >
77+ < text
78+ style = { { fg : isDisconnectHovered ? theme . error : theme . muted } }
79+ >
80+ Disconnect
81+ </ text >
82+ </ Button >
83+ </ box >
7484 </ box >
7585 </ BottomBanner >
7686 )
@@ -91,12 +101,11 @@ export const ClaudeConnectBanner = () => {
91101 if ( flowState === 'waiting-for-code' ) {
92102 return (
93103 < BottomBanner borderColorKey = "info" onClose = { handleClose } >
94- < box style = { { flexDirection : 'column' , gap : 0 } } >
95- < text style = { { fg : theme . info } } >
96- Browser opened. Sign in with your Claude account, then paste the authorization code below.
97- </ text >
104+ < box style = { { flexDirection : 'column' , gap : 0 , flexGrow : 1 } } >
105+ < text style = { { fg : theme . info } } > Waiting for authorization</ text >
98106 < text style = { { fg : theme . muted , marginTop : 1 } } >
99- Type the code in the input box above and press Enter.
107+ Sign in with your Claude account in the browser, then paste the code
108+ here.
100109 </ text >
101110 </ box >
102111 </ BottomBanner >
@@ -106,13 +115,21 @@ export const ClaudeConnectBanner = () => {
106115 // Not connected / checking state - show connect button
107116 return (
108117 < BottomBanner borderColorKey = "info" onClose = { handleClose } >
109- < box style = { { flexDirection : 'row' , justifyContent : 'space-between' , width : '100%' } } >
110- < text style = { { fg : theme . info } } >
111- Connect your Claude Pro/Max subscription to use Claude models directly.
112- </ text >
113- < Button onClick = { handleConnect } >
114- < text style = { { fg : theme . link } } > Connect →</ text >
115- </ Button >
118+ < box style = { { flexDirection : 'column' , gap : 0 , flexGrow : 1 } } >
119+ < text style = { { fg : theme . info } } > Connect to Claude</ text >
120+ < box style = { { flexDirection : 'row' , gap : 2 , marginTop : 1 } } >
121+ < text style = { { fg : theme . muted } } > Use your Pro/Max subscription</ text >
122+ < text style = { { fg : theme . muted } } > ·</ text >
123+ < Button
124+ onClick = { handleConnect }
125+ onMouseOver = { ( ) => setIsConnectHovered ( true ) }
126+ onMouseOut = { ( ) => setIsConnectHovered ( false ) }
127+ >
128+ < text style = { { fg : isConnectHovered ? theme . success : theme . link } } >
129+ Click to connect →
130+ </ text >
131+ </ Button >
132+ </ box >
116133 </ box >
117134 </ BottomBanner >
118135 )
@@ -130,12 +147,16 @@ export async function handleClaudeAuthCode(code: string): Promise<{
130147 await exchangeCodeForTokens ( code )
131148 return {
132149 success : true ,
133- message : 'Successfully connected to Claude! Your Claude models will now use your subscription.' ,
150+ message :
151+ 'Successfully connected your Claude subscription! Codebuff will now use it for Claude model requests.' ,
134152 }
135153 } catch ( err ) {
136154 return {
137155 success : false ,
138- message : err instanceof Error ? err . message : 'Failed to exchange authorization code' ,
156+ message :
157+ err instanceof Error
158+ ? err . message
159+ : 'Failed to exchange authorization code' ,
139160 }
140161 }
141162}
0 commit comments