mirror of
https://github.com/logto-io/logto.git
synced 2025-02-17 22:04:19 -05:00
fix(console): fix some user related type in console
This commit is contained in:
parent
8f5baac585
commit
8ac95a1bc2
5 changed files with 11 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
|||
import { type User } from '@logto/schemas';
|
||||
import { type UserInfo } from '@logto/schemas';
|
||||
import { conditional } from '@silverhand/essentials';
|
||||
|
||||
import SuspendedTag from '@/pages/Users/components/SuspendedTag';
|
||||
|
@ -9,7 +9,7 @@ import UserAvatar from '../UserAvatar';
|
|||
import ItemPreview from '.';
|
||||
|
||||
type Props = {
|
||||
user: User;
|
||||
user: UserInfo;
|
||||
};
|
||||
|
||||
/** A component that renders a preview of a user. It's useful for displaying a user in a list. */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type { AdminConsoleKey } from '@logto/phrases';
|
||||
import type { User } from '@logto/schemas';
|
||||
import type { UserProfileResponse } from '@logto/schemas';
|
||||
import { conditionalArray } from '@silverhand/essentials';
|
||||
import { useState } from 'react';
|
||||
import { toast } from 'react-hot-toast';
|
||||
|
@ -15,7 +15,7 @@ import * as modalStyles from '@/scss/modal.module.scss';
|
|||
import * as styles from './index.module.scss';
|
||||
|
||||
type Props = {
|
||||
user: User;
|
||||
user: UserProfileResponse;
|
||||
password: string;
|
||||
title: AdminConsoleKey;
|
||||
onClose: () => void;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { RoleResponse, User, Application } from '@logto/schemas';
|
||||
import type { RoleResponse, UserProfileResponse, Application } from '@logto/schemas';
|
||||
import { RoleType } from '@logto/schemas';
|
||||
import { useState } from 'react';
|
||||
import { toast } from 'react-hot-toast';
|
||||
|
@ -15,7 +15,7 @@ import { getUserTitle } from '@/utils/user';
|
|||
|
||||
type Props =
|
||||
| {
|
||||
entity: User;
|
||||
entity: UserProfileResponse;
|
||||
onClose: (success?: boolean) => void;
|
||||
type: RoleType.User;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import type { User } from '@logto/schemas';
|
||||
import type { UserProfileResponse } from '@logto/schemas';
|
||||
import { formatToInternationalPhoneNumber } from '@logto/shared/universal';
|
||||
import { conditional } from '@silverhand/essentials';
|
||||
|
||||
import type { UserDetailsForm } from './types';
|
||||
|
||||
export const userDetailsParser = {
|
||||
toLocalForm: (data: User): UserDetailsForm => {
|
||||
toLocalForm: (data: UserProfileResponse): UserDetailsForm => {
|
||||
const { primaryEmail, primaryPhone, username, name, avatar, customData } = data;
|
||||
const parsedPhoneNumber = conditional(
|
||||
primaryPhone && formatToInternationalPhoneNumber(primaryPhone)
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import type { User } from '@logto/schemas';
|
||||
import type { UserInfo } from '@logto/schemas';
|
||||
import { getUserDisplayName } from '@logto/shared/universal';
|
||||
import { t } from 'i18next';
|
||||
|
||||
export const getUserTitle = (user?: User): string =>
|
||||
export const getUserTitle = (user?: UserInfo): string =>
|
||||
(user ? getUserDisplayName(user) : undefined) ?? t('admin_console.users.unnamed');
|
||||
|
||||
export const getUserSubtitle = (user?: User) => {
|
||||
export const getUserSubtitle = (user?: UserInfo) => {
|
||||
if (!user?.name) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue