🚸(frontend) display email with username to clarify logged-in account

Show email alongside full name when available to prevent user confusion
about which account is currently logged in. Enhances general app UX.
This commit is contained in:
ericboucher
2025-07-18 10:06:29 +02:00
committed by aleb_the_flash
parent cadb20793a
commit f7268c507b
2 changed files with 10 additions and 2 deletions

View File

@@ -10,6 +10,10 @@ export const SettingsDialog = (props: SettingsDialogProps) => {
const { t, i18n } = useTranslation('settings') const { t, i18n } = useTranslation('settings')
const { user, isLoggedIn, logout } = useUser() const { user, isLoggedIn, logout } = useUser()
const { languagesList, currentLanguage } = useLanguageLabels() const { languagesList, currentLanguage } = useLanguageLabels()
const userDisplay =
user?.full_name && user?.email
? `${user.full_name} (${user.email})`
: user?.email
return ( return (
<Dialog title={t('dialog.heading')} {...props}> <Dialog title={t('dialog.heading')} {...props}>
<H lvl={2}>{t('account.heading')}</H> <H lvl={2}>{t('account.heading')}</H>
@@ -18,7 +22,7 @@ export const SettingsDialog = (props: SettingsDialogProps) => {
<P> <P>
<Trans <Trans
i18nKey="settings:account.currentlyLoggedAs" i18nKey="settings:account.currentlyLoggedAs"
values={{ user: user?.full_name ?? user?.email }} values={{ user: userDisplay }}
components={[<Badge />]} components={[<Badge />]}
/> />
</P> </P>

View File

@@ -18,6 +18,10 @@ export const AccountTab = ({ id, onOpenChange }: AccountTabProps) => {
const room = useRoomContext() const room = useRoomContext()
const { user, isLoggedIn, logout } = useUser() const { user, isLoggedIn, logout } = useUser()
const [name, setName] = useState(room?.localParticipant.name ?? '') const [name, setName] = useState(room?.localParticipant.name ?? '')
const userDisplay =
user?.full_name && user?.email
? `${user.full_name} (${user.email})`
: user?.email
const handleOnSubmit = () => { const handleOnSubmit = () => {
if (room) room.localParticipant.setName(name) if (room) room.localParticipant.setName(name)
@@ -46,7 +50,7 @@ export const AccountTab = ({ id, onOpenChange }: AccountTabProps) => {
<P> <P>
<Trans <Trans
i18nKey="settings:account.currentlyLoggedAs" i18nKey="settings:account.currentlyLoggedAs"
values={{ user: user?.full_name || user?.email }} values={{ user: userDisplay }}
components={[<Badge />]} components={[<Badge />]}
/> />
</P> </P>