Skip to content

Commit 7a9ab98

Browse files
committed
Add ctrl+c handler for login screen. Tweak styles
1 parent 05a7a3d commit 7a9ab98

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

cli/src/components/login-modal.tsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,10 @@ import { useLoginPolling } from '../hooks/use-login-polling'
1010
import { useLogo } from '../hooks/use-logo'
1111
import { useSheenAnimation } from '../hooks/use-sheen-animation'
1212
import { useTheme } from '../hooks/use-theme'
13-
import {
14-
DEFAULT_TERMINAL_HEIGHT,
15-
MODAL_VERTICAL_MARGIN,
16-
MAX_MODAL_BASE_HEIGHT,
17-
WARNING_BANNER_HEIGHT,
18-
} from '../login/constants'
1913
import {
2014
formatUrl,
2115
generateFingerprintId,
2216
calculateResponsiveLayout,
23-
calculateModalDimensions,
2417
} from '../login/utils'
2518
import { useLoginStore } from '../state/login-store'
2619
import { copyTextToClipboard } from '../utils/clipboard'
@@ -272,7 +265,7 @@ export const LoginModal = ({
272265
style={{
273266
width: '100%',
274267
padding: 1,
275-
backgroundColor: theme.error,
268+
backgroundColor: theme.surface,
276269
flexShrink: 0,
277270
}}
278271
>
@@ -364,10 +357,10 @@ export const LoginModal = ({
364357
}}
365358
>
366359
<text style={{ wrapMode: 'word' }}>
367-
<span fg={theme.primary}>
360+
<span fg={'#00cc00'}>
368361
{isNarrow
369362
? 'Press ENTER to login...'
370-
: 'Press ENTER to open your browser and finish logging in...'}
363+
: 'Press ENTER to open your browser and login...'}
371364
</span>
372365
</text>
373366
</box>

cli/src/hooks/use-login-keyboard-handlers.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ interface UseLoginKeyboardHandlersParams {
1515
* Custom hook that handles keyboard input for the login modal
1616
* - Enter key: fetch login URL and open browser
1717
* - 'c' key: copy URL to clipboard
18+
* - Ctrl+C: exit the application
1819
*/
1920
export function useLoginKeyboardHandlers({
2021
loginUrl,
@@ -33,6 +34,17 @@ export function useLoginKeyboardHandlers({
3334
!key.shift
3435

3536
const isCKey = key.name === 'c' && !key.ctrl && !key.meta && !key.shift
37+
const isCtrlC = key.ctrl && key.name === 'c'
38+
39+
if (isCtrlC) {
40+
if (
41+
'preventDefault' in key &&
42+
typeof key.preventDefault === 'function'
43+
) {
44+
key.preventDefault()
45+
}
46+
process.exit(0)
47+
}
3648

3749
if (isEnter && !hasOpenedBrowser && !loading) {
3850
if (

0 commit comments

Comments
 (0)