diff --git a/packages/core-api/src/apis/implementations/auth/google/GoogleAuth.ts b/packages/core-api/src/apis/implementations/auth/google/GoogleAuth.ts
index f40e164c82..d43741a9e8 100644
--- a/packages/core-api/src/apis/implementations/auth/google/GoogleAuth.ts
+++ b/packages/core-api/src/apis/implementations/auth/google/GoogleAuth.ts
@@ -24,7 +24,6 @@ import {
AccessTokenOptions,
ProfileInfoApi,
ProfileInfoOptions,
- ProfileInfo,
} from '../../../definitions/auth';
import { OAuthRequestApi, AuthProvider } from '../../../definitions';
import { SessionManager } from '../../../../lib/AuthSessionManager/types';
diff --git a/packages/core/src/layout/Sidebar/LoggedUserBadge.tsx b/packages/core/src/layout/Sidebar/LoggedUserBadge.tsx
index 1053d3a36e..d0c3dc62c2 100644
--- a/packages/core/src/layout/Sidebar/LoggedUserBadge.tsx
+++ b/packages/core/src/layout/Sidebar/LoggedUserBadge.tsx
@@ -28,11 +28,12 @@ import {
ListItemSecondaryAction,
IconButton,
Tooltip,
+ Typography,
} from '@material-ui/core';
import { blueGrey } from '@material-ui/core/colors';
import { useSetState } from 'react-use';
import { Skeleton } from '@material-ui/lab';
-import { useApi, googleAuthApiRef, ProfileInfo } from '@backstage/core';
+import { useApi, googleAuthApiRef, ProfileInfo } from '@backstage/core-api';
import LogoutIcon from '@material-ui/icons/PowerSettingsNew';
import ControlPointIcon from '@material-ui/icons/ControlPoint';
import AccountCircleIcon from '@material-ui/icons/AccountCircle';
@@ -90,7 +91,6 @@ const SessionListItem: FC<{
}
secondary={}
/>
@@ -103,16 +103,12 @@ const SessionListItem: FC<{
);
}
- //TODO: Not functional yet to sign in from the sidebar
+ // TODO: Not functional yet to sign in from the sidebar
if (!user) {
return (
{icon}
-
+
+ {id}
+
+ }
secondary={title}
/>
@@ -163,25 +163,21 @@ const useGoogleLoginState = (open: boolean) => {
const [profile, setProfile] = useState();
useEffect(() => {
- if (!open) {
- return;
- }
-
let didCancel = false;
- googleAuth.getProfile().then(profile => {
- if (didCancel) {
- return;
- }
-
- setProfile(profile);
- setLoading(false);
- });
+ if (open) {
+ googleAuth.getProfile().then(_profile => {
+ if (!didCancel) {
+ setProfile(_profile);
+ setLoading(false);
+ }
+ });
+ }
return () => {
didCancel = true;
};
- }, [open]);
+ }, [open, googleAuth]);
if (loading) {
return { loading: true };
@@ -261,8 +257,11 @@ export const LoggedUserBadge: FC = ({
{!collapsedMode && (
+ {displayName}
+
+ }
/>
)}
diff --git a/packages/core/src/layout/Sidebar/UserBadge.tsx b/packages/core/src/layout/Sidebar/UserBadge.tsx
index 0a1424ee6e..d3e02d26cc 100644
--- a/packages/core/src/layout/Sidebar/UserBadge.tsx
+++ b/packages/core/src/layout/Sidebar/UserBadge.tsx
@@ -16,14 +16,14 @@
import React, { FC, useContext, useEffect, useState } from 'react';
import { makeStyles } from '@material-ui/core';
-import People from '@material-ui/icons/People';
+import AccountCircleIcon from '@material-ui/icons/AccountCircle';
import { SidebarContext } from './config';
import { SidebarItem } from './Items';
import { LoggedUserBadge } from './LoggedUserBadge';
import DoubleArrowIcon from '@material-ui/icons/DoubleArrow';
import { BackstageTheme } from '@backstage/theme';
import { SidebarPinStateContext } from './Page';
-import { useApi, googleAuthApiRef, ProfileInfo } from '@backstage/core';
+import { useApi, googleAuthApiRef, ProfileInfo } from '@backstage/core-api';
const ARROW_BUTTON_SIZE = 20;
const useStyles = makeStyles(theme => {
@@ -63,8 +63,8 @@ export const SidebarUserBadge: FC<{}> = () => {
const [profile, setProfile] = useState();
useEffect(() => {
- //TODO(soapraj): How to observe if the user is logged in
- //TODO(soapraj): Enumerate all the providers supported by the app and let user log in from here
+ // TODO(soapraj): How to observe if the user is logged in
+ // TODO(soapraj): List all the providers supported by the app and let user log in from here
googleAuth.getProfile({ optional: true }).then(googleProfile => {
setProfile(googleProfile);
});
@@ -82,7 +82,7 @@ export const SidebarUserBadge: FC<{}> = () => {
/>
>
) : (
-
+
)}
{isOpen && (