From b87b9def629920582f5709d8ab58dd23c4783e4a Mon Sep 17 00:00:00 2001 From: wangsijie Date: Wed, 18 Jan 2023 15:56:47 +0800 Subject: [PATCH] fix(console): remove username admin tag (#2973) --- packages/console/src/components/UserName/index.tsx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/packages/console/src/components/UserName/index.tsx b/packages/console/src/components/UserName/index.tsx index 1993d8bc5..2b0575474 100644 --- a/packages/console/src/components/UserName/index.tsx +++ b/packages/console/src/components/UserName/index.tsx @@ -1,5 +1,4 @@ -import type { UserWithRoleNames } from '@logto/schemas'; -import { UserRole } from '@logto/schemas'; +import type { User } from '@logto/schemas'; import { useTranslation } from 'react-i18next'; import { Link } from 'react-router-dom'; import useSWR from 'swr'; @@ -14,29 +13,24 @@ type Props = { }; const UserName = ({ userId, isLink = false }: Props) => { - const { data, error } = useSWR(`/api/users/${userId}`); + const { data, error } = useSWR(`/api/users/${userId}`); const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' }); const isLoading = !data && !error; const name = data?.name ?? t('users.unnamed'); - const isAdmin = data?.roleNames.includes(UserRole.Admin); - if (isLoading) { return null; } return (
- {isLink && !isAdmin ? ( + {isLink ? ( {name} ) : ( - - {name} - {isAdmin && <> ({t('admin_user')})} - + {name} )} {userId}