feat(cli): add auth info to footer (#24042)

This commit is contained in:
Sehoon Shon
2026-03-31 12:10:13 -04:00
committed by GitHub
parent 3982a252bb
commit f9a93a1337
11 changed files with 423 additions and 198 deletions
@@ -5,7 +5,7 @@
*/
import type React from 'react';
import { useMemo } from 'react';
import { useMemo, useState, useEffect } from 'react';
import { Box, Text } from 'ink';
import { theme } from '../semantic-colors.js';
import {
@@ -21,12 +21,15 @@ interface UserIdentityProps {
export const UserIdentity: React.FC<UserIdentityProps> = ({ config }) => {
const authType = config.getContentGeneratorConfig()?.authType;
const email = useMemo(() => {
const [email, setEmail] = useState<string | undefined>();
useEffect(() => {
if (authType) {
const userAccountManager = new UserAccountManager();
return userAccountManager.getCachedGoogleAccount() ?? undefined;
setEmail(userAccountManager.getCachedGoogleAccount() ?? undefined);
} else {
setEmail(undefined);
}
return undefined;
}, [authType]);
const tierName = useMemo(