feat(AccountsPage): add change page size

This commit is contained in:
Vladislav Syrochkin 2025-06-25 21:00:51 +05:00
parent a7e813b447
commit 6c0a6ac1d4
3 changed files with 15 additions and 4 deletions

View File

@ -2,6 +2,7 @@ import { Drawer } from 'antd';
import { useEffect, useState } from 'react';
import { Avatar, Typography } from 'antd';
import { useTranslation } from 'react-i18next';
import { useUserSelector } from '@/store/userStore';
interface ContentDrawerProps {
open: boolean;
@ -22,6 +23,7 @@ export default function ContentDrawer({
name,
email,
}: ContentDrawerProps) {
const user = useUserSelector();
const { t } = useTranslation();
const [width, setWidth] = useState<number | string>('30%');
@ -36,6 +38,7 @@ export default function ContentDrawer({
window.addEventListener('resize', calculateWidths);
return () => window.removeEventListener('resize', calculateWidths);
}, []);
console.log(login, user?.login, login === user?.login);
const editDrawerTitle = (
<div
@ -72,8 +75,11 @@ export default function ContentDrawer({
style={{ flexShrink: 0 }}
/>
<div>
<Typography.Text strong style={{ display: 'block' }}>
{name}
<Typography.Text
strong
style={{ display: 'block', fontSize: '20px' }}
>
{name} {login === user?.login ? t('you') : ''}
</Typography.Text>
<Typography.Text type="secondary" style={{ fontSize: 14 }}>
{email}

View File

@ -49,6 +49,7 @@ i18n
createdAt: 'Created',
saving: 'Saving...',
createdAccountMessage: 'User successfully created!',
you: '(You)',
},
},
ru: {
@ -89,7 +90,8 @@ i18n
nameLogin: 'Имя, Логин',
createdAt: 'Создано',
saving: 'Сохранение...',
createdAccountMessage: 'Пользователь успешно создан!'
createdAccountMessage: 'Пользователь успешно создан!',
you: '(Вы)',
},
},
},

View File

@ -138,7 +138,10 @@ export default function AccountsPage() {
const onTableChange: TableProps<AllUser>['onChange'] = (pagination) => {
console.log(pagination);
UserService.getUsers(pagination.current as number, 10).then((data) => {
UserService.getUsers(
pagination.current as number,
pagination.pageSize
).then((data) => {
setAccounts(data);
});
};