statistics
This commit is contained in:
@ -2,7 +2,8 @@ import React, { useState, MouseEvent,useContext } from 'react';
|
||||
import styled from 'styled-components/macro';
|
||||
import Plan from '../assets/plan.svg';
|
||||
import History from '../assets/history.svg';
|
||||
import Statistics from '../assets/statistics.svg';
|
||||
import StatisticsIcon from '../assets/statistics.svg';
|
||||
import { Statistics } from './Statistics';
|
||||
import { Scheduler } from './Scheduler';
|
||||
import { Rightbar } from './Rightbar';
|
||||
import { SchedulerHistory } from './SchedulerHistory';
|
||||
@ -124,7 +125,7 @@ export const Deanery = ({ schedulerEvents }: Deanery) => {
|
||||
Historia Zmian
|
||||
</LeftPanelElement>
|
||||
<LeftPanelElement id={'3'} isCurrentTab={currentTab === 3} onClick={handleClick}>
|
||||
<Icon alt="statistics" src={Statistics} />
|
||||
<Icon alt="statistics" src={StatisticsIcon} />
|
||||
Statystyki
|
||||
</LeftPanelElement>
|
||||
</LeftSide>
|
||||
@ -137,7 +138,7 @@ export const Deanery = ({ schedulerEvents }: Deanery) => {
|
||||
) : currentTab === 2 ? (
|
||||
<SchedulerHistory schedulerHistoryEvents={schedulerHistoryEvents}/>
|
||||
) : currentTab === 3 ? (
|
||||
<StatsDiv />
|
||||
<StatsDiv><Statistics/></StatsDiv>
|
||||
) : (
|
||||
<LogoWrapper>
|
||||
<Logo alt="logo" src="https://plannaplan.pl/img/logo.svg" />
|
||||
|
94
src/components/Statistics.tsx
Normal file
94
src/components/Statistics.tsx
Normal file
@ -0,0 +1,94 @@
|
||||
import React, { useState, useContext } from 'react';
|
||||
import Collapse from '@material-ui/core/Collapse';
|
||||
import { ReactComponent as Expand } from '../assets/expand.svg';
|
||||
import { Course, Group, GroupType } from '../types/index';
|
||||
import { coursesContext } from '../contexts/CoursesProvider';
|
||||
import styled, { css } from 'styled-components';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import DeleteIcon from '@material-ui/icons/Delete';
|
||||
import { useMemo } from 'react';
|
||||
import { dayMapping } from '../constants';
|
||||
|
||||
const StatisticsWrapper = styled.div`
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
`;
|
||||
|
||||
const Row = styled.div`
|
||||
display: flex;
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
`;
|
||||
|
||||
const StatisticBox = styled.div`
|
||||
background-color:white;
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
margin: 10px;
|
||||
border: 1px solid #000000;
|
||||
border-radius: 38px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
font-size: 22px;
|
||||
padding:2px;
|
||||
box-shadow: 0px 2px 2px 0px rgba(0, 0, 0, 0.75);
|
||||
`;
|
||||
|
||||
const StatisticNumber = styled.p`
|
||||
font-size: 52px;
|
||||
margin-top: 40px;
|
||||
margin-bottom:0px;
|
||||
`;
|
||||
|
||||
const StatisticText = styled.p`
|
||||
font-size: 18px;
|
||||
text-align:center;
|
||||
align-items:center;
|
||||
justify-content:center;
|
||||
`;
|
||||
|
||||
export const Statistics = () => {
|
||||
return (
|
||||
<StatisticsWrapper>
|
||||
<Row>
|
||||
<StatisticBox>
|
||||
<StatisticNumber>65</StatisticNumber>
|
||||
<StatisticText>Utworzonych grup</StatisticText>
|
||||
</StatisticBox>
|
||||
<StatisticBox>
|
||||
{' '}
|
||||
<StatisticNumber>280</StatisticNumber>
|
||||
<StatisticText>Zapisanych studentów do grup</StatisticText>
|
||||
</StatisticBox>
|
||||
<StatisticBox>
|
||||
{' '}
|
||||
<StatisticNumber>24</StatisticNumber>
|
||||
<StatisticText>Studentów niezapisanych do żadnej grupy</StatisticText>
|
||||
</StatisticBox>
|
||||
</Row>
|
||||
<Row>
|
||||
<StatisticBox>
|
||||
{' '}
|
||||
<StatisticNumber>150</StatisticNumber>
|
||||
<StatisticText>Studentów z zaakceptowanym planem</StatisticText>
|
||||
</StatisticBox>
|
||||
<StatisticBox>
|
||||
{' '}
|
||||
<StatisticNumber>130</StatisticNumber>
|
||||
<StatisticText>Studentów bez zaakceptowanego pełengo planu</StatisticText>
|
||||
</StatisticBox>
|
||||
<StatisticBox>
|
||||
{' '}
|
||||
<StatisticNumber>0</StatisticNumber>
|
||||
<StatisticText>Zamkniętych grup</StatisticText>
|
||||
</StatisticBox>
|
||||
</Row>
|
||||
</StatisticsWrapper>
|
||||
);
|
||||
};
|
26
src/components/__tests__/Statistics.test.jsx
Normal file
26
src/components/__tests__/Statistics.test.jsx
Normal file
@ -0,0 +1,26 @@
|
||||
import React from 'react';
|
||||
import { cleanup, fireEvent, waitForElement, screen } from '@testing-library/react';
|
||||
import '@testing-library/jest-dom/extend-expect';
|
||||
import { customRender } from '../../customRender';
|
||||
import Topbar from '../Topbar';
|
||||
import { Statistics } from '../Statistics';
|
||||
|
||||
beforeAll(() => {
|
||||
delete window.location;
|
||||
window.location = { replace: jest.fn() };
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
window.location = location;
|
||||
});
|
||||
|
||||
test('renders component', async () => {
|
||||
customRender(<Statistics/>);
|
||||
expect(screen.getByText(/Studentów bez zaakceptowanego pełengo planu/i)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('renders component', async () => {
|
||||
customRender(<Statistics/>);
|
||||
expect(screen.getByText(/Zapisanych sutdentów do grup/i)).toBeInTheDocument();
|
||||
});
|
||||
|
Reference in New Issue
Block a user