Skip to content

Commit

Permalink
showing only the first name in the app bar instead of full name
Browse files Browse the repository at this point in the history
  • Loading branch information
nitheesh-aot committed Aug 6, 2024
1 parent 40ca175 commit 4fa08bd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions compliance-web/src/components/Shared/Header/EAOAppBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ const EAOAppBar = forwardRef<HTMLDivElement, EAOAppBarProps>((_props, ref) => {
setProfileMenuAnchorEl(null);
};

const userInitials = `${auth.user?.profile?.given_name?.charAt(0)}${auth.user?.profile?.family_name?.charAt(0)}`;

return (
<>
<AppBar ref={ref} position="static" color="primary" open={true}>
Expand Down Expand Up @@ -81,7 +83,7 @@ const EAOAppBar = forwardRef<HTMLDivElement, EAOAppBarProps>((_props, ref) => {
onMouseEnter={handleOpenProfileMenu}
>
<Typography variant="h6" color="inherit" marginRight={"1rem"}>
Hello, {auth.user?.profile.name}
Hello, {auth.user?.profile.given_name}
</Typography>
<Avatar
sx={{
Expand All @@ -94,7 +96,7 @@ const EAOAppBar = forwardRef<HTMLDivElement, EAOAppBarProps>((_props, ref) => {
variant="body1"
fontWeight={700}
color={theme.palette.primary.main}
>{`${auth.user?.profile?.given_name?.charAt(0)}${auth.user?.profile?.family_name?.charAt(0)}`}</Typography>
>{userInitials}</Typography>
</Avatar>
</Box>
) : (
Expand Down

0 comments on commit 4fa08bd

Please sign in to comment.