Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#999 fe analytics of companies #1014

Merged
merged 7 commits into from
Dec 17, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,40 +1,75 @@
import React from 'react';
import React, { useState, useEffect } from 'react';
import axios from 'axios';
import { Descriptions } from 'antd';
import css from './ProfilesStatistics.module.css';

const items = [
function ProfilesStatistics() {
const [statistics, setStatistics] = useState(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);

useEffect(() => {
const fetchStatistics = async () => {
try {
const baseUrl = process.env.REACT_APP_BASE_API_URL;
const response = await axios.get(`${baseUrl}/api/admin/profiles/statistics/`);
setStatistics(response.data);
} catch (error) {
console.error('Error fetching statistics:', error);
setError('Не вдалось отримати статистику компаній');
} finally {
setLoading(false);
}
};

fetchStatistics();
}, []);

if (loading) return <div className={css['loading']}>Loading...</div>;
if (error) return <div className={css['error']}>{error}</div>;

const items = [
{
key: '1',
label: 'Кількість зареєстрованих компаній',
children: '2',
children: statistics.companies_count,
},
{
key: '2',
label: 'Кількість Інвесторів',
children: '22',
children: statistics.investors_count,
},
{
key: '3',
label: 'Кількість стратапів',
children: '222',
label: 'Кількість Cтратапів',
children: statistics.startups_count,
},
{
key: '4',
label: 'Кількість заблокованих компаній',
children: '2222',
}
children: statistics.blocked_companies_count,
},
];


const ProfilesStatistics = () => <Descriptions
title="Сompanies Statistics"
column={1}
bordered
size="small"
items={items.map((item) => ({
return (
<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>
}))} />;
label: (
<span className={css['description-item-label']}>{item.label}</span>
),
children: (
<span className={css['description-item-content']}>
{item.children}
</span>
),
}))}
/>
);
}

export default ProfilesStatistics;
export default ProfilesStatistics;
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
.description-item-label {
max-width: 150px;
max-width: 150px;
}

.description-item-content {
max-width: 200px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
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;
}

.loading {
font-size: 18px;
}

Unchanged files with check annotations Beta

return (
<div className={css['checkbox']}>
<label >
<input id={props.id} type="checkbox" />

Check warning on line 6 in FrontEnd/src/components/Checkbox/Checkbox.jsx

GitHub Actions / Linting

'id' is missing in props validation
{props.title}

Check warning on line 7 in FrontEnd/src/components/Checkbox/Checkbox.jsx

GitHub Actions / Linting

'title' is missing in props validation
</label>
</div>
);
return (
<header>
<div className={css['header-content']}>
<Navbar isAuthorized={props.isAuthorized} page={pathname}></Navbar>

Check warning on line 13 in FrontEnd/src/components/Header/Header.jsx

GitHub Actions / Linting

'isAuthorized' is missing in props validation
<div className={css['header-divider']}></div>
</div>
</header>
import css from './Buttons.module.css';
import { Link } from 'react-router-dom';
function Buttons({adminPage}) {

Check warning on line 4 in FrontEnd/src/components/Header/Navbar/Buttons.jsx

GitHub Actions / Linting

'adminPage' is missing in props validation
return (
<div className={css['header-buttons-section']}>
<Link className={css['header-login__button']} to="/login">Увійти</Link>
import React, { useState, useEffect, useRef } from 'react';
import css from './DropdownMenu.module.css';
function DropdownMenu({ children, toggleText }) {

Check warning on line 4 in FrontEnd/src/components/Header/Navbar/DropdownMenu.jsx

GitHub Actions / Linting

'children' is missing in props validation

Check warning on line 4 in FrontEnd/src/components/Header/Navbar/DropdownMenu.jsx

GitHub Actions / Linting

'toggleText' is missing in props validation
const [isOpen, setIsOpen] = useState(false);
const ref = useRef(null);
import classes from './AdminSubmitButton.module.css';
const AdminSubmitButton = ({ disabled }) => {

Check warning on line 3 in FrontEnd/src/components/MiniComponents/AdminSubmitButton.jsx

GitHub Actions / Linting

'disabled' is missing in props validation
return (
<div className={classes['admin-submit__container']}>
<button
import { Tooltip } from 'antd';
import styles from './PendingStatus.module.css';
const PendingStatus = ({ profile, elementType }) => {

Check warning on line 4 in FrontEnd/src/components/MiniComponents/PendingModerationIcon/PendingStatus.jsx

GitHub Actions / Linting

'profile' is missing in props validation

Check warning on line 4 in FrontEnd/src/components/MiniComponents/PendingModerationIcon/PendingStatus.jsx

GitHub Actions / Linting

'elementType' is missing in props validation
const bannerApproved = profile?.banner?.is_approved;

Check warning on line 6 in FrontEnd/src/components/MiniComponents/PendingModerationIcon/PendingStatus.jsx

GitHub Actions / Linting

'profile.banner' is missing in props validation
const logoApproved = profile?.logo?.is_approved;
const shouldShowTooltip = (elementType === 'banner' && bannerApproved === false)