0
Fork 0
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:
Darcy Ye 2024-03-20 01:12:54 +08:00
parent 8f5baac585
commit 8ac95a1bc2
No known key found for this signature in database
GPG key ID: B46F4C07EDEFC610
5 changed files with 11 additions and 11 deletions

View file

@ -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. */

View file

@ -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;

View file

@ -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;
}

View file

@ -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)

View file

@ -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;
}