updated classes fetching endpoint
This commit is contained in:
parent
4c2820d3b8
commit
8ceef555d1
@ -66,7 +66,6 @@ export const Dropdown = ({ clearInput, handleClearInput }: DropdownProps) => {
|
||||
//courses - choosenCourses
|
||||
const [filteredCourses, setFilteredCourses] = useState<Array<Course>>([]);
|
||||
|
||||
|
||||
const { courses, basket, addToBasket } = useContext(coursesContext)!;
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React, { MouseEvent, useEffect, useState } from 'react';
|
||||
import React, { MouseEvent, useState } from 'react';
|
||||
import { Group, GroupType } from '../types';
|
||||
import styled from 'styled-components/macro';
|
||||
import Popover from '@material-ui/core/Popover';
|
||||
@ -48,13 +48,13 @@ const Classes = styled.div<ClassesProps>`
|
||||
z-index: 2;
|
||||
border-radius: 10px;
|
||||
|
||||
font-size:0.90vw;
|
||||
font-size: 0.9vw;
|
||||
/* background-color: rgb(100, 181, 246); */
|
||||
width: ${({ cellWidth }) => (cellWidth * 2.5) / 3}px;
|
||||
height: ${({ cellHeight }) => (cellHeight * 2 * 3) / 4}px;
|
||||
margin-right: 5px;
|
||||
text-align: center;
|
||||
background-color:${({groupType})=>groupType === "CLASS" ? "#FFDC61" : "#A68820"};
|
||||
background-color: ${({ groupType }) => (groupType === 'CLASS' ? '#FFDC61' : '#A68820')};
|
||||
box-shadow: 9px 9px 8px -2px rgba(0, 0, 0, 0.59);
|
||||
`;
|
||||
|
||||
@ -98,7 +98,7 @@ export const SchedulerRow = ({ groups, indexRow, cellTop, cellWidth, cellHeight
|
||||
{groups.map(
|
||||
(group, index) =>
|
||||
group.day === eventIndex && (
|
||||
<>
|
||||
<div key={index}>
|
||||
<Classes
|
||||
groupType={group.type}
|
||||
cellWidth={cellWidth}
|
||||
@ -141,7 +141,7 @@ export const SchedulerRow = ({ groups, indexRow, cellTop, cellWidth, cellHeight
|
||||
<p>{groups[index].room}</p>
|
||||
</Typography>
|
||||
</Popover>
|
||||
</>
|
||||
</div>
|
||||
),
|
||||
)}
|
||||
</SchedulerEvent>
|
||||
|
@ -75,18 +75,10 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => {
|
||||
|
||||
useEffect(() => {
|
||||
const fetchData = async () => {
|
||||
const { data } = await axios.get<Array<{ id: number; name: string; lectures: Array<Group>, classes:Array<Group> }>>(
|
||||
const { data: courses } = await axios.get<Array<Course>>(
|
||||
`${process.env.REACT_APP_API_URL}/api/v1/courses/getCoursesWithGroups`,
|
||||
);
|
||||
console.log(data);
|
||||
const courses = data.map(({ id, name, lectures, classes }) => ({
|
||||
id,
|
||||
name,
|
||||
lectures,
|
||||
classes,
|
||||
})) as Array<Course>;
|
||||
courses.sort((a: Course, b: Course) => (a.name > b.name ? 1 : -1));
|
||||
|
||||
setCourses(courses);
|
||||
};
|
||||
fetchData();
|
||||
|
Loading…
Reference in New Issue
Block a user