Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Update username display components UI (#2159)
Leendert de Borst1e848927c093
diff --git a/apps/mobile-app/app/unlock.tsx b/apps/mobile-app/app/unlock.tsxindex 52d130e70..c856f2d68 100644--- a/apps/mobile-app/app/unlock.tsx+++ b/apps/mobile-app/app/unlock.tsx@@ -17,7 +17,7 @@ import Logo from '@/assets/images/logo.svg';import { ConfirmDialog } from '@/components/common/ConfirmDialog';import LoadingIndicator from '@/components/LoadingIndicator';import { ThemedText } from '@/components/themed/ThemedText';-import { Avatar } from '@/components/ui/Avatar';+import { AccountChip } from '@/components/ui/AccountChip';import { RobustPressable } from '@/components/ui/RobustPressable';import { useApp } from '@/context/AppContext';import { useDb } from '@/context/DbContext';@@ -389,18 +389,15 @@ export default function UnlockScreen() : React.ReactNode {})();const styles = StyleSheet.create({+ accountChip: {+ marginBottom: 16,+ },appName: {color: colors.text,fontSize: 32,fontWeight: 'bold',textAlign: 'center',},- avatarContainer: {- alignItems: 'center',- flexDirection: 'row',- justifyContent: 'center',- marginBottom: 16,- },button: {alignItems: 'center',backgroundColor: colors.primary,@@ -526,12 +523,6 @@ export default function UnlockScreen() : React.ReactNode {opacity: 0.7,textAlign: 'center',},- username: {- color: colors.text,- fontSize: 18,- opacity: 0.8,- textAlign: 'center',- },});// Render password mode or loading@@ -563,10 +554,7 @@ export default function UnlockScreen() : React.ReactNode {</View></View><View style={styles.content}>- <View style={styles.avatarContainer}>- <Avatar />- <ThemedText style={styles.username}>{username}</ThemedText>- </View>+ <AccountChip style={styles.accountChip} />{/* Error Message */}{error && <ThemedText style={styles.errorText}>{error}</ThemedText>}diff --git a/apps/mobile-app/app/upgrade.tsx b/apps/mobile-app/app/upgrade.tsxindex 15178a03a..545e9be48 100644--- a/apps/mobile-app/app/upgrade.tsx+++ b/apps/mobile-app/app/upgrade.tsx@@ -18,7 +18,7 @@ import Logo from '@/assets/images/logo.svg';import LoadingIndicator from '@/components/LoadingIndicator';import { ThemedText } from '@/components/themed/ThemedText';import { ThemedView } from '@/components/themed/ThemedView';-import { Avatar } from '@/components/ui/Avatar';+import { AccountChip } from '@/components/ui/AccountChip';import { RobustPressable } from '@/components/ui/RobustPressable';import { useApp } from '@/context/AppContext';import { useDb } from '@/context/DbContext';@@ -82,7 +82,6 @@ const LOGOUT_ERROR_CODES: ReadonlySet<AppErrorCode> = new Set([*/export default function UpgradeScreen() : React.ReactNode {const app = useApp();- const { username } = app;const { logoutUserInitiated, logoutForced } = useLogout();const webApi = useWebApi();const dbContext = useDb();@@ -344,18 +343,15 @@ export default function UpgradeScreen() : React.ReactNode {};const styles = StyleSheet.create({+ accountChip: {+ marginBottom: 16,+ },appName: {color: colors.text,fontSize: 32,fontWeight: 'bold',textAlign: 'center',},- avatarContainer: {- alignItems: 'center',- flexDirection: 'row',- justifyContent: 'center',- marginBottom: 16,- },button: {alignItems: 'center',backgroundColor: colors.primary,@@ -476,12 +472,6 @@ export default function UpgradeScreen() : React.ReactNode {marginBottom: 12,textAlign: 'center',},- username: {- color: colors.text,- fontSize: 18,- opacity: 0.8,- textAlign: 'center',- },versionContainer: {backgroundColor: colors.background,borderRadius: 8,@@ -575,10 +565,7 @@ export default function UpgradeScreen() : React.ReactNode {</View>) : (<View style={styles.content}>- <View style={styles.avatarContainer}>- <Avatar />- <ThemedText style={styles.username}>{username}</ThemedText>- </View>+ <AccountChip style={styles.accountChip} /><ThemedText style={styles.subtitle}>{t('upgrade.subtitle')}</ThemedText>{error && (diff --git a/apps/mobile-app/components/ui/Avatar.tsx b/apps/mobile-app/components/ui/Avatar.tsxindex c77799448..d7dc6810f 100644--- a/apps/mobile-app/components/ui/Avatar.tsx+++ b/apps/mobile-app/components/ui/Avatar.tsx@@ -6,10 +6,14 @@ import { useAuth } from '@/context/AuthContext';import { ThemedText } from '../themed/ThemedText';+type AvatarProps = {+ size?: number;+};+/*** Avatar component that displays the first letter of the username.*/-export function Avatar(): React.ReactNode {+export function Avatar({ size = 40 }: AvatarProps): React.ReactNode {const colors = useColors();const { username } = useAuth();@@ -17,16 +21,16 @@ export function Avatar(): React.ReactNode {avatar: {alignItems: 'center',backgroundColor: colors.primary + 80,- borderRadius: 20,- height: 40,+ borderRadius: size / 2,+ height: size,justifyContent: 'center',- marginRight: 12,- width: 40,+ width: size,},avatarText: {color: colors.primarySurfaceText,- fontSize: 18,+ fontSize: size * 0.45,fontWeight: '600',+ lineHeight: size * 0.6,},});@@ -37,4 +41,4 @@ export function Avatar(): React.ReactNode {</ThemedText></View>);-}\ No newline at end of file+}diff --git a/apps/mobile-app/components/ui/UsernameDisplay.tsx b/apps/mobile-app/components/ui/UsernameDisplay.tsxindex 8b0d0fef5..08e273d64 100644--- a/apps/mobile-app/components/ui/UsernameDisplay.tsx+++ b/apps/mobile-app/components/ui/UsernameDisplay.tsx@@ -9,7 +9,7 @@ import { useAuth } from '@/context/AuthContext';import { Avatar } from './Avatar';/**- * Username display component that shows the avatar and "Logged in as" text.+ * Account card that shows the avatar with "Logged in as" above the username.*/export function UsernameDisplay(): React.ReactNode {const { t } = useTranslation();@@ -17,23 +17,38 @@ export function UsernameDisplay(): React.ReactNode {const { username } = useAuth();const styles = StyleSheet.create({- userInfoContainer: {+ card: {alignItems: 'center',- backgroundColor: colors.background,+ backgroundColor: colors.accentBackground,borderRadius: 10,flexDirection: 'row',+ gap: 12,+ paddingHorizontal: 16,+ paddingVertical: 12,+ },+ textContainer: {+ flex: 1,+ },+ label: {+ color: colors.textMuted,+ fontSize: 13,+ lineHeight: 18,},usernameText: {color: colors.text,fontSize: 16,fontWeight: '600',+ lineHeight: 22,},});return (- <View style={styles.userInfoContainer}>- <Avatar />- <ThemedText style={styles.usernameText}>{t('auth.loggedInAs')}: {username}</ThemedText>+ <View style={styles.card}>+ <Avatar size={44} />+ <View style={styles.textContainer}>+ <ThemedText style={styles.label}>{t('auth.loggedInAs')}</ThemedText>+ <ThemedText style={styles.usernameText} numberOfLines={1}>{username}</ThemedText>+ </View></View>);}