File size: 1,656 Bytes
9332ccf | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | /**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { type Config } from '@google/gemini-cli-core';
import { Box, Text } from 'ink';
import { theme } from '../semantic-colors.js';
import { useKeypress } from '../hooks/useKeypress.js';
import { relaunchApp } from '../../utils/processUtils.js';
interface LoginRestartDialogProps {
onDismiss: () => void;
config: Config;
message?: string;
}
export const LoginRestartDialog = ({
onDismiss,
config,
message,
}: LoginRestartDialogProps) => {
useKeypress(
(key) => {
if (key.name === 'escape') {
onDismiss();
return true;
} else if (key.name === 'r' || key.name === 'R') {
setTimeout(async () => {
if (process.send) {
const remoteSettings = config.getRemoteAdminSettings();
if (remoteSettings) {
process.send({
type: 'admin-settings-update',
settings: remoteSettings,
});
}
}
await relaunchApp();
}, 100);
return true;
}
return false;
},
{ isActive: true },
);
const displayMessage =
message ??
"You've successfully signed in with Google. Gemini CLI needs to be restarted.";
return (
<Box
borderStyle="round"
borderColor={theme.status.warning}
paddingX={1}
flexDirection="column"
>
<Text color={theme.status.warning}>{displayMessage}</Text>
<Text color={theme.status.warning}>
Press R to restart, or Esc to choose a different authentication method.
</Text>
</Box>
);
};
|