Prefer usernames in shell and admin flows

This commit is contained in:
cesnimda
2026-03-23 21:07:21 +01:00
parent 2c03379504
commit 2bcee6e07c
5 changed files with 8 additions and 5 deletions
@@ -39,7 +39,7 @@ export default function AuthStatusCard() {
.catch(() => setMe(null)); .catch(() => setMe(null));
}, [token]); }, [token]);
const label = useMemo(() => me?.displayName || [me?.firstName, me?.lastName].filter(Boolean).join(" ") || me?.userName || me?.email, [me]); const label = useMemo(() => me?.userName || me?.displayName || [me?.firstName, me?.lastName].filter(Boolean).join(" ") || me?.email, [me]);
return ( return (
<Paper sx={{ mt: 2, p: 2 }}> <Paper sx={{ mt: 2, p: 2 }}>
@@ -154,7 +154,7 @@ export default function GoogleAuthCard({ onSignedIn }: { onSignedIn?: () => void
}; };
}, [clientId, me?.provider, me?.googleLink?.linked, onSignedIn, isRawGoogleToken, token, toast, t]); }, [clientId, me?.provider, me?.googleLink?.linked, onSignedIn, isRawGoogleToken, token, toast, t]);
const signedInName = me?.displayName || [me?.firstName, me?.lastName].filter(Boolean).join(" ") || me?.userName || me?.email || ""; const signedInName = me?.userName || me?.displayName || [me?.firstName, me?.lastName].filter(Boolean).join(" ") || me?.email || "";
return ( return (
<Paper sx={{ mt: 2, p: 2 }}> <Paper sx={{ mt: 2, p: 2 }}>
+2
View File
@@ -278,6 +278,7 @@ export const translations = {
adminUsersAdminYes: "Admin: Yes", adminUsersAdminYes: "Admin: Yes",
adminUsersAdminNo: "Admin: No", adminUsersAdminNo: "Admin: No",
adminUsersDeleteConfirmBody: "Delete this user?", adminUsersDeleteConfirmBody: "Delete this user?",
adminUsersDeleteConfirmNamed: "Delete user {name}?",
adminUsersPassword: "Password", adminUsersPassword: "Password",
kanbanHint: "Drag cards between columns to update status.", kanbanHint: "Drag cards between columns to update status.",
kanbanDropHere: "Drop here", kanbanDropHere: "Drop here",
@@ -990,6 +991,7 @@ export const translations = {
adminUsersAdminYes: "Admin: Ja", adminUsersAdminYes: "Admin: Ja",
adminUsersAdminNo: "Admin: Nei", adminUsersAdminNo: "Admin: Nei",
adminUsersDeleteConfirmBody: "Slette denne brukeren?", adminUsersDeleteConfirmBody: "Slette denne brukeren?",
adminUsersDeleteConfirmNamed: "Slette bruker {name}?",
adminUsersPassword: "Passord", adminUsersPassword: "Passord",
kanbanHint: "Dra kort mellom kolonnene for å oppdatere status.", kanbanHint: "Dra kort mellom kolonnene for å oppdatere status.",
kanbanDropHere: "Slipp her", kanbanDropHere: "Slipp her",
+2 -2
View File
@@ -167,7 +167,7 @@ export default function AppShell({
</Box> </Box>
); );
const nameForAvatar = user?.displayName || user?.userName || user?.email; const nameForAvatar = user?.userName || user?.displayName || user?.email;
const initials = initialsFrom(nameForAvatar); const initials = initialsFrom(nameForAvatar);
const [userMenuAnchor, setUserMenuAnchor] = useState<null | HTMLElement>(null); const [userMenuAnchor, setUserMenuAnchor] = useState<null | HTMLElement>(null);
@@ -232,7 +232,7 @@ export default function AppShell({
<Avatar src={user.avatarImageDataUrl || undefined} sx={{ width: 30, height: 30, fontWeight: 900 }}>{initials}</Avatar> <Avatar src={user.avatarImageDataUrl || undefined} sx={{ width: 30, height: 30, fontWeight: 900 }}>{initials}</Avatar>
</IconButton> </IconButton>
<Box sx={{ display: { xs: "none", sm: "block" } }}> <Box sx={{ display: { xs: "none", sm: "block" } }}>
<Typography sx={{ fontWeight: 600, lineHeight: 1.2 }}>{user.displayName || user.userName || user.email || t("user")}</Typography> <Typography sx={{ fontWeight: 600, lineHeight: 1.2 }}>{user.userName || user.displayName || user.email || t("user")}</Typography>
<Typography variant="caption" sx={{ color: "text.secondary" }}> <Typography variant="caption" sx={{ color: "text.secondary" }}>
{user.roleLabel || ""} {user.roleLabel || ""}
</Typography> </Typography>
+2 -1
View File
@@ -80,7 +80,8 @@ export default function AdminUsersPage() {
}; };
const remove = async (u: UserDto) => { const remove = async (u: UserDto) => {
if (!(await confirmAction(`Delete user ${u.email || u.userName || u.id}?`, { title: t("adminUsersDeleteConfirmTitle"), confirmLabel: t("adminUsersDelete"), destructive: true }))) return; const name = u.userName || u.email || u.id;
if (!(await confirmAction(t("adminUsersDeleteConfirmNamed", { name }), { title: t("adminUsersDeleteConfirmTitle"), confirmLabel: t("adminUsersDelete"), destructive: true }))) return;
try { try {
await api.delete(`/users/${u.id}`); await api.delete(`/users/${u.id}`);
toast(t("adminUsersDeleted"), "info"); toast(t("adminUsersDeleted"), "info");