💩(frontend) restore user name / org header
This was added previously and while the organization is not displayed elsewhere it's better to keep the information displayed somewhere.
This commit is contained in:
20
src/frontend/apps/desk/src/core/auth/UserInfo.tsx
Normal file
20
src/frontend/apps/desk/src/core/auth/UserInfo.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { Box, Text } from '@/components';
|
||||
import { useAuthStore } from '@/core/auth';
|
||||
|
||||
export const UserInfo = () => {
|
||||
const { t } = useTranslation();
|
||||
const { authenticated, userData } = useAuthStore();
|
||||
const userName = userData?.name || userData?.email || t('No Username');
|
||||
const organizationName = userData?.organization?.name || '';
|
||||
|
||||
return authenticated ? (
|
||||
<Box $direction="column" $align="left">
|
||||
<Text $theme="primary">
|
||||
{userName}
|
||||
{organizationName ? ` | ${organizationName}` : ''}
|
||||
</Text>
|
||||
</Box>
|
||||
) : null;
|
||||
};
|
||||
@@ -5,6 +5,7 @@ import { useTranslation } from 'react-i18next';
|
||||
import { default as IconRegie } from '@/assets/logo-regie.svg?url';
|
||||
import { Icon, StyledLink, Text } from '@/components/';
|
||||
import { ButtonLogin } from '@/core/auth';
|
||||
import { UserInfo } from '@/core/auth/UserInfo';
|
||||
import { useCunninghamTheme } from '@/cunningham';
|
||||
import { LanguagePicker } from '@/features/language';
|
||||
import { useLeftPanelStore } from '@/features/left-panel';
|
||||
@@ -107,6 +108,7 @@ export const Header = () => {
|
||||
flexDirection: 'row',
|
||||
}}
|
||||
>
|
||||
<UserInfo />
|
||||
<ButtonLogin />
|
||||
<LanguagePicker />
|
||||
<LaGaufre />
|
||||
|
||||
@@ -4,6 +4,7 @@ import { createGlobalStyle } from 'styled-components';
|
||||
|
||||
import { SeparatedSection } from '@/components/separators';
|
||||
import { ButtonLogin } from '@/core';
|
||||
import { UserInfo } from '@/core/auth/UserInfo';
|
||||
import { LanguagePicker } from '@/features/language';
|
||||
|
||||
import { useLeftPanelStore } from '../stores';
|
||||
@@ -99,6 +100,7 @@ export const LeftPanel = () => {
|
||||
gap: 'var(--c--theme--spacings--sm)',
|
||||
}}
|
||||
>
|
||||
<UserInfo />
|
||||
<ButtonLogin />
|
||||
<LanguagePicker />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user