diff --git a/src/components/Dropdown.tsx b/src/components/Dropdown.tsx index 84df6aa..985bb63 100644 --- a/src/components/Dropdown.tsx +++ b/src/components/Dropdown.tsx @@ -66,7 +66,6 @@ export const Dropdown = ({ clearInput, handleClearInput }: DropdownProps) => { //courses - choosenCourses const [filteredCourses, setFilteredCourses] = useState>([]); - const { courses, basket, addToBasket } = useContext(coursesContext)!; useEffect(() => { diff --git a/src/components/SchedulerRow.tsx b/src/components/SchedulerRow.tsx index cb45953..e7b80f3 100644 --- a/src/components/SchedulerRow.tsx +++ b/src/components/SchedulerRow.tsx @@ -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'; @@ -35,7 +35,7 @@ const SchedulerEvent = styled.div` z-index: 2; `; -interface ClassesProps{ +interface ClassesProps { cellWidth: number; cellHeight: number; groupType: GroupType; @@ -47,15 +47,15 @@ const Classes = styled.div` align-items: center; 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"}; - box-shadow: 9px 9px 8px -2px rgba(0,0,0,0.59); + background-color: ${({ groupType }) => (groupType === 'CLASS' ? '#FFDC61' : '#A68820')}; + box-shadow: 9px 9px 8px -2px rgba(0, 0, 0, 0.59); `; interface SchedulerRowProps { @@ -98,7 +98,7 @@ export const SchedulerRow = ({ groups, indexRow, cellTop, cellWidth, cellHeight {groups.map( (group, index) => group.day === eventIndex && ( - <> +
{groups[index].room}

- +
), )} diff --git a/src/contexts/CoursesProvider.tsx b/src/contexts/CoursesProvider.tsx index 444a461..e347eec 100644 --- a/src/contexts/CoursesProvider.tsx +++ b/src/contexts/CoursesProvider.tsx @@ -75,18 +75,10 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => { useEffect(() => { const fetchData = async () => { - const { data } = await axios.get, classes:Array }>>( + const { data: courses } = await axios.get>( `${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; courses.sort((a: Course, b: Course) => (a.name > b.name ? 1 : -1)); - setCourses(courses); }; fetchData();