Skip to content

Commit

Permalink
separate page for statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrewakiv committed Dec 20, 2024
1 parent cfb63a8 commit 30fd923
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 21 deletions.
10 changes: 6 additions & 4 deletions FrontEnd/src/pages/AdminPage/Menu/Menu.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { NavLink, useLocation } from 'react-router-dom';
import { NavLink } from 'react-router-dom';
import { useAuth } from '../../../hooks';
import ProfilesStatistics from '../UserProfilesTable/ProfilesStatistics';
import css from './Menu.module.css';

const MENU = [
Expand All @@ -24,6 +23,11 @@ const MENU = [
title: 'Налаштування часу автоапруву',
link: '/customadmin/automoderation/'
},
{
id: 'am5',
title: 'Статистика компаній',
link: '/customadmin/statistics/'
},
];


Expand All @@ -43,7 +47,6 @@ const SUPERUSER_MENU = [

function Menu() {
const { isSuperUser } = useAuth();
const location = useLocation();

return (
<div className={css['menu-section']}>
Expand All @@ -56,7 +59,6 @@ function Menu() {
key={element.id} to={element.link}>{element.title}
</NavLink>
))}
{location.pathname === '/customadmin/profiles/' && <ProfilesStatistics />}
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,25 @@ function ProfilesStatistics() {
) : error ? (
<div className={css['error']}>Не вдалося отримати статистику компаній</div>
) : (
<Descriptions
title="Статистика компаній"
column={1}
bordered
size="small"
items={items.map((item) => ({
...item,
label: (
<span className={css['description-item-label']}>{item.label}</span>
),
children: (
<span className={css['description-item-content']}>
{item.children}
</span>
),
}))}
/>
<div className={css['statistics-container']}>
<Descriptions
title="Статистика компаній"
column={1}
bordered
size="small"
items={items.map((item) => ({
...item,
label: (
<span className={css['description-item-label']}>{item.label}</span>
),
children: (
<span className={css['description-item-content']}>
{item.children}
</span>
),
}))}
/>
</div>
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
.statistics-container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100%;
padding: 30px;
}

.description-item-label {
max-width: 150px;
}
Expand Down
2 changes: 2 additions & 0 deletions FrontEnd/src/routes/AdminRouter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import ModerationEmail from '../pages/AdminPage/DetailView/ModerationEmail';
import Contacts from '../pages/AdminPage/DetailView/Contacts';
import AdminProfilePage from '../pages/AdminPage/AdminProfile/AdminProfilePage';
import AdminRegistration from '../pages/AdminPage/AdminRegistration/AdminRegistration';
import ProfilesStatistics from '../pages/AdminPage/UserProfilesTable/ProfilesStatistics';

import customAdminTheme from '../pages/CustomThemes/customAdminTheme.js';
import '../pages/AdminPage/AdminGlobal.css';
Expand Down Expand Up @@ -46,6 +47,7 @@ function AdminRouter() {
)}
<Route path="/contacts" element={<Contacts />} />
<Route path="/admin-profile/*" element={<AdminProfilePage />} />
<Route path="/statistics" element={<ProfilesStatistics />} />
</>
) : (
<Route path="/customadmin/" />
Expand Down

0 comments on commit 30fd923

Please sign in to comment.