diff --git a/FrontEnd/src/pages/AdminPage/Menu/Menu.jsx b/FrontEnd/src/pages/AdminPage/Menu/Menu.jsx index 70cd9910d..8bb537a71 100644 --- a/FrontEnd/src/pages/AdminPage/Menu/Menu.jsx +++ b/FrontEnd/src/pages/AdminPage/Menu/Menu.jsx @@ -1,5 +1,6 @@ -import { NavLink } from 'react-router-dom'; +import { NavLink, useLocation } from 'react-router-dom'; import { useAuth } from '../../../hooks'; +import ProfilesStatistics from '../UserProfilesTable/ProfilesStatistics'; import css from './Menu.module.css'; const MENU = [ @@ -25,6 +26,7 @@ const MENU = [ }, ]; + const SUPERUSER_MENU = [ { id: 'am5', @@ -41,6 +43,7 @@ const SUPERUSER_MENU = [ function Menu() { const { isSuperUser } = useAuth(); + const location = useLocation(); return (
@@ -53,6 +56,7 @@ function Menu() { key={element.id} to={element.link}>{element.title} ))} + {location.pathname === '/customadmin/profiles/' && }
); } diff --git a/FrontEnd/src/pages/AdminPage/Menu/Menu.module.css b/FrontEnd/src/pages/AdminPage/Menu/Menu.module.css index 93170f61f..a191141bf 100644 --- a/FrontEnd/src/pages/AdminPage/Menu/Menu.module.css +++ b/FrontEnd/src/pages/AdminPage/Menu/Menu.module.css @@ -22,3 +22,4 @@ .menu-section-element__active { font-weight: 600; } + diff --git a/FrontEnd/src/pages/AdminPage/UserProfilesTable/ProfilesStatistics.jsx b/FrontEnd/src/pages/AdminPage/UserProfilesTable/ProfilesStatistics.jsx new file mode 100644 index 000000000..7354b456a --- /dev/null +++ b/FrontEnd/src/pages/AdminPage/UserProfilesTable/ProfilesStatistics.jsx @@ -0,0 +1,69 @@ +import axios from 'axios'; +import useSWR from 'swr'; +import { Descriptions } from 'antd'; +import Loader from '../../../components/Loader/Loader'; +import css from './ProfilesStatistics.module.css'; + +async function fetcher(url) { + const response = await axios.get(url); + return response.data; +} + +function ProfilesStatistics() { + const baseUrl = process.env.REACT_APP_BASE_API_URL; + const url = `${baseUrl}/api/admin/profiles/statistics/`; + const { data: statistics, error, isLoading } = useSWR(url, fetcher); + + const items = statistics + ? [ + { + key: '1', + label: 'Кількість зареєстрованих компаній', + children: statistics.companies_count, + }, + { + key: '2', + label: 'Кількість Інвесторів', + children: statistics.investors_count, + }, + { + key: '3', + label: 'Кількість Cтратапів', + children: statistics.startups_count, + }, + { + key: '4', + label: 'Кількість заблокованих компаній', + children: statistics.blocked_companies_count, + }, + ] + : []; + + return isLoading ? ( +
+ +
+ ) : error ? ( +
Не вдалося отримати статистику компаній
+ ) : ( + ({ + ...item, + label: ( + {item.label} + ), + children: ( + + {item.children} + + ), + }))} + /> + ); +} + +export default ProfilesStatistics; diff --git a/FrontEnd/src/pages/AdminPage/UserProfilesTable/ProfilesStatistics.module.css b/FrontEnd/src/pages/AdminPage/UserProfilesTable/ProfilesStatistics.module.css new file mode 100644 index 000000000..4e2dcbb6e --- /dev/null +++ b/FrontEnd/src/pages/AdminPage/UserProfilesTable/ProfilesStatistics.module.css @@ -0,0 +1,24 @@ +.description-item-label { + max-width: 150px; +} + +.description-item-content { + max-width: 200px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.error { + color: #f5222d; + background-color: #fff1f0; + border: 1px solid #ffa39e; + padding: 10px; + border-radius: 4px; + margin-top: 10px; +} + +.loader-container { + width: 200px; + height: 300px; +} \ No newline at end of file diff --git a/FrontEnd/src/pages/CustomThemes/customAdminTheme.js b/FrontEnd/src/pages/CustomThemes/customAdminTheme.js index 4410b6374..545c6783e 100644 --- a/FrontEnd/src/pages/CustomThemes/customAdminTheme.js +++ b/FrontEnd/src/pages/CustomThemes/customAdminTheme.js @@ -21,6 +21,13 @@ const customAdminTheme = { Table: { lineWidth: 3, colorPrimary: '#1f9a7c' + }, + Carousel: { + colorBgContainer: '#B4D27A', + dotActiveWidth: 32, + dotWidth: 32, + dotHeight: 6, + lineHeight: 1, } }, token: {