feat: avatar column in admin users table

This commit is contained in:
Kirill
2026-05-21 20:52:43 +05:00
parent d1e4cc67aa
commit 2751332356
3 changed files with 21 additions and 1 deletions
+3
View File
@@ -2,6 +2,9 @@ export type AdminUser = {
id: string
email: string
name: string | null
avatar?: string | null
avatarType?: string | null
avatarStyle?: string | null
createdAt: string
updatedAt: string
}
@@ -21,6 +21,7 @@ import { $user } from '@/shared/model/auth'
import { AdminDialog } from '@/shared/ui/AdminDialog/AdminDialog'
import { AdminTable } from '@/shared/ui/AdminTable'
import { EntityRowActions } from '@/shared/ui/EntityRowActions'
import { UserAvatar } from '@/shared/ui/UserAvatar'
type UserFormState = {
email: string
@@ -171,6 +172,7 @@ export function AdminUsersPage() {
<AdminTable
columns={[
{ key: 'avatar', label: 'Аватар' },
{ key: 'email', label: 'Почта' },
{ key: 'name', label: 'Имя' },
{ key: 'createdAt', label: 'Создан' },
@@ -182,13 +184,22 @@ export function AdminUsersPage() {
>
{users.length === 0 && !usersQuery.isLoading ? (
<TableRow>
<TableCell colSpan={5} sx={{ color: 'text.secondary' }}>
<TableCell colSpan={6} sx={{ color: 'text.secondary' }}>
Пользователей пока нет.
</TableCell>
</TableRow>
) : (
users.map((u) => (
<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.name ?? '—'}</TableCell>
<TableCell>{formatDt(u.createdAt)}</TableCell>
+6
View File
@@ -33,6 +33,9 @@ export async function registerAdminUserRoutes(fastify) {
id: true,
email: true,
displayName: true,
avatar: true,
avatarType: true,
avatarStyle: true,
createdAt: true,
updatedAt: true,
},
@@ -44,6 +47,9 @@ export async function registerAdminUserRoutes(fastify) {
id: u.id,
email: u.email,
displayName: u.displayName,
avatar: u.avatar,
avatarType: u.avatarType,
avatarStyle: u.avatarStyle,
createdAt: u.createdAt,
updatedAt: u.updatedAt,
}))