feat: avatar column in admin users table
This commit is contained in:
@@ -2,6 +2,9 @@ export type AdminUser = {
|
|||||||
id: string
|
id: string
|
||||||
email: string
|
email: string
|
||||||
name: string | null
|
name: string | null
|
||||||
|
avatar?: string | null
|
||||||
|
avatarType?: string | null
|
||||||
|
avatarStyle?: string | null
|
||||||
createdAt: string
|
createdAt: string
|
||||||
updatedAt: string
|
updatedAt: string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import { $user } from '@/shared/model/auth'
|
|||||||
import { AdminDialog } from '@/shared/ui/AdminDialog/AdminDialog'
|
import { AdminDialog } from '@/shared/ui/AdminDialog/AdminDialog'
|
||||||
import { AdminTable } from '@/shared/ui/AdminTable'
|
import { AdminTable } from '@/shared/ui/AdminTable'
|
||||||
import { EntityRowActions } from '@/shared/ui/EntityRowActions'
|
import { EntityRowActions } from '@/shared/ui/EntityRowActions'
|
||||||
|
import { UserAvatar } from '@/shared/ui/UserAvatar'
|
||||||
|
|
||||||
type UserFormState = {
|
type UserFormState = {
|
||||||
email: string
|
email: string
|
||||||
@@ -171,6 +172,7 @@ export function AdminUsersPage() {
|
|||||||
|
|
||||||
<AdminTable
|
<AdminTable
|
||||||
columns={[
|
columns={[
|
||||||
|
{ key: 'avatar', label: 'Аватар' },
|
||||||
{ key: 'email', label: 'Почта' },
|
{ key: 'email', label: 'Почта' },
|
||||||
{ key: 'name', label: 'Имя' },
|
{ key: 'name', label: 'Имя' },
|
||||||
{ key: 'createdAt', label: 'Создан' },
|
{ key: 'createdAt', label: 'Создан' },
|
||||||
@@ -182,13 +184,22 @@ export function AdminUsersPage() {
|
|||||||
>
|
>
|
||||||
{users.length === 0 && !usersQuery.isLoading ? (
|
{users.length === 0 && !usersQuery.isLoading ? (
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell colSpan={5} sx={{ color: 'text.secondary' }}>
|
<TableCell colSpan={6} sx={{ color: 'text.secondary' }}>
|
||||||
Пользователей пока нет.
|
Пользователей пока нет.
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
) : (
|
) : (
|
||||||
users.map((u) => (
|
users.map((u) => (
|
||||||
<TableRow key={u.id} hover>
|
<TableRow key={u.id} hover>
|
||||||
|
<TableCell>
|
||||||
|
<UserAvatar
|
||||||
|
userId={u.id}
|
||||||
|
avatarUrl={u.avatar}
|
||||||
|
avatarType={u.avatarType}
|
||||||
|
avatarStyle={u.avatarStyle}
|
||||||
|
size={28}
|
||||||
|
/>
|
||||||
|
</TableCell>
|
||||||
<TableCell>{u.email}</TableCell>
|
<TableCell>{u.email}</TableCell>
|
||||||
<TableCell>{u.name ?? '—'}</TableCell>
|
<TableCell>{u.name ?? '—'}</TableCell>
|
||||||
<TableCell>{formatDt(u.createdAt)}</TableCell>
|
<TableCell>{formatDt(u.createdAt)}</TableCell>
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ export async function registerAdminUserRoutes(fastify) {
|
|||||||
id: true,
|
id: true,
|
||||||
email: true,
|
email: true,
|
||||||
displayName: true,
|
displayName: true,
|
||||||
|
avatar: true,
|
||||||
|
avatarType: true,
|
||||||
|
avatarStyle: true,
|
||||||
createdAt: true,
|
createdAt: true,
|
||||||
updatedAt: true,
|
updatedAt: true,
|
||||||
},
|
},
|
||||||
@@ -44,6 +47,9 @@ export async function registerAdminUserRoutes(fastify) {
|
|||||||
id: u.id,
|
id: u.id,
|
||||||
email: u.email,
|
email: u.email,
|
||||||
displayName: u.displayName,
|
displayName: u.displayName,
|
||||||
|
avatar: u.avatar,
|
||||||
|
avatarType: u.avatarType,
|
||||||
|
avatarStyle: u.avatarStyle,
|
||||||
createdAt: u.createdAt,
|
createdAt: u.createdAt,
|
||||||
updatedAt: u.updatedAt,
|
updatedAt: u.updatedAt,
|
||||||
}))
|
}))
|
||||||
|
|||||||
Reference in New Issue
Block a user