mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-10-12 21:41:32 +08:00

* chore: added jsx-runtime plugin in eslint tsconfig Signed-off-by: GermaVinsmoke <vaibhav1180@gmail.com> * chore: updated react imports Signed-off-by: GermaVinsmoke <vaibhav1180@gmail.com> * chore: renamed redux dispatch Signed-off-by: GermaVinsmoke <vaibhav1180@gmail.com> * fix: build is fixed --------- Signed-off-by: GermaVinsmoke <vaibhav1180@gmail.com> Co-authored-by: Palash Gupta <palashgdev@gmail.com>
51 lines
1.2 KiB
TypeScript
51 lines
1.2 KiB
TypeScript
import { Avatar, Typography } from 'antd';
|
|
import ROUTES from 'constants/routes';
|
|
import history from 'lib/history';
|
|
import { useCallback } from 'react';
|
|
import { useSelector } from 'react-redux';
|
|
import { AppState } from 'store/reducers';
|
|
import AppReducer from 'types/reducer/app';
|
|
|
|
import { AvatarContainer, ManageAccountLink, Wrapper } from '../styles';
|
|
|
|
function SignedIn({ onToggle }: SignedInProps): JSX.Element {
|
|
const { user } = useSelector<AppState, AppReducer>((state) => state.app);
|
|
|
|
const onManageAccountClick = useCallback(() => {
|
|
onToggle();
|
|
history.push(ROUTES.MY_SETTINGS);
|
|
}, [onToggle]);
|
|
|
|
if (!user) {
|
|
return <div />;
|
|
}
|
|
|
|
const { name, email } = user;
|
|
|
|
return (
|
|
<div>
|
|
<Typography>SIGNED IN AS</Typography>
|
|
<Wrapper>
|
|
<AvatarContainer>
|
|
<Avatar shape="circle" size="large">
|
|
{name[0]}
|
|
</Avatar>
|
|
<div>
|
|
<Typography>{name}</Typography>
|
|
<Typography>{email}</Typography>
|
|
</div>
|
|
</AvatarContainer>
|
|
<ManageAccountLink onClick={onManageAccountClick}>
|
|
Manage Account
|
|
</ManageAccountLink>
|
|
</Wrapper>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
interface SignedInProps {
|
|
onToggle: VoidFunction;
|
|
}
|
|
|
|
export default SignedIn;
|