From c80d1b624d6ed81d0bf31e473c4948167f4e3afd Mon Sep 17 00:00:00 2001 From: wrzesinski-hubert Date: Tue, 30 Jun 2020 19:22:32 +0200 Subject: [PATCH 01/27] dropdown --- package-lock.json | 102 ++++++++++++++++++++++- package.json | 7 +- src/App.tsx | 7 +- src/components/TopBar/Results/index.scss | 21 +++++ src/components/TopBar/Results/index.tsx | 64 ++++++++++++++ src/components/TopBar/index.scss | 2 +- src/components/TopBar/index.tsx | 18 +--- 7 files changed, 195 insertions(+), 26 deletions(-) create mode 100644 src/components/TopBar/Results/index.scss create mode 100644 src/components/TopBar/Results/index.tsx diff --git a/package-lock.json b/package-lock.json index 8ff59d4..aa67c95 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1417,6 +1417,30 @@ "@babel/runtime": "^7.4.4" } }, + "@material-ui/lab": { + "version": "4.0.0-alpha.56", + "resolved": "https://registry.npmjs.org/@material-ui/lab/-/lab-4.0.0-alpha.56.tgz", + "integrity": "sha512-xPlkK+z/6y/24ka4gVJgwPfoCF4RCh8dXb1BNE7MtF9bXEBLN/lBxNTK8VAa0qm3V2oinA6xtUIdcRh0aeRtVw==", + "requires": { + "@babel/runtime": "^7.4.4", + "@material-ui/utils": "^4.10.2", + "clsx": "^1.0.4", + "prop-types": "^15.7.2", + "react-is": "^16.8.0" + }, + "dependencies": { + "@material-ui/utils": { + "version": "4.10.2", + "resolved": "https://registry.npmjs.org/@material-ui/utils/-/utils-4.10.2.tgz", + "integrity": "sha512-eg29v74P7W5r6a4tWWDAAfZldXIzfyO1am2fIsC39hdUUHm/33k6pGOKPbgDjg/U/4ifmgAePy/1OjkKN6rFRw==", + "requires": { + "@babel/runtime": "^7.4.4", + "prop-types": "^15.7.2", + "react-is": "^16.8.0" + } + } + } + }, "@material-ui/pickers": { "version": "3.2.10", "resolved": "https://registry.npmjs.org/@material-ui/pickers/-/pickers-3.2.10.tgz", @@ -1834,6 +1858,11 @@ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.4.tgz", "integrity": "sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA==" }, + "@types/lru-cache": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@types/lru-cache/-/lru-cache-4.1.2.tgz", + "integrity": "sha512-ve2IoUJClE+4S/sG2zoLGEHP6DCvqgyz7UkHZdiICdQaAYRaCXsRWfJlbL8B0KvUyo9lgzD+oR0YSy4YikFyFQ==" + }, "@types/minimatch": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", @@ -2657,6 +2686,63 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.10.0.tgz", "integrity": "sha512-3YDiu347mtVtjpyV3u5kVqQLP242c06zwDOgpeRnybmXlYYsLbtTrUBUm8i8srONt+FWobl5aibnU1030PeeuA==" }, + "axios": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz", + "integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==", + "requires": { + "follow-redirects": "1.5.10" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + }, + "follow-redirects": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", + "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", + "requires": { + "debug": "=3.1.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + } + } + }, + "axios-extensions": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/axios-extensions/-/axios-extensions-3.1.3.tgz", + "integrity": "sha512-/OB9OcJLNOIx9pdW4m4/hFRvNo12wlX5BaprIzqpMaLR02I88Mr98/wW4QN9rhx0/yg9rM7i6Af/RpV4MyxXjA==", + "requires": { + "@types/lru-cache": "^4.1.1", + "lru-cache": "^5.1.1", + "tslib": "^1.9.0", + "util": "^0.11.1" + }, + "dependencies": { + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "util": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/util/-/util-0.11.1.tgz", + "integrity": "sha512-HShAsny+zS2TZfaXxD9tYj4HQGlBezXZMZuM/S5PKLLoZkShZiGk9o5CzukI1LVHZvjdvZ2Sj1aW/Ndn2NB/HQ==", + "requires": { + "inherits": "2.0.3" + } + } + } + }, "axobject-query": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.1.2.tgz", @@ -6830,9 +6916,9 @@ "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==" }, "immer": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/immer/-/immer-1.10.0.tgz", - "integrity": "sha512-O3sR1/opvCDGLEVcvrGTMtLac8GJ5IwZC4puPrLuRj3l7ICKvkmA0vGuU9OW8mV9WIBRnaxp5GJh9IEAaNOoYg==" + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/immer/-/immer-7.0.5.tgz", + "integrity": "sha512-TtRAKZyuqld2eYjvWgXISLJ0ZlOl1OOTzRmrmiY8SlB0dnAhZ1OiykIDL5KDFNaPHDXiLfGQFNJGtet8z8AEmg==" }, "import-cwd": { "version": "2.1.0", @@ -11238,6 +11324,11 @@ } } }, + "immer": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/immer/-/immer-1.10.0.tgz", + "integrity": "sha512-O3sR1/opvCDGLEVcvrGTMtLac8GJ5IwZC4puPrLuRj3l7ICKvkmA0vGuU9OW8mV9WIBRnaxp5GJh9IEAaNOoYg==" + }, "inquirer": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.0.4.tgz", @@ -13734,6 +13825,11 @@ "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==" }, + "use-immer": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/use-immer/-/use-immer-0.4.0.tgz", + "integrity": "sha512-mxx4jbRRc1/56geSc3VHx8gg3FvlzUpQPfVNJXtU1NRK/iTdK0pV3k3YPi7iFUcCM8YJ6/0dUBENyuk3WO/gxw==" + }, "util": { "version": "0.10.3", "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", diff --git a/package.json b/package.json index db22b16..ccb0384 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "@devexpress/dx-react-scheduler-material-ui": "^2.6.3", "@material-ui/core": "^4.10.0", "@material-ui/icons": "^4.9.1", + "@material-ui/lab": "^4.0.0-alpha.56", "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.5.0", "@testing-library/user-event": "^7.2.1", @@ -19,6 +20,9 @@ "@types/node": "^12.12.42", "@types/react": "^16.9.35", "@types/react-dom": "^16.9.8", + "axios": "^0.19.2", + "axios-extensions": "^3.1.3", + "immer": "^7.0.5", "install": "^0.13.0", "node-sass": "^4.14.1", "react": "^16.13.1", @@ -26,7 +30,8 @@ "react-scripts": "3.4.1", "sass": "^1.26.5", "to": "^0.2.9", - "typescript": "^3.9.3" + "typescript": "^3.9.3", + "use-immer": "^0.4.0" }, "scripts": { "start": "react-scripts start", diff --git a/src/App.tsx b/src/App.tsx index 5897bee..0582597 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -12,16 +12,13 @@ import { BuisnessProvided } from "./businesslogic/BusinessLogicProvider"; function App() { const [isOpenTransfer, setOpenTransfer] = useState(false); - const [text, setText] = useState(""); + return (
{(context) => ( { - setText(e.target.value); - }} handleTransfer={(e) => { setOpenTransfer(!isOpenTransfer); }} @@ -54,8 +51,6 @@ function App() { />
- -

{text}

); } diff --git a/src/components/TopBar/Results/index.scss b/src/components/TopBar/Results/index.scss new file mode 100644 index 0000000..4b250b9 --- /dev/null +++ b/src/components/TopBar/Results/index.scss @@ -0,0 +1,21 @@ +.lecture { + position: relative; + z-index: 10; + padding: 5px; + background-color: #e6c759; + font-size: 18px; +} +.lecture:hover{ + background-color: #d4b851; + cursor: pointer; +} +.dropdown::-webkit-scrollbar { + display: none; +} +.dropdown { + max-height: 400px; + overflow-y: auto; +} +.top-bar__input-field { + width: 100%; +} diff --git a/src/components/TopBar/Results/index.tsx b/src/components/TopBar/Results/index.tsx new file mode 100644 index 0000000..dc63207 --- /dev/null +++ b/src/components/TopBar/Results/index.tsx @@ -0,0 +1,64 @@ +import React, { useState } from "react"; +import axios from "axios"; +import { Input } from "@material-ui/core"; +import "./index.scss"; +import ClickAwayListener from "@material-ui/core/ClickAwayListener"; + +interface data { + id: number; + name: string; + sym: string; +} + +export const Results: React.FC = () => { + const [input, setInput] = useState(""); + const [data, setData] = useState>([]); + const [open, setOpen] = React.useState(false); + + const handleChange = (event: React.ChangeEvent) => { + setInput(event.target.value); + //query should be updated on backend to not accept empty string + if (event.target.value !== "") { + console.log(event.target.value); + search(event.target.value); + } else { + search("xxxxxxxxxxxxxxx"); + } + }; + const search = (text: string) => { + axios + .get(`http://localhost:1287/getCourses?name=${text}`) + .then((response) => setData(response.data)); + }; + + const handleClick = () => { + setOpen(true); + }; + + const handleClickAway = () => { + setOpen(false); + }; + + return ( + +
+ + {open ? ( +
+ {data.map((lecture, index) => ( +
+

{lecture.name}

+
+ ))} +
+ ) : null} +
+
+ ); +}; diff --git a/src/components/TopBar/index.scss b/src/components/TopBar/index.scss index e0ae02a..e31438e 100644 --- a/src/components/TopBar/index.scss +++ b/src/components/TopBar/index.scss @@ -24,12 +24,12 @@ &-div { width: 70%; display: flex; - align-items: center; flex-grow: 3; } &-field { width: 96%; + margin-top: 10px; } &-icon { diff --git a/src/components/TopBar/index.tsx b/src/components/TopBar/index.tsx index c0455ce..d00f7a6 100644 --- a/src/components/TopBar/index.tsx +++ b/src/components/TopBar/index.tsx @@ -1,6 +1,5 @@ -import React, { ChangeEvent } from "react"; +import React from "react"; import "./index.scss"; -import Input from "@material-ui/core/Input"; import Transfer from "./transfer.png"; import Search from "./search.svg"; import UK from "./UK.png"; @@ -8,14 +7,12 @@ import PL from "./PL.png"; import User from "./user.png"; import CloseIcon from "./close.svg"; import { Profile } from "./Profile"; +import {Results} from "./Results"; interface TopBarProps { handleTransfer: (e: React.MouseEvent) => void; onLangChange: (lang: boolean) => void; handleLogout: () => void; - textChangeHandler: ( - e: React.ChangeEvent - ) => void; } interface TopBarState { @@ -36,10 +33,6 @@ export default class TopBar extends React.Component { }; } - handleChange(e: React.ChangeEvent) { - this.props.textChangeHandler(e); - } - handleTransfer(e: React.MouseEvent) { this.props.handleTransfer(e); } @@ -80,12 +73,7 @@ export default class TopBar extends React.Component { alt="search" src={Search} /> - this.handleChange(e)} - /> +
close Date: Tue, 30 Jun 2020 22:09:13 +0200 Subject: [PATCH 02/27] You can add lecture to your basket now --- src/businesslogic/LecturesProvider.tsx | 24 +++++++++++++ src/components/RightBar/index.tsx | 8 +++-- src/components/TopBar/Results/index.tsx | 48 +++++++++++++++++++++++-- src/index.tsx | 3 ++ src/lectures.ts | 2 +- 5 files changed, 79 insertions(+), 6 deletions(-) create mode 100644 src/businesslogic/LecturesProvider.tsx diff --git a/src/businesslogic/LecturesProvider.tsx b/src/businesslogic/LecturesProvider.tsx new file mode 100644 index 0000000..f599533 --- /dev/null +++ b/src/businesslogic/LecturesProvider.tsx @@ -0,0 +1,24 @@ +import React, { useState } from "react"; +import { Lecture } from "../lectures"; + +interface ILectureContext { + lectures: Array + updateLectures: (lectures: Lecture) => void +} +export const LecturesContext = React.createContext({lectures: Array(), updateLectures: (lectures: Lecture) => {}}); + +export const LecturesProvider : React.FC = (props) => { + + const [lectures, setLectures] = useState>([]); + + const updateLectures = (lecture : Lecture) => {setLectures([...lectures, lecture]); console.log(`Lectures xd are: ${JSON.stringify(lectures)}\n`)} + + return ( + + {props.children} + + ); + + +} + diff --git a/src/components/RightBar/index.tsx b/src/components/RightBar/index.tsx index 4cec1df..a3485e8 100644 --- a/src/components/RightBar/index.tsx +++ b/src/components/RightBar/index.tsx @@ -1,9 +1,10 @@ -import React, { useState } from "react"; +import React, { useState, useContext } from "react"; import "./index.scss"; import { Lecture } from "../../lectures"; import LectureCard from "./LectureCard"; import BusinessLogicContext from "../../businesslogic/BusinessLogicContext"; import { BuisnessProvided } from "../../businesslogic/BusinessLogicProvider"; +import { LecturesContext } from "../../businesslogic/LecturesProvider"; interface RightBarProps { onGroupMouseOver: (id: string, name: string) => void; @@ -14,6 +15,9 @@ interface RightBarProps { export default function RightBar({ lectures, onGroupMouseOver, onGroupClick }: RightBarProps) { const [selectedCardId, setSelectedCardId] = useState(null); + const lecturesContext = useContext(LecturesContext); + + const onCardClick = (e: React.MouseEvent) => { const target = e.currentTarget as HTMLElement; selectedCardId === target.id ? setSelectedCardId(null) : setSelectedCardId(target.id); @@ -28,7 +32,7 @@ export default function RightBar({ lectures, onGroupMouseOver, onGroupClick }: R Hubert Wrzesiński

Semestr zimowy 2020/2021 - {lectures.map((lecture, index) => ( + {lecturesContext.lectures.map((lecture, index) => ( { const [input, setInput] = useState(""); const [data, setData] = useState>([]); const [open, setOpen] = React.useState(false); + const lecturesContext = useContext(LecturesContext); + + const handleChange = (event: React.ChangeEvent) => { setInput(event.target.value); //query should be updated on backend to not accept empty string @@ -39,6 +50,36 @@ export const Results: React.FC = () => { setOpen(false); }; + const onLectureClick = (e: React.MouseEvent) => { + const target = e.currentTarget as HTMLElement; + const id = target.id; + + const lecture = {name: "", groups: []} as Lecture; + + console.log(id); + axios + .get(`http://localhost:1287/getClassesByCourseId?id=${id}`) + .then((response) => { + for(let data of response.data){ + console.log("XDD"); + console.log(data); + let group = {} as Group; + lecture.name = data.course.name; + group.id = data.id; + group.day = data.day; + group.time = data.time; + group.lecturer = `${data.lecturer.title} ${data.lecturer.name} ${data.lecturer.surname}`; + group.room = data.room.trim(); + lecture.groups.push(group); + console.log("XDDD"); + console.log(lecture.groups); + lecturesContext.updateLectures(lecture); + } + + setOpen(false); + }); + } + return (
@@ -52,8 +93,8 @@ export const Results: React.FC = () => { {open ? (
{data.map((lecture, index) => ( -
-

{lecture.name}

+
+

{lecture.name}

))}
@@ -62,3 +103,4 @@ export const Results: React.FC = () => { ); }; + diff --git a/src/index.tsx b/src/index.tsx index 628c5bc..315593c 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -2,12 +2,15 @@ import React from "react"; import ReactDOM from "react-dom"; import App from "./App"; import BuisnessLogicProvider from "./businesslogic/BusinessLogicProvider"; +import { LecturesProvider } from "./businesslogic/LecturesProvider"; ReactDOM.render( <> + + , document.getElementById("root") ); diff --git a/src/lectures.ts b/src/lectures.ts index fbc7068..a1e714d 100644 --- a/src/lectures.ts +++ b/src/lectures.ts @@ -3,7 +3,7 @@ export interface Lecture { groups: Array; } -interface Group { +export interface Group { id: string; day: string; time: string; From 5b24b5fd59784eaa3a77e08cdd681faa46991f86 Mon Sep 17 00:00:00 2001 From: wrzesinski-hubert Date: Wed, 1 Jul 2020 00:59:19 +0200 Subject: [PATCH 03/27] A lot of stuff to refactor, have fun --- src/App.scss | 5 +- src/App.tsx | 1 - src/businesslogic/LecturesProvider.tsx | 2 +- .../RightBar/LectureCard/index.scss | 91 ++++++++++++------- src/components/RightBar/LectureCard/index.tsx | 74 +++++++++------ src/components/RightBar/index.scss | 20 +++- src/components/RightBar/index.tsx | 6 +- src/components/TopBar/Results/index.scss | 3 + src/components/TopBar/Results/index.tsx | 25 ++--- src/components/Transfer/index.scss | 60 +++++++----- src/components/Transfer/index.tsx | 16 ++-- 11 files changed, 188 insertions(+), 115 deletions(-) diff --git a/src/App.scss b/src/App.scss index 5204e1a..aa31b26 100644 --- a/src/App.scss +++ b/src/App.scss @@ -7,8 +7,9 @@ body { } .wraper{ display: flex; - &__calendar{ - width: 85%; + &__rightbar{ + width: 80%; } + } diff --git a/src/App.tsx b/src/App.tsx index 0582597..ad8b52b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -45,7 +45,6 @@ function App() { { - console.log("XD"); }} onGroupClick={(id, name) => {}} /> diff --git a/src/businesslogic/LecturesProvider.tsx b/src/businesslogic/LecturesProvider.tsx index f599533..c5625de 100644 --- a/src/businesslogic/LecturesProvider.tsx +++ b/src/businesslogic/LecturesProvider.tsx @@ -11,7 +11,7 @@ export const LecturesProvider : React.FC = (props) => { const [lectures, setLectures] = useState>([]); - const updateLectures = (lecture : Lecture) => {setLectures([...lectures, lecture]); console.log(`Lectures xd are: ${JSON.stringify(lectures)}\n`)} + const updateLectures = (lecture : Lecture) => { setLectures([...lectures, lecture])} return ( diff --git a/src/components/RightBar/LectureCard/index.scss b/src/components/RightBar/LectureCard/index.scss index 93d091e..8a15cc8 100644 --- a/src/components/RightBar/LectureCard/index.scss +++ b/src/components/RightBar/LectureCard/index.scss @@ -1,38 +1,59 @@ .class { - display: flex; - min-height: 50px; - background-color: rgb(100, 181, 246) !important; - align-items: center; - justify-content: center; - flex-direction: column; - margin-top: 10px; - padding-top:10px; - padding-bottom:10px; - border-radius: 10px; - cursor: pointer; - align-items: stretch; - &__group{ - padding-top: 1px; - padding-bottom: 1px; - &:hover{ - cursor: pointer; - transition: 1s; - background-color: #8BC8FB; - } - } - &__name{ - padding-top: 10px; - padding-bottom: 10px; - } - &__expandIcon{ - margin-top: 5px; - width: 20px; - transition: 0.2s; - } - &__expandIconRotate{ - margin-top: 5px; - width: 20px; - transition: 0.5s; - transform: scaleY(-1); + display: flex; + min-height: 50px; + background-color: rgb(100, 181, 246) !important; + align-items: center; + justify-content: center; + flex-direction: column; + margin-top: 10px; + padding-top: 10px; + padding-bottom: 10px; + border-radius: 10px; + cursor: pointer; + align-items: stretch; + &__group { + padding-top: 1px; + padding-bottom: 1px; + &:hover { + cursor: pointer; + transition: 1s; + background-color: #8bc8fb; } } + &__name { + padding-top: 10px; + padding-bottom: 10px; + } + &__expandIcon { + margin-top: 5px; + width: 20px; + transition: 0.2s; + } + &__expandIconRotate { + margin-top: 5px; + width: 20px; + transition: 0.5s; + transform: scaleY(-1); + } + .expanded { + max-height: 244px; + overflow-y: auto; + } + .expanded::-webkit-scrollbar-track { + border-radius: 10px; + border-radius: 10px; + background-color: #8bc8fb; + } + + .expanded::-webkit-scrollbar { + width: 12px; + border-radius: 10px; + background-color: #8bc8fb; + } + + .expanded::-webkit-scrollbar-thumb { + border-radius: 10px; + background-color: #d4b851; + border: 1px solid; + } +} diff --git a/src/components/RightBar/LectureCard/index.tsx b/src/components/RightBar/LectureCard/index.tsx index 382c3a1..59edc95 100644 --- a/src/components/RightBar/LectureCard/index.tsx +++ b/src/components/RightBar/LectureCard/index.tsx @@ -5,35 +5,51 @@ import ExpandIcon from "./expand.png"; import { Lecture } from "../../../lectures"; interface LectureCardProps { - onGroupMouseOver: (id: string, name: string) => void; - onGroupClick: (id: string, name: string) => void; - onCardClick: (e: React.MouseEvent) => void; - lecture: Lecture; - id: string; - isSelected: boolean; + onGroupMouseOver: (id: string, name: string) => void; + onGroupClick: (id: string, name: string) => void; + onCardClick: (e: React.MouseEvent) => void; + lecture: Lecture; + id: string; + isSelected: boolean; } -export default function LectureCard({ onGroupMouseOver, onGroupClick, onCardClick, lecture, id, isSelected }: LectureCardProps) { - return ( -
-
{lecture.name}
- - {lecture.groups.map((group, index) => ( -
onGroupMouseOver(group.id, lecture.name)} - onClick={() => onGroupClick(group.id, lecture.name)} - > -

- {group.id} {group.day} {group.time} {group.room}

{group.lecturer} -

{" "} -
- ))} -
-
- expand -
-
- ); +export default function LectureCard({ + onGroupMouseOver, + onGroupClick, + onCardClick, + lecture, + id, + isSelected, +}: LectureCardProps) { + return ( +
+
{lecture.name}
+ + {lecture.groups.map((group, index) => ( +
onGroupMouseOver(group.id, lecture.name)} + onClick={() => onGroupClick(group.id, lecture.name)} + > +

+ {group.time} {group.room}

{group.lecturer} +

{" "} +
+ ))} +
+
+ expand +
+
+ ); } diff --git a/src/components/RightBar/index.scss b/src/components/RightBar/index.scss index 75411bb..dc0c833 100644 --- a/src/components/RightBar/index.scss +++ b/src/components/RightBar/index.scss @@ -4,10 +4,28 @@ padding-right: 15px; text-align: center; font-family: Lato; + width: 300px; &__text { border-bottom: 1px solid; } height:85vh; overflow-y: scroll; + } + .right-bar::-webkit-scrollbar-track +{ + border-radius: 10px; + background-color: #F5F5F5; +} - } \ No newline at end of file +.right-bar::-webkit-scrollbar +{ + width: 12px; + background-color: #F5F5F5; +} + +.right-bar::-webkit-scrollbar-thumb +{ + border-radius: 10px; + background-color: #d4b851; + border: 1px solid; +} \ No newline at end of file diff --git a/src/components/RightBar/index.tsx b/src/components/RightBar/index.tsx index a3485e8..aa7ee93 100644 --- a/src/components/RightBar/index.tsx +++ b/src/components/RightBar/index.tsx @@ -2,8 +2,6 @@ import React, { useState, useContext } from "react"; import "./index.scss"; import { Lecture } from "../../lectures"; import LectureCard from "./LectureCard"; -import BusinessLogicContext from "../../businesslogic/BusinessLogicContext"; -import { BuisnessProvided } from "../../businesslogic/BusinessLogicProvider"; import { LecturesContext } from "../../businesslogic/LecturesProvider"; interface RightBarProps { @@ -25,9 +23,9 @@ export default function RightBar({ lectures, onGroupMouseOver, onGroupClick }: R return (
- + {/* {(context) =>

{JSON.stringify((context as BuisnessProvided).states.user?.ticket)}

} -
+
*/}
Hubert Wrzesiński

Semestr zimowy 2020/2021 diff --git a/src/components/TopBar/Results/index.scss b/src/components/TopBar/Results/index.scss index 4b250b9..9c93f91 100644 --- a/src/components/TopBar/Results/index.scss +++ b/src/components/TopBar/Results/index.scss @@ -2,8 +2,10 @@ position: relative; z-index: 10; padding: 5px; + padding-left: 20px; background-color: #e6c759; font-size: 18px; + font-family: Lato; } .lecture:hover{ background-color: #d4b851; @@ -19,3 +21,4 @@ .top-bar__input-field { width: 100%; } + diff --git a/src/components/TopBar/Results/index.tsx b/src/components/TopBar/Results/index.tsx index c480add..9440b32 100644 --- a/src/components/TopBar/Results/index.tsx +++ b/src/components/TopBar/Results/index.tsx @@ -5,8 +5,7 @@ import "./index.scss"; import ClickAwayListener from "@material-ui/core/ClickAwayListener"; import { LecturesContext } from "../../../businesslogic/LecturesProvider"; import { Lecture, Group } from "../../../lectures"; -import { GroupingPanel } from "@devexpress/dx-react-scheduler"; -import { group } from "console"; +import { EDEADLK } from "constants"; interface data { id: number; @@ -30,20 +29,29 @@ export const Results: React.FC = () => { setInput(event.target.value); //query should be updated on backend to not accept empty string if (event.target.value !== "") { - console.log(event.target.value); + console.log("Jeste w okej") search(event.target.value); } else { + console.log("Jeste w dupuie") search("xxxxxxxxxxxxxxx"); + } }; const search = (text: string) => { axios .get(`http://localhost:1287/getCourses?name=${text}`) - .then((response) => setData(response.data)); + .then((response) => { + const names = lecturesContext.lectures.map(lecture => lecture.name); + console.log(`Names: ${names}`) + const filteredData = response.data.filter((el : any) => !names.includes(el.name)); + console.log("D") + setData(filteredData) + }); }; const handleClick = () => { setOpen(true); + console.log("OPWENEE") }; const handleClickAway = () => { @@ -56,13 +64,10 @@ export const Results: React.FC = () => { const lecture = {name: "", groups: []} as Lecture; - console.log(id); axios .get(`http://localhost:1287/getClassesByCourseId?id=${id}`) .then((response) => { for(let data of response.data){ - console.log("XDD"); - console.log(data); let group = {} as Group; lecture.name = data.course.name; group.id = data.id; @@ -71,13 +76,10 @@ export const Results: React.FC = () => { group.lecturer = `${data.lecturer.title} ${data.lecturer.name} ${data.lecturer.surname}`; group.room = data.room.trim(); lecture.groups.push(group); - console.log("XDDD"); - console.log(lecture.groups); lecturesContext.updateLectures(lecture); } - setOpen(false); - }); + }).then(()=>{search(input)}); } return ( @@ -89,6 +91,7 @@ export const Results: React.FC = () => { className="top-bar__input-field" onChange={handleChange} onClick={handleClick} + value={input} /> {open ? (
diff --git a/src/components/Transfer/index.scss b/src/components/Transfer/index.scss index 41e710c..cef0e2b 100644 --- a/src/components/Transfer/index.scss +++ b/src/components/Transfer/index.scss @@ -3,51 +3,67 @@ justify-content: center; text-align: center; align-items: center; - } .transfer { display: flex; - outline:none; - width: 80%; + + flex-direction: row; + + outline: none; + min-width: 35%; height: 70%; padding-top: 40px; - background: rgba(255, 220, 97, 0.6); + background: #006b96; + box-shadow: 0px 0px 0px 4px #006b96; + border: 4px solid #ffc400; + margin: 0 auto; + border-top-left-radius: 5px; + border-bottom-right-radius: 5px; - border: 3px solid #000000; - border-radius: 15px; text-transform: uppercase; letter-spacing: 0.3ch; - &__left { - display: flex; - justify-content: space-around; + &__give { flex-grow: 1; + display: flex; + flex-direction: column; + align-items: center; } - &__right { - flex-grow: 4; + &__receive { + flex-grow: 1; } &__text { font-family: Lato; - font-size: 50px; + font-size: 30px; margin-bottom: 10px; } &__input { - width: 300px; - height: 45px; + width: 250px; + height: 25px; background: #ffc400; - outline:none; + outline: none; border: 1px solid; - border-radius: 22px ; + border-radius: 10px; padding: 10px; font-size: 24px; transition-duration: 0.3s; - } - input:focus { - -webkit-box-shadow: 0px 0px 18px 8px #ffae00; - -moz-box-shadow: 0px 0px 18px 8px #ffae00; - box-shadow: 0px 0px 18px 8px #ffae00; - + &__input:focus { + -webkit-box-shadow: 0px 0px 34px 1px #ffae00; + -moz-box-shadow: 0px 0px 34px 1px #ffae00; + box-shadow: 0px 0px 34px 1px #ffae00; + } + &__input2 { + width: 250px; + height: 25px; + padding: 10px; + font-size: 24px; + transition-duration: 0.3s; + } + input::placeholder{ + color: black; + font-weight: bold; + text-align: center; } } diff --git a/src/components/Transfer/index.tsx b/src/components/Transfer/index.tsx index 6f1e7d1..7f4ba6f 100644 --- a/src/components/Transfer/index.tsx +++ b/src/components/Transfer/index.tsx @@ -2,7 +2,7 @@ import React from "react"; import Modal from "@material-ui/core/Modal"; import "./index.scss"; import Fade from '@material-ui/core/Fade'; - +import Input from "@material-ui/core/Input"; interface TransferProps { handleClose: (e: React.MouseEvent) => void; isOpen: boolean; @@ -36,20 +36,18 @@ export default class Transfer extends React.Component< >
-
- {/* */}
Oddam
- -
+
+
Przyjmę
-
-
-
-
From f95c8d450d5bd9cab72a8338cf7426209a381fec Mon Sep 17 00:00:00 2001 From: wrzesinski-hubert Date: Mon, 20 Jul 2020 17:53:50 +0200 Subject: [PATCH 04/27] dropdown+scheduler --- src/App.scss | 5 +- src/App.tsx | 5 +- src/components/Calendar/appointments.ts | 30 ------- src/components/Calendar/index.tsx | 87 ------------------- .../{Calendar => Scheduler/Cell}/index.scss | 0 src/components/Scheduler/Cell/index.tsx | 23 +++++ src/components/Scheduler/Column/index.scss | 0 src/components/Scheduler/Column/index.tsx | 33 +++++++ .../Scheduler/SchedulerEvent/index.scss | 0 .../Scheduler/SchedulerEvent/index.tsx | 38 ++++++++ src/components/Scheduler/index.scss | 30 +++++++ src/components/Scheduler/index.tsx | 76 ++++++++++++++++ 12 files changed, 204 insertions(+), 123 deletions(-) delete mode 100644 src/components/Calendar/appointments.ts delete mode 100644 src/components/Calendar/index.tsx rename src/components/{Calendar => Scheduler/Cell}/index.scss (100%) create mode 100644 src/components/Scheduler/Cell/index.tsx create mode 100644 src/components/Scheduler/Column/index.scss create mode 100644 src/components/Scheduler/Column/index.tsx create mode 100644 src/components/Scheduler/SchedulerEvent/index.scss create mode 100644 src/components/Scheduler/SchedulerEvent/index.tsx create mode 100644 src/components/Scheduler/index.scss create mode 100644 src/components/Scheduler/index.tsx diff --git a/src/App.scss b/src/App.scss index aa31b26..7113279 100644 --- a/src/App.scss +++ b/src/App.scss @@ -7,9 +7,8 @@ body { } .wraper{ display: flex; - &__rightbar{ - width: 80%; + &__calendar{ + flex-grow: 3; } - } diff --git a/src/App.tsx b/src/App.tsx index ad8b52b..8a8318e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -2,8 +2,7 @@ import React, { useState } from "react"; import TopBar from "./components/TopBar/"; import Transfer from "./components/Transfer/"; import "./App.scss"; -import Schedule from "./components/Calendar/"; -import { appointments } from "./components/Calendar/appointments"; +import {Scheduler} from "./components/Scheduler"; import RightBar from "./components/RightBar"; import { lectures } from "./lectures"; @@ -39,7 +38,7 @@ function App() { />
- +
; -} - -interface CalendarState { - currentDate: Date; -} - -const formatDayScaleDate = (date: moment.MomentInput, nextOptions: Intl.DateTimeFormatOptions): string => { - const momentDate = moment(date).locale("pl"); - return momentDate.format(nextOptions.weekday ? "dddd" : " ").toUpperCase(); -}; - -const useStyles = makeStyles(() => - createStyles({ - dayScaleCell: { - paddingTop: 10, - paddingBottom: 10, - }, - timeTableLayout: { - border: "1px solid rgba(224, 224, 224, 1);", - borderCollapse: "separate", - }, - appointmentLayer: { - borderRadius: 15, - marginLeft: 5, - textAlign: "center", - }, - }) -); - -const DayScaleCell = ({ formatDate, ...restProps }: WeekView.DayScaleCellProps) => { - const classes = useStyles(); - return ( - - ); -}; - -const TimeTableLayout = ({ ...restProps }: WeekView.TimeTableLayoutProps) => { - const classes = useStyles(); - return ; -}; - -const Appointment = ({ ...restProps }: Appointments.AppointmentProps) => { - const classes = useStyles(); - return ; -}; - -export default class Calendar extends React.PureComponent { - constructor(props: CalendarProps) { - super(props); - - this.state = { - currentDate: new Date("2020-06-01"), - }; - } - - render() { - const { data } = this.props; - const { currentDate } = this.state; - - return ( - - - - - - - ); - } -} diff --git a/src/components/Calendar/index.scss b/src/components/Scheduler/Cell/index.scss similarity index 100% rename from src/components/Calendar/index.scss rename to src/components/Scheduler/Cell/index.scss diff --git a/src/components/Scheduler/Cell/index.tsx b/src/components/Scheduler/Cell/index.tsx new file mode 100644 index 0000000..09bc0bc --- /dev/null +++ b/src/components/Scheduler/Cell/index.tsx @@ -0,0 +1,23 @@ +import React from "react"; + +interface CellProps { + colIndex: number; + index: number; + term?: string; + handleClick?: (e: React.MouseEvent) => void; + isEventable?: boolean; +} + +export const Cell = ({ + colIndex, + index, + term, + handleClick, + isEventable, +}: CellProps) => { + return ( +
+ {isEventable || term} +
+ ); +}; diff --git a/src/components/Scheduler/Column/index.scss b/src/components/Scheduler/Column/index.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/components/Scheduler/Column/index.tsx b/src/components/Scheduler/Column/index.tsx new file mode 100644 index 0000000..e200b65 --- /dev/null +++ b/src/components/Scheduler/Column/index.tsx @@ -0,0 +1,33 @@ +import React from "react"; +import { Cell } from "../Cell"; + +interface ColumnProps { + hours: Array; + handleClick?: (e: React.MouseEvent) => void; + children?: React.ReactNode; + colIndex?: number; + isEventable?: boolean; +} + +export const Column = ({ + hours, + colIndex, + isEventable, + children, + ...rest +}: ColumnProps) => { + return ( +
+ {hours.map((hour, index) => ( + + ))} + {children} +
+ ); +}; diff --git a/src/components/Scheduler/SchedulerEvent/index.scss b/src/components/Scheduler/SchedulerEvent/index.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/components/Scheduler/SchedulerEvent/index.tsx b/src/components/Scheduler/SchedulerEvent/index.tsx new file mode 100644 index 0000000..57b03ab --- /dev/null +++ b/src/components/Scheduler/SchedulerEvent/index.tsx @@ -0,0 +1,38 @@ +import React from "react"; + +interface SchedulerEventProps { + events: Array; + colIndex: number; +} + +export const SchedulerEvent = ({ events, colIndex }: SchedulerEventProps) => { + const handleEventClick = (e: React.MouseEvent) => { + const eventDiv = e.target as HTMLDivElement; + eventDiv.style.backgroundColor = "#1547C5"; + }; + + return ( + <> + {events.map((event, index) => ( +
+ :) +
+ ))} + + ); +}; diff --git a/src/components/Scheduler/index.scss b/src/components/Scheduler/index.scss new file mode 100644 index 0000000..ef5e92d --- /dev/null +++ b/src/components/Scheduler/index.scss @@ -0,0 +1,30 @@ +.scheduler { + margin-top: 20px; + border-collapse: collapse; + + .thead { + display: flex; + width: 100%; + } + + .tbody { + display: flex; + &__column { + display: flex; + flex-direction: column; + position: relative; + flex: 1; + } + } + + .td, + .th { + border: 1px solid #ddd; + padding: 10px; + text-align: center; + flex: 1; + } + .td:hover { + background-color: #ddd; + } +} diff --git a/src/components/Scheduler/index.tsx b/src/components/Scheduler/index.tsx new file mode 100644 index 0000000..68d261c --- /dev/null +++ b/src/components/Scheduler/index.tsx @@ -0,0 +1,76 @@ +import React, { useEffect } from "react"; +import { useState } from "react"; +import "./index.scss"; +import { SchedulerEvent } from "./SchedulerEvent"; +import { Column } from "./Column"; +const days = ["", "poniedziałek", "wtorek", "środa", "czwartek", "piątek"]; + +const hours = [ + "8:00", + "9:00", + "10:00", + "11:00", + "12:00", + "13:00", + "14:00", + "15:00", + "16:00", + "17:00", + "18:00", + "19:00", + "20:00", + "21:00", +]; + +let events: Array = []; +for (let i = 0; i < hours.length / 2; i++) { + events.push(i); +} + +let terms = ["Zawsze", "jest pora", "na kurde", "lody", "koral"]; + +export const Scheduler = () => { + const [currentEventsIds, setCurrentEventsIds] = useState>([]); + useEffect(() => { + const displayEvents = () => { + currentEventsIds.map((eventId: string) => { + const event = document.getElementById(eventId); + event!.style.display = "block"; + }); + }; + displayEvents(); + }, [currentEventsIds]); + + const handleClick = (e: React.MouseEvent) => { + const cellId = e.currentTarget.id; + const column = cellId.slice(0, 1); + const row = cellId.slice(1); + const eventId = `eventCol${column}eventRow${Math.floor(parseInt(row) / 2)}`; + + setCurrentEventsIds((currentEventsIds) => [...currentEventsIds, eventId]); + }; + + return ( + <> +
+
+ {days.map((day, index) => ( +
+ {day} +
+ ))} +
+
+ + {terms.map((_, colIndex) => ( + + + + ))} +
+ + +
+ + ); +}; From 5c53bc89368269ed8d7334eb04c0ed7d885cea9a Mon Sep 17 00:00:00 2001 From: wrzesinski-hubert Date: Tue, 21 Jul 2020 21:00:34 +0200 Subject: [PATCH 05/27] lecturesData --- src/components/TopBar/Results/index.tsx | 115 ++++++++++++------------ 1 file changed, 59 insertions(+), 56 deletions(-) diff --git a/src/components/TopBar/Results/index.tsx b/src/components/TopBar/Results/index.tsx index 9440b32..fa990cf 100644 --- a/src/components/TopBar/Results/index.tsx +++ b/src/components/TopBar/Results/index.tsx @@ -1,86 +1,85 @@ -import React, { useState, useContext } from "react"; +import React, { useState, useContext, useEffect } from "react"; import axios from "axios"; import { Input } from "@material-ui/core"; import "./index.scss"; import ClickAwayListener from "@material-ui/core/ClickAwayListener"; import { LecturesContext } from "../../../businesslogic/LecturesProvider"; -import { Lecture, Group } from "../../../lectures"; -import { EDEADLK } from "constants"; +import { Lecture } from "../../../lectures"; +import Autocomplete from '@material-ui/lab/Autocomplete'; -interface data { - id: number; +interface LectureData { name: string; - sym: string; + id: number; } - - - - export const Results: React.FC = () => { const [input, setInput] = useState(""); - const [data, setData] = useState>([]); + const [lecturesData, setLecturesData] = useState>([]); const [open, setOpen] = React.useState(false); const lecturesContext = useContext(LecturesContext); + //fetch lectures ids and lectures names + // useEffect(() => { + // const fetchData = async () => { + // const {lecturesData } = await axios.get( + // `http://localhost:1287/getCourses?name=""` + // ); + // setLecturesData(lecturesData); + // }; + // fetchData(); + // }, []); + + useEffect(() => { + const fetchData = async () => { + const results = await axios.get(`http://localhost:1287/getCourses?name=`); + const lecturesData = results.data.map( + (result: { id: number; name: string }) => ({ + id: result.id, + name: result.name, + }) + ); + + setLecturesData(lecturesData); + }; + fetchData(); + }, []); + + useEffect(() => { + const filterLectures = (value: string) => { + const zmienna= lecturesData.filter((lecture) => lecture.name.includes(value)); + console.log(zmienna); + return zmienna + }; + filterLectures(input); + }, [input]); + + const getLecturesById = async (id: string): Promise => { + const { data } = await axios.get( + `http://localhost:1287/getClassesByCourseId?id=${id}` + ); + return data; + }; const handleChange = (event: React.ChangeEvent) => { setInput(event.target.value); - //query should be updated on backend to not accept empty string - if (event.target.value !== "") { - console.log("Jeste w okej") - search(event.target.value); - } else { - console.log("Jeste w dupuie") - search("xxxxxxxxxxxxxxx"); - - } - }; - const search = (text: string) => { - axios - .get(`http://localhost:1287/getCourses?name=${text}`) - .then((response) => { - const names = lecturesContext.lectures.map(lecture => lecture.name); - console.log(`Names: ${names}`) - const filteredData = response.data.filter((el : any) => !names.includes(el.name)); - console.log("D") - setData(filteredData) - }); }; const handleClick = () => { setOpen(true); - console.log("OPWENEE") }; const handleClickAway = () => { setOpen(false); }; - const onLectureClick = (e: React.MouseEvent) => { - const target = e.currentTarget as HTMLElement; + const onLectureClick = async (e: React.MouseEvent) => { + const target = e.currentTarget as HTMLElement; const id = target.id; - - const lecture = {name: "", groups: []} as Lecture; - - axios - .get(`http://localhost:1287/getClassesByCourseId?id=${id}`) - .then((response) => { - for(let data of response.data){ - let group = {} as Group; - lecture.name = data.course.name; - group.id = data.id; - group.day = data.day; - group.time = data.time; - group.lecturer = `${data.lecturer.title} ${data.lecturer.name} ${data.lecturer.surname}`; - group.room = data.room.trim(); - lecture.groups.push(group); - lecturesContext.updateLectures(lecture); - } + const result = await getLecturesById(id); + lecturesContext.updateLectures(result); setOpen(false); - }).then(()=>{search(input)}); - } + }; return ( @@ -95,8 +94,13 @@ export const Results: React.FC = () => { /> {open ? (
- {data.map((lecture, index) => ( -
+ {lecturesData.map((lecture, index) => ( +

{lecture.name}

))} @@ -106,4 +110,3 @@ export const Results: React.FC = () => { ); }; - From f2f87682ad4fd3bb5c68f05f3371f625107a2bd3 Mon Sep 17 00:00:00 2001 From: wrzesinski-hubert Date: Tue, 21 Jul 2020 21:03:19 +0200 Subject: [PATCH 06/27] toLowerCase --- src/components/TopBar/Results/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/TopBar/Results/index.tsx b/src/components/TopBar/Results/index.tsx index fa990cf..232c7de 100644 --- a/src/components/TopBar/Results/index.tsx +++ b/src/components/TopBar/Results/index.tsx @@ -47,7 +47,7 @@ export const Results: React.FC = () => { useEffect(() => { const filterLectures = (value: string) => { - const zmienna= lecturesData.filter((lecture) => lecture.name.includes(value)); + const zmienna= lecturesData.filter((lecture) => lecture.name.toLowerCase().includes(value.toLowerCase())); console.log(zmienna); return zmienna }; From c194bf1ee2e7dd610d782dcaefb622cb86370fdf Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 24 Jul 2020 17:00:06 +0200 Subject: [PATCH 07/27] Refactor --- src/App.tsx | 2 +- src/businesslogic/BusinessLogicProvider.tsx | 2 +- src/businesslogic/LecturesProvider.tsx | 2 +- src/businesslogic/mockData/lectures.ts | 42 +++++++ src/businesslogic/types/group.ts | 7 ++ src/businesslogic/types/lecture.ts | 6 + src/businesslogic/types/lectureInit.ts | 4 + src/businesslogic/{models => types}/user.ts | 2 +- src/components/RightBar/LectureCard/index.tsx | 2 +- src/components/RightBar/index.tsx | 2 +- src/components/TopBar/Results/index.tsx | 111 ++++++++---------- src/lectures.ts | 53 --------- 12 files changed, 117 insertions(+), 118 deletions(-) create mode 100644 src/businesslogic/mockData/lectures.ts create mode 100644 src/businesslogic/types/group.ts create mode 100644 src/businesslogic/types/lecture.ts create mode 100644 src/businesslogic/types/lectureInit.ts rename src/businesslogic/{models => types}/user.ts (72%) delete mode 100644 src/lectures.ts diff --git a/src/App.tsx b/src/App.tsx index 8a8318e..00bc599 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -4,7 +4,7 @@ import Transfer from "./components/Transfer/"; import "./App.scss"; import {Scheduler} from "./components/Scheduler"; import RightBar from "./components/RightBar"; -import { lectures } from "./lectures"; +import { lectures } from "./businesslogic/mockData/lectures"; import BusinessLogicContext from "./businesslogic/BusinessLogicContext"; import { BuisnessProvided } from "./businesslogic/BusinessLogicProvider"; diff --git a/src/businesslogic/BusinessLogicProvider.tsx b/src/businesslogic/BusinessLogicProvider.tsx index 4cdb84a..9e90320 100644 --- a/src/businesslogic/BusinessLogicProvider.tsx +++ b/src/businesslogic/BusinessLogicProvider.tsx @@ -1,6 +1,6 @@ import BusinessLogicContext from "./BusinessLogicContext"; import React, { Component } from "react"; -import { User } from "./models/user"; +import { User } from "./types/user"; export interface BuisnessProvided { states: BusinessState; diff --git a/src/businesslogic/LecturesProvider.tsx b/src/businesslogic/LecturesProvider.tsx index c5625de..3b4309a 100644 --- a/src/businesslogic/LecturesProvider.tsx +++ b/src/businesslogic/LecturesProvider.tsx @@ -1,5 +1,5 @@ import React, { useState } from "react"; -import { Lecture } from "../lectures"; +import { Lecture } from "./mockData/lectures"; interface ILectureContext { lectures: Array diff --git a/src/businesslogic/mockData/lectures.ts b/src/businesslogic/mockData/lectures.ts new file mode 100644 index 0000000..1b6b73d --- /dev/null +++ b/src/businesslogic/mockData/lectures.ts @@ -0,0 +1,42 @@ +import { Lecture } from "../types/lecture"; + +export const lectures: Array = [ + { + name: "E-gospodarka - narzędzia i bezpieczeństwo", + groups: [ + { + id: "1CB", + day: "Pn", + time: "10:00", + lecturer: "dr inż. Michał Ren", + room: "A2-01", + }, + { + id: "1XD", + day: "Wt", + time: "12:00", + lecturer: "dr inż. Michał Ren", + room: "A3-01", + }, + ], + }, + { + name: "Statystyka", + groups: [ + { + id: "2CB", + day: "Pn", + time: "10:00", + lecturer: "dr inż. Michał Ren", + room: "A2-01", + }, + { + id: "2XD", + day: "Wt", + time: "12:00", + lecturer: "dr inż. Michał Ren", + room: "A3-01", + }, + ], + }, +]; diff --git a/src/businesslogic/types/group.ts b/src/businesslogic/types/group.ts new file mode 100644 index 0000000..af6e89e --- /dev/null +++ b/src/businesslogic/types/group.ts @@ -0,0 +1,7 @@ +export interface Group { + id: string; + day: string; + time: string; + lecturer: string; + room: string; +} \ No newline at end of file diff --git a/src/businesslogic/types/lecture.ts b/src/businesslogic/types/lecture.ts new file mode 100644 index 0000000..ef86640 --- /dev/null +++ b/src/businesslogic/types/lecture.ts @@ -0,0 +1,6 @@ +import { Group } from "./group"; + +export interface Lecture { + name: string; + groups: Array; +} diff --git a/src/businesslogic/types/lectureInit.ts b/src/businesslogic/types/lectureInit.ts new file mode 100644 index 0000000..8d2869d --- /dev/null +++ b/src/businesslogic/types/lectureInit.ts @@ -0,0 +1,4 @@ +export interface LectureInit { + name: string; + id: number; +} diff --git a/src/businesslogic/models/user.ts b/src/businesslogic/types/user.ts similarity index 72% rename from src/businesslogic/models/user.ts rename to src/businesslogic/types/user.ts index dee0426..3f125a3 100644 --- a/src/businesslogic/models/user.ts +++ b/src/businesslogic/types/user.ts @@ -1,4 +1,4 @@ -export type User = { +export interface User { name?: string; surname?: string; ticket: string | null; diff --git a/src/components/RightBar/LectureCard/index.tsx b/src/components/RightBar/LectureCard/index.tsx index 59edc95..a221a15 100644 --- a/src/components/RightBar/LectureCard/index.tsx +++ b/src/components/RightBar/LectureCard/index.tsx @@ -2,7 +2,7 @@ import React from "react"; import "./index.scss"; import Collapse from "@material-ui/core/Collapse"; import ExpandIcon from "./expand.png"; -import { Lecture } from "../../../lectures"; +import { Lecture } from "../../../businesslogic/mockData/lectures"; interface LectureCardProps { onGroupMouseOver: (id: string, name: string) => void; diff --git a/src/components/RightBar/index.tsx b/src/components/RightBar/index.tsx index aa7ee93..29a9fee 100644 --- a/src/components/RightBar/index.tsx +++ b/src/components/RightBar/index.tsx @@ -1,6 +1,6 @@ import React, { useState, useContext } from "react"; import "./index.scss"; -import { Lecture } from "../../lectures"; +import { Lecture } from "../../businesslogic/mockData/lectures"; import LectureCard from "./LectureCard"; import { LecturesContext } from "../../businesslogic/LecturesProvider"; diff --git a/src/components/TopBar/Results/index.tsx b/src/components/TopBar/Results/index.tsx index 9440b32..b123790 100644 --- a/src/components/TopBar/Results/index.tsx +++ b/src/components/TopBar/Results/index.tsx @@ -1,86 +1,75 @@ -import React, { useState, useContext } from "react"; +import React, { useState, useContext, useEffect } from "react"; import axios from "axios"; import { Input } from "@material-ui/core"; import "./index.scss"; import ClickAwayListener from "@material-ui/core/ClickAwayListener"; import { LecturesContext } from "../../../businesslogic/LecturesProvider"; -import { Lecture, Group } from "../../../lectures"; -import { EDEADLK } from "constants"; - -interface data { - id: number; - name: string; - sym: string; -} - - - +import {LectureInit} from "../../../businesslogic/types/lectureInit"; export const Results: React.FC = () => { const [input, setInput] = useState(""); - const [data, setData] = useState>([]); + const [lecturesData, setLecturesData] = useState>([]); const [open, setOpen] = React.useState(false); const lecturesContext = useContext(LecturesContext); + //fetch lectures ids and lectures names + // useEffect(() => { + // const fetchData = async () => { + // const {lecturesData } = await axios.get( + // `http://localhost:1287/getCourses?name=""` + // ); + // setLecturesData(lecturesData); + // }; + // fetchData(); + // }, []); + + useEffect(() => { + const fetchData = async () => { + const { data } = await axios.get( + `http://localhost:1287/getCourses?name=""` + ); + const lecturesData = data.map((data: { name: any; id: any; })=> {name: data.name, id: data.id}) + + setLecturesData(lecturesData); + }; + fetchData(); + }, []); + + useEffect(() => { + const filterLectures = (value: string) => { + return lecturesData.filter((lecture) => lecture.name.includes(value)); + }; + filterLectures(input); + }, [input]); + + const getLecturesById = async (id: string): Promise => { + const { data } = await axios.get( + `http://localhost:1287/getClassesByCourseId?id=${id}` + ); + return data; + }; const handleChange = (event: React.ChangeEvent) => { setInput(event.target.value); - //query should be updated on backend to not accept empty string - if (event.target.value !== "") { - console.log("Jeste w okej") - search(event.target.value); - } else { - console.log("Jeste w dupuie") - search("xxxxxxxxxxxxxxx"); - - } - }; - const search = (text: string) => { - axios - .get(`http://localhost:1287/getCourses?name=${text}`) - .then((response) => { - const names = lecturesContext.lectures.map(lecture => lecture.name); - console.log(`Names: ${names}`) - const filteredData = response.data.filter((el : any) => !names.includes(el.name)); - console.log("D") - setData(filteredData) - }); - }; + }; const handleClick = () => { setOpen(true); - console.log("OPWENEE") }; const handleClickAway = () => { setOpen(false); }; - const onLectureClick = (e: React.MouseEvent) => { - const target = e.currentTarget as HTMLElement; + const onLectureClick = async (e: React.MouseEvent) => { + const target = e.currentTarget as HTMLElement; const id = target.id; - - const lecture = {name: "", groups: []} as Lecture; - - axios - .get(`http://localhost:1287/getClassesByCourseId?id=${id}`) - .then((response) => { - for(let data of response.data){ - let group = {} as Group; - lecture.name = data.course.name; - group.id = data.id; - group.day = data.day; - group.time = data.time; - group.lecturer = `${data.lecturer.title} ${data.lecturer.name} ${data.lecturer.surname}`; - group.room = data.room.trim(); - lecture.groups.push(group); - lecturesContext.updateLectures(lecture); - } + const result = await getLecturesById(id); + lecturesContext.updateLectures(result); setOpen(false); - }).then(()=>{search(input)}); - } + }; return ( @@ -95,8 +84,13 @@ export const Results: React.FC = () => { /> {open ? (
- {data.map((lecture, index) => ( -
+ {lecturesData.map((lecture, index) => ( +

{lecture.name}

))} @@ -106,4 +100,3 @@ export const Results: React.FC = () => { ); }; - diff --git a/src/lectures.ts b/src/lectures.ts deleted file mode 100644 index a1e714d..0000000 --- a/src/lectures.ts +++ /dev/null @@ -1,53 +0,0 @@ -export interface Lecture { - name: string; - groups: Array; -} - -export interface Group { - id: string; - day: string; - time: string; - lecturer: string; - room: string; -} - -export const lectures: Array = [ - { - name: "E-gospodarka - narzędzia i bezpieczeństwo", - groups: [ - { - id: "1CB", - day: "Pn", - time: "10:00", - lecturer: "dr inż. Michał Ren", - room: "A2-01", - }, - { - id: "1XD", - day: "Wt", - time: "12:00", - lecturer: "dr inż. Michał Ren", - room: "A3-01", - }, - ], - }, - { - name: "Statystyka", - groups: [ - { - id: "2CB", - day: "Pn", - time: "10:00", - lecturer: "dr inż. Michał Ren", - room: "A2-01", - }, - { - id: "2XD", - day: "Wt", - time: "12:00", - lecturer: "dr inż. Michał Ren", - room: "A3-01", - }, - ], - }, -]; From bef314120a2ef482fde5ca616aa63480a967b900 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 24 Jul 2020 18:59:45 +0200 Subject: [PATCH 08/27] Dej te endpointy --- src/businesslogic/LecturesProvider.tsx | 38 +++++----- src/businesslogic/types/lecture.ts | 1 + src/components/RightBar/LectureCard/index.tsx | 2 +- src/components/RightBar/index.tsx | 69 ++++++++++--------- src/components/TopBar/Results/index.tsx | 46 ++++++++++--- 5 files changed, 97 insertions(+), 59 deletions(-) diff --git a/src/businesslogic/LecturesProvider.tsx b/src/businesslogic/LecturesProvider.tsx index 3b4309a..09777f2 100644 --- a/src/businesslogic/LecturesProvider.tsx +++ b/src/businesslogic/LecturesProvider.tsx @@ -1,24 +1,28 @@ import React, { useState } from "react"; -import { Lecture } from "./mockData/lectures"; +import { lectures } from "./mockData/lectures"; +import { Lecture } from "./types/lecture"; interface ILectureContext { - lectures: Array - updateLectures: (lectures: Lecture) => void + lectures: Array; + updateLectures: (lectures: Lecture) => void; } -export const LecturesContext = React.createContext({lectures: Array(), updateLectures: (lectures: Lecture) => {}}); +export const LecturesContext = React.createContext({ + lectures: Array(), + updateLectures: (lectures: Lecture) => {}, +}); -export const LecturesProvider : React.FC = (props) => { +export const LecturesProvider: React.FC = (props) => { + const [lectures, setLectures] = useState>([]); - const [lectures, setLectures] = useState>([]); - - const updateLectures = (lecture : Lecture) => { setLectures([...lectures, lecture])} - - return ( - - {props.children} - - ); - - -} + const updateLectures = (lecture: Lecture) => { + setLectures([...lectures, lecture]); + }; + return ( + + {props.children} + + ); +}; diff --git a/src/businesslogic/types/lecture.ts b/src/businesslogic/types/lecture.ts index ef86640..604f44c 100644 --- a/src/businesslogic/types/lecture.ts +++ b/src/businesslogic/types/lecture.ts @@ -1,6 +1,7 @@ import { Group } from "./group"; export interface Lecture { + id?: number; name: string; groups: Array; } diff --git a/src/components/RightBar/LectureCard/index.tsx b/src/components/RightBar/LectureCard/index.tsx index a221a15..d18335f 100644 --- a/src/components/RightBar/LectureCard/index.tsx +++ b/src/components/RightBar/LectureCard/index.tsx @@ -2,7 +2,7 @@ import React from "react"; import "./index.scss"; import Collapse from "@material-ui/core/Collapse"; import ExpandIcon from "./expand.png"; -import { Lecture } from "../../../businesslogic/mockData/lectures"; +import { Lecture } from "../../../businesslogic/types/lecture"; interface LectureCardProps { onGroupMouseOver: (id: string, name: string) => void; diff --git a/src/components/RightBar/index.tsx b/src/components/RightBar/index.tsx index 29a9fee..07e627d 100644 --- a/src/components/RightBar/index.tsx +++ b/src/components/RightBar/index.tsx @@ -1,46 +1,51 @@ import React, { useState, useContext } from "react"; import "./index.scss"; -import { Lecture } from "../../businesslogic/mockData/lectures"; +import { Lecture } from "../../businesslogic/types/lecture"; import LectureCard from "./LectureCard"; import { LecturesContext } from "../../businesslogic/LecturesProvider"; interface RightBarProps { - onGroupMouseOver: (id: string, name: string) => void; - onGroupClick: (id: string, name: string) => void; - lectures: Array; + onGroupMouseOver: (id: string, name: string) => void; + onGroupClick: (id: string, name: string) => void; + lectures: Array; } -export default function RightBar({ lectures, onGroupMouseOver, onGroupClick }: RightBarProps) { - const [selectedCardId, setSelectedCardId] = useState(null); +export default function RightBar({ + lectures, + onGroupMouseOver, + onGroupClick, +}: RightBarProps) { + const [selectedCardId, setSelectedCardId] = useState(null); - const lecturesContext = useContext(LecturesContext); + const lecturesContext = useContext(LecturesContext); + const onCardClick = (e: React.MouseEvent) => { + const target = e.currentTarget as HTMLElement; + selectedCardId === target.id + ? setSelectedCardId(null) + : setSelectedCardId(target.id); + }; - const onCardClick = (e: React.MouseEvent) => { - const target = e.currentTarget as HTMLElement; - selectedCardId === target.id ? setSelectedCardId(null) : setSelectedCardId(target.id); - }; - - return ( -
- {/* + return ( +
+ {/* {(context) =>

{JSON.stringify((context as BuisnessProvided).states.user?.ticket)}

}
*/} -
- Hubert Wrzesiński

- Semestr zimowy 2020/2021 -
- {lecturesContext.lectures.map((lecture, index) => ( - - ))} -
- ); +
+ Hubert Wrzesiński

+ Semestr zimowy 2020/2021 +
+ {lecturesContext.lectures.map((lecture, index) => ( + + ))} +
+ ); } diff --git a/src/components/TopBar/Results/index.tsx b/src/components/TopBar/Results/index.tsx index c5a99a7..06960ed 100644 --- a/src/components/TopBar/Results/index.tsx +++ b/src/components/TopBar/Results/index.tsx @@ -1,15 +1,23 @@ import React, { useState, useContext, useEffect } from "react"; import axios from "axios"; -import { Input } from "@material-ui/core"; +import { Input, Grow } from "@material-ui/core"; import "./index.scss"; import ClickAwayListener from "@material-ui/core/ClickAwayListener"; import { LecturesContext } from "../../../businesslogic/LecturesProvider"; import { Lecture } from "../../../businesslogic/types/lecture"; -import { LectureInit } from "../../../businesslogic/types/lectureInit"; +import { Group } from "../../../businesslogic/types/group"; + +interface LectureData { + name: string; + id: number; +} export const Results: React.FC = () => { const [input, setInput] = useState(""); - const [lecturesData, setLecturesData] = useState>([]); + const [lecturesData, setLecturesData] = useState>([]); + const [filteredLecturesData, setFilteredLecturesData] = useState< + Array + >([]); const [open, setOpen] = React.useState(false); const lecturesContext = useContext(LecturesContext); @@ -42,16 +50,15 @@ export const Results: React.FC = () => { useEffect(() => { const filterLectures = (value: string) => { - const zmienna = lecturesData.filter((lecture) => + const filteredLectures = lecturesData.filter((lecture) => lecture.name.toLowerCase().includes(value.toLowerCase()) ); - console.log(zmienna); - return zmienna; + setFilteredLecturesData(filteredLectures); }; filterLectures(input); }, [input]); - const getLecturesById = async (id: string): Promise => { + const getLecturesById = async (id: string) => { const { data } = await axios.get( `http://localhost:1287/getClassesByCourseId?id=${id}` ); @@ -74,7 +81,28 @@ export const Results: React.FC = () => { const target = e.currentTarget as HTMLElement; const id = target.id; const result = await getLecturesById(id); - lecturesContext.updateLectures(result); + let groups: Array = []; + let lecture = { groups: groups } as Lecture; + lecture.id = result[0].course.id; + lecture.name = result[0].course.name; + for (let i = 0; i < result.length; i++) { + let group = {} as Group; + group.id = result[i].id; + group.day = result[i].day; + group.time = result[i].time; + group.lecturer = + result[i].lecturer.title + + " " + + result[i].lecturer.name + + " " + + result[i].lecturer.surname; + group.room = result[i].room; + lecture.groups.push(group); + } + console.log(result); + console.log(result[0].course.name); + + lecturesContext.updateLectures(lecture); setOpen(false); }; @@ -91,7 +119,7 @@ export const Results: React.FC = () => { /> {open ? (
- {lecturesData.map((lecture, index) => ( + {filteredLecturesData.map((lecture, index) => (
Date: Thu, 30 Jul 2020 18:06:27 +0200 Subject: [PATCH 09/27] Groups are added to state --- src/App.tsx | 1 - src/businesslogic/LecturesProvider.tsx | 18 +++++++++++---- src/components/RightBar/LectureCard/index.tsx | 18 +++++++++++---- src/components/RightBar/index.tsx | 6 ----- .../Scheduler/SchedulerEvent/index.tsx | 7 +++--- src/components/Scheduler/index.tsx | 23 +++++++++++++------ src/components/TopBar/Results/index.tsx | 12 ++++++---- 7 files changed, 53 insertions(+), 32 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 00bc599..11a0525 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -45,7 +45,6 @@ function App() { lectures={lectures} onGroupMouseOver={(id, name) => { }} - onGroupClick={(id, name) => {}} />
diff --git a/src/businesslogic/LecturesProvider.tsx b/src/businesslogic/LecturesProvider.tsx index 09777f2..623f446 100644 --- a/src/businesslogic/LecturesProvider.tsx +++ b/src/businesslogic/LecturesProvider.tsx @@ -1,26 +1,34 @@ -import React, { useState } from "react"; +import React, { useState, useEffect } from "react"; import { lectures } from "./mockData/lectures"; import { Lecture } from "./types/lecture"; - +import { Group } from "./types/group"; interface ILectureContext { lectures: Array; updateLectures: (lectures: Lecture) => void; } export const LecturesContext = React.createContext({ lectures: Array(), - updateLectures: (lectures: Lecture) => {}, + choosenGroups: Array(), + updateLectures: (lecture: Lecture) => {}, + updateGroups: (group : Group) => {} }); export const LecturesProvider: React.FC = (props) => { const [lectures, setLectures] = useState>([]); - + const [choosenGroups, setChoosenGroups] = useState>([]); const updateLectures = (lecture: Lecture) => { setLectures([...lectures, lecture]); }; + const updateGroups = (group : Group) => { + setChoosenGroups([...choosenGroups, group]); + }; + + + useEffect(()=>{console.log(`Groups have changed: ${JSON.stringify(choosenGroups)}`)},[choosenGroups]); return ( {props.children} diff --git a/src/components/RightBar/LectureCard/index.tsx b/src/components/RightBar/LectureCard/index.tsx index d18335f..071cd41 100644 --- a/src/components/RightBar/LectureCard/index.tsx +++ b/src/components/RightBar/LectureCard/index.tsx @@ -1,12 +1,13 @@ -import React from "react"; +import React, {useContext} from "react"; import "./index.scss"; import Collapse from "@material-ui/core/Collapse"; import ExpandIcon from "./expand.png"; import { Lecture } from "../../../businesslogic/types/lecture"; +import { Group } from "../../../businesslogic/types/group"; +import { LecturesContext } from "../../../businesslogic/LecturesProvider"; interface LectureCardProps { onGroupMouseOver: (id: string, name: string) => void; - onGroupClick: (id: string, name: string) => void; onCardClick: (e: React.MouseEvent) => void; lecture: Lecture; id: string; @@ -15,12 +16,21 @@ interface LectureCardProps { export default function LectureCard({ onGroupMouseOver, - onGroupClick, onCardClick, lecture, id, isSelected, }: LectureCardProps) { + + const {updateGroups} = useContext(LecturesContext); + + + function onGroupClick(group : Group){ + console.log(`group is: ${JSON.stringify(group)}`) + updateGroups(group); + } + + return (
{lecture.name}
@@ -35,7 +45,7 @@ export default function LectureCard({ className="class__group" key={index} onMouseOver={() => onGroupMouseOver(group.id, lecture.name)} - onClick={() => onGroupClick(group.id, lecture.name)} + onClick={() => onGroupClick(group)} >

{group.time} {group.room}

{group.lecturer} diff --git a/src/components/RightBar/index.tsx b/src/components/RightBar/index.tsx index 07e627d..c3d1bc5 100644 --- a/src/components/RightBar/index.tsx +++ b/src/components/RightBar/index.tsx @@ -6,14 +6,12 @@ import { LecturesContext } from "../../businesslogic/LecturesProvider"; interface RightBarProps { onGroupMouseOver: (id: string, name: string) => void; - onGroupClick: (id: string, name: string) => void; lectures: Array; } export default function RightBar({ lectures, onGroupMouseOver, - onGroupClick, }: RightBarProps) { const [selectedCardId, setSelectedCardId] = useState(null); @@ -28,9 +26,6 @@ export default function RightBar({ return (

- {/* - {(context) =>

{JSON.stringify((context as BuisnessProvided).states.user?.ticket)}

} -
*/}
Hubert Wrzesiński

Semestr zimowy 2020/2021 @@ -41,7 +36,6 @@ export default function RightBar({ key={index} id={index.toString()} onGroupMouseOver={onGroupMouseOver} - onGroupClick={onGroupClick} onCardClick={onCardClick} isSelected={selectedCardId === index.toString()} /> diff --git a/src/components/Scheduler/SchedulerEvent/index.tsx b/src/components/Scheduler/SchedulerEvent/index.tsx index 57b03ab..5189865 100644 --- a/src/components/Scheduler/SchedulerEvent/index.tsx +++ b/src/components/Scheduler/SchedulerEvent/index.tsx @@ -13,17 +13,16 @@ export const SchedulerEvent = ({ events, colIndex }: SchedulerEventProps) => { return ( <> - {events.map((event, index) => ( + {events.map((_, index) => (
{ const [currentEventsIds, setCurrentEventsIds] = useState>([]); + + const { choosenGroups } = useContext(LecturesContext); + useEffect(() => { const displayEvents = () => { currentEventsIds.map((eventId: string) => { const event = document.getElementById(eventId); - event!.style.display = "block"; + if (event) { + event.style.display = "block"; + } }); }; displayEvents(); @@ -52,7 +58,7 @@ export const Scheduler = () => { return ( <> -
+
{days.map((day, index) => (
@@ -61,15 +67,18 @@ export const Scheduler = () => { ))}
- + {terms.map((_, colIndex) => ( - + ))}
- -
); diff --git a/src/components/TopBar/Results/index.tsx b/src/components/TopBar/Results/index.tsx index 06960ed..0d2a524 100644 --- a/src/components/TopBar/Results/index.tsx +++ b/src/components/TopBar/Results/index.tsx @@ -35,7 +35,7 @@ export const Results: React.FC = () => { useEffect(() => { const fetchData = async () => { - const results = await axios.get(`http://localhost:1287/getCourses?name=`); + const results = await axios.get(`http://localhost:1285/getCourses?name=`); const lecturesData = results.data.map( (result: { id: number; name: string }) => ({ id: result.id, @@ -49,18 +49,19 @@ export const Results: React.FC = () => { }, []); useEffect(() => { + const names = lecturesContext.lectures.map((lecture) => lecture.name); const filterLectures = (value: string) => { - const filteredLectures = lecturesData.filter((lecture) => - lecture.name.toLowerCase().includes(value.toLowerCase()) + let filteredLectures = lecturesData.filter((lecture) => + lecture.name.toLowerCase().includes(value.toLowerCase()) && !names.includes(lecture.name) ); setFilteredLecturesData(filteredLectures); }; filterLectures(input); - }, [input]); + }, [input, open]); const getLecturesById = async (id: string) => { const { data } = await axios.get( - `http://localhost:1287/getClassesByCourseId?id=${id}` + `http://localhost:1285/getClassesByCourseId?id=${id}` ); return data; }; @@ -81,6 +82,7 @@ export const Results: React.FC = () => { const target = e.currentTarget as HTMLElement; const id = target.id; const result = await getLecturesById(id); + let groups: Array = []; let lecture = { groups: groups } as Lecture; lecture.id = result[0].course.id; From 143a0cf051b4a6bb99e384f182745da224d5ac5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciek=20G=C5=82owacki?= Date: Wed, 5 Aug 2020 23:54:30 +0200 Subject: [PATCH 10/27] Rewritten table --- src/components/Scheduler/Row.jsx | 0 src/components/Scheduler/index.tsx | 78 +++++++++++++++++++++++++++++- 2 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 src/components/Scheduler/Row.jsx diff --git a/src/components/Scheduler/Row.jsx b/src/components/Scheduler/Row.jsx new file mode 100644 index 0000000..e69de29 diff --git a/src/components/Scheduler/index.tsx b/src/components/Scheduler/index.tsx index a38b0eb..1f14b32 100644 --- a/src/components/Scheduler/index.tsx +++ b/src/components/Scheduler/index.tsx @@ -28,6 +28,32 @@ for (let i = 0; i < hours.length / 2; i++) { events.push(i); } +let center: "center" = "center"; +let row: "row" = "row"; +let column: "column" = "column"; +let wrap: "wrap" = "wrap"; +const tbodyStyles = { + width: 900, + height: 560, + backgroundColor: "blue", + display: "flex", + flexDirection: column, + // flexWrap: wrap + +} + +const rowStyles = { + display: "flex", + flexDirection: row, +} + +const cellStyles = { + border: "1px solid #ddd", + padding: "10px", + textAlign: center, + flex: 1, +} + let terms = ["Zawsze", "jest pora", "na kurde", "lody", "koral"]; export const Scheduler = () => { @@ -66,7 +92,55 @@ export const Scheduler = () => {
))}
-
+
+ {hours.map((hour, index) => ( +
{ + [hour, "", "", "", "", ""].map((value) => ( +
{value}
+ ))}
+ ))} +
+
+ {["", "", "", "", ""].map((value, index) => ( +
+ +
+ ))} +
+
+ {["", "", "", "", ""].map((value, index) => ( +
+ +
+ ))} +
+ {["", "", "", "", ""].map((value, index) => ( +
+ +
+ ))} +
+ {["", "", "", "", ""].map((value, index) => ( +
+ +
+ ))} +
+ {["", "", "", "", ""].map((value, index) => ( +
+ +
+ ))} +
+ {["", "", "", "", ""].map((value, index) => ( +
+ +
+ ))} +
+ + + {/*
{terms.map((_, colIndex) => ( { ))} -
+
*/}
); From 7aec9ff9436ec3ab73e516489910c715715de0ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciek=20G=C5=82owacki?= Date: Sun, 9 Aug 2020 19:29:03 +0200 Subject: [PATCH 11/27] Basic responsivness for table --- src/components/Scheduler/index.scss | 4 -- src/components/Scheduler/index.tsx | 99 ++++++++++++++++------------- 2 files changed, 55 insertions(+), 48 deletions(-) diff --git a/src/components/Scheduler/index.scss b/src/components/Scheduler/index.scss index ef5e92d..8a0764f 100644 --- a/src/components/Scheduler/index.scss +++ b/src/components/Scheduler/index.scss @@ -2,10 +2,6 @@ margin-top: 20px; border-collapse: collapse; - .thead { - display: flex; - width: 100%; - } .tbody { display: flex; diff --git a/src/components/Scheduler/index.tsx b/src/components/Scheduler/index.tsx index 1f14b32..5e082e7 100644 --- a/src/components/Scheduler/index.tsx +++ b/src/components/Scheduler/index.tsx @@ -1,8 +1,6 @@ -import React, { useEffect, useContext } from "react"; +import React, { useEffect, useContext, useRef } from "react"; import { useState } from "react"; import "./index.scss"; -import { SchedulerEvent } from "./SchedulerEvent"; -import { Column } from "./Column"; import { LecturesContext } from "../../businesslogic/LecturesProvider"; const days = ["", "poniedziałek", "wtorek", "środa", "czwartek", "piątek"]; @@ -19,8 +17,6 @@ const hours = [ "17:00", "18:00", "19:00", - "20:00", - "21:00", ]; let events: Array = []; @@ -31,15 +27,12 @@ for (let i = 0; i < hours.length / 2; i++) { let center: "center" = "center"; let row: "row" = "row"; let column: "column" = "column"; -let wrap: "wrap" = "wrap"; +const collapse: "collapse" = "collapse"; const tbodyStyles = { - width: 900, - height: 560, - backgroundColor: "blue", + width: "100%", + height: "100%", display: "flex", flexDirection: column, - // flexWrap: wrap - } const rowStyles = { @@ -54,13 +47,44 @@ const cellStyles = { flex: 1, } -let terms = ["Zawsze", "jest pora", "na kurde", "lody", "koral"]; +const theadStyles = { + display: "flex", + width: "100%" +} + +const scheduler = { + marginTop: "20px", + borderCollapse: collapse + +} + export const Scheduler = () => { const [currentEventsIds, setCurrentEventsIds] = useState>([]); - + const cellRef = useRef(null); + const [cellWidth, setCellWidth] = useState(0); + const [cellTop, setCellTop] = useState(0); const { choosenGroups } = useContext(LecturesContext); + + useEffect(() => { + const handleResize = () => { + console.log(`cellref is:`); + console.log(cellRef); + if (cellRef.current) { + setCellWidth(cellRef.current.getBoundingClientRect().width); + setCellTop(cellRef.current.getBoundingClientRect().top); + console.log(`cellwidth: ${cellWidth}`); + console.log("cell ref:"); + console.log(cellRef.current.getBoundingClientRect()); + } + } + handleResize(); + window.addEventListener('resize', handleResize); + + }, []); + + useEffect(() => { const displayEvents = () => { currentEventsIds.map((eventId: string) => { @@ -85,7 +109,7 @@ export const Scheduler = () => { return ( <>
-
+
{days.map((day, index) => (
{day} @@ -93,66 +117,53 @@ export const Scheduler = () => { ))}
- {hours.map((hour, index) => ( + {hours.map((hour, indexRow) => (
{ - [hour, "", "", "", "", ""].map((value) => ( -
{value}
- ))}
+ [hour, "", "", "", "", ""].map((value, indexCell) => + indexRow === 0 && indexCell === 1 ? (
) : (
{value}
) + + )}
))}
- {["", "", "", "", ""].map((value, index) => ( -
+ {[...Array(5)].map((value, index) => ( +
))}
- {["", "", "", "", ""].map((value, index) => ( -
+ {[...Array(5)].map((value, index) => ( +
))}
- {["", "", "", "", ""].map((value, index) => ( -
+ {[...Array(5)].map((value, index) => ( +
))}
- {["", "", "", "", ""].map((value, index) => ( -
+ {[...Array(5)].map((value, index) => ( +
))}
- {["", "", "", "", ""].map((value, index) => ( -
+ {[...Array(5)].map((value, index) => ( +
))}
- {["", "", "", "", ""].map((value, index) => ( -
+ {[...Array(5)].map((value, index) => ( +
))}
- - {/*
- - {terms.map((_, colIndex) => ( - - - - ))} -
*/}
); From aa38625207aa6fc84d97a244bbce5740821fc8b6 Mon Sep 17 00:00:00 2001 From: wrzesinski-hubert Date: Sun, 9 Aug 2020 20:44:35 +0200 Subject: [PATCH 12/27] Scheduler c.d --- src/businesslogic/LecturesProvider.tsx | 17 ++- src/components/RightBar/LectureCard/index.tsx | 5 +- src/components/Scheduler/Row.jsx | 0 .../Scheduler/SchedulerEvent/index.scss | 0 .../Scheduler/SchedulerEvent/index.tsx | 37 ------ .../Scheduler/SchedulerEvents/index.tsx | 68 +++++++++++ .../Scheduler/SchedulerRow/index.tsx | 48 ++++++++ src/components/Scheduler/index.tsx | 108 ++++++------------ src/components/TopBar/Results/index.tsx | 10 +- 9 files changed, 162 insertions(+), 131 deletions(-) delete mode 100644 src/components/Scheduler/Row.jsx delete mode 100644 src/components/Scheduler/SchedulerEvent/index.scss delete mode 100644 src/components/Scheduler/SchedulerEvent/index.tsx create mode 100644 src/components/Scheduler/SchedulerEvents/index.tsx create mode 100644 src/components/Scheduler/SchedulerRow/index.tsx diff --git a/src/businesslogic/LecturesProvider.tsx b/src/businesslogic/LecturesProvider.tsx index 623f446..d56189f 100644 --- a/src/businesslogic/LecturesProvider.tsx +++ b/src/businesslogic/LecturesProvider.tsx @@ -1,34 +1,31 @@ -import React, { useState, useEffect } from "react"; -import { lectures } from "./mockData/lectures"; +import React, { useState } from "react"; import { Lecture } from "./types/lecture"; import { Group } from "./types/group"; interface ILectureContext { lectures: Array; - updateLectures: (lectures: Lecture) => void; + addLecture: (lectures: Lecture) => void; } export const LecturesContext = React.createContext({ lectures: Array(), choosenGroups: Array(), - updateLectures: (lecture: Lecture) => {}, - updateGroups: (group : Group) => {} + addLecture: (lecture: Lecture) => {}, + addGroup: (group : Group) => {} }); export const LecturesProvider: React.FC = (props) => { const [lectures, setLectures] = useState>([]); const [choosenGroups, setChoosenGroups] = useState>([]); - const updateLectures = (lecture: Lecture) => { + const addLecture = (lecture: Lecture) => { setLectures([...lectures, lecture]); }; - const updateGroups = (group : Group) => { + const addGroup = (group : Group) => { setChoosenGroups([...choosenGroups, group]); }; - useEffect(()=>{console.log(`Groups have changed: ${JSON.stringify(choosenGroups)}`)},[choosenGroups]); - return ( {props.children} diff --git a/src/components/RightBar/LectureCard/index.tsx b/src/components/RightBar/LectureCard/index.tsx index 071cd41..4f15f71 100644 --- a/src/components/RightBar/LectureCard/index.tsx +++ b/src/components/RightBar/LectureCard/index.tsx @@ -22,12 +22,11 @@ export default function LectureCard({ isSelected, }: LectureCardProps) { - const {updateGroups} = useContext(LecturesContext); + const {addGroup} = useContext(LecturesContext); function onGroupClick(group : Group){ - console.log(`group is: ${JSON.stringify(group)}`) - updateGroups(group); + addGroup(group); } diff --git a/src/components/Scheduler/Row.jsx b/src/components/Scheduler/Row.jsx deleted file mode 100644 index e69de29..0000000 diff --git a/src/components/Scheduler/SchedulerEvent/index.scss b/src/components/Scheduler/SchedulerEvent/index.scss deleted file mode 100644 index e69de29..0000000 diff --git a/src/components/Scheduler/SchedulerEvent/index.tsx b/src/components/Scheduler/SchedulerEvent/index.tsx deleted file mode 100644 index 5189865..0000000 --- a/src/components/Scheduler/SchedulerEvent/index.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import React from "react"; - -interface SchedulerEventProps { - events: Array; - colIndex: number; -} - -export const SchedulerEvent = ({ events, colIndex }: SchedulerEventProps) => { - const handleEventClick = (e: React.MouseEvent) => { - const eventDiv = e.target as HTMLDivElement; - eventDiv.style.backgroundColor = "#1547C5"; - }; - - return ( - <> - {events.map((_, index) => ( -
- :) -
- ))} - - ); -}; diff --git a/src/components/Scheduler/SchedulerEvents/index.tsx b/src/components/Scheduler/SchedulerEvents/index.tsx new file mode 100644 index 0000000..27517cf --- /dev/null +++ b/src/components/Scheduler/SchedulerEvents/index.tsx @@ -0,0 +1,68 @@ +import React, { useContext } from "react"; +import { SchedulerRow } from "../SchedulerRow"; +import { LecturesContext } from "../../../businesslogic/LecturesProvider"; + +interface SchedulerEventsProps { + cellTop: number; + cellWidth: number; +} + +export const SchedulerEvents = ({ + cellTop, + cellWidth, +}: SchedulerEventsProps) => { +// const handleEventClick = (e: React.MouseEvent) => { +// const eventDiv = e.target as HTMLDivElement; +// eventDiv.style.backgroundColor = "#1547C5"; +// }; + const mapGroupToEvent = () => { + + } + +const { choosenGroups } = useContext(LecturesContext); + + const group = {0: {id: 5, day: 4, time: "11.45", lecturer: "dr Dorota Blinkiewicz", room: "A2-3"}} + + + console.log(choosenGroups) + return ( +
+ + + + + + +
+ ); +}; diff --git a/src/components/Scheduler/SchedulerRow/index.tsx b/src/components/Scheduler/SchedulerRow/index.tsx new file mode 100644 index 0000000..c63958d --- /dev/null +++ b/src/components/Scheduler/SchedulerRow/index.tsx @@ -0,0 +1,48 @@ +import React from "react"; +import { Group } from "../../../businesslogic/types/group"; + +interface SchedulerRowProps { + groups: Array; + indexRow: number; + cellTop: number; + cellWidth: number; +} + +export const SchedulerRow = ({ + groups, + indexRow, + cellTop, + cellWidth, +}: SchedulerRowProps) => { + // const handleEventClick = (e: React.MouseEvent) => { + // const eventDiv = e.target as HTMLDivElement; + // eventDiv.style.backgroundColor = "#1547C5"; + // }; + + const group = {0: {id: 5, day: 4, time: "11.45", lecturer: "dr Dorota Blinkiewicz", room: "A2-3"}} + + return ( +
+ {[...Array(5)].map((value, index) => ( +
+ + {groups.map((value, index) => ( +
{groups[index]?.lecturer}
+ ))} +
+ ))} +
+ ); +}; diff --git a/src/components/Scheduler/index.tsx b/src/components/Scheduler/index.tsx index 5e082e7..dcf8a5f 100644 --- a/src/components/Scheduler/index.tsx +++ b/src/components/Scheduler/index.tsx @@ -1,7 +1,7 @@ -import React, { useEffect, useContext, useRef } from "react"; +import React, { useEffect, useRef } from "react"; import { useState } from "react"; import "./index.scss"; -import { LecturesContext } from "../../businesslogic/LecturesProvider"; +import { SchedulerEvents } from "./SchedulerEvents"; const days = ["", "poniedziałek", "wtorek", "środa", "czwartek", "piątek"]; const hours = [ @@ -27,64 +27,54 @@ for (let i = 0; i < hours.length / 2; i++) { let center: "center" = "center"; let row: "row" = "row"; let column: "column" = "column"; -const collapse: "collapse" = "collapse"; +// const collapse: "collapse" = "collapse"; const tbodyStyles = { width: "100%", height: "100%", display: "flex", flexDirection: column, -} +}; const rowStyles = { display: "flex", flexDirection: row, -} +}; const cellStyles = { border: "1px solid #ddd", padding: "10px", textAlign: center, flex: 1, -} +}; const theadStyles = { display: "flex", - width: "100%" -} - -const scheduler = { - marginTop: "20px", - borderCollapse: collapse - -} + width: "100%", +}; +// const scheduler = { +// marginTop: "20px", +// borderCollapse: collapse, +// }; export const Scheduler = () => { const [currentEventsIds, setCurrentEventsIds] = useState>([]); const cellRef = useRef(null); const [cellWidth, setCellWidth] = useState(0); const [cellTop, setCellTop] = useState(0); - const { choosenGroups } = useContext(LecturesContext); - + useEffect(() => { const handleResize = () => { - console.log(`cellref is:`); - console.log(cellRef); if (cellRef.current) { setCellWidth(cellRef.current.getBoundingClientRect().width); setCellTop(cellRef.current.getBoundingClientRect().top); - console.log(`cellwidth: ${cellWidth}`); - console.log("cell ref:"); - console.log(cellRef.current.getBoundingClientRect()); } - } + }; handleResize(); - window.addEventListener('resize', handleResize); - + window.addEventListener("resize", handleResize); }, []); - useEffect(() => { const displayEvents = () => { currentEventsIds.map((eventId: string) => { @@ -97,18 +87,18 @@ export const Scheduler = () => { displayEvents(); }, [currentEventsIds]); - const handleClick = (e: React.MouseEvent) => { - const cellId = e.currentTarget.id; - const column = cellId.slice(0, 1); - const row = cellId.slice(1); - const eventId = `eventCol${column}eventRow${Math.floor(parseInt(row) / 2)}`; + // const handleClick = (e: React.MouseEvent) => { + // const cellId = e.currentTarget.id; + // const column = cellId.slice(0, 1); + // const row = cellId.slice(1); + // const eventId = `eventCol${column}eventRow${Math.floor(parseInt(row) / 2)}`; - setCurrentEventsIds((currentEventsIds) => [...currentEventsIds, eventId]); - }; + // setCurrentEventsIds((currentEventsIds) => [...currentEventsIds, eventId]); + // }; return ( <> -
+
{days.map((day, index) => (
@@ -118,52 +108,18 @@ export const Scheduler = () => {
{hours.map((hour, indexRow) => ( -
{ - [hour, "", "", "", "", ""].map((value, indexCell) => - indexRow === 0 && indexCell === 1 ? (
) : (
{value}
) - - )}
- ))} -
-
- {[...Array(5)].map((value, index) => ( -
- +
+ {[hour, "", "", "", "", ""].map((value, indexCell) => + indexRow === 0 && indexCell === 1 ? ( +
+ ) : ( +
{value}
+ ) + )}
))}
-
- {[...Array(5)].map((value, index) => ( -
- -
- ))} -
- {[...Array(5)].map((value, index) => ( -
- -
- ))} -
- {[...Array(5)].map((value, index) => ( -
- -
- ))} -
- {[...Array(5)].map((value, index) => ( -
- -
- ))} -
- {[...Array(5)].map((value, index) => ( -
- -
- ))} -
- +
); diff --git a/src/components/TopBar/Results/index.tsx b/src/components/TopBar/Results/index.tsx index 0d2a524..7068d1c 100644 --- a/src/components/TopBar/Results/index.tsx +++ b/src/components/TopBar/Results/index.tsx @@ -1,6 +1,6 @@ import React, { useState, useContext, useEffect } from "react"; import axios from "axios"; -import { Input, Grow } from "@material-ui/core"; +import { Input } from "@material-ui/core"; import "./index.scss"; import ClickAwayListener from "@material-ui/core/ClickAwayListener"; import { LecturesContext } from "../../../businesslogic/LecturesProvider"; @@ -35,7 +35,7 @@ export const Results: React.FC = () => { useEffect(() => { const fetchData = async () => { - const results = await axios.get(`http://localhost:1285/getCourses?name=`); + const results = await axios.get(`http://localhost:1287/getCourses?name=`); const lecturesData = results.data.map( (result: { id: number; name: string }) => ({ id: result.id, @@ -61,7 +61,7 @@ export const Results: React.FC = () => { const getLecturesById = async (id: string) => { const { data } = await axios.get( - `http://localhost:1285/getClassesByCourseId?id=${id}` + `http://localhost:1287/getClassesByCourseId?id=${id}` ); return data; }; @@ -98,13 +98,13 @@ export const Results: React.FC = () => { result[i].lecturer.name + " " + result[i].lecturer.surname; - group.room = result[i].room; + group.room = result[i].room.trim(); lecture.groups.push(group); } console.log(result); console.log(result[0].course.name); - lecturesContext.updateLectures(lecture); + lecturesContext.addLecture(lecture); setOpen(false); }; From f6da0d9c72ffb8540c0b1a16ab8fc0095d8c4a04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciek=20G=C5=82owacki?= Date: Sun, 9 Aug 2020 21:41:52 +0200 Subject: [PATCH 13/27] Added group to event mapping --- .../Scheduler/SchedulerEvents/index.tsx | 114 ++++++++++-------- .../Scheduler/SchedulerRow/index.tsx | 21 ++-- 2 files changed, 78 insertions(+), 57 deletions(-) diff --git a/src/components/Scheduler/SchedulerEvents/index.tsx b/src/components/Scheduler/SchedulerEvents/index.tsx index 27517cf..d02c2fa 100644 --- a/src/components/Scheduler/SchedulerEvents/index.tsx +++ b/src/components/Scheduler/SchedulerEvents/index.tsx @@ -1,6 +1,7 @@ -import React, { useContext } from "react"; +import React, { useContext, useEffect, useState } from "react"; import { SchedulerRow } from "../SchedulerRow"; import { LecturesContext } from "../../../businesslogic/LecturesProvider"; +import { Group } from "../../../businesslogic/types/group"; interface SchedulerEventsProps { cellTop: number; @@ -11,58 +12,75 @@ export const SchedulerEvents = ({ cellTop, cellWidth, }: SchedulerEventsProps) => { -// const handleEventClick = (e: React.MouseEvent) => { -// const eventDiv = e.target as HTMLDivElement; -// eventDiv.style.backgroundColor = "#1547C5"; -// }; - const mapGroupToEvent = () => { - + // const handleEventClick = (e: React.MouseEvent) => { + // const eventDiv = e.target as HTMLDivElement; + // eventDiv.style.backgroundColor = "#1547C5"; + // }; + + const { choosenGroups } = useContext(LecturesContext); + + const [groupsMappedToEvents, setGroupsMappedToEvents] = useState([]); + + + + // const groups: Array = [{ id: "5", day: "4", time: "11.45", lecturer: "dr Dorota Blinkiewicz", room: "A2-3" }, + // { id: "28", day: "1", time: "13.45", lecturer: "dr Barbara Kołodziejczak", room: "D-3" }, + // { id: "69", day: "4", time: "15.30", lecturer: "dr Karol Gierszewski", room: "A2-3" }]; + + + interface GroupTimeToEventRowMapping { + [time: string]: number + } + + const groupTimeToEventRowMapping: GroupTimeToEventRowMapping = { + "8.15": 0, + "10.00": 1, + "11.45": 2, + "13.45": 3, + "15.30": 4, + "17.15": 5, + } + + + + + useEffect(() => { + function mapGroupTimeToEventRow(groups: Array) { + for (const group of groups) { + console.log(group); + const groupTime = group.time + const eventRow: number = groupTimeToEventRowMapping[groupTime]; + const groupMappedToEvent: any = { id: group.id, day: group.day, eventRow: eventRow, lecturer: group.lecturer, room: group.room }; + setGroupsMappedToEvents((groupsMappedToEvents: any) => [...groupsMappedToEvents, groupMappedToEvent]); + } } - -const { choosenGroups } = useContext(LecturesContext); - - const group = {0: {id: 5, day: 4, time: "11.45", lecturer: "dr Dorota Blinkiewicz", room: "A2-3"}} + mapGroupTimeToEventRow(choosenGroups); + }, [choosenGroups]); + + + useEffect(() => { + console.log(groupsMappedToEvents); + + }, [groupsMappedToEvents]); - console.log(choosenGroups) return ( + +
- - - - - - + { + [...Array(6)].map((_, index) => ( + { return group.eventRow === index })} + indexRow={index} + cellTop={cellTop + (10 + 70 * index)} + cellWidth={cellWidth} + /> + )) + } + +
); }; diff --git a/src/components/Scheduler/SchedulerRow/index.tsx b/src/components/Scheduler/SchedulerRow/index.tsx index c63958d..dd1f693 100644 --- a/src/components/Scheduler/SchedulerRow/index.tsx +++ b/src/components/Scheduler/SchedulerRow/index.tsx @@ -19,28 +19,31 @@ export const SchedulerRow = ({ // eventDiv.style.backgroundColor = "#1547C5"; // }; - const group = {0: {id: 5, day: 4, time: "11.45", lecturer: "dr Dorota Blinkiewicz", room: "A2-3"}} + console.log(`You passed me these of a groupzzz: ${groups}`) + return (
- {[...Array(5)].map((value, index) => ( + {[...Array(5)].map((value, eventIndex) => (
- - {groups.map((value, index) => ( -
{groups[index]?.lecturer}
- ))} + + {groups.map((group, index) => + ( + parseInt(group.day) === eventIndex ?
{groups[index]?.lecturer}
+ : null + ))}
))}
From 09384e46fd15d997ea1cccae39b0a74dd7165fc1 Mon Sep 17 00:00:00 2001 From: wrzesinski-hubert Date: Sun, 9 Aug 2020 21:54:49 +0200 Subject: [PATCH 14/27] adding groups to scheduler --- .../Scheduler/SchedulerEvents/index.tsx | 55 +++++++++---------- .../Scheduler/SchedulerRow/index.tsx | 3 - src/components/TopBar/Results/index.tsx | 2 - 3 files changed, 25 insertions(+), 35 deletions(-) diff --git a/src/components/Scheduler/SchedulerEvents/index.tsx b/src/components/Scheduler/SchedulerEvents/index.tsx index d02c2fa..0018f3b 100644 --- a/src/components/Scheduler/SchedulerEvents/index.tsx +++ b/src/components/Scheduler/SchedulerEvents/index.tsx @@ -21,15 +21,12 @@ export const SchedulerEvents = ({ const [groupsMappedToEvents, setGroupsMappedToEvents] = useState([]); - - // const groups: Array = [{ id: "5", day: "4", time: "11.45", lecturer: "dr Dorota Blinkiewicz", room: "A2-3" }, // { id: "28", day: "1", time: "13.45", lecturer: "dr Barbara Kołodziejczak", room: "D-3" }, // { id: "69", day: "4", time: "15.30", lecturer: "dr Karol Gierszewski", room: "A2-3" }]; - interface GroupTimeToEventRowMapping { - [time: string]: number + [time: string]: number; } const groupTimeToEventRowMapping: GroupTimeToEventRowMapping = { @@ -39,48 +36,46 @@ export const SchedulerEvents = ({ "13.45": 3, "15.30": 4, "17.15": 5, - } - - - + }; useEffect(() => { function mapGroupTimeToEventRow(groups: Array) { + const groupsMappedToEventsTemp = [] for (const group of groups) { - console.log(group); - const groupTime = group.time + const groupTime = group.time; const eventRow: number = groupTimeToEventRowMapping[groupTime]; - const groupMappedToEvent: any = { id: group.id, day: group.day, eventRow: eventRow, lecturer: group.lecturer, room: group.room }; - setGroupsMappedToEvents((groupsMappedToEvents: any) => [...groupsMappedToEvents, groupMappedToEvent]); + const groupMappedToEvent: any = { + id: group.id, + day: group.day, + eventRow: eventRow, + lecturer: group.lecturer, + room: group.room, + }; + groupsMappedToEventsTemp.push(groupMappedToEvent) } + setGroupsMappedToEvents(groupsMappedToEventsTemp) } mapGroupTimeToEventRow(choosenGroups); }, [choosenGroups]); - useEffect(() => { + console.log(choosenGroups) console.log(groupsMappedToEvents); - }, [groupsMappedToEvents]); - return ( - -
- { - [...Array(6)].map((_, index) => ( - { return group.eventRow === index })} - indexRow={index} - cellTop={cellTop + (10 + 70 * index)} - cellWidth={cellWidth} - /> - )) - } - - + {[...Array(6)].map((_, index) => ( + { + return group.eventRow === index; + })} + indexRow={index} + cellTop={cellTop + (10 + 70 * index)} + cellWidth={cellWidth} + /> + ))}
); }; diff --git a/src/components/Scheduler/SchedulerRow/index.tsx b/src/components/Scheduler/SchedulerRow/index.tsx index dd1f693..463b401 100644 --- a/src/components/Scheduler/SchedulerRow/index.tsx +++ b/src/components/Scheduler/SchedulerRow/index.tsx @@ -19,9 +19,6 @@ export const SchedulerRow = ({ // eventDiv.style.backgroundColor = "#1547C5"; // }; - console.log(`You passed me these of a groupzzz: ${groups}`) - - return (
{[...Array(5)].map((value, eventIndex) => ( diff --git a/src/components/TopBar/Results/index.tsx b/src/components/TopBar/Results/index.tsx index 7068d1c..27eeefb 100644 --- a/src/components/TopBar/Results/index.tsx +++ b/src/components/TopBar/Results/index.tsx @@ -101,8 +101,6 @@ export const Results: React.FC = () => { group.room = result[i].room.trim(); lecture.groups.push(group); } - console.log(result); - console.log(result[0].course.name); lecturesContext.addLecture(lecture); setOpen(false); From f1cf374b075745f42eeb6720d044af6fecc8374b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciek=20G=C5=82owacki?= Date: Wed, 12 Aug 2020 04:13:14 +0200 Subject: [PATCH 15/27] Major refactoring --- .env | 2 + .eslintignore | 2 + .eslintrc.js | 28 + .prettierrc.js | 7 + package-lock.json | 516 +++++++++++++----- package.json | 6 + src/App.scss | 14 - src/App.tsx | 85 ++- src/businesslogic/BusinessLogicContext.ts | 5 - src/businesslogic/BusinessLogicProvider.tsx | 76 --- src/businesslogic/LecturesProvider.tsx | 33 -- src/businesslogic/mockData/lectures.ts | 42 -- src/businesslogic/types/group.ts | 7 - src/businesslogic/types/lecture.ts | 7 - src/businesslogic/types/lectureInit.ts | 4 - src/businesslogic/types/user.ts | 5 - src/components/RightBar/LectureCard/index.tsx | 45 +- src/components/RightBar/index.tsx | 22 +- src/components/Scheduler/Cell/index.scss | 0 src/components/Scheduler/Cell/index.tsx | 23 - src/components/Scheduler/Column/index.scss | 0 src/components/Scheduler/Column/index.tsx | 33 -- .../Scheduler/SchedulerEvents/index.tsx | 91 ++- .../Scheduler/SchedulerRow/index.tsx | 63 +-- src/components/Scheduler/index.scss | 26 - src/components/Scheduler/index.tsx | 110 ++-- src/components/TopBar/Results/index.tsx | 57 +- src/constants/index.ts | 22 + src/contexts/CASProvider.tsx | 48 ++ src/contexts/LecturesProvider.tsx | 32 ++ src/contexts/reducers.ts | 8 + src/index.tsx | 28 +- src/styles/GlobalStyles.ts | 20 + src/teest.tsx | 27 - src/types/index.ts | 21 + 35 files changed, 783 insertions(+), 732 deletions(-) create mode 100644 .env create mode 100644 .eslintignore create mode 100644 .eslintrc.js create mode 100644 .prettierrc.js delete mode 100644 src/App.scss delete mode 100644 src/businesslogic/BusinessLogicContext.ts delete mode 100644 src/businesslogic/BusinessLogicProvider.tsx delete mode 100644 src/businesslogic/LecturesProvider.tsx delete mode 100644 src/businesslogic/mockData/lectures.ts delete mode 100644 src/businesslogic/types/group.ts delete mode 100644 src/businesslogic/types/lecture.ts delete mode 100644 src/businesslogic/types/lectureInit.ts delete mode 100644 src/businesslogic/types/user.ts delete mode 100644 src/components/Scheduler/Cell/index.scss delete mode 100644 src/components/Scheduler/Cell/index.tsx delete mode 100644 src/components/Scheduler/Column/index.scss delete mode 100644 src/components/Scheduler/Column/index.tsx delete mode 100644 src/components/Scheduler/index.scss create mode 100644 src/constants/index.ts create mode 100644 src/contexts/CASProvider.tsx create mode 100644 src/contexts/LecturesProvider.tsx create mode 100644 src/contexts/reducers.ts create mode 100644 src/styles/GlobalStyles.ts delete mode 100644 src/teest.tsx create mode 100644 src/types/index.ts diff --git a/.env b/.env new file mode 100644 index 0000000..c62b767 --- /dev/null +++ b/.env @@ -0,0 +1,2 @@ +REACT_APP_API_URL=http://localhost:5000/api +REACT_APP_API_HOST=http://localhost:5000 \ No newline at end of file diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..b7dab5e --- /dev/null +++ b/.eslintignore @@ -0,0 +1,2 @@ +node_modules +build \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..0d85867 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,28 @@ +module.exports = { + parser: '@typescript-eslint/parser', + extends: [ + 'plugin:react/recommended', + 'plugin:@typescript-eslint/recommended', + 'prettier/@typescript-eslint', + 'plugin:prettier/recommended', + 'plugin:react-hooks/recommended', + ], + parserOptions: { + ecmaVersion: 2018, + sourceType: 'module', + ecmaFeatures: { + jsx: true, + }, + }, + rules: { + '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_|^req|^next' }], + '@typescript-eslint/no-explicit-any': 0, + '@typescript-eslint/explicit-function-return-type': 0, + 'react/prop-types': 0, + }, + settings: { + react: { + version: 'detect', + }, + }, +}; diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000..13c2be1 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,7 @@ +module.exports = { + semi: true, + trailingComma: 'all', + singleQuote: true, + printWidth: 120, + tabWidth: 2, +}; diff --git a/package-lock.json b/package-lock.json index aa67c95..6a18444 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1165,6 +1165,29 @@ "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.8.0.tgz", "integrity": "sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==" }, + "@emotion/is-prop-valid": { + "version": "0.8.8", + "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-0.8.8.tgz", + "integrity": "sha512-u5WtneEAr5IDG2Wv65yhunPSMLIpuKsbuOktRojfrEiEvRyC85LgPMZI63cr7NUqT8ZIGdSVg8ZKGxIug4lXcA==", + "requires": { + "@emotion/memoize": "0.7.4" + } + }, + "@emotion/memoize": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.4.tgz", + "integrity": "sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==" + }, + "@emotion/stylis": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/@emotion/stylis/-/stylis-0.8.5.tgz", + "integrity": "sha512-h6KtPihKFn3T9fuIrwvXXUOwlx3rfUvfZIcP5a6rh8Y7zjE3O06hT5Ss4S/YI1AYhuZ1kjaE/5EaOOI2NqSylQ==" + }, + "@emotion/unitless": { + "version": "0.7.5", + "resolved": "https://registry.npmjs.org/@emotion/unitless/-/unitless-0.7.5.tgz", + "integrity": "sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg==" + }, "@hapi/address": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz", @@ -1823,6 +1846,15 @@ "@types/node": "*" } }, + "@types/hoist-non-react-statics": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz", + "integrity": "sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA==", + "requires": { + "@types/react": "*", + "hoist-non-react-statics": "^3.3.0" + } + }, "@types/istanbul-lib-coverage": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.2.tgz", @@ -1854,9 +1886,9 @@ } }, "@types/json-schema": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.4.tgz", - "integrity": "sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA==" + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.5.tgz", + "integrity": "sha512-7+2BITlgjgDhH0vvwZU/HZJVyk+2XUlvxXe8dFMedNX/aMkaOq++rMAFXc0tM7ij15QaWlbdQASBR9dihi+bDQ==" }, "@types/lru-cache": { "version": "4.1.2", @@ -1905,6 +1937,14 @@ "@types/react": "*" } }, + "@types/react-native": { + "version": "0.63.7", + "resolved": "https://registry.npmjs.org/@types/react-native/-/react-native-0.63.7.tgz", + "integrity": "sha512-TrtH69+HuWVxTERhoDDP2YtpznfH/Ra3/Fu2dCrssy+CkBZjvDlEESfWiAJWlOto3QtUzkTA7RT/S2jrO4WKkw==", + "requires": { + "@types/react": "*" + } + }, "@types/react-transition-group": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.0.tgz", @@ -1918,6 +1958,24 @@ "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz", "integrity": "sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw==" }, + "@types/styled-components": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/@types/styled-components/-/styled-components-5.1.2.tgz", + "integrity": "sha512-HNocYLfrsnNNm8NTS/W53OERSjRA8dx5Bn6wBd2rXXwt4Z3s+oqvY6/PbVt3e6sgtzI63GX//WiWiRhWur08qQ==", + "requires": { + "@types/hoist-non-react-statics": "*", + "@types/react": "*", + "@types/react-native": "*", + "csstype": "^3.0.2" + }, + "dependencies": { + "csstype": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.2.tgz", + "integrity": "sha512-ofovWglpqoqbfLNOTBNZLSbMuGrblAf1efvvArGKOZMBrIoJeu5UsAipQolkijtyQx5MtAzT/J9IHj/CEY1mJw==" + } + } + }, "@types/styled-jsx": { "version": "2.2.8", "resolved": "https://registry.npmjs.org/@types/styled-jsx/-/styled-jsx-2.2.8.tgz", @@ -2033,46 +2091,43 @@ "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-15.0.0.tgz", "integrity": "sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw==" }, - "@typescript-eslint/eslint-plugin": { - "version": "2.34.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.34.0.tgz", - "integrity": "sha512-4zY3Z88rEE99+CNvTbXSyovv2z9PNOVffTWD2W8QF5s2prBQtwN2zadqERcrHpcR7O/+KMI3fcTAmUUhK/iQcQ==", - "requires": { - "@typescript-eslint/experimental-utils": "2.34.0", - "functional-red-black-tree": "^1.0.1", - "regexpp": "^3.0.0", - "tsutils": "^3.17.1" - } - }, "@typescript-eslint/experimental-utils": { - "version": "2.34.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz", - "integrity": "sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA==", + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.9.0.tgz", + "integrity": "sha512-/vSHUDYizSOhrOJdjYxPNGfb4a3ibO8zd4nUKo/QBFOmxosT3cVUV7KIg8Dwi6TXlr667G7YPqFK9+VSZOorNA==", "requires": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "2.34.0", + "@typescript-eslint/types": "3.9.0", + "@typescript-eslint/typescript-estree": "3.9.0", "eslint-scope": "^5.0.0", "eslint-utils": "^2.0.0" } }, "@typescript-eslint/parser": { - "version": "2.34.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.34.0.tgz", - "integrity": "sha512-03ilO0ucSD0EPTw2X4PntSIRFtDPWjrVq7C3/Z3VQHRC7+13YB55rcJI3Jt+YgeHbjUdJPcPa7b23rXCBokuyA==", + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.9.0.tgz", + "integrity": "sha512-rDHOKb6uW2jZkHQniUQVZkixQrfsZGUCNWWbKWep4A5hGhN5dLHMUCNAWnC4tXRlHedXkTDptIpxs6e4Pz8UfA==", "requires": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "2.34.0", - "@typescript-eslint/typescript-estree": "2.34.0", + "@typescript-eslint/experimental-utils": "3.9.0", + "@typescript-eslint/types": "3.9.0", + "@typescript-eslint/typescript-estree": "3.9.0", "eslint-visitor-keys": "^1.1.0" } }, + "@typescript-eslint/types": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-3.9.0.tgz", + "integrity": "sha512-rb6LDr+dk9RVVXO/NJE8dT1pGlso3voNdEIN8ugm4CWM5w5GimbThCMiMl4da1t5u3YwPWEwOnKAULCZgBtBHg==" + }, "@typescript-eslint/typescript-estree": { - "version": "2.34.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz", - "integrity": "sha512-OMAr+nJWKdlVM9LOqCqh3pQQPwxHAN7Du8DR6dmwCrAmxtiXQnhHJ6tBNtf+cggqfo51SG/FCwnKhXCIM7hnVg==", + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.9.0.tgz", + "integrity": "sha512-N+158NKgN4rOmWVfvKOMoMFV5n8XxAliaKkArm/sOypzQ0bUL8MSnOEBW3VFIeffb/K5ce/cAV0yYhR7U4ALAA==", "requires": { + "@typescript-eslint/types": "3.9.0", + "@typescript-eslint/visitor-keys": "3.9.0", "debug": "^4.1.1", - "eslint-visitor-keys": "^1.1.0", "glob": "^7.1.6", "is-glob": "^4.0.1", "lodash": "^4.17.15", @@ -2087,6 +2142,14 @@ } } }, + "@typescript-eslint/visitor-keys": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-3.9.0.tgz", + "integrity": "sha512-O1qeoGqDbu0EZUC/MZ6F1WHTIzcBVhGqDj3LhTnj65WUA548RXVxUHbYhAW9bZWfb2rnX9QsbbP5nmeJ5Z4+ng==", + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, "@webassemblyjs/ast": { "version": "1.8.5", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.8.5.tgz", @@ -2275,9 +2338,9 @@ } }, "acorn": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.2.0.tgz", - "integrity": "sha512-apwXVmYVpQ34m/i71vrApRrRKCWQnZZF1+npOD0WV5xZFfwWOmKGQ2RWlfdy9vWITsenisM8M0Qeq8agcFHNiQ==" + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.0.tgz", + "integrity": "sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w==" }, "acorn-globals": { "version": "4.3.4", @@ -2980,6 +3043,22 @@ "resolved": "https://registry.npmjs.org/babel-plugin-named-asset-import/-/babel-plugin-named-asset-import-0.3.6.tgz", "integrity": "sha512-1aGDUfL1qOOIoqk9QKGIo2lANk+C7ko/fqH0uIyC71x3PEGz0uVP8ISgfEsFuG+FKmjHTvFK/nNM8dowpmUxLA==" }, + "babel-plugin-styled-components": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/babel-plugin-styled-components/-/babel-plugin-styled-components-1.11.1.tgz", + "integrity": "sha512-YwrInHyKUk1PU3avIRdiLyCpM++18Rs1NgyMXEAQC33rIXs/vro0A+stf4sT0Gf22Got+xRWB8Cm0tw+qkRzBA==", + "requires": { + "@babel/helper-annotate-as-pure": "^7.0.0", + "@babel/helper-module-imports": "^7.0.0", + "babel-plugin-syntax-jsx": "^6.18.0", + "lodash": "^4.17.11" + } + }, + "babel-plugin-syntax-jsx": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz", + "integrity": "sha1-CvMqmm4Tyno/1QaeYtew9Y0NiUY=" + }, "babel-plugin-syntax-object-rest-spread": { "version": "6.13.0", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", @@ -3620,6 +3699,11 @@ } } }, + "camelize": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/camelize/-/camelize-1.0.0.tgz", + "integrity": "sha1-FkpUg+Yw+kMh5a8HAg5TGDGyYJs=" + }, "caniuse-api": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/caniuse-api/-/caniuse-api-3.0.0.tgz", @@ -4257,6 +4341,11 @@ "postcss": "^7.0.5" } }, + "css-color-keywords": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/css-color-keywords/-/css-color-keywords-1.0.0.tgz", + "integrity": "sha1-/qJhbcZ2spYmhrOvjb2+GAskTgU=" + }, "css-color-names": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/css-color-names/-/css-color-names-0.0.4.tgz", @@ -4347,6 +4436,16 @@ "resolved": "https://registry.npmjs.org/css-select-base-adapter/-/css-select-base-adapter-0.1.1.tgz", "integrity": "sha512-jQVeeRG70QI08vSTwf1jHxp74JoZsr2XSgETae8/xC8ovSnL2WF87GTLO86Sbwdt2lK4Umg4HnnwMO4YF3Ce7w==" }, + "css-to-react-native": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/css-to-react-native/-/css-to-react-native-3.0.0.tgz", + "integrity": "sha512-Ro1yETZA813eoyUp2GDBhG2j+YggidUmzO1/v9eYBKR2EHVEniE2MI/NqpTQ954BMpTPZFsGNPm46qFB9dpaPQ==", + "requires": { + "camelize": "^1.0.0", + "css-color-keywords": "^1.0.0", + "postcss-value-parser": "^4.0.2" + } + }, "css-tree": { "version": "1.0.0-alpha.37", "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.0.0-alpha.37.tgz", @@ -5185,84 +5284,18 @@ } } }, - "eslint": { - "version": "6.8.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.8.0.tgz", - "integrity": "sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==", + "eslint-config-prettier": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.11.0.tgz", + "integrity": "sha512-oB8cpLWSAjOVFEJhhyMZh6NOEOtBVziaqdDQ86+qhDHFbZXoRTM7pNSvFRfW/W/L/LrQ38C99J5CGuRBBzBsdA==", "requires": { - "@babel/code-frame": "^7.0.0", - "ajv": "^6.10.0", - "chalk": "^2.1.0", - "cross-spawn": "^6.0.5", - "debug": "^4.0.1", - "doctrine": "^3.0.0", - "eslint-scope": "^5.0.0", - "eslint-utils": "^1.4.3", - "eslint-visitor-keys": "^1.1.0", - "espree": "^6.1.2", - "esquery": "^1.0.1", - "esutils": "^2.0.2", - "file-entry-cache": "^5.0.1", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^5.0.0", - "globals": "^12.1.0", - "ignore": "^4.0.6", - "import-fresh": "^3.0.0", - "imurmurhash": "^0.1.4", - "inquirer": "^7.0.0", - "is-glob": "^4.0.0", - "js-yaml": "^3.13.1", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.3.0", - "lodash": "^4.17.14", - "minimatch": "^3.0.4", - "mkdirp": "^0.5.1", - "natural-compare": "^1.4.0", - "optionator": "^0.8.3", - "progress": "^2.0.0", - "regexpp": "^2.0.1", - "semver": "^6.1.2", - "strip-ansi": "^5.2.0", - "strip-json-comments": "^3.0.1", - "table": "^5.2.3", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" + "get-stdin": "^6.0.0" }, "dependencies": { - "eslint-utils": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz", - "integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==", - "requires": { - "eslint-visitor-keys": "^1.1.0" - } - }, - "globals": { - "version": "12.4.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", - "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", - "requires": { - "type-fest": "^0.8.1" - } - }, - "import-fresh": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", - "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", - "requires": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - } - }, - "regexpp": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", - "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==" - }, - "resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==" + "get-stdin": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz", + "integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==" } } }, @@ -5467,6 +5500,14 @@ } } }, + "eslint-plugin-prettier": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.4.tgz", + "integrity": "sha512-jZDa8z76klRqo+TdGDTFJSavwbnWK2ZpqGKNZ+VvweMW516pDUMmQ2koXvxEE4JhzNvTv+radye/bWGBmA6jmg==", + "requires": { + "prettier-linter-helpers": "^1.0.0" + } + }, "eslint-plugin-react": { "version": "7.19.0", "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.19.0.tgz", @@ -5510,18 +5551,18 @@ "integrity": "sha512-iXTCFcOmlWvw4+TOE8CLWj6yX1GwzT0Y6cUfHHZqWnSk144VmVIRcVGtUAzrLES7C798lmvnt02C7rxaOX1HNA==" }, "eslint-scope": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz", - "integrity": "sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.0.tgz", + "integrity": "sha512-iiGRvtxWqgtx5m8EyQUJihBloE4EnYeGE/bz1wSPwJE6tZuJUtHlhqDM4Xj2ukE8Dyy1+HCZ4hE0fzIVMzb58w==", "requires": { "esrecurse": "^4.1.0", "estraverse": "^4.1.1" } }, "eslint-utils": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.0.0.tgz", - "integrity": "sha512-0HCPuJv+7Wv1bACm8y5/ECVfYdfsAm9xmVb7saeFlxjPYALefjhbYoCkBjPdPzGH8wWyTpAez82Fh3VKYEZ8OA==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", "requires": { "eslint-visitor-keys": "^1.1.0" } @@ -5531,16 +5572,6 @@ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz", "integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==" }, - "espree": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/espree/-/espree-6.2.1.tgz", - "integrity": "sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw==", - "requires": { - "acorn": "^7.1.1", - "acorn-jsx": "^5.2.0", - "eslint-visitor-keys": "^1.1.0" - } - }, "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", @@ -5555,9 +5586,9 @@ }, "dependencies": { "estraverse": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.1.0.tgz", - "integrity": "sha512-FyohXK+R0vE+y1nHLoBM7ZTyqRpqAlhdZHCWIWEviFLiGB8b04H6bQs8G+XTthacvT8VuwvteiP7RJSxMs8UEw==" + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==" } } }, @@ -5878,6 +5909,11 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==" }, + "fast-diff": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", + "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==" + }, "fast-glob": { "version": "2.2.7", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-2.2.7.tgz", @@ -6999,20 +7035,20 @@ "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" }, "inquirer": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.1.0.tgz", - "integrity": "sha512-5fJMWEmikSYu0nv/flMc475MhGbB7TSPd/2IpFV4I4rMklboCH2rQjYY5kKiYGHqUF9gvaambupcJFFG9dvReg==", + "version": "7.3.3", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.3.3.tgz", + "integrity": "sha512-JG3eIAj5V9CwcGvuOmoo6LB9kbAYT8HXffUl6memuszlwDC/qvFAJw49XJ5NROSFNPxp3iQg1GqkFhaY/CR0IA==", "requires": { "ansi-escapes": "^4.2.1", - "chalk": "^3.0.0", + "chalk": "^4.1.0", "cli-cursor": "^3.1.0", - "cli-width": "^2.0.0", + "cli-width": "^3.0.0", "external-editor": "^3.0.3", "figures": "^3.0.0", - "lodash": "^4.17.15", + "lodash": "^4.17.19", "mute-stream": "0.0.8", "run-async": "^2.4.0", - "rxjs": "^6.5.3", + "rxjs": "^6.6.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0", "through": "^2.3.6" @@ -7028,14 +7064,19 @@ } }, "chalk": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", - "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", "requires": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, + "cli-width": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", + "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==" + }, "color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -7054,6 +7095,19 @@ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" }, + "lodash": { + "version": "4.17.19", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", + "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==" + }, + "rxjs": { + "version": "6.6.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.2.tgz", + "integrity": "sha512-BHdBMVoWC2sL26w//BCu3YzKT4s2jip/WhwsGEDmeKYBhKDZeYezVUnHatYB7L85v5xs0BAQmg6BEYJEKxBabg==", + "requires": { + "tslib": "^1.9.0" + } + }, "strip-ansi": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", @@ -10957,6 +11011,19 @@ "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=" }, + "prettier": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz", + "integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==" + }, + "prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "requires": { + "fast-diff": "^1.1.2" + } + }, "pretty-bytes": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.3.0.tgz", @@ -11547,6 +11614,153 @@ "webpack-dev-server": "3.10.3", "webpack-manifest-plugin": "2.2.0", "workbox-webpack-plugin": "4.3.1" + }, + "dependencies": { + "@typescript-eslint/eslint-plugin": { + "version": "2.34.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.34.0.tgz", + "integrity": "sha512-4zY3Z88rEE99+CNvTbXSyovv2z9PNOVffTWD2W8QF5s2prBQtwN2zadqERcrHpcR7O/+KMI3fcTAmUUhK/iQcQ==", + "requires": { + "@typescript-eslint/experimental-utils": "2.34.0", + "functional-red-black-tree": "^1.0.1", + "regexpp": "^3.0.0", + "tsutils": "^3.17.1" + } + }, + "@typescript-eslint/experimental-utils": { + "version": "2.34.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz", + "integrity": "sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA==", + "requires": { + "@types/json-schema": "^7.0.3", + "@typescript-eslint/typescript-estree": "2.34.0", + "eslint-scope": "^5.0.0", + "eslint-utils": "^2.0.0" + } + }, + "@typescript-eslint/parser": { + "version": "2.34.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.34.0.tgz", + "integrity": "sha512-03ilO0ucSD0EPTw2X4PntSIRFtDPWjrVq7C3/Z3VQHRC7+13YB55rcJI3Jt+YgeHbjUdJPcPa7b23rXCBokuyA==", + "requires": { + "@types/eslint-visitor-keys": "^1.0.0", + "@typescript-eslint/experimental-utils": "2.34.0", + "@typescript-eslint/typescript-estree": "2.34.0", + "eslint-visitor-keys": "^1.1.0" + } + }, + "@typescript-eslint/typescript-estree": { + "version": "2.34.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz", + "integrity": "sha512-OMAr+nJWKdlVM9LOqCqh3pQQPwxHAN7Du8DR6dmwCrAmxtiXQnhHJ6tBNtf+cggqfo51SG/FCwnKhXCIM7hnVg==", + "requires": { + "debug": "^4.1.1", + "eslint-visitor-keys": "^1.1.0", + "glob": "^7.1.6", + "is-glob": "^4.0.1", + "lodash": "^4.17.15", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + }, + "dependencies": { + "semver": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==" + } + } + }, + "eslint": { + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.8.0.tgz", + "integrity": "sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==", + "requires": { + "@babel/code-frame": "^7.0.0", + "ajv": "^6.10.0", + "chalk": "^2.1.0", + "cross-spawn": "^6.0.5", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "eslint-scope": "^5.0.0", + "eslint-utils": "^1.4.3", + "eslint-visitor-keys": "^1.1.0", + "espree": "^6.1.2", + "esquery": "^1.0.1", + "esutils": "^2.0.2", + "file-entry-cache": "^5.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.0.0", + "globals": "^12.1.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "inquirer": "^7.0.0", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.3.0", + "lodash": "^4.17.14", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "natural-compare": "^1.4.0", + "optionator": "^0.8.3", + "progress": "^2.0.0", + "regexpp": "^2.0.1", + "semver": "^6.1.2", + "strip-ansi": "^5.2.0", + "strip-json-comments": "^3.0.1", + "table": "^5.2.3", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "dependencies": { + "eslint-utils": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz", + "integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==", + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, + "regexpp": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", + "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==" + } + } + }, + "espree": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-6.2.1.tgz", + "integrity": "sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw==", + "requires": { + "acorn": "^7.1.1", + "acorn-jsx": "^5.2.0", + "eslint-visitor-keys": "^1.1.0" + } + }, + "globals": { + "version": "12.4.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", + "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", + "requires": { + "type-fest": "^0.8.1" + } + }, + "import-fresh": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", + "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==" + } } }, "react-transition-group": { @@ -12438,6 +12652,11 @@ } } }, + "shallowequal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/shallowequal/-/shallowequal-1.1.0.tgz", + "integrity": "sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ==" + }, "shebang-command": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", @@ -13133,9 +13352,9 @@ } }, "strip-json-comments": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.0.tgz", - "integrity": "sha512-e6/d0eBu7gHtdCqFt0xJr642LdToM5/cN4Qb9DbHjVx1CP5RyeM+zH7pbecEmDv/lBqb0QH+6Uqq75rxFPkM0w==" + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==" }, "style-loader": { "version": "0.23.1", @@ -13158,6 +13377,23 @@ } } }, + "styled-components": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/styled-components/-/styled-components-5.1.1.tgz", + "integrity": "sha512-1ps8ZAYu2Husx+Vz8D+MvXwEwvMwFv+hqqUwhNlDN5ybg6A+3xyW1ECrAgywhvXapNfXiz79jJyU0x22z0FFTg==", + "requires": { + "@babel/helper-module-imports": "^7.0.0", + "@babel/traverse": "^7.4.5", + "@emotion/is-prop-valid": "^0.8.8", + "@emotion/stylis": "^0.8.4", + "@emotion/unitless": "^0.7.4", + "babel-plugin-styled-components": ">= 1", + "css-to-react-native": "^3.0.0", + "hoist-non-react-statics": "^3.0.0", + "shallowequal": "^1.1.0", + "supports-color": "^5.5.0" + } + }, "stylehacks": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-4.0.3.tgz", @@ -13877,9 +14113,9 @@ "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" }, "v8-compile-cache": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz", - "integrity": "sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g==" + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz", + "integrity": "sha512-8OQ9CL+VWyt3JStj7HX7/ciTL2V3Rl1Wf5OL+SNTm0yK1KvtReVulksyeRnCANHHuUxHlQig+JJDlUhBt1NQDQ==" }, "validate-npm-package-license": { "version": "3.0.4", diff --git a/package.json b/package.json index ccb0384..24feab5 100644 --- a/package.json +++ b/package.json @@ -20,15 +20,21 @@ "@types/node": "^12.12.42", "@types/react": "^16.9.35", "@types/react-dom": "^16.9.8", + "@types/styled-components": "^5.1.2", + "@typescript-eslint/parser": "^3.9.0", "axios": "^0.19.2", "axios-extensions": "^3.1.3", + "eslint-config-prettier": "^6.11.0", + "eslint-plugin-prettier": "^3.1.4", "immer": "^7.0.5", "install": "^0.13.0", "node-sass": "^4.14.1", + "prettier": "^2.0.5", "react": "^16.13.1", "react-dom": "^16.13.1", "react-scripts": "3.4.1", "sass": "^1.26.5", + "styled-components": "^5.1.1", "to": "^0.2.9", "typescript": "^3.9.3", "use-immer": "^0.4.0" diff --git a/src/App.scss b/src/App.scss deleted file mode 100644 index 7113279..0000000 --- a/src/App.scss +++ /dev/null @@ -1,14 +0,0 @@ -body { - margin: 0px; - padding: 0px; - } - body::-webkit-scrollbar { - display: none; - } - .wraper{ - display: flex; - &__calendar{ - flex-grow: 3; - } - } - diff --git a/src/App.tsx b/src/App.tsx index 11a0525..2188477 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,55 +1,40 @@ -import React, { useState } from "react"; -import TopBar from "./components/TopBar/"; -import Transfer from "./components/Transfer/"; -import "./App.scss"; -import {Scheduler} from "./components/Scheduler"; -import RightBar from "./components/RightBar"; -import { lectures } from "./businesslogic/mockData/lectures"; +import React, { useState, useContext } from 'react'; +import TopBar from './components/TopBar/'; +import Transfer from './components/Transfer/'; +import { Scheduler } from './components/Scheduler'; +import RightBar from './components/RightBar'; +import { CASContext } from './contexts/CASProvider'; +import styled from 'styled-components'; -import BusinessLogicContext from "./businesslogic/BusinessLogicContext"; -import { BuisnessProvided } from "./businesslogic/BusinessLogicProvider"; +const Wrapper = styled.div` + display: flex; +`; -function App() { - const [isOpenTransfer, setOpenTransfer] = useState(false); +export const App = () => { + const [isOpenTransfer, setOpenTransfer] = useState(false); + const { logout } = useContext(CASContext)!; - return ( -
- - {(context) => ( - { - setOpenTransfer(!isOpenTransfer); - }} - onLangChange={(e) => { - console.log(e); - }} - handleLogout={() => { - (context as BuisnessProvided).reducers.userlogout(); - }} - /> - )} - - { - setOpenTransfer(!isOpenTransfer); - }} - /> -
-
- -
-
- { - }} - /> -
-
-
- ); -} + const handleCloseTransfer = () => { + setOpenTransfer(!isOpenTransfer); + }; -export default App; + const onLangChange = () => { + console.log('Language changed'); + }; + + const onGroupMouseOver = () => { + console.log(`On groupmouse over`); + }; + + return ( + <> + + + + + + + + ); +}; diff --git a/src/businesslogic/BusinessLogicContext.ts b/src/businesslogic/BusinessLogicContext.ts deleted file mode 100644 index 40ffea1..0000000 --- a/src/businesslogic/BusinessLogicContext.ts +++ /dev/null @@ -1,5 +0,0 @@ -import React from "react"; - -const BusinessLogicContext = React.createContext({}); - -export default BusinessLogicContext; diff --git a/src/businesslogic/BusinessLogicProvider.tsx b/src/businesslogic/BusinessLogicProvider.tsx deleted file mode 100644 index 9e90320..0000000 --- a/src/businesslogic/BusinessLogicProvider.tsx +++ /dev/null @@ -1,76 +0,0 @@ -import BusinessLogicContext from "./BusinessLogicContext"; -import React, { Component } from "react"; -import { User } from "./types/user"; - -export interface BuisnessProvided { - states: BusinessState; - reducers: { - userlogout: () => void; - }; -} - -interface BusinessState { - user: User | null; -} - -interface Props {} - -class BusinessLogicProvider extends Component { - constructor(props: Props) { - super(props); - this.state = { - user: null, - }; - } - - componentDidMount() { - this.login(); - } - - login() { - const urlParams = new URLSearchParams(window.location.search); - const ticket = urlParams.get("ticket"); - - if (!ticket) { - this.redirectToCASLoginService(); - } - if (ticket) { - this.setState({ user: { ticket } }); - } - } - - logout() { - this.redirectToCASLogoutService(); - } - - redirectToCASLogoutService() { - window.location.replace( - `https://cas.amu.edu.pl/cas/logout?service=${window.origin}` - ); - } - - redirectToCASLoginService() { - window.location.replace( - `https://cas.amu.edu.pl/cas/login?service=${window.origin}&locale=pl` - ); - } - - render() { - return ( - { - this.logout(); - }, - }, - }} - > - {this.props.children} - - ); - } -} - -export default BusinessLogicProvider; diff --git a/src/businesslogic/LecturesProvider.tsx b/src/businesslogic/LecturesProvider.tsx deleted file mode 100644 index d56189f..0000000 --- a/src/businesslogic/LecturesProvider.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import React, { useState } from "react"; -import { Lecture } from "./types/lecture"; -import { Group } from "./types/group"; -interface ILectureContext { - lectures: Array; - addLecture: (lectures: Lecture) => void; -} -export const LecturesContext = React.createContext({ - lectures: Array(), - choosenGroups: Array(), - addLecture: (lecture: Lecture) => {}, - addGroup: (group : Group) => {} -}); - -export const LecturesProvider: React.FC = (props) => { - const [lectures, setLectures] = useState>([]); - const [choosenGroups, setChoosenGroups] = useState>([]); - const addLecture = (lecture: Lecture) => { - setLectures([...lectures, lecture]); - }; - const addGroup = (group : Group) => { - setChoosenGroups([...choosenGroups, group]); - }; - - - return ( - - {props.children} - - ); -}; diff --git a/src/businesslogic/mockData/lectures.ts b/src/businesslogic/mockData/lectures.ts deleted file mode 100644 index 1b6b73d..0000000 --- a/src/businesslogic/mockData/lectures.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Lecture } from "../types/lecture"; - -export const lectures: Array = [ - { - name: "E-gospodarka - narzędzia i bezpieczeństwo", - groups: [ - { - id: "1CB", - day: "Pn", - time: "10:00", - lecturer: "dr inż. Michał Ren", - room: "A2-01", - }, - { - id: "1XD", - day: "Wt", - time: "12:00", - lecturer: "dr inż. Michał Ren", - room: "A3-01", - }, - ], - }, - { - name: "Statystyka", - groups: [ - { - id: "2CB", - day: "Pn", - time: "10:00", - lecturer: "dr inż. Michał Ren", - room: "A2-01", - }, - { - id: "2XD", - day: "Wt", - time: "12:00", - lecturer: "dr inż. Michał Ren", - room: "A3-01", - }, - ], - }, -]; diff --git a/src/businesslogic/types/group.ts b/src/businesslogic/types/group.ts deleted file mode 100644 index af6e89e..0000000 --- a/src/businesslogic/types/group.ts +++ /dev/null @@ -1,7 +0,0 @@ -export interface Group { - id: string; - day: string; - time: string; - lecturer: string; - room: string; -} \ No newline at end of file diff --git a/src/businesslogic/types/lecture.ts b/src/businesslogic/types/lecture.ts deleted file mode 100644 index 604f44c..0000000 --- a/src/businesslogic/types/lecture.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Group } from "./group"; - -export interface Lecture { - id?: number; - name: string; - groups: Array; -} diff --git a/src/businesslogic/types/lectureInit.ts b/src/businesslogic/types/lectureInit.ts deleted file mode 100644 index 8d2869d..0000000 --- a/src/businesslogic/types/lectureInit.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface LectureInit { - name: string; - id: number; -} diff --git a/src/businesslogic/types/user.ts b/src/businesslogic/types/user.ts deleted file mode 100644 index 3f125a3..0000000 --- a/src/businesslogic/types/user.ts +++ /dev/null @@ -1,5 +0,0 @@ -export interface User { - name?: string; - surname?: string; - ticket: string | null; -}; diff --git a/src/components/RightBar/LectureCard/index.tsx b/src/components/RightBar/LectureCard/index.tsx index 4f15f71..54a90d2 100644 --- a/src/components/RightBar/LectureCard/index.tsx +++ b/src/components/RightBar/LectureCard/index.tsx @@ -1,10 +1,9 @@ -import React, {useContext} from "react"; -import "./index.scss"; -import Collapse from "@material-ui/core/Collapse"; -import ExpandIcon from "./expand.png"; -import { Lecture } from "../../../businesslogic/types/lecture"; -import { Group } from "../../../businesslogic/types/group"; -import { LecturesContext } from "../../../businesslogic/LecturesProvider"; +import React, { useContext } from 'react'; +import './index.scss'; +import Collapse from '@material-ui/core/Collapse'; +import ExpandIcon from './expand.png'; +import { Lecture, Group } from '../../../types/index'; +import { LecturesContext } from '../../../contexts/LecturesProvider'; interface LectureCardProps { onGroupMouseOver: (id: string, name: string) => void; @@ -14,31 +13,17 @@ interface LectureCardProps { isSelected: boolean; } -export default function LectureCard({ - onGroupMouseOver, - onCardClick, - lecture, - id, - isSelected, -}: LectureCardProps) { +export default function LectureCard({ onGroupMouseOver, onCardClick, lecture, id, isSelected }: LectureCardProps) { + const { addGroup } = useContext(LecturesContext)!; - const {addGroup} = useContext(LecturesContext); - - - function onGroupClick(group : Group){ - addGroup(group); + function onGroupClick(group: Group) { + addGroup(group); } - return (
{lecture.name}
- + {lecture.groups.map((group, index) => (

{group.time} {group.room}

{group.lecturer} -

{" "} +

{' '}
))}
- expand + expand
); diff --git a/src/components/RightBar/index.tsx b/src/components/RightBar/index.tsx index c3d1bc5..ecef611 100644 --- a/src/components/RightBar/index.tsx +++ b/src/components/RightBar/index.tsx @@ -1,27 +1,21 @@ -import React, { useState, useContext } from "react"; -import "./index.scss"; -import { Lecture } from "../../businesslogic/types/lecture"; -import LectureCard from "./LectureCard"; -import { LecturesContext } from "../../businesslogic/LecturesProvider"; +import React, { useState, useContext } from 'react'; +import './index.scss'; +import { Lecture } from '../../types'; +import LectureCard from './LectureCard'; +import { LecturesContext } from '../../contexts/LecturesProvider'; interface RightBarProps { onGroupMouseOver: (id: string, name: string) => void; - lectures: Array; } -export default function RightBar({ - lectures, - onGroupMouseOver, -}: RightBarProps) { +export default function RightBar({ onGroupMouseOver }: RightBarProps) { const [selectedCardId, setSelectedCardId] = useState(null); const lecturesContext = useContext(LecturesContext); const onCardClick = (e: React.MouseEvent) => { const target = e.currentTarget as HTMLElement; - selectedCardId === target.id - ? setSelectedCardId(null) - : setSelectedCardId(target.id); + selectedCardId === target.id ? setSelectedCardId(null) : setSelectedCardId(target.id); }; return ( @@ -30,7 +24,7 @@ export default function RightBar({ Hubert Wrzesiński

Semestr zimowy 2020/2021
- {lecturesContext.lectures.map((lecture, index) => ( + {lecturesContext?.lectures.map((lecture, index) => ( void; - isEventable?: boolean; -} - -export const Cell = ({ - colIndex, - index, - term, - handleClick, - isEventable, -}: CellProps) => { - return ( -
- {isEventable || term} -
- ); -}; diff --git a/src/components/Scheduler/Column/index.scss b/src/components/Scheduler/Column/index.scss deleted file mode 100644 index e69de29..0000000 diff --git a/src/components/Scheduler/Column/index.tsx b/src/components/Scheduler/Column/index.tsx deleted file mode 100644 index e200b65..0000000 --- a/src/components/Scheduler/Column/index.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import React from "react"; -import { Cell } from "../Cell"; - -interface ColumnProps { - hours: Array; - handleClick?: (e: React.MouseEvent) => void; - children?: React.ReactNode; - colIndex?: number; - isEventable?: boolean; -} - -export const Column = ({ - hours, - colIndex, - isEventable, - children, - ...rest -}: ColumnProps) => { - return ( -
- {hours.map((hour, index) => ( - - ))} - {children} -
- ); -}; diff --git a/src/components/Scheduler/SchedulerEvents/index.tsx b/src/components/Scheduler/SchedulerEvents/index.tsx index d02c2fa..999dd0a 100644 --- a/src/components/Scheduler/SchedulerEvents/index.tsx +++ b/src/components/Scheduler/SchedulerEvents/index.tsx @@ -1,86 +1,81 @@ -import React, { useContext, useEffect, useState } from "react"; -import { SchedulerRow } from "../SchedulerRow"; -import { LecturesContext } from "../../../businesslogic/LecturesProvider"; -import { Group } from "../../../businesslogic/types/group"; +import React, { useContext, useEffect, useState } from 'react'; +import { SchedulerRow } from '../SchedulerRow'; +import { LecturesContext } from '../../../contexts/LecturesProvider'; +import { Group } from '../../../types'; interface SchedulerEventsProps { cellTop: number; cellWidth: number; } -export const SchedulerEvents = ({ - cellTop, - cellWidth, -}: SchedulerEventsProps) => { - // const handleEventClick = (e: React.MouseEvent) => { - // const eventDiv = e.target as HTMLDivElement; - // eventDiv.style.backgroundColor = "#1547C5"; - // }; - - const { choosenGroups } = useContext(LecturesContext); +export const SchedulerEvents = ({ cellTop, cellWidth }: SchedulerEventsProps) => { + const { choosenGroups } = useContext(LecturesContext)!; const [groupsMappedToEvents, setGroupsMappedToEvents] = useState([]); - - // const groups: Array = [{ id: "5", day: "4", time: "11.45", lecturer: "dr Dorota Blinkiewicz", room: "A2-3" }, // { id: "28", day: "1", time: "13.45", lecturer: "dr Barbara Kołodziejczak", room: "D-3" }, // { id: "69", day: "4", time: "15.30", lecturer: "dr Karol Gierszewski", room: "A2-3" }]; - interface GroupTimeToEventRowMapping { - [time: string]: number + [time: string]: number; } const groupTimeToEventRowMapping: GroupTimeToEventRowMapping = { - "8.15": 0, - "10.00": 1, - "11.45": 2, - "13.45": 3, - "15.30": 4, - "17.15": 5, - } - - - + '8.15': 0, + '10.00': 1, + '11.45': 2, + '13.45': 3, + '15.30': 4, + '17.15': 5, + }; useEffect(() => { function mapGroupTimeToEventRow(groups: Array) { for (const group of groups) { console.log(group); - const groupTime = group.time + const groupTime = group.time; const eventRow: number = groupTimeToEventRowMapping[groupTime]; - const groupMappedToEvent: any = { id: group.id, day: group.day, eventRow: eventRow, lecturer: group.lecturer, room: group.room }; + const groupMappedToEvent: any = { + id: group.id, + day: group.day, + eventRow: eventRow, + lecturer: group.lecturer, + room: group.room, + }; setGroupsMappedToEvents((groupsMappedToEvents: any) => [...groupsMappedToEvents, groupMappedToEvent]); } + function alternative(groups: Array) { + const groupsMapped = choosenGroups.map(({ id, day, lecturer, room, time }) => ({ + id, + day, + lecturer, + room, + eventRow: groupTimeToEventRowMapping[time], + })); + setGroupsMappedToEvents(groupsMapped); + } } mapGroupTimeToEventRow(choosenGroups); }, [choosenGroups]); - useEffect(() => { console.log(groupsMappedToEvents); - }, [groupsMappedToEvents]); - return ( - -
- { - [...Array(6)].map((_, index) => ( - { return group.eventRow === index })} - indexRow={index} - cellTop={cellTop + (10 + 70 * index)} - cellWidth={cellWidth} - /> - )) - } - - + {[...Array(6)].map((_, index) => ( + { + return group.eventRow === index; + })} + indexRow={index} + cellTop={cellTop + (10 + 70 * index)} + cellWidth={cellWidth} + /> + ))}
); }; diff --git a/src/components/Scheduler/SchedulerRow/index.tsx b/src/components/Scheduler/SchedulerRow/index.tsx index dd1f693..79cd7e8 100644 --- a/src/components/Scheduler/SchedulerRow/index.tsx +++ b/src/components/Scheduler/SchedulerRow/index.tsx @@ -1,5 +1,22 @@ -import React from "react"; -import { Group } from "../../../businesslogic/types/group"; +import React from 'react'; +import { Group } from '../../../types'; +import styled from 'styled-components'; + +interface SchedulerEventProps { + eventIndex: number; + cellTop: number; + cellWidth: number; +} + +const SchedulerEvent = styled.div` + position: absolute; + top: ${(props) => props.cellTop}px; + left: ${(props) => props.cellWidth + 5 + props.cellWidth * props.eventIndex}px; + width: ${(props) => (props.cellWidth * 2) / 3}px; + height: 60px; + background-color: lightblue; + z-index: 2; +`; interface SchedulerRowProps { groups: Array; @@ -8,44 +25,24 @@ interface SchedulerRowProps { cellWidth: number; } -export const SchedulerRow = ({ - groups, - indexRow, - cellTop, - cellWidth, -}: SchedulerRowProps) => { - // const handleEventClick = (e: React.MouseEvent) => { - // const eventDiv = e.target as HTMLDivElement; - // eventDiv.style.backgroundColor = "#1547C5"; - // }; - - console.log(`You passed me these of a groupzzz: ${groups}`) - +export const SchedulerRow = ({ groups, indexRow, cellTop, cellWidth }: SchedulerRowProps) => { + console.log(`You passed me these of a groupzzz: ${groups}`); return ( -
+ <> {[...Array(5)].map((value, eventIndex) => ( -
- {groups.map((group, index) => - ( - parseInt(group.day) === eventIndex ?
{groups[index]?.lecturer}
- : null - ))} -
+ parseInt(group.day) === eventIndex ?
{groups[index]?.lecturer}
: null, + )} + ))} -
+ ); }; diff --git a/src/components/Scheduler/index.scss b/src/components/Scheduler/index.scss deleted file mode 100644 index 8a0764f..0000000 --- a/src/components/Scheduler/index.scss +++ /dev/null @@ -1,26 +0,0 @@ -.scheduler { - margin-top: 20px; - border-collapse: collapse; - - - .tbody { - display: flex; - &__column { - display: flex; - flex-direction: column; - position: relative; - flex: 1; - } - } - - .td, - .th { - border: 1px solid #ddd; - padding: 10px; - text-align: center; - flex: 1; - } - .td:hover { - background-color: #ddd; - } -} diff --git a/src/components/Scheduler/index.tsx b/src/components/Scheduler/index.tsx index dcf8a5f..40522c9 100644 --- a/src/components/Scheduler/index.tsx +++ b/src/components/Scheduler/index.tsx @@ -1,61 +1,45 @@ import React, { useEffect, useRef } from "react"; import { useState } from "react"; -import "./index.scss"; import { SchedulerEvents } from "./SchedulerEvents"; -const days = ["", "poniedziałek", "wtorek", "środa", "czwartek", "piątek"]; +import { days, hours } from "../../constants/index"; +import styled from "styled-components"; -const hours = [ - "8:00", - "9:00", - "10:00", - "11:00", - "12:00", - "13:00", - "14:00", - "15:00", - "16:00", - "17:00", - "18:00", - "19:00", -]; +const SchedulerWrapper = styled.div` + flex-grow: 3; + margin-top: 20px; + border-collapse: collapse; +`; -let events: Array = []; -for (let i = 0; i < hours.length / 2; i++) { - events.push(i); -} +const TableBody = styled.div` + width: 100%; + height: 100%; + display: flex; + flex-direction: column; +`; -let center: "center" = "center"; -let row: "row" = "row"; -let column: "column" = "column"; -// const collapse: "collapse" = "collapse"; -const tbodyStyles = { - width: "100%", - height: "100%", - display: "flex", - flexDirection: column, -}; +const TableRow = styled.div` + display: flex; + flex-direction: row; +`; -const rowStyles = { - display: "flex", - flexDirection: row, -}; +const TableCell = styled.div` + border: 1px solid #ddd; + padding: 10px; + text-align: center; + flex: 1; +`; -const cellStyles = { - border: "1px solid #ddd", - padding: "10px", - textAlign: center, - flex: 1, -}; +const TableHead = styled.div` + display: flex; + width: 100%; +`; -const theadStyles = { - display: "flex", - width: "100%", -}; - -// const scheduler = { -// marginTop: "20px", -// borderCollapse: collapse, -// }; +const TableHeadCell = styled.div` + border: 1px solid #ddd; + padding: 10px; + text-align: center; + flex: 1; +`; export const Scheduler = () => { const [currentEventsIds, setCurrentEventsIds] = useState>([]); @@ -63,7 +47,6 @@ export const Scheduler = () => { const [cellWidth, setCellWidth] = useState(0); const [cellTop, setCellTop] = useState(0); - useEffect(() => { const handleResize = () => { if (cellRef.current) { @@ -98,29 +81,30 @@ export const Scheduler = () => { return ( <> -
-
+ + {days.map((day, index) => ( -
- {day} -
+ {day} ))} -
-
+ + {hours.map((hour, indexRow) => ( -
+ {[hour, "", "", "", "", ""].map((value, indexCell) => indexRow === 0 && indexCell === 1 ? ( -
+ ) : ( -
{value}
+ {value} ) )} -
+ ))} -
+ -
+ ); }; diff --git a/src/components/TopBar/Results/index.tsx b/src/components/TopBar/Results/index.tsx index 7068d1c..e365673 100644 --- a/src/components/TopBar/Results/index.tsx +++ b/src/components/TopBar/Results/index.tsx @@ -1,11 +1,10 @@ -import React, { useState, useContext, useEffect } from "react"; -import axios from "axios"; -import { Input } from "@material-ui/core"; -import "./index.scss"; -import ClickAwayListener from "@material-ui/core/ClickAwayListener"; -import { LecturesContext } from "../../../businesslogic/LecturesProvider"; -import { Lecture } from "../../../businesslogic/types/lecture"; -import { Group } from "../../../businesslogic/types/group"; +import React, { useState, useContext, useEffect } from 'react'; +import axios from 'axios'; +import { Input } from '@material-ui/core'; +import './index.scss'; +import ClickAwayListener from '@material-ui/core/ClickAwayListener'; +import { LecturesContext } from '../../../contexts/LecturesProvider'; +import { Lecture, Group } from '../../../types'; interface LectureData { name: string; @@ -13,14 +12,12 @@ interface LectureData { } export const Results: React.FC = () => { - const [input, setInput] = useState(""); + const [input, setInput] = useState(''); const [lecturesData, setLecturesData] = useState>([]); - const [filteredLecturesData, setFilteredLecturesData] = useState< - Array - >([]); + const [filteredLecturesData, setFilteredLecturesData] = useState>([]); const [open, setOpen] = React.useState(false); - const lecturesContext = useContext(LecturesContext); + const lecturesContext = useContext(LecturesContext)!; //fetch lectures ids and lectures names // useEffect(() => { @@ -36,12 +33,10 @@ export const Results: React.FC = () => { useEffect(() => { const fetchData = async () => { const results = await axios.get(`http://localhost:1287/getCourses?name=`); - const lecturesData = results.data.map( - (result: { id: number; name: string }) => ({ - id: result.id, - name: result.name, - }) - ); + const lecturesData = results.data.map((result: { id: number; name: string }) => ({ + id: result.id, + name: result.name, + })); setLecturesData(lecturesData); }; @@ -51,8 +46,8 @@ export const Results: React.FC = () => { useEffect(() => { const names = lecturesContext.lectures.map((lecture) => lecture.name); const filterLectures = (value: string) => { - let filteredLectures = lecturesData.filter((lecture) => - lecture.name.toLowerCase().includes(value.toLowerCase()) && !names.includes(lecture.name) + let filteredLectures = lecturesData.filter( + (lecture) => lecture.name.toLowerCase().includes(value.toLowerCase()) && !names.includes(lecture.name), ); setFilteredLecturesData(filteredLectures); }; @@ -60,9 +55,7 @@ export const Results: React.FC = () => { }, [input, open]); const getLecturesById = async (id: string) => { - const { data } = await axios.get( - `http://localhost:1287/getClassesByCourseId?id=${id}` - ); + const { data } = await axios.get(`http://localhost:1287/getClassesByCourseId?id=${id}`); return data; }; @@ -92,12 +85,7 @@ export const Results: React.FC = () => { group.id = result[i].id; group.day = result[i].day; group.time = result[i].time; - group.lecturer = - result[i].lecturer.title + - " " + - result[i].lecturer.name + - " " + - result[i].lecturer.surname; + group.lecturer = result[i].lecturer.title + ' ' + result[i].lecturer.name + ' ' + result[i].lecturer.surname; group.room = result[i].room.trim(); lecture.groups.push(group); } @@ -113,7 +101,7 @@ export const Results: React.FC = () => {
{ {open ? (
{filteredLecturesData.map((lecture, index) => ( -
+

{lecture.name}

))} diff --git a/src/constants/index.ts b/src/constants/index.ts new file mode 100644 index 0000000..ad14654 --- /dev/null +++ b/src/constants/index.ts @@ -0,0 +1,22 @@ +export const days = [ + "", + "poniedziałek", + "wtorek", + "środa", + "czwartek", + "piątek", +]; +export const hours = [ + "8:00", + "9:00", + "10:00", + "11:00", + "12:00", + "13:00", + "14:00", + "15:00", + "16:00", + "17:00", + "18:00", + "19:00", +]; diff --git a/src/contexts/CASProvider.tsx b/src/contexts/CASProvider.tsx new file mode 100644 index 0000000..a46f549 --- /dev/null +++ b/src/contexts/CASProvider.tsx @@ -0,0 +1,48 @@ +import React, { useState, useEffect } from 'react'; +import { User } from '../types'; + +export interface CASContext { + user: User | null; + logout: () => void; +} + +export const CASContext = React.createContext(null); + +export interface CASProviderProps { + children: React.ReactNode; +} + +export const CASProvider = ({ children }: CASProviderProps) => { + const [user, setUser] = useState(null); + + useEffect(() => { + login(); + }, []); + + function login() { + const urlParams = new URLSearchParams(window.location.search); + const ticket = urlParams.get('ticket'); + + if (!ticket) { + redirectToCASLoginService(); + } + if (ticket) { + console.log(`Ticket is: ${ticket}`); + setUser({ ...user, ticket: ticket }); + } + } + + function logout() { + redirectToCASLogoutService(); + } + + function redirectToCASLogoutService() { + window.location.replace(`https://cas.amu.edu.pl/cas/logout?service=${window.origin}`); + } + + function redirectToCASLoginService() { + window.location.replace(`https://cas.amu.edu.pl/cas/login?service=${window.origin}&locale=pl`); + } + + return {children}; +}; diff --git a/src/contexts/LecturesProvider.tsx b/src/contexts/LecturesProvider.tsx new file mode 100644 index 0000000..be7f04a --- /dev/null +++ b/src/contexts/LecturesProvider.tsx @@ -0,0 +1,32 @@ +import React, { useState, createContext } from 'react'; +import { Lecture, Group } from '../types'; + +interface LectureContext { + lectures: Array; + choosenGroups: Array; + addLecture: (lectures: Lecture) => void; + addGroup: (group: Group) => void; +} +export const LecturesContext = createContext(null); + +interface LecturesProviderProps { + children: React.ReactNode; +} + +export const LecturesProvider = ({ children }: LecturesProviderProps) => { + const [lectures, setLectures] = useState>([]); + const [choosenGroups, setChoosenGroups] = useState>([]); + + const addLecture = (lecture: Lecture) => { + setLectures([...lectures, lecture]); + }; + const addGroup = (group: Group) => { + setChoosenGroups([...choosenGroups, group]); + }; + + return ( + + {children} + + ); +}; diff --git a/src/contexts/reducers.ts b/src/contexts/reducers.ts new file mode 100644 index 0000000..bb8b250 --- /dev/null +++ b/src/contexts/reducers.ts @@ -0,0 +1,8 @@ +export enum Types { + addLecture = 'ADD_LECTURE', + removeLecture = 'REMOVE_LECTURE', + addGroup = 'ADD_GROUP', + removeGroup = 'ADD_GROUP', + addCourse = 'ADD_COURSE', + removeCourse = 'REMOVE_COURSE', +} diff --git a/src/index.tsx b/src/index.tsx index 315593c..57d769e 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,16 +1,18 @@ -import React from "react"; -import ReactDOM from "react-dom"; -import App from "./App"; -import BuisnessLogicProvider from "./businesslogic/BusinessLogicProvider"; -import { LecturesProvider } from "./businesslogic/LecturesProvider"; +import React from 'react'; +import ReactDOM from 'react-dom'; +import { App } from './App'; +import { CASProvider } from './contexts/CASProvider'; +import { LecturesProvider } from './contexts/LecturesProvider'; +import { GlobalStyles } from './styles/GlobalStyles'; ReactDOM.render( - <> - - - - - - , - document.getElementById("root") + <> + + + + + + + , + document.getElementById('root'), ); diff --git a/src/styles/GlobalStyles.ts b/src/styles/GlobalStyles.ts new file mode 100644 index 0000000..4f68eaa --- /dev/null +++ b/src/styles/GlobalStyles.ts @@ -0,0 +1,20 @@ +import { createGlobalStyle } from 'styled-components'; + +export const GlobalStyles = createGlobalStyle` + *, *::before, *::after { + box-sizing: border-box; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + } + + body { + margin: 0; + padding: 0; + line-height: 24px; + + } + + body::-webkit-scrollbar { + display: none; + } +`; diff --git a/src/teest.tsx b/src/teest.tsx deleted file mode 100644 index 639a670..0000000 --- a/src/teest.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { withStyles } from '@material-ui/core/styles'; -import Button from '@material-ui/core/Button'; - -const styles = { - root: { - background: 'linear-gradient(45deg, #FE6B8B 30%, #FF8E53 90%)', - border: 0, - borderRadius: 3, - boxShadow: '0 3px 5px 2px rgba(255, 105, 135, .3)', - color: 'white', - height: 48, - padding: '0 30px', - }, -}; - -function HigherOrderComponent(props: { classes: any; }) { - const { classes } = props; - return ; -} - -HigherOrderComponent.propTypes = { - classes: PropTypes.object.isRequired, -}; - -export default withStyles(styles)(HigherOrderComponent); \ No newline at end of file diff --git a/src/types/index.ts b/src/types/index.ts new file mode 100644 index 0000000..d4aa768 --- /dev/null +++ b/src/types/index.ts @@ -0,0 +1,21 @@ +export interface Group { + id: string; + day: string; + time: string; + lecturer: string; + room: string; +} +export interface Lecture { + id?: number; + name: string; + groups: Array; +} +export interface LectureInit { + name: string; + id: number; +} +export interface User { + name?: string; + surname?: string; + ticket: string | null; +} From 3fba8a4a236633e3edfad97983e34586e5368b9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciek=20G=C5=82owacki?= Date: Wed, 12 Aug 2020 20:52:53 +0200 Subject: [PATCH 16/27] Refactor again --- .../{LectureCard => CourseCard}/expand.png | Bin .../{LectureCard => CourseCard}/index.scss | 0 src/components/RightBar/CourseCard/index.tsx | 50 ++++++++++ src/components/RightBar/LectureCard/index.tsx | 45 --------- src/components/RightBar/index.tsx | 16 +-- .../Scheduler/SchedulerEvents/index.tsx | 12 +-- .../Scheduler/SchedulerRow/index.tsx | 2 +- src/components/TopBar/Results/index.scss | 5 +- src/components/TopBar/Results/index.tsx | 94 +++++++++--------- src/contexts/CoursesProvider.tsx | 32 ++++++ src/contexts/LecturesProvider.tsx | 32 ------ src/contexts/reducers.ts | 8 +- src/index.tsx | 6 +- src/types/index.ts | 18 +++- 14 files changed, 163 insertions(+), 157 deletions(-) rename src/components/RightBar/{LectureCard => CourseCard}/expand.png (100%) rename src/components/RightBar/{LectureCard => CourseCard}/index.scss (100%) create mode 100644 src/components/RightBar/CourseCard/index.tsx delete mode 100644 src/components/RightBar/LectureCard/index.tsx create mode 100644 src/contexts/CoursesProvider.tsx delete mode 100644 src/contexts/LecturesProvider.tsx diff --git a/src/components/RightBar/LectureCard/expand.png b/src/components/RightBar/CourseCard/expand.png similarity index 100% rename from src/components/RightBar/LectureCard/expand.png rename to src/components/RightBar/CourseCard/expand.png diff --git a/src/components/RightBar/LectureCard/index.scss b/src/components/RightBar/CourseCard/index.scss similarity index 100% rename from src/components/RightBar/LectureCard/index.scss rename to src/components/RightBar/CourseCard/index.scss diff --git a/src/components/RightBar/CourseCard/index.tsx b/src/components/RightBar/CourseCard/index.tsx new file mode 100644 index 0000000..e2ca19c --- /dev/null +++ b/src/components/RightBar/CourseCard/index.tsx @@ -0,0 +1,50 @@ +import React, { useContext } from 'react'; +import './index.scss'; +import Collapse from '@material-ui/core/Collapse'; +import ExpandIcon from './expand.png'; +import { Course, Group } from '../../../types/index'; +import { coursesContext } from '../../../contexts/CoursesProvider'; +import { group } from 'console'; + +interface CourseCardProps { + onGroupMouseOver: (id: number, name: string) => void; + onCardClick: (e: React.MouseEvent) => void; + course: Course; + id: string; + isSelected: boolean; +} + +export function CourseCard({ onGroupMouseOver, onCardClick, course, id, isSelected }: CourseCardProps) { + const { addGroup, courses } = useContext(coursesContext)!; + + function onGroupClick(group: Group) { + addGroup(group); + } + + return ( +
+
{course.name}
+ + {courses.map((course, index) => ( + <> + {course.groups.map((group, index) => ( +
onGroupMouseOver(group.id, course.name)} + onClick={() => onGroupClick(group)} + > +

+ {group.time} {group.room}

{group.lecturer} +

{' '} +
+ ))} + + ))} +
+
+ expand +
+
+ ); +} diff --git a/src/components/RightBar/LectureCard/index.tsx b/src/components/RightBar/LectureCard/index.tsx deleted file mode 100644 index 54a90d2..0000000 --- a/src/components/RightBar/LectureCard/index.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import React, { useContext } from 'react'; -import './index.scss'; -import Collapse from '@material-ui/core/Collapse'; -import ExpandIcon from './expand.png'; -import { Lecture, Group } from '../../../types/index'; -import { LecturesContext } from '../../../contexts/LecturesProvider'; - -interface LectureCardProps { - onGroupMouseOver: (id: string, name: string) => void; - onCardClick: (e: React.MouseEvent) => void; - lecture: Lecture; - id: string; - isSelected: boolean; -} - -export default function LectureCard({ onGroupMouseOver, onCardClick, lecture, id, isSelected }: LectureCardProps) { - const { addGroup } = useContext(LecturesContext)!; - - function onGroupClick(group: Group) { - addGroup(group); - } - - return ( -
-
{lecture.name}
- - {lecture.groups.map((group, index) => ( -
onGroupMouseOver(group.id, lecture.name)} - onClick={() => onGroupClick(group)} - > -

- {group.time} {group.room}

{group.lecturer} -

{' '} -
- ))} -
-
- expand -
-
- ); -} diff --git a/src/components/RightBar/index.tsx b/src/components/RightBar/index.tsx index ecef611..ebcf2e6 100644 --- a/src/components/RightBar/index.tsx +++ b/src/components/RightBar/index.tsx @@ -1,17 +1,17 @@ import React, { useState, useContext } from 'react'; import './index.scss'; -import { Lecture } from '../../types'; -import LectureCard from './LectureCard'; -import { LecturesContext } from '../../contexts/LecturesProvider'; +import { Course } from '../../types'; +import { CourseCard } from './CourseCard/index'; +import { coursesContext } from '../../contexts/CoursesProvider'; interface RightBarProps { - onGroupMouseOver: (id: string, name: string) => void; + onGroupMouseOver: (id: number, name: string) => void; } export default function RightBar({ onGroupMouseOver }: RightBarProps) { const [selectedCardId, setSelectedCardId] = useState(null); - const lecturesContext = useContext(LecturesContext); + const { courses } = useContext(coursesContext)!; const onCardClick = (e: React.MouseEvent) => { const target = e.currentTarget as HTMLElement; @@ -24,9 +24,9 @@ export default function RightBar({ onGroupMouseOver }: RightBarProps) { Hubert Wrzesiński

Semestr zimowy 2020/2021
- {lecturesContext?.lectures.map((lecture, index) => ( - ( + { - const { choosenGroups } = useContext(LecturesContext)!; + const { choosenGroups } = useContext(coursesContext)!; const [groupsMappedToEvents, setGroupsMappedToEvents] = useState([]); - // const groups: Array = [{ id: "5", day: "4", time: "11.45", lecturer: "dr Dorota Blinkiewicz", room: "A2-3" }, - // { id: "28", day: "1", time: "13.45", lecturer: "dr Barbara Kołodziejczak", room: "D-3" }, - // { id: "69", day: "4", time: "15.30", lecturer: "dr Karol Gierszewski", room: "A2-3" }]; + // const groups: Array = [{ id: "5", day: "4", time: "11.45", courser: "dr Dorota Blinkiewicz", room: "A2-3" }, + // { id: "28", day: "1", time: "13.45", courser: "dr Barbara Kołodziejczak", room: "D-3" }, + // { id: "69", day: "4", time: "15.30", courser: "dr Karol Gierszewski", room: "A2-3" }]; interface GroupTimeToEventRowMapping { [time: string]: number; } const groupTimeToEventRowMapping: GroupTimeToEventRowMapping = { - '8.15': 0, + '08.15': 0, '10.00': 1, '11.45': 2, '13.45': 3, diff --git a/src/components/Scheduler/SchedulerRow/index.tsx b/src/components/Scheduler/SchedulerRow/index.tsx index 79cd7e8..ad8e434 100644 --- a/src/components/Scheduler/SchedulerRow/index.tsx +++ b/src/components/Scheduler/SchedulerRow/index.tsx @@ -39,7 +39,7 @@ export const SchedulerRow = ({ groups, indexRow, cellTop, cellWidth }: Scheduler id={`eventRow${indexRow}eventCol${eventIndex}`} > {groups.map((group, index) => - parseInt(group.day) === eventIndex ?
{groups[index]?.lecturer}
: null, + group.day === eventIndex ?
{groups[index]?.lecturer}
: null, )} ))} diff --git a/src/components/TopBar/Results/index.scss b/src/components/TopBar/Results/index.scss index 9c93f91..e1d64fe 100644 --- a/src/components/TopBar/Results/index.scss +++ b/src/components/TopBar/Results/index.scss @@ -1,4 +1,4 @@ -.lecture { +.course { position: relative; z-index: 10; padding: 5px; @@ -7,7 +7,7 @@ font-size: 18px; font-family: Lato; } -.lecture:hover{ +.course:hover { background-color: #d4b851; cursor: pointer; } @@ -21,4 +21,3 @@ .top-bar__input-field { width: 100%; } - diff --git a/src/components/TopBar/Results/index.tsx b/src/components/TopBar/Results/index.tsx index 8b8b75c..b1a94f8 100644 --- a/src/components/TopBar/Results/index.tsx +++ b/src/components/TopBar/Results/index.tsx @@ -3,59 +3,48 @@ import axios from 'axios'; import { Input } from '@material-ui/core'; import './index.scss'; import ClickAwayListener from '@material-ui/core/ClickAwayListener'; -import { LecturesContext } from '../../../contexts/LecturesProvider'; -import { Lecture, Group } from '../../../types'; +import { coursesContext } from '../../../contexts/CoursesProvider'; +import { Course, Group } from '../../../types'; -interface LectureData { +interface courseData { name: string; id: number; } export const Results: React.FC = () => { const [input, setInput] = useState(''); - const [lecturesData, setLecturesData] = useState>([]); - const [filteredLecturesData, setFilteredLecturesData] = useState>([]); + const [coursesData, setcoursesData] = useState>([]); + const [filteredcoursesData, setFilteredcoursesData] = useState>([]); const [open, setOpen] = React.useState(false); - const lecturesContext = useContext(LecturesContext)!; - - //fetch lectures ids and lectures names - // useEffect(() => { - // const fetchData = async () => { - // const {lecturesData } = await axios.get( - // `http://localhost:1287/getCourses?name=""` - // ); - // setLecturesData(lecturesData); - // }; - // fetchData(); - // }, []); + const { courses, addCourse } = useContext(coursesContext)!; useEffect(() => { const fetchData = async () => { - const results = await axios.get(`http://localhost:1287/getCourses?name=`); - const lecturesData = results.data.map((result: { id: number; name: string }) => ({ + const results = await axios.get(`http://localhost:1285/getCourses`); + const coursesData = results.data.map((result: { id: number; name: string }) => ({ id: result.id, name: result.name, })); - setLecturesData(lecturesData); + setcoursesData(coursesData); }; fetchData(); }, []); useEffect(() => { - const names = lecturesContext.lectures.map((lecture) => lecture.name); - const filterLectures = (value: string) => { - let filteredLectures = lecturesData.filter( - (lecture) => lecture.name.toLowerCase().includes(value.toLowerCase()) && !names.includes(lecture.name), + const names = courses.map((course) => course.name); + const filtercourses = (value: string) => { + let filteredcourses = coursesData.filter( + (course) => course.name.toLowerCase().includes(value.toLowerCase()) && !names.includes(course.name), ); - setFilteredLecturesData(filteredLectures); + setFilteredcoursesData(filteredcourses); }; - filterLectures(input); + filtercourses(input); }, [input, open]); - const getLecturesById = async (id: string) => { - const { data } = await axios.get(`http://localhost:1287/getClassesByCourseId?id=${id}`); + const getGroupsByCourseId = async (id: string) => { + const { data } = await axios.get(`http://localhost:1285/getCourseGroups?id=${id}`); return data; }; @@ -71,27 +60,34 @@ export const Results: React.FC = () => { setOpen(false); }; - const onLectureClick = async (e: React.MouseEvent) => { + const onCourseClick = async (e: React.MouseEvent) => { const target = e.currentTarget as HTMLElement; - const id = target.id; - const result = await getLecturesById(id); - - let groups: Array = []; - let lecture = { groups: groups } as Lecture; - lecture.id = result[0].course.id; - lecture.name = result[0].course.name; - for (let i = 0; i < result.length; i++) { - let group = {} as Group; - group.id = result[i].id; - group.day = result[i].day; - group.time = result[i].time; - group.lecturer = result[i].lecturer.title + ' ' + result[i].lecturer.name + ' ' + result[i].lecturer.surname; - group.room = result[i].room.trim(); - lecture.groups.push(group); + if (target.id && target.textContent) { + const id = target.id; + const name = target.textContent; + const groups = await getGroupsByCourseId(id); + const course: Course = { + name: name, + id: parseInt(id), + groups: groups, + }; + addCourse(course); + setOpen(false); } - lecturesContext.addLecture(lecture); - setOpen(false); + // let groups: Array = []; + // let course = { groups: groups } as course; + // course.id = result[0].course.id; + // course.name = result[0].course.name; + // for (let i = 0; i < result.length; i++) { + // let group = {} as Group; + // group.id = result[i].id; + // group.day = result[i].day; + // group.time = result[i].time; + // group.courser = result[i].courser.title + ' ' + result[i].courser.name + ' ' + result[i].courser.surname; + // group.room = result[i].room.trim(); + // course.groups.push(group); + // } }; return ( @@ -107,9 +103,9 @@ export const Results: React.FC = () => { /> {open ? (
- {filteredLecturesData.map((lecture, index) => ( -
-

{lecture.name}

+ {filteredcoursesData.map((course, index) => ( +
+

{course.name}

))}
diff --git a/src/contexts/CoursesProvider.tsx b/src/contexts/CoursesProvider.tsx new file mode 100644 index 0000000..6993e93 --- /dev/null +++ b/src/contexts/CoursesProvider.tsx @@ -0,0 +1,32 @@ +import React, { useState, createContext, useEffect } from 'react'; +import { Course, Group } from '../types'; + +interface courseContext { + courses: Array; + choosenGroups: Array; + addCourse: (courses: Course) => void; + addGroup: (group: Group) => void; +} +export const coursesContext = createContext(null); + +interface CoursesProviderProps { + children: React.ReactNode; +} + +export const CoursesProvider = ({ children }: CoursesProviderProps) => { + const [courses, setCourses] = useState>([]); + const [choosenGroups, setChoosenGroups] = useState>([]); + + const addCourse = (course: Course) => { + setCourses([...courses, course]); + }; + const addGroup = (group: Group) => { + setChoosenGroups([...choosenGroups, group]); + }; + + return ( + + {children} + + ); +}; diff --git a/src/contexts/LecturesProvider.tsx b/src/contexts/LecturesProvider.tsx deleted file mode 100644 index be7f04a..0000000 --- a/src/contexts/LecturesProvider.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import React, { useState, createContext } from 'react'; -import { Lecture, Group } from '../types'; - -interface LectureContext { - lectures: Array; - choosenGroups: Array; - addLecture: (lectures: Lecture) => void; - addGroup: (group: Group) => void; -} -export const LecturesContext = createContext(null); - -interface LecturesProviderProps { - children: React.ReactNode; -} - -export const LecturesProvider = ({ children }: LecturesProviderProps) => { - const [lectures, setLectures] = useState>([]); - const [choosenGroups, setChoosenGroups] = useState>([]); - - const addLecture = (lecture: Lecture) => { - setLectures([...lectures, lecture]); - }; - const addGroup = (group: Group) => { - setChoosenGroups([...choosenGroups, group]); - }; - - return ( - - {children} - - ); -}; diff --git a/src/contexts/reducers.ts b/src/contexts/reducers.ts index bb8b250..c936812 100644 --- a/src/contexts/reducers.ts +++ b/src/contexts/reducers.ts @@ -1,8 +1,6 @@ export enum Types { - addLecture = 'ADD_LECTURE', - removeLecture = 'REMOVE_LECTURE', - addGroup = 'ADD_GROUP', - removeGroup = 'ADD_GROUP', addCourse = 'ADD_COURSE', - removeCourse = 'REMOVE_COURSE', + removecourse = 'REMOVE_COURSE', + addGroup = 'ADD_GROUP', + removeGroup = 'REMOVE_GROUP', } diff --git a/src/index.tsx b/src/index.tsx index 57d769e..9c2e4c8 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -2,17 +2,17 @@ import React from 'react'; import ReactDOM from 'react-dom'; import { App } from './App'; import { CASProvider } from './contexts/CASProvider'; -import { LecturesProvider } from './contexts/LecturesProvider'; +import { CoursesProvider } from './contexts/CoursesProvider'; import { GlobalStyles } from './styles/GlobalStyles'; ReactDOM.render( <> - + - + , document.getElementById('root'), ); diff --git a/src/types/index.ts b/src/types/index.ts index d4aa768..d514202 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,16 +1,24 @@ +export enum GroupType { + course = 'course', + CLASS = 'class', +} + export interface Group { - id: string; - day: string; + id: number; + day: number; time: string; lecturer: string; room: string; + groupType: GroupType; + capacity?: number; } -export interface Lecture { - id?: number; + +export interface Course { + id: number; name: string; groups: Array; } -export interface LectureInit { +export interface courseInit { name: string; id: number; } From 324b83eecb3a74541f8d037ece7f69749da7a3b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciek=20G=C5=82owacki?= Date: Mon, 17 Aug 2020 19:21:14 +0200 Subject: [PATCH 17/27] added linter --- .eslintrc.js | 2 +- package-lock.json | 509 +++++++++------------------ package.json | 50 +-- src/components/TopBar/Profile.tsx | 57 ++- src/{contexts => styles}/reducers.ts | 0 tsconfig.json | 34 +- 6 files changed, 234 insertions(+), 418 deletions(-) rename src/{contexts => styles}/reducers.ts (100%) diff --git a/.eslintrc.js b/.eslintrc.js index 0d85867..45af087 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -8,7 +8,7 @@ module.exports = { 'plugin:react-hooks/recommended', ], parserOptions: { - ecmaVersion: 2018, + ecmaVersion: 2020, sourceType: 'module', ecmaFeatures: { jsx: true, diff --git a/package-lock.json b/package-lock.json index 6a18444..5e52ab3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,11 +4,6 @@ "lockfileVersion": 1, "requires": true, "dependencies": { - "-": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/-/-/--0.0.1.tgz", - "integrity": "sha512-3HfneK3DGAm05fpyj20sT3apkNcvPpCuccOThOPdzz8sY7GgQGe0l93XH9bt+YzibcTIgUAIMoyVJI740RtgyQ==" - }, "@babel/code-frame": { "version": "7.8.3", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz", @@ -1083,83 +1078,6 @@ "resolved": "https://registry.npmjs.org/@csstools/normalize.css/-/normalize.css-10.1.0.tgz", "integrity": "sha512-ij4wRiunFfaJxjB0BdrYHIH8FxBJpOwNPhhAcunlmPdXudL1WQV1qoP9un6JsEBAgQH+7UXyyjh0g7jTxXK6tg==" }, - "@date-io/core": { - "version": "1.3.13", - "resolved": "https://registry.npmjs.org/@date-io/core/-/core-1.3.13.tgz", - "integrity": "sha512-AlEKV7TxjeK+jxWVKcCFrfYAk8spX9aCyiToFIiLPtfQbsjmRGLIhb5VZgptQcJdHtLXo7+m0DuurwFgUToQuA==" - }, - "@date-io/moment": { - "version": "1.3.13", - "resolved": "https://registry.npmjs.org/@date-io/moment/-/moment-1.3.13.tgz", - "integrity": "sha512-3kJYusJtQuOIxq6byZlzAHoW/18iExJer9qfRF5DyyzdAk074seTuJfdofjz4RFfTd/Idk8WylOQpWtERqvFuQ==", - "requires": { - "@date-io/core": "^1.3.13" - } - }, - "@devexpress/dx-core": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/@devexpress/dx-core/-/dx-core-2.6.3.tgz", - "integrity": "sha512-MMOPm+UQdxliq0IidfsgOryYCJsFVRHtILZeMyHMs9I8IFbV8DuDwkhzNNr2/RjRZ3GVm4ZuxnWjbeOSUdft8A==" - }, - "@devexpress/dx-grid-core": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/@devexpress/dx-grid-core/-/dx-grid-core-2.6.3.tgz", - "integrity": "sha512-hYgBM/vv70gjIpuHzS80CagzDenoT20ddIcFOLJQinsAk3mdFJr/fkJAMB819wop225S0Rtb+Z157EGNgMCAXA==" - }, - "@devexpress/dx-react-core": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/@devexpress/dx-react-core/-/dx-react-core-2.6.3.tgz", - "integrity": "sha512-lKmmhHCfOBfkEFaa/SOt7DjdMLvkHqgwIiWBXaZEqK6kJk4u0Y5+yWJLUo0O9RNszaKQzAoDMQUupi47fbCPWg==", - "requires": { - "@devexpress/dx-core": "2.6.3", - "prop-types": "^15.7.2" - } - }, - "@devexpress/dx-react-grid": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/@devexpress/dx-react-grid/-/dx-react-grid-2.6.3.tgz", - "integrity": "sha512-s2RMhn6Ctbe/Tp066sWgscC2eZVTTQfKs2VOR/p9gD1vMIQFPGUkSS/XyDwMPb5MD7DRvFYJ2U8oQryobB2yoQ==", - "requires": { - "@devexpress/dx-grid-core": "2.6.3" - } - }, - "@devexpress/dx-react-grid-material-ui": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/@devexpress/dx-react-grid-material-ui/-/dx-react-grid-material-ui-2.6.3.tgz", - "integrity": "sha512-7tVQVrbGQNrkbOOF/xd8mTk7vAsDwQ8URRvRJGILthcnewPCJZqzmjsMV4GRQ1bEAQKAiCnRDbPunvR4vW0GEw==", - "requires": { - "clsx": "^1.0.4", - "prop-types": "^15.7.2" - } - }, - "@devexpress/dx-react-scheduler": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/@devexpress/dx-react-scheduler/-/dx-react-scheduler-2.6.3.tgz", - "integrity": "sha512-trQMLbOlkTnmi0y0AYic369XzXu58IablHiUg5Ndp7XC8pz3eysERFFd9yziOUz0LnxcpPP204D9zUZQAPUfpA==", - "requires": { - "@devexpress/dx-scheduler-core": "2.6.3" - } - }, - "@devexpress/dx-react-scheduler-material-ui": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/@devexpress/dx-react-scheduler-material-ui/-/dx-react-scheduler-material-ui-2.6.3.tgz", - "integrity": "sha512-UuORS7BSErFgjmVDfWTfrwDlDSTifBRM8Y6KiwDwn2ew25wHP8MKyCiPSY9A36H2s10iXX/D7tJokF//lA31AA==", - "requires": { - "@date-io/moment": "^1.3.11", - "@material-ui/pickers": "^3.2.10", - "clsx": "^1.0.4", - "prop-types": "^15.7.2" - } - }, - "@devexpress/dx-scheduler-core": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/@devexpress/dx-scheduler-core/-/dx-scheduler-core-2.6.3.tgz", - "integrity": "sha512-yZp9vvzuLvkw+dUASp6WLxrqyvTqB9Nx+k56fnCYz8o18yMWBuYtGZvg34p3pdry930HEfLLRVrRXBWcQI8mzg==", - "requires": { - "moment": "^2.24.0", - "rrule": "^2.6.2" - } - }, "@emotion/hash": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/@emotion/hash/-/hash-0.8.0.tgz", @@ -1432,51 +1350,6 @@ "react-transition-group": "^4.4.0" } }, - "@material-ui/icons": { - "version": "4.9.1", - "resolved": "https://registry.npmjs.org/@material-ui/icons/-/icons-4.9.1.tgz", - "integrity": "sha512-GBitL3oBWO0hzBhvA9KxqcowRUsA0qzwKkURyC8nppnC3fw54KPKZ+d4V1Eeg/UnDRSzDaI9nGCdel/eh9AQMg==", - "requires": { - "@babel/runtime": "^7.4.4" - } - }, - "@material-ui/lab": { - "version": "4.0.0-alpha.56", - "resolved": "https://registry.npmjs.org/@material-ui/lab/-/lab-4.0.0-alpha.56.tgz", - "integrity": "sha512-xPlkK+z/6y/24ka4gVJgwPfoCF4RCh8dXb1BNE7MtF9bXEBLN/lBxNTK8VAa0qm3V2oinA6xtUIdcRh0aeRtVw==", - "requires": { - "@babel/runtime": "^7.4.4", - "@material-ui/utils": "^4.10.2", - "clsx": "^1.0.4", - "prop-types": "^15.7.2", - "react-is": "^16.8.0" - }, - "dependencies": { - "@material-ui/utils": { - "version": "4.10.2", - "resolved": "https://registry.npmjs.org/@material-ui/utils/-/utils-4.10.2.tgz", - "integrity": "sha512-eg29v74P7W5r6a4tWWDAAfZldXIzfyO1am2fIsC39hdUUHm/33k6pGOKPbgDjg/U/4ifmgAePy/1OjkKN6rFRw==", - "requires": { - "@babel/runtime": "^7.4.4", - "prop-types": "^15.7.2", - "react-is": "^16.8.0" - } - } - } - }, - "@material-ui/pickers": { - "version": "3.2.10", - "resolved": "https://registry.npmjs.org/@material-ui/pickers/-/pickers-3.2.10.tgz", - "integrity": "sha512-B8G6Obn5S3RCl7hwahkQj9sKUapwXWFjiaz/Bsw1fhYFdNMnDUolRiWQSoKPb1/oKe37Dtfszoywi1Ynbo3y8w==", - "requires": { - "@babel/runtime": "^7.6.0", - "@date-io/core": "1.x", - "@types/styled-jsx": "^2.2.8", - "clsx": "^1.0.2", - "react-transition-group": "^4.0.0", - "rifm": "^0.7.0" - } - }, "@material-ui/styles": { "version": "4.10.0", "resolved": "https://registry.npmjs.org/@material-ui/styles/-/styles-4.10.0.tgz", @@ -1542,7 +1415,7 @@ }, "@sheerun/mutationobserver-shim": { "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@sheerun/mutationobserver-shim/-/mutationobserver-shim-0.3.3.tgz", + "resolved": "https://npm.mlabs.pl:443/@sheerun%2fmutationobserver-shim/-/mutationobserver-shim-0.3.3.tgz", "integrity": "sha512-DetpxZw1fzPD5xUBrIAoplLChO2VB8DlL5Gg+I1IR9b2wPqYIca2WSUxL5g1vLeR4MsQq1NeWriXAVffV+U1Fw==" }, "@svgr/babel-plugin-add-jsx-attribute": { @@ -1656,7 +1529,7 @@ }, "@testing-library/dom": { "version": "6.16.0", - "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-6.16.0.tgz", + "resolved": "https://npm.mlabs.pl:443/@testing-library%2fdom/-/dom-6.16.0.tgz", "integrity": "sha512-lBD88ssxqEfz0wFL6MeUyyWZfV/2cjEZZV3YRpb2IoJRej/4f1jB0TzqIOznTpfR1r34CNesrubxwIlAQ8zgPA==", "requires": { "@babel/runtime": "^7.8.4", @@ -1668,9 +1541,18 @@ "wait-for-expect": "^3.0.2" }, "dependencies": { + "@babel/runtime-corejs3": { + "version": "7.11.2", + "resolved": "https://npm.mlabs.pl:443/@babel%2fruntime-corejs3/-/runtime-corejs3-7.11.2.tgz", + "integrity": "sha512-qh5IR+8VgFz83VBa6OkaET6uN/mJOhHONuy3m1sgF0CV6mXdPSEBdA7e1eUbVvyNtANjMbg22JUv71BaDXLY6A==", + "requires": { + "core-js-pure": "^3.0.0", + "regenerator-runtime": "^0.13.4" + } + }, "@jest/types": { "version": "25.5.0", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.5.0.tgz", + "resolved": "https://npm.mlabs.pl:443/@jest%2ftypes/-/types-25.5.0.tgz", "integrity": "sha512-OXD0RgQ86Tu3MazKo8bnrkDRaDXXMGUqd+kTtLtK1Zb7CRzQcaSRPPPV37SvYTdevXEBVxe0HXylEjs8ibkmCw==", "requires": { "@types/istanbul-lib-coverage": "^2.0.0", @@ -1681,7 +1563,7 @@ }, "@types/yargs": { "version": "15.0.5", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.5.tgz", + "resolved": "https://npm.mlabs.pl:443/@types%2fyargs/-/yargs-15.0.5.tgz", "integrity": "sha512-Dk/IDOPtOgubt/IaevIUbTgV7doaKkoorvOyYM2CMwuDyP89bekI7H4xLIwunNYiK9jhCkmc6pUrJk3cj2AB9w==", "requires": { "@types/yargs-parser": "*" @@ -1689,7 +1571,7 @@ }, "ansi-styles": { "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "resolved": "https://npm.mlabs.pl:443/ansi-styles/-/ansi-styles-4.2.1.tgz", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", "requires": { "@types/color-name": "^1.1.1", @@ -1697,17 +1579,27 @@ } }, "aria-query": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-4.0.2.tgz", - "integrity": "sha512-S1G1V790fTaigUSM/Gd0NngzEfiMy9uTUfMyHhKhVyy4cH5O/eTuR01ydhGL0z4Za1PXFTRGH3qL8VhUQuEO5w==", + "version": "4.2.2", + "resolved": "https://npm.mlabs.pl:443/aria-query/-/aria-query-4.2.2.tgz", + "integrity": "sha512-o/HelwhuKpTj/frsOsbNLNgnNGVIFsVP/SW2BSF14gVl7kAfMOJ6/8wUAUvG1R1NHKrfG+2sHZTu0yauT1qBrA==", "requires": { - "@babel/runtime": "^7.7.4", - "@babel/runtime-corejs3": "^7.7.4" + "@babel/runtime": "^7.10.2", + "@babel/runtime-corejs3": "^7.10.2" + }, + "dependencies": { + "@babel/runtime": { + "version": "7.11.2", + "resolved": "https://npm.mlabs.pl:443/@babel%2fruntime/-/runtime-7.11.2.tgz", + "integrity": "sha512-TeWkU52so0mPtDcaCTxNBI/IHiz0pZgr8VEFqXFtZWpYD08ZB6FaSwVAS8MKRQAP3bYKiVjwysOJgMFY28o6Tw==", + "requires": { + "regenerator-runtime": "^0.13.4" + } + } } }, "chalk": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "resolved": "https://npm.mlabs.pl:443/chalk/-/chalk-3.0.0.tgz", "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", "requires": { "ansi-styles": "^4.1.0", @@ -1716,7 +1608,7 @@ }, "color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "resolved": "https://npm.mlabs.pl:443/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "requires": { "color-name": "~1.1.4" @@ -1724,17 +1616,17 @@ }, "color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "resolved": "https://npm.mlabs.pl:443/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, "has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "resolved": "https://npm.mlabs.pl:443/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" }, "pretty-format": { "version": "25.5.0", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-25.5.0.tgz", + "resolved": "https://npm.mlabs.pl:443/pretty-format/-/pretty-format-25.5.0.tgz", "integrity": "sha512-kbo/kq2LQ/A/is0PQwsEHM7Ca6//bGPPvU6UnsdDRSKTWxT/ru/xb88v4BJf6a69H+uTytOEsTusT9ksd/1iWQ==", "requires": { "@jest/types": "^25.5.0", @@ -1745,7 +1637,7 @@ }, "supports-color": { "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "resolved": "https://npm.mlabs.pl:443/supports-color/-/supports-color-7.1.0.tgz", "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", "requires": { "has-flag": "^4.0.0" @@ -1755,7 +1647,7 @@ }, "@testing-library/jest-dom": { "version": "4.2.4", - "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-4.2.4.tgz", + "resolved": "https://npm.mlabs.pl:443/@testing-library%2fjest-dom/-/jest-dom-4.2.4.tgz", "integrity": "sha512-j31Bn0rQo12fhCWOUWy9fl7wtqkp7In/YP2p5ZFyRuiiB9Qs3g+hS4gAmDWONbAHcRmVooNJ5eOHQDCOmUFXHg==", "requires": { "@babel/runtime": "^7.5.1", @@ -1771,7 +1663,7 @@ }, "@testing-library/react": { "version": "9.5.0", - "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-9.5.0.tgz", + "resolved": "https://npm.mlabs.pl:443/@testing-library%2freact/-/react-9.5.0.tgz", "integrity": "sha512-di1b+D0p+rfeboHO5W7gTVeZDIK5+maEgstrZbWZSSvxDyfDRkkyBE1AJR5Psd6doNldluXlCWqXriUfqu/9Qg==", "requires": { "@babel/runtime": "^7.8.4", @@ -1781,7 +1673,7 @@ }, "@testing-library/user-event": { "version": "7.2.1", - "resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-7.2.1.tgz", + "resolved": "https://npm.mlabs.pl:443/@testing-library%2fuser-event/-/user-event-7.2.1.tgz", "integrity": "sha512-oZ0Ib5I4Z2pUEcoo95cT1cr6slco9WY7yiPpG+RGNkj8YcYgJnM7pXmYmorNOReh8MIGcKSqXyeGjxnr8YiZbA==" }, "@types/babel__core": { @@ -1850,6 +1742,7 @@ "version": "3.3.1", "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz", "integrity": "sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA==", + "dev": true, "requires": { "@types/react": "*", "hoist-non-react-statics": "^3.3.0" @@ -1881,6 +1774,7 @@ "version": "24.9.1", "resolved": "https://registry.npmjs.org/@types/jest/-/jest-24.9.1.tgz", "integrity": "sha512-Fb38HkXSVA4L8fGKEZ6le5bB8r6MRWlOCZbVuWZcmOMSCd2wCYOwN1ibj8daIoV9naq7aaOZjrLCoCMptKU/4Q==", + "dev": true, "requires": { "jest-diff": "^24.3.0" } @@ -1890,20 +1784,15 @@ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.5.tgz", "integrity": "sha512-7+2BITlgjgDhH0vvwZU/HZJVyk+2XUlvxXe8dFMedNX/aMkaOq++rMAFXc0tM7ij15QaWlbdQASBR9dihi+bDQ==" }, - "@types/lru-cache": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/@types/lru-cache/-/lru-cache-4.1.2.tgz", - "integrity": "sha512-ve2IoUJClE+4S/sG2zoLGEHP6DCvqgyz7UkHZdiICdQaAYRaCXsRWfJlbL8B0KvUyo9lgzD+oR0YSy4YikFyFQ==" - }, "@types/minimatch": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==" }, "@types/node": { - "version": "12.12.42", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.42.tgz", - "integrity": "sha512-R/9QdYFLL9dE9l5cWWzWIZByVGFd7lk7JVOJ7KD+E1SJ4gni7XJRLz9QTjyYQiHIqEAgku9VgxdLjMlhhUaAFg==" + "version": "12.12.54", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.54.tgz", + "integrity": "sha512-ge4xZ3vSBornVYlDnk7yZ0gK6ChHf/CHB7Gl1I0Jhah8DDnEQqBzgohYG4FX4p81TNirSETOiSyn+y1r9/IR6w==" }, "@types/parse-json": { "version": "4.0.0", @@ -1921,12 +1810,19 @@ "integrity": "sha512-1HcDas8SEj4z1Wc696tH56G8OlRaH/sqZOynNNB+HF0WOeXPaxTtbYzJY2oEfiUxjSKjhCKr+MvR7dCHcEelug==" }, "@types/react": { - "version": "16.9.35", - "resolved": "https://registry.npmjs.org/@types/react/-/react-16.9.35.tgz", - "integrity": "sha512-q0n0SsWcGc8nDqH2GJfWQWUOmZSJhXV64CjVN5SvcNti3TdEaA3AH0D8DwNmMdzjMAC/78tB8nAZIlV8yTz+zQ==", + "version": "16.9.46", + "resolved": "https://registry.npmjs.org/@types/react/-/react-16.9.46.tgz", + "integrity": "sha512-dbHzO3aAq1lB3jRQuNpuZ/mnu+CdD3H0WVaaBQA8LTT3S33xhVBUj232T8M3tAhSWJs/D/UqORYUlJNl/8VQZg==", "requires": { "@types/prop-types": "*", - "csstype": "^2.2.0" + "csstype": "^3.0.2" + }, + "dependencies": { + "csstype": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.2.tgz", + "integrity": "sha512-ofovWglpqoqbfLNOTBNZLSbMuGrblAf1efvvArGKOZMBrIoJeu5UsAipQolkijtyQx5MtAzT/J9IHj/CEY1mJw==" + } } }, "@types/react-dom": { @@ -1938,9 +1834,10 @@ } }, "@types/react-native": { - "version": "0.63.7", - "resolved": "https://registry.npmjs.org/@types/react-native/-/react-native-0.63.7.tgz", - "integrity": "sha512-TrtH69+HuWVxTERhoDDP2YtpznfH/Ra3/Fu2dCrssy+CkBZjvDlEESfWiAJWlOto3QtUzkTA7RT/S2jrO4WKkw==", + "version": "0.63.8", + "resolved": "https://registry.npmjs.org/@types/react-native/-/react-native-0.63.8.tgz", + "integrity": "sha512-QRwGFRTyGafRVTUS+0GYyJrlpmS3boyBaFI0ULSc+mh/lQNxrzbdQvoL2k5X7+t9hxyqA4dTQAlP6l0ir/fNJQ==", + "dev": true, "requires": { "@types/react": "*" } @@ -1962,6 +1859,7 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/@types/styled-components/-/styled-components-5.1.2.tgz", "integrity": "sha512-HNocYLfrsnNNm8NTS/W53OERSjRA8dx5Bn6wBd2rXXwt4Z3s+oqvY6/PbVt3e6sgtzI63GX//WiWiRhWur08qQ==", + "dev": true, "requires": { "@types/hoist-non-react-statics": "*", "@types/react": "*", @@ -1972,21 +1870,14 @@ "csstype": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.2.tgz", - "integrity": "sha512-ofovWglpqoqbfLNOTBNZLSbMuGrblAf1efvvArGKOZMBrIoJeu5UsAipQolkijtyQx5MtAzT/J9IHj/CEY1mJw==" + "integrity": "sha512-ofovWglpqoqbfLNOTBNZLSbMuGrblAf1efvvArGKOZMBrIoJeu5UsAipQolkijtyQx5MtAzT/J9IHj/CEY1mJw==", + "dev": true } } }, - "@types/styled-jsx": { - "version": "2.2.8", - "resolved": "https://registry.npmjs.org/@types/styled-jsx/-/styled-jsx-2.2.8.tgz", - "integrity": "sha512-Yjye9VwMdYeXfS71ihueWRSxrruuXTwKCbzue4+5b2rjnQ//AtyM7myZ1BEhNhBQ/nL/RE7bdToUoLln2miKvg==", - "requires": { - "@types/react": "*" - } - }, "@types/testing-library__dom": { "version": "6.14.0", - "resolved": "https://registry.npmjs.org/@types/testing-library__dom/-/testing-library__dom-6.14.0.tgz", + "resolved": "https://npm.mlabs.pl:443/@types%2ftesting-library__dom/-/testing-library__dom-6.14.0.tgz", "integrity": "sha512-sMl7OSv0AvMOqn1UJ6j1unPMIHRXen0Ita1ujnMX912rrOcawe4f7wu0Zt9GIQhBhJvH2BaibqFgQ3lP+Pj2hA==", "requires": { "pretty-format": "^24.3.0" @@ -1994,7 +1885,7 @@ }, "@types/testing-library__react": { "version": "9.1.3", - "resolved": "https://registry.npmjs.org/@types/testing-library__react/-/testing-library__react-9.1.3.tgz", + "resolved": "https://npm.mlabs.pl:443/@types%2ftesting-library__react/-/testing-library__react-9.1.3.tgz", "integrity": "sha512-iCdNPKU3IsYwRK9JieSYAiX0+aYDXOGAmrC/3/M7AqqSDKnWWVv07X+Zk1uFSL7cMTUYzv4lQRfohucEocn5/w==", "requires": { "@types/react-dom": "*", @@ -2004,7 +1895,7 @@ "dependencies": { "@jest/types": { "version": "25.5.0", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.5.0.tgz", + "resolved": "https://npm.mlabs.pl:443/@jest%2ftypes/-/types-25.5.0.tgz", "integrity": "sha512-OXD0RgQ86Tu3MazKo8bnrkDRaDXXMGUqd+kTtLtK1Zb7CRzQcaSRPPPV37SvYTdevXEBVxe0HXylEjs8ibkmCw==", "requires": { "@types/istanbul-lib-coverage": "^2.0.0", @@ -2015,7 +1906,7 @@ }, "@types/yargs": { "version": "15.0.5", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.5.tgz", + "resolved": "https://npm.mlabs.pl:443/@types%2fyargs/-/yargs-15.0.5.tgz", "integrity": "sha512-Dk/IDOPtOgubt/IaevIUbTgV7doaKkoorvOyYM2CMwuDyP89bekI7H4xLIwunNYiK9jhCkmc6pUrJk3cj2AB9w==", "requires": { "@types/yargs-parser": "*" @@ -2023,7 +1914,7 @@ }, "ansi-styles": { "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "resolved": "https://npm.mlabs.pl:443/ansi-styles/-/ansi-styles-4.2.1.tgz", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", "requires": { "@types/color-name": "^1.1.1", @@ -2032,7 +1923,7 @@ }, "chalk": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "resolved": "https://npm.mlabs.pl:443/chalk/-/chalk-3.0.0.tgz", "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", "requires": { "ansi-styles": "^4.1.0", @@ -2041,7 +1932,7 @@ }, "color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "resolved": "https://npm.mlabs.pl:443/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "requires": { "color-name": "~1.1.4" @@ -2049,17 +1940,17 @@ }, "color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "resolved": "https://npm.mlabs.pl:443/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, "has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "resolved": "https://npm.mlabs.pl:443/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" }, "pretty-format": { "version": "25.5.0", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-25.5.0.tgz", + "resolved": "https://npm.mlabs.pl:443/pretty-format/-/pretty-format-25.5.0.tgz", "integrity": "sha512-kbo/kq2LQ/A/is0PQwsEHM7Ca6//bGPPvU6UnsdDRSKTWxT/ru/xb88v4BJf6a69H+uTytOEsTusT9ksd/1iWQ==", "requires": { "@jest/types": "^25.5.0", @@ -2070,7 +1961,7 @@ }, "supports-color": { "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "resolved": "https://npm.mlabs.pl:443/supports-color/-/supports-color-7.1.0.tgz", "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", "requires": { "has-flag": "^4.0.0" @@ -2091,10 +1982,33 @@ "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-15.0.0.tgz", "integrity": "sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw==" }, + "@typescript-eslint/eslint-plugin": { + "version": "3.9.0", + "resolved": "https://npm.mlabs.pl:443/@typescript-eslint%2feslint-plugin/-/eslint-plugin-3.9.0.tgz", + "integrity": "sha512-UD6b4p0/hSe1xdTvRCENSx7iQ+KR6ourlZFfYuPC7FlXEzdHuLPrEmuxZ23b2zW96KJX9Z3w05GE/wNOiEzrVg==", + "dev": true, + "requires": { + "@typescript-eslint/experimental-utils": "3.9.0", + "debug": "^4.1.1", + "functional-red-black-tree": "^1.0.1", + "regexpp": "^3.0.0", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + }, + "dependencies": { + "semver": { + "version": "7.3.2", + "resolved": "https://npm.mlabs.pl:443/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", + "dev": true + } + } + }, "@typescript-eslint/experimental-utils": { "version": "3.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.9.0.tgz", + "resolved": "https://npm.mlabs.pl:443/@typescript-eslint%2fexperimental-utils/-/experimental-utils-3.9.0.tgz", "integrity": "sha512-/vSHUDYizSOhrOJdjYxPNGfb4a3ibO8zd4nUKo/QBFOmxosT3cVUV7KIg8Dwi6TXlr667G7YPqFK9+VSZOorNA==", + "dev": true, "requires": { "@types/json-schema": "^7.0.3", "@typescript-eslint/types": "3.9.0", @@ -2105,8 +2019,9 @@ }, "@typescript-eslint/parser": { "version": "3.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.9.0.tgz", + "resolved": "https://npm.mlabs.pl:443/@typescript-eslint%2fparser/-/parser-3.9.0.tgz", "integrity": "sha512-rDHOKb6uW2jZkHQniUQVZkixQrfsZGUCNWWbKWep4A5hGhN5dLHMUCNAWnC4tXRlHedXkTDptIpxs6e4Pz8UfA==", + "dev": true, "requires": { "@types/eslint-visitor-keys": "^1.0.0", "@typescript-eslint/experimental-utils": "3.9.0", @@ -2117,13 +2032,15 @@ }, "@typescript-eslint/types": { "version": "3.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-3.9.0.tgz", - "integrity": "sha512-rb6LDr+dk9RVVXO/NJE8dT1pGlso3voNdEIN8ugm4CWM5w5GimbThCMiMl4da1t5u3YwPWEwOnKAULCZgBtBHg==" + "resolved": "https://npm.mlabs.pl:443/@typescript-eslint%2ftypes/-/types-3.9.0.tgz", + "integrity": "sha512-rb6LDr+dk9RVVXO/NJE8dT1pGlso3voNdEIN8ugm4CWM5w5GimbThCMiMl4da1t5u3YwPWEwOnKAULCZgBtBHg==", + "dev": true }, "@typescript-eslint/typescript-estree": { "version": "3.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.9.0.tgz", + "resolved": "https://npm.mlabs.pl:443/@typescript-eslint%2ftypescript-estree/-/typescript-estree-3.9.0.tgz", "integrity": "sha512-N+158NKgN4rOmWVfvKOMoMFV5n8XxAliaKkArm/sOypzQ0bUL8MSnOEBW3VFIeffb/K5ce/cAV0yYhR7U4ALAA==", + "dev": true, "requires": { "@typescript-eslint/types": "3.9.0", "@typescript-eslint/visitor-keys": "3.9.0", @@ -2137,15 +2054,17 @@ "dependencies": { "semver": { "version": "7.3.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==" + "resolved": "https://npm.mlabs.pl:443/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", + "dev": true } } }, "@typescript-eslint/visitor-keys": { "version": "3.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-3.9.0.tgz", + "resolved": "https://npm.mlabs.pl:443/@typescript-eslint%2fvisitor-keys/-/visitor-keys-3.9.0.tgz", "integrity": "sha512-O1qeoGqDbu0EZUC/MZ6F1WHTIzcBVhGqDj3LhTnj65WUA548RXVxUHbYhAW9bZWfb2rnX9QsbbP5nmeJ5Z4+ng==", + "dev": true, "requires": { "eslint-visitor-keys": "^1.1.0" } @@ -2780,32 +2699,6 @@ } } }, - "axios-extensions": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/axios-extensions/-/axios-extensions-3.1.3.tgz", - "integrity": "sha512-/OB9OcJLNOIx9pdW4m4/hFRvNo12wlX5BaprIzqpMaLR02I88Mr98/wW4QN9rhx0/yg9rM7i6Af/RpV4MyxXjA==", - "requires": { - "@types/lru-cache": "^4.1.1", - "lru-cache": "^5.1.1", - "tslib": "^1.9.0", - "util": "^0.11.1" - }, - "dependencies": { - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - }, - "util": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/util/-/util-0.11.1.tgz", - "integrity": "sha512-HShAsny+zS2TZfaXxD9tYj4HQGlBezXZMZuM/S5PKLLoZkShZiGk9o5CzukI1LVHZvjdvZ2Sj1aW/Ndn2NB/HQ==", - "requires": { - "inherits": "2.0.3" - } - } - } - }, "axobject-query": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.1.2.tgz", @@ -3318,6 +3211,15 @@ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.0.0.tgz", "integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==" }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "optional": true, + "requires": { + "file-uri-to-path": "1.0.0" + } + }, "block-stream": { "version": "0.0.9", "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", @@ -4478,7 +4380,7 @@ }, "css.escape": { "version": "1.5.1", - "resolved": "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz", + "resolved": "https://npm.mlabs.pl:443/css.escape/-/css.escape-1.5.1.tgz", "integrity": "sha1-QuJ9T6BK4y+TGktNQZH6nN3ul8s=" }, "cssdb": { @@ -4932,7 +4834,7 @@ }, "dom-accessibility-api": { "version": "0.3.0", - "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.3.0.tgz", + "resolved": "https://npm.mlabs.pl:443/dom-accessibility-api/-/dom-accessibility-api-0.3.0.tgz", "integrity": "sha512-PzwHEmsRP3IGY4gv/Ug+rMeaTIyTJvadCb+ujYXYeIylbHJezIyNToe8KfEgHTCEYyC+/bUghYOGg8yMGlZ6vA==" }, "dom-converter": { @@ -5286,16 +5188,18 @@ }, "eslint-config-prettier": { "version": "6.11.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.11.0.tgz", + "resolved": "https://npm.mlabs.pl:443/eslint-config-prettier/-/eslint-config-prettier-6.11.0.tgz", "integrity": "sha512-oB8cpLWSAjOVFEJhhyMZh6NOEOtBVziaqdDQ86+qhDHFbZXoRTM7pNSvFRfW/W/L/LrQ38C99J5CGuRBBzBsdA==", + "dev": true, "requires": { "get-stdin": "^6.0.0" }, "dependencies": { "get-stdin": { "version": "6.0.0", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz", - "integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==" + "resolved": "https://npm.mlabs.pl:443/get-stdin/-/get-stdin-6.0.0.tgz", + "integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==", + "dev": true } } }, @@ -5502,8 +5406,9 @@ }, "eslint-plugin-prettier": { "version": "3.1.4", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.4.tgz", + "resolved": "https://npm.mlabs.pl:443/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.4.tgz", "integrity": "sha512-jZDa8z76klRqo+TdGDTFJSavwbnWK2ZpqGKNZ+VvweMW516pDUMmQ2koXvxEE4JhzNvTv+radye/bWGBmA6jmg==", + "dev": true, "requires": { "prettier-linter-helpers": "^1.0.0" } @@ -5546,9 +5451,10 @@ } }, "eslint-plugin-react-hooks": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-1.7.0.tgz", - "integrity": "sha512-iXTCFcOmlWvw4+TOE8CLWj6yX1GwzT0Y6cUfHHZqWnSk144VmVIRcVGtUAzrLES7C798lmvnt02C7rxaOX1HNA==" + "version": "4.1.0", + "resolved": "https://npm.mlabs.pl:443/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.1.0.tgz", + "integrity": "sha512-36zilUcDwDReiORXmcmTc6rRumu9JIM3WjSvV0nclHoUQ0CNrX866EwONvLR/UqaeqFutbAnVu8PEmctdo2SRQ==", + "dev": true }, "eslint-scope": { "version": "5.1.0", @@ -5911,8 +5817,9 @@ }, "fast-diff": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", - "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==" + "resolved": "https://npm.mlabs.pl:443/fast-diff/-/fast-diff-1.2.0.tgz", + "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", + "dev": true }, "fast-glob": { "version": "2.2.7", @@ -6004,6 +5911,12 @@ "schema-utils": "^2.5.0" } }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "optional": true + }, "filesize": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/filesize/-/filesize-6.0.1.tgz", @@ -6554,11 +6467,6 @@ "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-2.0.1.tgz", "integrity": "sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg==" }, - "handy": { - "version": "0.0.13", - "resolved": "https://registry.npmjs.org/handy/-/handy-0.0.13.tgz", - "integrity": "sha1-gls40+0ozJ+rsGlXWItKiUM8hGc=" - }, "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", @@ -6817,11 +6725,6 @@ } } }, - "htmlparser": { - "version": "1.7.7", - "resolved": "https://registry.npmjs.org/htmlparser/-/htmlparser-1.7.7.tgz", - "integrity": "sha1-GeezmX/2+6yZrlp9J2ZInv5+LQ4=" - }, "htmlparser2": { "version": "3.10.1", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.10.1.tgz", @@ -6951,11 +6854,6 @@ "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==" }, - "immer": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/immer/-/immer-7.0.5.tgz", - "integrity": "sha512-TtRAKZyuqld2eYjvWgXISLJ0ZlOl1OOTzRmrmiY8SlB0dnAhZ1OiykIDL5KDFNaPHDXiLfGQFNJGtet8z8AEmg==" - }, "import-cwd": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-2.1.0.tgz", @@ -7126,11 +7024,6 @@ } } }, - "install": { - "version": "0.13.0", - "resolved": "https://registry.npmjs.org/install/-/install-0.13.0.tgz", - "integrity": "sha512-zDml/jzr2PKU9I8J/xyZBQn8rPCAY//UOYNmR01XwNwyfhEWObo2SWfSl1+0tm1u6PhxLwDnfsT/6jB7OUxqFA==" - }, "internal-ip": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/internal-ip/-/internal-ip-4.3.0.tgz", @@ -7747,6 +7640,7 @@ "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", "optional": true, "requires": { + "bindings": "^1.5.0", "nan": "^2.12.1" } } @@ -8520,12 +8414,6 @@ } } }, - "luxon": { - "version": "1.24.1", - "resolved": "https://registry.npmjs.org/luxon/-/luxon-1.24.1.tgz", - "integrity": "sha512-CgnIMKAWT0ghcuWFfCWBnWGOddM0zu6c4wZAWmD0NN7MZTnro0+833DF6tJep+xlxRPg4KtsYEHYLfTMBQKwYg==", - "optional": true - }, "make-dir": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", @@ -8874,9 +8762,9 @@ "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" }, "min-indent": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.0.tgz", - "integrity": "sha1-z8RcN+nsDY8KDsPdTvf3w6vjklY=" + "version": "1.0.1", + "resolved": "https://npm.mlabs.pl:443/min-indent/-/min-indent-1.0.1.tgz", + "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==" }, "mini-css-extract-plugin": { "version": "0.9.0", @@ -9016,11 +8904,6 @@ "minimist": "^1.2.5" } }, - "moment": { - "version": "2.26.0", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.26.0.tgz", - "integrity": "sha512-oIixUO+OamkUkwjhAVE18rAMfRJNsNe/Stid/gwHSOfHrOtw9EhAY2AHvdKZ/k/MggcYELFCJz/Sn2pL8b8JMw==" - }, "move-concurrently": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", @@ -9265,7 +9148,7 @@ }, "node-sass": { "version": "4.14.1", - "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.14.1.tgz", + "resolved": "https://npm.mlabs.pl:443/node-sass/-/node-sass-4.14.1.tgz", "integrity": "sha512-sjCuOlvGyCJS40R8BscF5vhVlQjNN069NtQ1gSxyK1u9iqvn6tf7O1R4GNowVZfiZUCRt5MmMs1xd+4V/7Yr0g==", "requires": { "async-foreach": "^0.1.3", @@ -9289,17 +9172,17 @@ "dependencies": { "ansi-regex": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "resolved": "https://npm.mlabs.pl:443/ansi-regex/-/ansi-regex-2.1.1.tgz", "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" }, "ansi-styles": { "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "resolved": "https://npm.mlabs.pl:443/ansi-styles/-/ansi-styles-2.2.1.tgz", "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" }, "chalk": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://npm.mlabs.pl:443/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "requires": { "ansi-styles": "^2.2.1", @@ -9311,7 +9194,7 @@ }, "cross-spawn": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-3.0.1.tgz", + "resolved": "https://npm.mlabs.pl:443/cross-spawn/-/cross-spawn-3.0.1.tgz", "integrity": "sha1-ElYDfsufDF9549bvE14wdwGEuYI=", "requires": { "lru-cache": "^4.0.1", @@ -9320,7 +9203,7 @@ }, "lru-cache": { "version": "4.1.5", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "resolved": "https://npm.mlabs.pl:443/lru-cache/-/lru-cache-4.1.5.tgz", "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", "requires": { "pseudomap": "^1.0.2", @@ -9329,7 +9212,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "https://npm.mlabs.pl:443/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "requires": { "ansi-regex": "^2.0.0" @@ -9337,12 +9220,12 @@ }, "supports-color": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "resolved": "https://npm.mlabs.pl:443/supports-color/-/supports-color-2.0.0.tgz", "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" }, "yallist": { "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "resolved": "https://npm.mlabs.pl:443/yallist/-/yallist-2.1.2.tgz", "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" } } @@ -9627,22 +9510,6 @@ "is-wsl": "^1.1.0" } }, - "optimist": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", - "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", - "requires": { - "minimist": "~0.0.1", - "wordwrap": "~0.0.2" - }, - "dependencies": { - "minimist": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", - "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=" - } - } - }, "optimize-css-assets-webpack-plugin": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/optimize-css-assets-webpack-plugin/-/optimize-css-assets-webpack-plugin-5.0.3.tgz", @@ -11013,13 +10880,15 @@ }, "prettier": { "version": "2.0.5", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz", - "integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==" + "resolved": "https://npm.mlabs.pl:443/prettier/-/prettier-2.0.5.tgz", + "integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==", + "dev": true }, "prettier-linter-helpers": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "resolved": "https://npm.mlabs.pl:443/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dev": true, "requires": { "fast-diff": "^1.1.2" } @@ -11729,6 +11598,11 @@ } } }, + "eslint-plugin-react-hooks": { + "version": "1.7.0", + "resolved": "https://npm.mlabs.pl:443/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-1.7.0.tgz", + "integrity": "sha512-iXTCFcOmlWvw4+TOE8CLWj6yX1GwzT0Y6cUfHHZqWnSk144VmVIRcVGtUAzrLES7C798lmvnt02C7rxaOX1HNA==" + }, "espree": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/espree/-/espree-6.2.1.tgz", @@ -11869,7 +11743,7 @@ }, "redent": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", + "resolved": "https://npm.mlabs.pl:443/redent/-/redent-3.0.0.tgz", "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", "requires": { "indent-string": "^4.0.0", @@ -12245,14 +12119,6 @@ "resolved": "https://registry.npmjs.org/rgba-regex/-/rgba-regex-1.0.0.tgz", "integrity": "sha1-QzdOLiyglosO8VI0YLfXMP8i7rM=" }, - "rifm": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/rifm/-/rifm-0.7.0.tgz", - "integrity": "sha512-DSOJTWHD67860I5ojetXdEQRIBvF6YcpNe53j0vn1vp9EUb9N80EiZTxgP+FkDKorWC8PZw052kTF4C1GOivCQ==", - "requires": { - "@babel/runtime": "^7.3.1" - } - }, "rimraf": { "version": "2.6.3", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", @@ -12270,15 +12136,6 @@ "inherits": "^2.0.1" } }, - "rrule": { - "version": "2.6.4", - "resolved": "https://registry.npmjs.org/rrule/-/rrule-2.6.4.tgz", - "integrity": "sha512-sLdnh4lmjUqq8liFiOUXD5kWp/FcnbDLPwq5YAc/RrN6120XOPb86Ae5zxF7ttBVq8O3LxjjORMEit1baluahA==", - "requires": { - "luxon": "^1.21.3", - "tslib": "^1.10.0" - } - }, "rsvp": { "version": "4.8.5", "resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz", @@ -13345,7 +13202,7 @@ }, "strip-indent": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", + "resolved": "https://npm.mlabs.pl:443/strip-indent/-/strip-indent-3.0.0.tgz", "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", "requires": { "min-indent": "^1.0.0" @@ -13728,18 +13585,6 @@ "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", "integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=" }, - "to": { - "version": "0.2.9", - "resolved": "https://registry.npmjs.org/to/-/to-0.2.9.tgz", - "integrity": "sha1-C6Wlb+U1ONuSBc621+0heq5GNcQ=", - "requires": { - "handy": ">= 0.0.11", - "htmlparser": ">= 1.7.6", - "js-yaml": ">= 1.0.2", - "optimist": ">= 0.3.5", - "underscore": ">= 1.4.0" - } - }, "to-arraybuffer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", @@ -13882,14 +13727,10 @@ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" }, "typescript": { - "version": "3.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.3.tgz", - "integrity": "sha512-D/wqnB2xzNFIcoBG9FG8cXRDjiqSTbG2wd8DMZeQyJlP1vfTkIxH4GKveWaEBYySKIg+USu+E+EDIR47SqnaMQ==" - }, - "underscore": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.10.2.tgz", - "integrity": "sha512-N4P+Q/BuyuEKFJ43B9gYuOj4TQUHXX+j2FqguVOpjkssLUUrnJofCcBccJSCoeturDoZU6GorDTHSvUDlSQbTg==" + "version": "3.9.7", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz", + "integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==", + "dev": true }, "unicode-canonical-property-names-ecmascript": { "version": "1.0.4", @@ -14061,11 +13902,6 @@ "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==" }, - "use-immer": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/use-immer/-/use-immer-0.4.0.tgz", - "integrity": "sha512-mxx4jbRRc1/56geSc3VHx8gg3FvlzUpQPfVNJXtU1NRK/iTdK0pV3k3YPi7iFUcCM8YJ6/0dUBENyuk3WO/gxw==" - }, "util": { "version": "0.10.3", "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", @@ -14171,7 +14007,7 @@ }, "wait-for-expect": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/wait-for-expect/-/wait-for-expect-3.0.2.tgz", + "resolved": "https://npm.mlabs.pl:443/wait-for-expect/-/wait-for-expect-3.0.2.tgz", "integrity": "sha512-cfS1+DZxuav1aBYbaO/kE06EOS8yRw7qOFoD3XtjTkYvCvh3zUvNST8DXK/nPaeqIzIv3P3kL3lRJn8iwOiSag==" }, "walker": { @@ -14234,6 +14070,7 @@ "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", "optional": true, "requires": { + "bindings": "^1.5.0", "nan": "^2.12.1" } }, @@ -14550,6 +14387,7 @@ "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", "optional": true, "requires": { + "bindings": "^1.5.0", "nan": "^2.12.1" } }, @@ -14930,11 +14768,6 @@ "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==" }, - "wordwrap": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=" - }, "workbox-background-sync": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/workbox-background-sync/-/workbox-background-sync-4.3.1.tgz", diff --git a/package.json b/package.json index 24feab5..e7ea6bd 100644 --- a/package.json +++ b/package.json @@ -3,50 +3,39 @@ "version": "0.1.0", "private": true, "dependencies": { - "-": "0.0.1", - "@devexpress/dx-grid-core": "^2.6.3", - "@devexpress/dx-react-core": "^2.6.3", - "@devexpress/dx-react-grid": "^2.6.3", - "@devexpress/dx-react-grid-material-ui": "^2.6.3", - "@devexpress/dx-react-scheduler": "^2.6.3", - "@devexpress/dx-react-scheduler-material-ui": "^2.6.3", "@material-ui/core": "^4.10.0", - "@material-ui/icons": "^4.9.1", - "@material-ui/lab": "^4.0.0-alpha.56", "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.5.0", "@testing-library/user-event": "^7.2.1", - "@types/jest": "^24.9.1", - "@types/node": "^12.12.42", - "@types/react": "^16.9.35", - "@types/react-dom": "^16.9.8", - "@types/styled-components": "^5.1.2", - "@typescript-eslint/parser": "^3.9.0", "axios": "^0.19.2", - "axios-extensions": "^3.1.3", - "eslint-config-prettier": "^6.11.0", - "eslint-plugin-prettier": "^3.1.4", - "immer": "^7.0.5", - "install": "^0.13.0", "node-sass": "^4.14.1", - "prettier": "^2.0.5", "react": "^16.13.1", "react-dom": "^16.13.1", "react-scripts": "3.4.1", "sass": "^1.26.5", - "styled-components": "^5.1.1", - "to": "^0.2.9", - "typescript": "^3.9.3", - "use-immer": "^0.4.0" + "styled-components": "^5.1.1" }, + "devDependencies": { + "@types/jest": "^24.9.1", + "@types/node": "^12.12.54", + "@types/react": "^16.9.46", + "@types/react-dom": "^16.9.8", + "@types/styled-components": "^5.1.2", + "@typescript-eslint/eslint-plugin": "^3.9.0", + "@typescript-eslint/parser": "^3.9.0", + "eslint-config-prettier": "^6.11.0", + "eslint-plugin-prettier": "^3.1.4", + "eslint-plugin-react-hooks": "^4.1.0", + "prettier": "^2.0.5", + "typescript": "^3.9.7" + }, + "optionalDependencies": {}, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", - "eject": "react-scripts eject" - }, - "eslintConfig": { - "extends": "react-app" + "eject": "react-scripts eject", + "lint": "eslint src/*.{js,ts,tsx} --quiet --fix" }, "browserslist": { "production": [ @@ -59,6 +48,5 @@ "last 1 firefox version", "last 1 safari version" ] - }, - "optionalDependencies": {} + } } diff --git a/src/components/TopBar/Profile.tsx b/src/components/TopBar/Profile.tsx index 215598b..ea05cc0 100644 --- a/src/components/TopBar/Profile.tsx +++ b/src/components/TopBar/Profile.tsx @@ -1,36 +1,31 @@ -import { Menu, MenuItem } from "@material-ui/core"; -import React, { FC } from "react"; +import { Menu, MenuItem } from '@material-ui/core'; +import React, { FC } from 'react'; interface ProfileProps { - anchorEl: HTMLElement | null; - handleClose: () => void; - handleLogout: () => void; + anchorEl: HTMLElement | null; + handleClose: () => void; + handleLogout: () => void; } -export const Profile: FC = ({ - anchorEl, - handleClose, - handleLogout, - ...restProps -}) => { - return ( - - Profile - My account - { - handleLogout(); - }} - > - Logout - - - ); +export const Profile: FC = ({ anchorEl, handleClose, handleLogout, ...restProps }) => { + return ( + + Profile + My account + { + handleLogout(); + }} + > + Logout + + + ); }; diff --git a/src/contexts/reducers.ts b/src/styles/reducers.ts similarity index 100% rename from src/contexts/reducers.ts rename to src/styles/reducers.ts diff --git a/tsconfig.json b/tsconfig.json index 97ba7e5..af10394 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,19 +1,19 @@ { - "compilerOptions": { - "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, - "skipLibCheck": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true, - "jsx": "react" - }, - "include": ["src"] + "compilerOptions": { + "target": "es5", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "react" + }, + "include": ["src"] } From 738848b1bd9a783da7e0d748efa70173ad2b73f9 Mon Sep 17 00:00:00 2001 From: wrzesinski-hubert Date: Mon, 17 Aug 2020 20:14:19 +0200 Subject: [PATCH 18/27] styled components --- package-lock.json | 100 +++++++++--------- src/components/RightBar/index.scss | 31 ------ src/components/RightBar/index.tsx | 38 +++++-- .../Scheduler/SchedulerEvents/index.tsx | 3 - .../Scheduler/SchedulerRow/index.tsx | 3 +- src/components/TopBar/Results/index.scss | 23 ---- src/components/TopBar/Results/index.tsx | 46 ++++++-- 7 files changed, 123 insertions(+), 121 deletions(-) delete mode 100644 src/components/RightBar/index.scss delete mode 100644 src/components/TopBar/Results/index.scss diff --git a/package-lock.json b/package-lock.json index 5e52ab3..c18cd30 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1415,7 +1415,7 @@ }, "@sheerun/mutationobserver-shim": { "version": "0.3.3", - "resolved": "https://npm.mlabs.pl:443/@sheerun%2fmutationobserver-shim/-/mutationobserver-shim-0.3.3.tgz", + "resolved": "https://registry.npmjs.org/@sheerun/mutationobserver-shim/-/mutationobserver-shim-0.3.3.tgz", "integrity": "sha512-DetpxZw1fzPD5xUBrIAoplLChO2VB8DlL5Gg+I1IR9b2wPqYIca2WSUxL5g1vLeR4MsQq1NeWriXAVffV+U1Fw==" }, "@svgr/babel-plugin-add-jsx-attribute": { @@ -1529,7 +1529,7 @@ }, "@testing-library/dom": { "version": "6.16.0", - "resolved": "https://npm.mlabs.pl:443/@testing-library%2fdom/-/dom-6.16.0.tgz", + "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-6.16.0.tgz", "integrity": "sha512-lBD88ssxqEfz0wFL6MeUyyWZfV/2cjEZZV3YRpb2IoJRej/4f1jB0TzqIOznTpfR1r34CNesrubxwIlAQ8zgPA==", "requires": { "@babel/runtime": "^7.8.4", @@ -1552,7 +1552,7 @@ }, "@jest/types": { "version": "25.5.0", - "resolved": "https://npm.mlabs.pl:443/@jest%2ftypes/-/types-25.5.0.tgz", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.5.0.tgz", "integrity": "sha512-OXD0RgQ86Tu3MazKo8bnrkDRaDXXMGUqd+kTtLtK1Zb7CRzQcaSRPPPV37SvYTdevXEBVxe0HXylEjs8ibkmCw==", "requires": { "@types/istanbul-lib-coverage": "^2.0.0", @@ -1563,7 +1563,7 @@ }, "@types/yargs": { "version": "15.0.5", - "resolved": "https://npm.mlabs.pl:443/@types%2fyargs/-/yargs-15.0.5.tgz", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.5.tgz", "integrity": "sha512-Dk/IDOPtOgubt/IaevIUbTgV7doaKkoorvOyYM2CMwuDyP89bekI7H4xLIwunNYiK9jhCkmc6pUrJk3cj2AB9w==", "requires": { "@types/yargs-parser": "*" @@ -1571,7 +1571,7 @@ }, "ansi-styles": { "version": "4.2.1", - "resolved": "https://npm.mlabs.pl:443/ansi-styles/-/ansi-styles-4.2.1.tgz", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", "requires": { "@types/color-name": "^1.1.1", @@ -1599,7 +1599,7 @@ }, "chalk": { "version": "3.0.0", - "resolved": "https://npm.mlabs.pl:443/chalk/-/chalk-3.0.0.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", "requires": { "ansi-styles": "^4.1.0", @@ -1608,7 +1608,7 @@ }, "color-convert": { "version": "2.0.1", - "resolved": "https://npm.mlabs.pl:443/color-convert/-/color-convert-2.0.1.tgz", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "requires": { "color-name": "~1.1.4" @@ -1616,17 +1616,17 @@ }, "color-name": { "version": "1.1.4", - "resolved": "https://npm.mlabs.pl:443/color-name/-/color-name-1.1.4.tgz", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, "has-flag": { "version": "4.0.0", - "resolved": "https://npm.mlabs.pl:443/has-flag/-/has-flag-4.0.0.tgz", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" }, "pretty-format": { "version": "25.5.0", - "resolved": "https://npm.mlabs.pl:443/pretty-format/-/pretty-format-25.5.0.tgz", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-25.5.0.tgz", "integrity": "sha512-kbo/kq2LQ/A/is0PQwsEHM7Ca6//bGPPvU6UnsdDRSKTWxT/ru/xb88v4BJf6a69H+uTytOEsTusT9ksd/1iWQ==", "requires": { "@jest/types": "^25.5.0", @@ -1637,7 +1637,7 @@ }, "supports-color": { "version": "7.1.0", - "resolved": "https://npm.mlabs.pl:443/supports-color/-/supports-color-7.1.0.tgz", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", "requires": { "has-flag": "^4.0.0" @@ -1647,7 +1647,7 @@ }, "@testing-library/jest-dom": { "version": "4.2.4", - "resolved": "https://npm.mlabs.pl:443/@testing-library%2fjest-dom/-/jest-dom-4.2.4.tgz", + "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-4.2.4.tgz", "integrity": "sha512-j31Bn0rQo12fhCWOUWy9fl7wtqkp7In/YP2p5ZFyRuiiB9Qs3g+hS4gAmDWONbAHcRmVooNJ5eOHQDCOmUFXHg==", "requires": { "@babel/runtime": "^7.5.1", @@ -1663,7 +1663,7 @@ }, "@testing-library/react": { "version": "9.5.0", - "resolved": "https://npm.mlabs.pl:443/@testing-library%2freact/-/react-9.5.0.tgz", + "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-9.5.0.tgz", "integrity": "sha512-di1b+D0p+rfeboHO5W7gTVeZDIK5+maEgstrZbWZSSvxDyfDRkkyBE1AJR5Psd6doNldluXlCWqXriUfqu/9Qg==", "requires": { "@babel/runtime": "^7.8.4", @@ -1673,7 +1673,7 @@ }, "@testing-library/user-event": { "version": "7.2.1", - "resolved": "https://npm.mlabs.pl:443/@testing-library%2fuser-event/-/user-event-7.2.1.tgz", + "resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-7.2.1.tgz", "integrity": "sha512-oZ0Ib5I4Z2pUEcoo95cT1cr6slco9WY7yiPpG+RGNkj8YcYgJnM7pXmYmorNOReh8MIGcKSqXyeGjxnr8YiZbA==" }, "@types/babel__core": { @@ -1877,7 +1877,7 @@ }, "@types/testing-library__dom": { "version": "6.14.0", - "resolved": "https://npm.mlabs.pl:443/@types%2ftesting-library__dom/-/testing-library__dom-6.14.0.tgz", + "resolved": "https://registry.npmjs.org/@types/testing-library__dom/-/testing-library__dom-6.14.0.tgz", "integrity": "sha512-sMl7OSv0AvMOqn1UJ6j1unPMIHRXen0Ita1ujnMX912rrOcawe4f7wu0Zt9GIQhBhJvH2BaibqFgQ3lP+Pj2hA==", "requires": { "pretty-format": "^24.3.0" @@ -1885,7 +1885,7 @@ }, "@types/testing-library__react": { "version": "9.1.3", - "resolved": "https://npm.mlabs.pl:443/@types%2ftesting-library__react/-/testing-library__react-9.1.3.tgz", + "resolved": "https://registry.npmjs.org/@types/testing-library__react/-/testing-library__react-9.1.3.tgz", "integrity": "sha512-iCdNPKU3IsYwRK9JieSYAiX0+aYDXOGAmrC/3/M7AqqSDKnWWVv07X+Zk1uFSL7cMTUYzv4lQRfohucEocn5/w==", "requires": { "@types/react-dom": "*", @@ -1895,7 +1895,7 @@ "dependencies": { "@jest/types": { "version": "25.5.0", - "resolved": "https://npm.mlabs.pl:443/@jest%2ftypes/-/types-25.5.0.tgz", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.5.0.tgz", "integrity": "sha512-OXD0RgQ86Tu3MazKo8bnrkDRaDXXMGUqd+kTtLtK1Zb7CRzQcaSRPPPV37SvYTdevXEBVxe0HXylEjs8ibkmCw==", "requires": { "@types/istanbul-lib-coverage": "^2.0.0", @@ -1906,7 +1906,7 @@ }, "@types/yargs": { "version": "15.0.5", - "resolved": "https://npm.mlabs.pl:443/@types%2fyargs/-/yargs-15.0.5.tgz", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.5.tgz", "integrity": "sha512-Dk/IDOPtOgubt/IaevIUbTgV7doaKkoorvOyYM2CMwuDyP89bekI7H4xLIwunNYiK9jhCkmc6pUrJk3cj2AB9w==", "requires": { "@types/yargs-parser": "*" @@ -1914,7 +1914,7 @@ }, "ansi-styles": { "version": "4.2.1", - "resolved": "https://npm.mlabs.pl:443/ansi-styles/-/ansi-styles-4.2.1.tgz", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", "requires": { "@types/color-name": "^1.1.1", @@ -1923,7 +1923,7 @@ }, "chalk": { "version": "3.0.0", - "resolved": "https://npm.mlabs.pl:443/chalk/-/chalk-3.0.0.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", "requires": { "ansi-styles": "^4.1.0", @@ -1932,7 +1932,7 @@ }, "color-convert": { "version": "2.0.1", - "resolved": "https://npm.mlabs.pl:443/color-convert/-/color-convert-2.0.1.tgz", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "requires": { "color-name": "~1.1.4" @@ -1940,17 +1940,17 @@ }, "color-name": { "version": "1.1.4", - "resolved": "https://npm.mlabs.pl:443/color-name/-/color-name-1.1.4.tgz", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, "has-flag": { "version": "4.0.0", - "resolved": "https://npm.mlabs.pl:443/has-flag/-/has-flag-4.0.0.tgz", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" }, "pretty-format": { "version": "25.5.0", - "resolved": "https://npm.mlabs.pl:443/pretty-format/-/pretty-format-25.5.0.tgz", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-25.5.0.tgz", "integrity": "sha512-kbo/kq2LQ/A/is0PQwsEHM7Ca6//bGPPvU6UnsdDRSKTWxT/ru/xb88v4BJf6a69H+uTytOEsTusT9ksd/1iWQ==", "requires": { "@jest/types": "^25.5.0", @@ -1961,7 +1961,7 @@ }, "supports-color": { "version": "7.1.0", - "resolved": "https://npm.mlabs.pl:443/supports-color/-/supports-color-7.1.0.tgz", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", "requires": { "has-flag": "^4.0.0" @@ -2006,7 +2006,7 @@ }, "@typescript-eslint/experimental-utils": { "version": "3.9.0", - "resolved": "https://npm.mlabs.pl:443/@typescript-eslint%2fexperimental-utils/-/experimental-utils-3.9.0.tgz", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.9.0.tgz", "integrity": "sha512-/vSHUDYizSOhrOJdjYxPNGfb4a3ibO8zd4nUKo/QBFOmxosT3cVUV7KIg8Dwi6TXlr667G7YPqFK9+VSZOorNA==", "dev": true, "requires": { @@ -2019,7 +2019,7 @@ }, "@typescript-eslint/parser": { "version": "3.9.0", - "resolved": "https://npm.mlabs.pl:443/@typescript-eslint%2fparser/-/parser-3.9.0.tgz", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.9.0.tgz", "integrity": "sha512-rDHOKb6uW2jZkHQniUQVZkixQrfsZGUCNWWbKWep4A5hGhN5dLHMUCNAWnC4tXRlHedXkTDptIpxs6e4Pz8UfA==", "dev": true, "requires": { @@ -2032,13 +2032,13 @@ }, "@typescript-eslint/types": { "version": "3.9.0", - "resolved": "https://npm.mlabs.pl:443/@typescript-eslint%2ftypes/-/types-3.9.0.tgz", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-3.9.0.tgz", "integrity": "sha512-rb6LDr+dk9RVVXO/NJE8dT1pGlso3voNdEIN8ugm4CWM5w5GimbThCMiMl4da1t5u3YwPWEwOnKAULCZgBtBHg==", "dev": true }, "@typescript-eslint/typescript-estree": { "version": "3.9.0", - "resolved": "https://npm.mlabs.pl:443/@typescript-eslint%2ftypescript-estree/-/typescript-estree-3.9.0.tgz", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.9.0.tgz", "integrity": "sha512-N+158NKgN4rOmWVfvKOMoMFV5n8XxAliaKkArm/sOypzQ0bUL8MSnOEBW3VFIeffb/K5ce/cAV0yYhR7U4ALAA==", "dev": true, "requires": { @@ -2062,7 +2062,7 @@ }, "@typescript-eslint/visitor-keys": { "version": "3.9.0", - "resolved": "https://npm.mlabs.pl:443/@typescript-eslint%2fvisitor-keys/-/visitor-keys-3.9.0.tgz", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-3.9.0.tgz", "integrity": "sha512-O1qeoGqDbu0EZUC/MZ6F1WHTIzcBVhGqDj3LhTnj65WUA548RXVxUHbYhAW9bZWfb2rnX9QsbbP5nmeJ5Z4+ng==", "dev": true, "requires": { @@ -4380,7 +4380,7 @@ }, "css.escape": { "version": "1.5.1", - "resolved": "https://npm.mlabs.pl:443/css.escape/-/css.escape-1.5.1.tgz", + "resolved": "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz", "integrity": "sha1-QuJ9T6BK4y+TGktNQZH6nN3ul8s=" }, "cssdb": { @@ -4834,7 +4834,7 @@ }, "dom-accessibility-api": { "version": "0.3.0", - "resolved": "https://npm.mlabs.pl:443/dom-accessibility-api/-/dom-accessibility-api-0.3.0.tgz", + "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.3.0.tgz", "integrity": "sha512-PzwHEmsRP3IGY4gv/Ug+rMeaTIyTJvadCb+ujYXYeIylbHJezIyNToe8KfEgHTCEYyC+/bUghYOGg8yMGlZ6vA==" }, "dom-converter": { @@ -5188,7 +5188,7 @@ }, "eslint-config-prettier": { "version": "6.11.0", - "resolved": "https://npm.mlabs.pl:443/eslint-config-prettier/-/eslint-config-prettier-6.11.0.tgz", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.11.0.tgz", "integrity": "sha512-oB8cpLWSAjOVFEJhhyMZh6NOEOtBVziaqdDQ86+qhDHFbZXoRTM7pNSvFRfW/W/L/LrQ38C99J5CGuRBBzBsdA==", "dev": true, "requires": { @@ -5197,7 +5197,7 @@ "dependencies": { "get-stdin": { "version": "6.0.0", - "resolved": "https://npm.mlabs.pl:443/get-stdin/-/get-stdin-6.0.0.tgz", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz", "integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==", "dev": true } @@ -5406,7 +5406,7 @@ }, "eslint-plugin-prettier": { "version": "3.1.4", - "resolved": "https://npm.mlabs.pl:443/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.4.tgz", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.4.tgz", "integrity": "sha512-jZDa8z76klRqo+TdGDTFJSavwbnWK2ZpqGKNZ+VvweMW516pDUMmQ2koXvxEE4JhzNvTv+radye/bWGBmA6jmg==", "dev": true, "requires": { @@ -5817,7 +5817,7 @@ }, "fast-diff": { "version": "1.2.0", - "resolved": "https://npm.mlabs.pl:443/fast-diff/-/fast-diff-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", "dev": true }, @@ -9148,7 +9148,7 @@ }, "node-sass": { "version": "4.14.1", - "resolved": "https://npm.mlabs.pl:443/node-sass/-/node-sass-4.14.1.tgz", + "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.14.1.tgz", "integrity": "sha512-sjCuOlvGyCJS40R8BscF5vhVlQjNN069NtQ1gSxyK1u9iqvn6tf7O1R4GNowVZfiZUCRt5MmMs1xd+4V/7Yr0g==", "requires": { "async-foreach": "^0.1.3", @@ -9172,17 +9172,17 @@ "dependencies": { "ansi-regex": { "version": "2.1.1", - "resolved": "https://npm.mlabs.pl:443/ansi-regex/-/ansi-regex-2.1.1.tgz", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" }, "ansi-styles": { "version": "2.2.1", - "resolved": "https://npm.mlabs.pl:443/ansi-styles/-/ansi-styles-2.2.1.tgz", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" }, "chalk": { "version": "1.1.3", - "resolved": "https://npm.mlabs.pl:443/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "requires": { "ansi-styles": "^2.2.1", @@ -9194,7 +9194,7 @@ }, "cross-spawn": { "version": "3.0.1", - "resolved": "https://npm.mlabs.pl:443/cross-spawn/-/cross-spawn-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-3.0.1.tgz", "integrity": "sha1-ElYDfsufDF9549bvE14wdwGEuYI=", "requires": { "lru-cache": "^4.0.1", @@ -9203,7 +9203,7 @@ }, "lru-cache": { "version": "4.1.5", - "resolved": "https://npm.mlabs.pl:443/lru-cache/-/lru-cache-4.1.5.tgz", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", "requires": { "pseudomap": "^1.0.2", @@ -9212,7 +9212,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "https://npm.mlabs.pl:443/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "requires": { "ansi-regex": "^2.0.0" @@ -9220,12 +9220,12 @@ }, "supports-color": { "version": "2.0.0", - "resolved": "https://npm.mlabs.pl:443/supports-color/-/supports-color-2.0.0.tgz", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" }, "yallist": { "version": "2.1.2", - "resolved": "https://npm.mlabs.pl:443/yallist/-/yallist-2.1.2.tgz", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" } } @@ -10880,13 +10880,13 @@ }, "prettier": { "version": "2.0.5", - "resolved": "https://npm.mlabs.pl:443/prettier/-/prettier-2.0.5.tgz", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz", "integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==", "dev": true }, "prettier-linter-helpers": { "version": "1.0.0", - "resolved": "https://npm.mlabs.pl:443/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", "dev": true, "requires": { @@ -11743,7 +11743,7 @@ }, "redent": { "version": "3.0.0", - "resolved": "https://npm.mlabs.pl:443/redent/-/redent-3.0.0.tgz", + "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", "requires": { "indent-string": "^4.0.0", @@ -13202,7 +13202,7 @@ }, "strip-indent": { "version": "3.0.0", - "resolved": "https://npm.mlabs.pl:443/strip-indent/-/strip-indent-3.0.0.tgz", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", "requires": { "min-indent": "^1.0.0" @@ -14007,7 +14007,7 @@ }, "wait-for-expect": { "version": "3.0.2", - "resolved": "https://npm.mlabs.pl:443/wait-for-expect/-/wait-for-expect-3.0.2.tgz", + "resolved": "https://registry.npmjs.org/wait-for-expect/-/wait-for-expect-3.0.2.tgz", "integrity": "sha512-cfS1+DZxuav1aBYbaO/kE06EOS8yRw7qOFoD3XtjTkYvCvh3zUvNST8DXK/nPaeqIzIv3P3kL3lRJn8iwOiSag==" }, "walker": { diff --git a/src/components/RightBar/index.scss b/src/components/RightBar/index.scss deleted file mode 100644 index dc0c833..0000000 --- a/src/components/RightBar/index.scss +++ /dev/null @@ -1,31 +0,0 @@ -.right-bar { - padding-top: 10px; - padding-left: 15px; - padding-right: 15px; - text-align: center; - font-family: Lato; - width: 300px; - &__text { - border-bottom: 1px solid; - } - height:85vh; - overflow-y: scroll; - } - .right-bar::-webkit-scrollbar-track -{ - border-radius: 10px; - background-color: #F5F5F5; -} - -.right-bar::-webkit-scrollbar -{ - width: 12px; - background-color: #F5F5F5; -} - -.right-bar::-webkit-scrollbar-thumb -{ - border-radius: 10px; - background-color: #d4b851; - border: 1px solid; -} \ No newline at end of file diff --git a/src/components/RightBar/index.tsx b/src/components/RightBar/index.tsx index ebcf2e6..813a957 100644 --- a/src/components/RightBar/index.tsx +++ b/src/components/RightBar/index.tsx @@ -1,13 +1,39 @@ import React, { useState, useContext } from 'react'; -import './index.scss'; -import { Course } from '../../types'; import { CourseCard } from './CourseCard/index'; import { coursesContext } from '../../contexts/CoursesProvider'; +import styled from 'styled-components'; interface RightBarProps { onGroupMouseOver: (id: number, name: string) => void; } +const RightBarStyled = styled.div` + padding-top: 10px; + padding-left: 15px; + padding-right: 15px; + text-align: center; + font-family: Lato; + width: 300px; + height: 85vh; + overflow-y: scroll; + ::-webkit-scrollbar-track { + border-radius: 10px; + background-color: #f5f5f5; + } + ::-webkit-scrollbar { + width: 12px; + background-color: #f5f5f5; + } + ::-webkit-scrollbar-thumb { + border-radius: 10px; + background-color: #d4b851; + border: 1px solid; + } +`; +const RightBarTextStyled = styled.div` + border-bottom: 1px solid; +`; + export default function RightBar({ onGroupMouseOver }: RightBarProps) { const [selectedCardId, setSelectedCardId] = useState(null); @@ -19,11 +45,11 @@ export default function RightBar({ onGroupMouseOver }: RightBarProps) { }; return ( -
-
+ + Hubert Wrzesiński

Semestr zimowy 2020/2021 -
+ {courses.map((course, index) => ( ))} -
+ ); } diff --git a/src/components/Scheduler/SchedulerEvents/index.tsx b/src/components/Scheduler/SchedulerEvents/index.tsx index f8723f9..665bbcf 100644 --- a/src/components/Scheduler/SchedulerEvents/index.tsx +++ b/src/components/Scheduler/SchedulerEvents/index.tsx @@ -34,7 +34,6 @@ export const SchedulerEvents = ({ cellTop, cellWidth }: SchedulerEventsProps) => function mapGroupTimeToEventRow(groups: Array) { const groupsMappedToEventsTemp = []; for (const group of groups) { - console.log(group); const groupTime = group.time; const eventRow: number = groupTimeToEventRowMapping[groupTime]; const groupMappedToEvent: any = { @@ -61,8 +60,6 @@ export const SchedulerEvents = ({ cellTop, cellWidth }: SchedulerEventsProps) => }, [choosenGroups]); useEffect(() => { - console.log(choosenGroups); - console.log(groupsMappedToEvents); }, [groupsMappedToEvents]); return ( diff --git a/src/components/Scheduler/SchedulerRow/index.tsx b/src/components/Scheduler/SchedulerRow/index.tsx index ad8e434..5366158 100644 --- a/src/components/Scheduler/SchedulerRow/index.tsx +++ b/src/components/Scheduler/SchedulerRow/index.tsx @@ -26,7 +26,8 @@ interface SchedulerRowProps { } export const SchedulerRow = ({ groups, indexRow, cellTop, cellWidth }: SchedulerRowProps) => { - console.log(`You passed me these of a groupzzz: ${groups}`); + console.log(`You passed me these of a groupzzz`); + console.log(groups) return ( <> diff --git a/src/components/TopBar/Results/index.scss b/src/components/TopBar/Results/index.scss deleted file mode 100644 index e1d64fe..0000000 --- a/src/components/TopBar/Results/index.scss +++ /dev/null @@ -1,23 +0,0 @@ -.course { - position: relative; - z-index: 10; - padding: 5px; - padding-left: 20px; - background-color: #e6c759; - font-size: 18px; - font-family: Lato; -} -.course:hover { - background-color: #d4b851; - cursor: pointer; -} -.dropdown::-webkit-scrollbar { - display: none; -} -.dropdown { - max-height: 400px; - overflow-y: auto; -} -.top-bar__input-field { - width: 100%; -} diff --git a/src/components/TopBar/Results/index.tsx b/src/components/TopBar/Results/index.tsx index b1a94f8..c397fca 100644 --- a/src/components/TopBar/Results/index.tsx +++ b/src/components/TopBar/Results/index.tsx @@ -1,17 +1,48 @@ import React, { useState, useContext, useEffect } from 'react'; import axios from 'axios'; import { Input } from '@material-ui/core'; -import './index.scss'; import ClickAwayListener from '@material-ui/core/ClickAwayListener'; import { coursesContext } from '../../../contexts/CoursesProvider'; -import { Course, Group } from '../../../types'; +import { Course } from '../../../types'; +import styled from 'styled-components'; +import { makeStyles } from '@material-ui/core/styles'; interface courseData { name: string; id: number; } +const CourseStyled = styled.div` + position: relative; + z-index: 10; + padding: 5px; + padding-left: 20px; + background-color: #e6c759; + font-size: 18px; + font-family: Lato; + :hover { + background-color: #d4b851; + cursor: pointer; + } +`; + +const Dropdown = styled.div` + max-height: 400px; + overflow-y: auto; + ::-webkit-scrollbar { + display: none; + } +`; + +const useStyles = makeStyles({ + topbarInput: { + marginTop:"8px", + width: '100%', + }, +}); + export const Results: React.FC = () => { + const classes = useStyles(); const [input, setInput] = useState(''); const [coursesData, setcoursesData] = useState>([]); const [filteredcoursesData, setFilteredcoursesData] = useState>([]); @@ -90,25 +121,26 @@ export const Results: React.FC = () => { // } }; + return (
{open ? ( -
+ {filteredcoursesData.map((course, index) => ( -
+

{course.name}

-
+ ))} -
+ ) : null}
From 4f7bc8aaa476e8031d48ed1d0a7aea9eb90824c9 Mon Sep 17 00:00:00 2001 From: wrzesinski-hubert Date: Mon, 17 Aug 2020 21:15:26 +0200 Subject: [PATCH 19/27] styled components --- src/components/RightBar/CourseCard/index.scss | 59 ----- src/components/RightBar/CourseCard/index.tsx | 81 +++++- src/components/TopBar/index.scss | 71 ------ src/components/TopBar/index.tsx | 235 ++++++++++-------- src/components/Transfer/index.tsx | 12 + 5 files changed, 222 insertions(+), 236 deletions(-) delete mode 100644 src/components/RightBar/CourseCard/index.scss delete mode 100644 src/components/TopBar/index.scss diff --git a/src/components/RightBar/CourseCard/index.scss b/src/components/RightBar/CourseCard/index.scss deleted file mode 100644 index 8a15cc8..0000000 --- a/src/components/RightBar/CourseCard/index.scss +++ /dev/null @@ -1,59 +0,0 @@ -.class { - display: flex; - min-height: 50px; - background-color: rgb(100, 181, 246) !important; - align-items: center; - justify-content: center; - flex-direction: column; - margin-top: 10px; - padding-top: 10px; - padding-bottom: 10px; - border-radius: 10px; - cursor: pointer; - align-items: stretch; - &__group { - padding-top: 1px; - padding-bottom: 1px; - &:hover { - cursor: pointer; - transition: 1s; - background-color: #8bc8fb; - } - } - &__name { - padding-top: 10px; - padding-bottom: 10px; - } - &__expandIcon { - margin-top: 5px; - width: 20px; - transition: 0.2s; - } - &__expandIconRotate { - margin-top: 5px; - width: 20px; - transition: 0.5s; - transform: scaleY(-1); - } - .expanded { - max-height: 244px; - overflow-y: auto; - } - .expanded::-webkit-scrollbar-track { - border-radius: 10px; - border-radius: 10px; - background-color: #8bc8fb; - } - - .expanded::-webkit-scrollbar { - width: 12px; - border-radius: 10px; - background-color: #8bc8fb; - } - - .expanded::-webkit-scrollbar-thumb { - border-radius: 10px; - background-color: #d4b851; - border: 1px solid; - } -} diff --git a/src/components/RightBar/CourseCard/index.tsx b/src/components/RightBar/CourseCard/index.tsx index e2ca19c..68c5e98 100644 --- a/src/components/RightBar/CourseCard/index.tsx +++ b/src/components/RightBar/CourseCard/index.tsx @@ -1,10 +1,11 @@ import React, { useContext } from 'react'; -import './index.scss'; import Collapse from '@material-ui/core/Collapse'; import ExpandIcon from './expand.png'; import { Course, Group } from '../../../types/index'; import { coursesContext } from '../../../contexts/CoursesProvider'; import { group } from 'console'; +import styled from 'styled-components'; +import { makeStyles } from '@material-ui/core/styles'; interface CourseCardProps { onGroupMouseOver: (id: number, name: string) => void; @@ -14,7 +15,70 @@ interface CourseCardProps { isSelected: boolean; } +interface ClassExandIconProps { + isSelected: boolean; +} + + +const ClassStyled = styled.div` + display: flex; + min-height: 50px; + background-color: rgb(100, 181, 246) !important; + align-items: center; + justify-content: center; + flex-direction: column; + margin-top: 10px; + padding-top: 10px; + padding-bottom: 10px; + border-radius: 10px; + cursor: pointer; + align-items: stretch; +`; + +const ClassNameStyled = styled.div` + padding-top: 10px; + padding-bottom: 10px; +`; + +const ClassGroupStyled = styled.div` + padding-top: 1px; + padding-bottom: 1px; + :hover { + cursor: pointer; + transition: 1s; + background-color: #8bc8fb; + } +`; + +const ClassExandIconStyled = styled.img` + margin-top: 5px; + width: 20px; + transition: 0.2s; + transform: ${props => props.isSelected ? 'scaleY(-1);' : 'scaleY(1);'}; +` + +const useStyles = makeStyles({ + expanded: { + maxHeight: "244px", + overflowY: "auto", + }, + '@global': { + '*::-webkit-scrollbar': { + width: '0.4em' + }, + '*::-webkit-scrollbar-track': { + '-webkit-box-shadow': 'inset 0 0 6px rgba(1,0,0,0.1)' + }, + '*::-webkit-scrollbar-thumb': { + borderRadius: "10px", + backgroundColor: '#d4b851', + outline: '1px solid slategrey' + } + } +}); + export function CourseCard({ onGroupMouseOver, onCardClick, course, id, isSelected }: CourseCardProps) { + const classes = useStyles(); const { addGroup, courses } = useContext(coursesContext)!; function onGroupClick(group: Group) { @@ -22,14 +86,13 @@ export function CourseCard({ onGroupMouseOver, onCardClick, course, id, isSelect } return ( -
-
{course.name}
- + + {course.name} + {courses.map((course, index) => ( <> {course.groups.map((group, index) => ( -
onGroupMouseOver(group.id, course.name)} onClick={() => onGroupClick(group)} @@ -37,14 +100,14 @@ export function CourseCard({ onGroupMouseOver, onCardClick, course, id, isSelect

{group.time} {group.room}

{group.lecturer}

{' '} -
+ ))} ))}
- expand +
-
+ ); } diff --git a/src/components/TopBar/index.scss b/src/components/TopBar/index.scss deleted file mode 100644 index e31438e..0000000 --- a/src/components/TopBar/index.scss +++ /dev/null @@ -1,71 +0,0 @@ -.top-bar { - background-color: #ffdc61; - height: 80px; - padding: 5px; - font-family: comic sans MS; - font-size: 24px; - font-weight: bold; - display: flex; - justify-content: space-between; - - &__logo { - display: flex; - align-items: center; - flex-grow: 0.5; - justify-content: flex-start; - - &-image { - width: 80px; - height: 80px; - } - } - - &__input { - &-div { - width: 70%; - display: flex; - flex-grow: 3; - } - - &-field { - width: 96%; - margin-top: 10px; - } - - &-icon { - width: 35px; - } - } - - &__icon { - width: 50px; - cursor: pointer; - &-box { - display: flex; - align-items: center; - justify-content: space-around; - flex-grow: 1.5; - } - } - &__menu{ -margin-top: 25px; - } -} -@media only screen and (max-width: 670px) { - .top-bar { - &__tekst { - display: none; - } - &__icon { - width: 35px; - } - &__logo-image { - width: 60px; - height: 60px; - } - - &__input-icon { - width: 25px; - } - } -} diff --git a/src/components/TopBar/index.tsx b/src/components/TopBar/index.tsx index d00f7a6..5556ced 100644 --- a/src/components/TopBar/index.tsx +++ b/src/components/TopBar/index.tsx @@ -1,111 +1,152 @@ -import React from "react"; -import "./index.scss"; -import Transfer from "./transfer.png"; -import Search from "./search.svg"; -import UK from "./UK.png"; -import PL from "./PL.png"; -import User from "./user.png"; -import CloseIcon from "./close.svg"; -import { Profile } from "./Profile"; -import {Results} from "./Results"; +import React from 'react'; +import Transfer from './transfer.png'; +import Search from './search.svg'; +import UK from './UK.png'; +import PL from './PL.png'; +import User from './user.png'; +import CloseIcon from './close.svg'; +import { Profile } from './Profile'; +import { Results } from './Results'; +import styled from 'styled-components'; interface TopBarProps { - handleTransfer: (e: React.MouseEvent) => void; - onLangChange: (lang: boolean) => void; - handleLogout: () => void; + handleTransfer: (e: React.MouseEvent) => void; + onLangChange: (lang: boolean) => void; + handleLogout: () => void; } interface TopBarState { - isPolish: boolean; - anchorEl: HTMLElement | null; + isPolish: boolean; + anchorEl: HTMLElement | null; } +const TopBarTekstStyled = styled.div` + @media only screen and (max-width: 670px) { + display: none; + } +`; + +const TopBarStyled = styled.div` + background-color: #ffdc61; + height: 80px; + padding: 5px; + font-family: comic sans MS; + font-size: 24px; + font-weight: bold; + display: flex; + justify-content: space-between; +`; + +const TopBarLogoStyled = styled.div` + display: flex; + align-items: center; + flex-grow: 0.5; + justify-content: flex-start; +`; + +const TopBarLogoImageStyled = styled.img` + width: 80px; + height: 80px; + @media only screen and (max-width: 670px) { + width: 60px; + height: 60px; + } +`; + +const TopBarInputDivStyled = styled.div` + width: 70%; + display: flex; + flex-grow: 3; +`; + +const TopBarInputFieldStyled = styled.div` + width: 96%; + margin-top: 10px; +`; + +const TopBarInputIconStyled = styled.img` + width: 35px; + @media only screen and (max-width: 670px) { + width: 25px; + } +`; + +const TopBarIcon = styled.img` + width: 50px; + cursor: pointer; + @media only screen and (max-width: 670px) { + width: 35px; + } +`; + +const TopBarIconBox = styled.div` + display: flex; + align-items: center; + justify-content: space-around; + flex-grow: 1.5; +`; + export default class TopBar extends React.Component { - constructor(props: TopBarProps) { - super(props); - this.handleProfile = this.handleProfile.bind(this); - this.handleClose = this.handleClose.bind(this); - this.onLangChange = this.onLangChange.bind(this); - this.handleTransfer = this.handleTransfer.bind(this); - this.state = { - isPolish: true, - anchorEl: null, - }; - } + constructor(props: TopBarProps) { + super(props); + this.handleProfile = this.handleProfile.bind(this); + this.handleClose = this.handleClose.bind(this); + this.onLangChange = this.onLangChange.bind(this); + this.handleTransfer = this.handleTransfer.bind(this); + this.state = { + isPolish: true, + anchorEl: null, + }; + } - handleTransfer(e: React.MouseEvent) { - this.props.handleTransfer(e); - } + handleTransfer(e: React.MouseEvent) { + this.props.handleTransfer(e); + } - onLangChange(e: React.MouseEvent) { - this.setState({ - isPolish: !this.state.isPolish, - }); - this.props.onLangChange(this.state.isPolish); - } + onLangChange(e: React.MouseEvent) { + this.setState({ + isPolish: !this.state.isPolish, + }); + this.props.onLangChange(this.state.isPolish); + } - handleProfile(event: React.MouseEvent) { - this.setState({ - anchorEl: event.currentTarget, - }); - } + handleProfile(event: React.MouseEvent) { + this.setState({ + anchorEl: event.currentTarget, + }); + } - handleClose() { - this.setState({ - anchorEl: null, - }); - } + handleClose() { + this.setState({ + anchorEl: null, + }); + } - render() { - return ( -
-
- logo -
plan na plan
-
-
- search -
- close -
-
- transfer - change_language - profile - -
-
- ); - } + render() { + return ( + + + + plan na plan + + + + + + + + + + + + + + + + ); + } } diff --git a/src/components/Transfer/index.tsx b/src/components/Transfer/index.tsx index 7f4ba6f..40ed89f 100644 --- a/src/components/Transfer/index.tsx +++ b/src/components/Transfer/index.tsx @@ -3,6 +3,9 @@ import Modal from "@material-ui/core/Modal"; import "./index.scss"; import Fade from '@material-ui/core/Fade'; import Input from "@material-ui/core/Input"; +import { makeStyles } from '@material-ui/core/styles'; +import styled from 'styled-components'; + interface TransferProps { handleClose: (e: React.MouseEvent) => void; isOpen: boolean; @@ -10,6 +13,15 @@ interface TransferProps { interface TransferState {} +const useStyles = makeStyles({ + wrapper: { + display: "flex", + justifyContent: "center", + textAlign: "center", + alignItems: "center", + }, +}); + export default class Transfer extends React.Component< TransferProps, TransferState From 55bb7945c9d33d7502687a1c3b1d57aad14fdce5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciek=20G=C5=82owacki?= Date: Mon, 17 Aug 2020 22:05:13 +0200 Subject: [PATCH 20/27] Restructured components and refactored topbar to functional --- package-lock.json | 195 ++++++------------ package.json | 6 +- public/manifest.json | 22 +- src/App.tsx | 40 ---- src/{components/TopBar => assets}/PL.png | Bin src/{components/TopBar => assets}/UK.png | Bin src/{components/TopBar => assets}/close.svg | 0 .../RightBar/CourseCard => assets}/expand.png | Bin src/{components/TopBar => assets}/search.svg | 0 .../TopBar => assets}/transfer.png | Bin src/{components/TopBar => assets}/user.png | Bin src/components/App.tsx | 32 +++ .../CourseCard/index.tsx => CourseCard.tsx} | 57 +++-- src/components/{TopBar => }/Profile.tsx | 0 .../{TopBar/Results/index.tsx => Results.tsx} | 7 +- .../{RightBar/index.tsx => Rightbar.tsx} | 23 +-- .../{Scheduler/index.tsx => Scheduler.tsx} | 2 +- .../index.tsx => SchedulerEvents.tsx} | 6 +- .../index.tsx => SchedulerRow.tsx} | 2 +- src/components/TopBar/index.tsx | 152 -------------- src/components/Topbar.tsx | 114 ++++++++++ src/components/Transfer/Transfer.tsx | 57 +++++ src/components/Transfer/index.tsx | 70 ------- src/index.tsx | 2 +- 24 files changed, 321 insertions(+), 466 deletions(-) delete mode 100644 src/App.tsx rename src/{components/TopBar => assets}/PL.png (100%) rename src/{components/TopBar => assets}/UK.png (100%) rename src/{components/TopBar => assets}/close.svg (100%) rename src/{components/RightBar/CourseCard => assets}/expand.png (100%) rename src/{components/TopBar => assets}/search.svg (100%) rename src/{components/TopBar => assets}/transfer.png (100%) rename src/{components/TopBar => assets}/user.png (100%) create mode 100644 src/components/App.tsx rename src/components/{RightBar/CourseCard/index.tsx => CourseCard.tsx} (69%) rename src/components/{TopBar => }/Profile.tsx (100%) rename src/components/{TopBar/Results/index.tsx => Results.tsx} (96%) rename src/components/{RightBar/index.tsx => Rightbar.tsx} (71%) rename src/components/{Scheduler/index.tsx => Scheduler.tsx} (98%) rename src/components/{Scheduler/SchedulerEvents/index.tsx => SchedulerEvents.tsx} (93%) rename src/components/{Scheduler/SchedulerRow/index.tsx => SchedulerRow.tsx} (96%) delete mode 100644 src/components/TopBar/index.tsx create mode 100644 src/components/Topbar.tsx create mode 100644 src/components/Transfer/Transfer.tsx delete mode 100644 src/components/Transfer/index.tsx diff --git a/package-lock.json b/package-lock.json index c18cd30..a4d832b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1415,7 +1415,7 @@ }, "@sheerun/mutationobserver-shim": { "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@sheerun/mutationobserver-shim/-/mutationobserver-shim-0.3.3.tgz", + "resolved": "https://npm.mlabs.pl:443/@sheerun%2fmutationobserver-shim/-/mutationobserver-shim-0.3.3.tgz", "integrity": "sha512-DetpxZw1fzPD5xUBrIAoplLChO2VB8DlL5Gg+I1IR9b2wPqYIca2WSUxL5g1vLeR4MsQq1NeWriXAVffV+U1Fw==" }, "@svgr/babel-plugin-add-jsx-attribute": { @@ -1529,7 +1529,7 @@ }, "@testing-library/dom": { "version": "6.16.0", - "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-6.16.0.tgz", + "resolved": "https://npm.mlabs.pl:443/@testing-library%2fdom/-/dom-6.16.0.tgz", "integrity": "sha512-lBD88ssxqEfz0wFL6MeUyyWZfV/2cjEZZV3YRpb2IoJRej/4f1jB0TzqIOznTpfR1r34CNesrubxwIlAQ8zgPA==", "requires": { "@babel/runtime": "^7.8.4", @@ -1552,7 +1552,7 @@ }, "@jest/types": { "version": "25.5.0", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.5.0.tgz", + "resolved": "https://npm.mlabs.pl:443/@jest%2ftypes/-/types-25.5.0.tgz", "integrity": "sha512-OXD0RgQ86Tu3MazKo8bnrkDRaDXXMGUqd+kTtLtK1Zb7CRzQcaSRPPPV37SvYTdevXEBVxe0HXylEjs8ibkmCw==", "requires": { "@types/istanbul-lib-coverage": "^2.0.0", @@ -1563,7 +1563,7 @@ }, "@types/yargs": { "version": "15.0.5", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.5.tgz", + "resolved": "https://npm.mlabs.pl:443/@types%2fyargs/-/yargs-15.0.5.tgz", "integrity": "sha512-Dk/IDOPtOgubt/IaevIUbTgV7doaKkoorvOyYM2CMwuDyP89bekI7H4xLIwunNYiK9jhCkmc6pUrJk3cj2AB9w==", "requires": { "@types/yargs-parser": "*" @@ -1571,7 +1571,7 @@ }, "ansi-styles": { "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "resolved": "https://npm.mlabs.pl:443/ansi-styles/-/ansi-styles-4.2.1.tgz", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", "requires": { "@types/color-name": "^1.1.1", @@ -1599,7 +1599,7 @@ }, "chalk": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "resolved": "https://npm.mlabs.pl:443/chalk/-/chalk-3.0.0.tgz", "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", "requires": { "ansi-styles": "^4.1.0", @@ -1608,7 +1608,7 @@ }, "color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "resolved": "https://npm.mlabs.pl:443/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "requires": { "color-name": "~1.1.4" @@ -1616,17 +1616,17 @@ }, "color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "resolved": "https://npm.mlabs.pl:443/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, "has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "resolved": "https://npm.mlabs.pl:443/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" }, "pretty-format": { "version": "25.5.0", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-25.5.0.tgz", + "resolved": "https://npm.mlabs.pl:443/pretty-format/-/pretty-format-25.5.0.tgz", "integrity": "sha512-kbo/kq2LQ/A/is0PQwsEHM7Ca6//bGPPvU6UnsdDRSKTWxT/ru/xb88v4BJf6a69H+uTytOEsTusT9ksd/1iWQ==", "requires": { "@jest/types": "^25.5.0", @@ -1637,7 +1637,7 @@ }, "supports-color": { "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "resolved": "https://npm.mlabs.pl:443/supports-color/-/supports-color-7.1.0.tgz", "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", "requires": { "has-flag": "^4.0.0" @@ -1647,7 +1647,7 @@ }, "@testing-library/jest-dom": { "version": "4.2.4", - "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-4.2.4.tgz", + "resolved": "https://npm.mlabs.pl:443/@testing-library%2fjest-dom/-/jest-dom-4.2.4.tgz", "integrity": "sha512-j31Bn0rQo12fhCWOUWy9fl7wtqkp7In/YP2p5ZFyRuiiB9Qs3g+hS4gAmDWONbAHcRmVooNJ5eOHQDCOmUFXHg==", "requires": { "@babel/runtime": "^7.5.1", @@ -1663,7 +1663,7 @@ }, "@testing-library/react": { "version": "9.5.0", - "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-9.5.0.tgz", + "resolved": "https://npm.mlabs.pl:443/@testing-library%2freact/-/react-9.5.0.tgz", "integrity": "sha512-di1b+D0p+rfeboHO5W7gTVeZDIK5+maEgstrZbWZSSvxDyfDRkkyBE1AJR5Psd6doNldluXlCWqXriUfqu/9Qg==", "requires": { "@babel/runtime": "^7.8.4", @@ -1673,7 +1673,7 @@ }, "@testing-library/user-event": { "version": "7.2.1", - "resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-7.2.1.tgz", + "resolved": "https://npm.mlabs.pl:443/@testing-library%2fuser-event/-/user-event-7.2.1.tgz", "integrity": "sha512-oZ0Ib5I4Z2pUEcoo95cT1cr6slco9WY7yiPpG+RGNkj8YcYgJnM7pXmYmorNOReh8MIGcKSqXyeGjxnr8YiZbA==" }, "@types/babel__core": { @@ -1877,7 +1877,7 @@ }, "@types/testing-library__dom": { "version": "6.14.0", - "resolved": "https://registry.npmjs.org/@types/testing-library__dom/-/testing-library__dom-6.14.0.tgz", + "resolved": "https://npm.mlabs.pl:443/@types%2ftesting-library__dom/-/testing-library__dom-6.14.0.tgz", "integrity": "sha512-sMl7OSv0AvMOqn1UJ6j1unPMIHRXen0Ita1ujnMX912rrOcawe4f7wu0Zt9GIQhBhJvH2BaibqFgQ3lP+Pj2hA==", "requires": { "pretty-format": "^24.3.0" @@ -1885,7 +1885,7 @@ }, "@types/testing-library__react": { "version": "9.1.3", - "resolved": "https://registry.npmjs.org/@types/testing-library__react/-/testing-library__react-9.1.3.tgz", + "resolved": "https://npm.mlabs.pl:443/@types%2ftesting-library__react/-/testing-library__react-9.1.3.tgz", "integrity": "sha512-iCdNPKU3IsYwRK9JieSYAiX0+aYDXOGAmrC/3/M7AqqSDKnWWVv07X+Zk1uFSL7cMTUYzv4lQRfohucEocn5/w==", "requires": { "@types/react-dom": "*", @@ -1895,7 +1895,7 @@ "dependencies": { "@jest/types": { "version": "25.5.0", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-25.5.0.tgz", + "resolved": "https://npm.mlabs.pl:443/@jest%2ftypes/-/types-25.5.0.tgz", "integrity": "sha512-OXD0RgQ86Tu3MazKo8bnrkDRaDXXMGUqd+kTtLtK1Zb7CRzQcaSRPPPV37SvYTdevXEBVxe0HXylEjs8ibkmCw==", "requires": { "@types/istanbul-lib-coverage": "^2.0.0", @@ -1906,7 +1906,7 @@ }, "@types/yargs": { "version": "15.0.5", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.5.tgz", + "resolved": "https://npm.mlabs.pl:443/@types%2fyargs/-/yargs-15.0.5.tgz", "integrity": "sha512-Dk/IDOPtOgubt/IaevIUbTgV7doaKkoorvOyYM2CMwuDyP89bekI7H4xLIwunNYiK9jhCkmc6pUrJk3cj2AB9w==", "requires": { "@types/yargs-parser": "*" @@ -1914,7 +1914,7 @@ }, "ansi-styles": { "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "resolved": "https://npm.mlabs.pl:443/ansi-styles/-/ansi-styles-4.2.1.tgz", "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", "requires": { "@types/color-name": "^1.1.1", @@ -1923,7 +1923,7 @@ }, "chalk": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "resolved": "https://npm.mlabs.pl:443/chalk/-/chalk-3.0.0.tgz", "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", "requires": { "ansi-styles": "^4.1.0", @@ -1932,7 +1932,7 @@ }, "color-convert": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "resolved": "https://npm.mlabs.pl:443/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "requires": { "color-name": "~1.1.4" @@ -1940,17 +1940,17 @@ }, "color-name": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "resolved": "https://npm.mlabs.pl:443/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, "has-flag": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "resolved": "https://npm.mlabs.pl:443/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" }, "pretty-format": { "version": "25.5.0", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-25.5.0.tgz", + "resolved": "https://npm.mlabs.pl:443/pretty-format/-/pretty-format-25.5.0.tgz", "integrity": "sha512-kbo/kq2LQ/A/is0PQwsEHM7Ca6//bGPPvU6UnsdDRSKTWxT/ru/xb88v4BJf6a69H+uTytOEsTusT9ksd/1iWQ==", "requires": { "@jest/types": "^25.5.0", @@ -1961,7 +1961,7 @@ }, "supports-color": { "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "resolved": "https://npm.mlabs.pl:443/supports-color/-/supports-color-7.1.0.tgz", "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", "requires": { "has-flag": "^4.0.0" @@ -1982,68 +1982,46 @@ "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-15.0.0.tgz", "integrity": "sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw==" }, - "@typescript-eslint/eslint-plugin": { - "version": "3.9.0", - "resolved": "https://npm.mlabs.pl:443/@typescript-eslint%2feslint-plugin/-/eslint-plugin-3.9.0.tgz", - "integrity": "sha512-UD6b4p0/hSe1xdTvRCENSx7iQ+KR6ourlZFfYuPC7FlXEzdHuLPrEmuxZ23b2zW96KJX9Z3w05GE/wNOiEzrVg==", - "dev": true, - "requires": { - "@typescript-eslint/experimental-utils": "3.9.0", - "debug": "^4.1.1", - "functional-red-black-tree": "^1.0.1", - "regexpp": "^3.0.0", - "semver": "^7.3.2", - "tsutils": "^3.17.1" - }, - "dependencies": { - "semver": { - "version": "7.3.2", - "resolved": "https://npm.mlabs.pl:443/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", - "dev": true - } - } - }, "@typescript-eslint/experimental-utils": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.9.0.tgz", - "integrity": "sha512-/vSHUDYizSOhrOJdjYxPNGfb4a3ibO8zd4nUKo/QBFOmxosT3cVUV7KIg8Dwi6TXlr667G7YPqFK9+VSZOorNA==", + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.9.1.tgz", + "integrity": "sha512-lkiZ8iBBaYoyEKhCkkw4SAeatXyBq9Ece5bZXdLe1LWBUwTszGbmbiqmQbwWA8cSYDnjWXp9eDbXpf9Sn0hLAg==", "dev": true, "requires": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/types": "3.9.0", - "@typescript-eslint/typescript-estree": "3.9.0", + "@typescript-eslint/types": "3.9.1", + "@typescript-eslint/typescript-estree": "3.9.1", "eslint-scope": "^5.0.0", "eslint-utils": "^2.0.0" } }, "@typescript-eslint/parser": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.9.0.tgz", - "integrity": "sha512-rDHOKb6uW2jZkHQniUQVZkixQrfsZGUCNWWbKWep4A5hGhN5dLHMUCNAWnC4tXRlHedXkTDptIpxs6e4Pz8UfA==", + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.9.1.tgz", + "integrity": "sha512-y5QvPFUn4Vl4qM40lI+pNWhTcOWtpZAJ8pOEQ21fTTW4xTJkRplMjMRje7LYTXqVKKX9GJhcyweMz2+W1J5bMg==", "dev": true, "requires": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "3.9.0", - "@typescript-eslint/types": "3.9.0", - "@typescript-eslint/typescript-estree": "3.9.0", + "@typescript-eslint/experimental-utils": "3.9.1", + "@typescript-eslint/types": "3.9.1", + "@typescript-eslint/typescript-estree": "3.9.1", "eslint-visitor-keys": "^1.1.0" } }, "@typescript-eslint/types": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-3.9.0.tgz", - "integrity": "sha512-rb6LDr+dk9RVVXO/NJE8dT1pGlso3voNdEIN8ugm4CWM5w5GimbThCMiMl4da1t5u3YwPWEwOnKAULCZgBtBHg==", + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-3.9.1.tgz", + "integrity": "sha512-15JcTlNQE1BsYy5NBhctnEhEoctjXOjOK+Q+rk8ugC+WXU9rAcS2BYhoh6X4rOaXJEpIYDl+p7ix+A5U0BqPTw==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.9.0.tgz", - "integrity": "sha512-N+158NKgN4rOmWVfvKOMoMFV5n8XxAliaKkArm/sOypzQ0bUL8MSnOEBW3VFIeffb/K5ce/cAV0yYhR7U4ALAA==", + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.9.1.tgz", + "integrity": "sha512-IqM0gfGxOmIKPhiHW/iyAEXwSVqMmR2wJ9uXHNdFpqVvPaQ3dWg302vW127sBpAiqM9SfHhyS40NKLsoMpN2KA==", "dev": true, "requires": { - "@typescript-eslint/types": "3.9.0", - "@typescript-eslint/visitor-keys": "3.9.0", + "@typescript-eslint/types": "3.9.1", + "@typescript-eslint/visitor-keys": "3.9.1", "debug": "^4.1.1", "glob": "^7.1.6", "is-glob": "^4.0.1", @@ -2054,16 +2032,16 @@ "dependencies": { "semver": { "version": "7.3.2", - "resolved": "https://npm.mlabs.pl:443/semver/-/semver-7.3.2.tgz", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", "dev": true } } }, "@typescript-eslint/visitor-keys": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-3.9.0.tgz", - "integrity": "sha512-O1qeoGqDbu0EZUC/MZ6F1WHTIzcBVhGqDj3LhTnj65WUA548RXVxUHbYhAW9bZWfb2rnX9QsbbP5nmeJ5Z4+ng==", + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-3.9.1.tgz", + "integrity": "sha512-zxdtUjeoSh+prCpogswMwVUJfEFmCOjdzK9rpNjNBfm6EyPt99x3RrJoBOGZO23FCt0WPKUCOL5mb/9D5LjdwQ==", "dev": true, "requires": { "eslint-visitor-keys": "^1.1.0" @@ -4380,7 +4358,7 @@ }, "css.escape": { "version": "1.5.1", - "resolved": "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz", + "resolved": "https://npm.mlabs.pl:443/css.escape/-/css.escape-1.5.1.tgz", "integrity": "sha1-QuJ9T6BK4y+TGktNQZH6nN3ul8s=" }, "cssdb": { @@ -4834,7 +4812,7 @@ }, "dom-accessibility-api": { "version": "0.3.0", - "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.3.0.tgz", + "resolved": "https://npm.mlabs.pl:443/dom-accessibility-api/-/dom-accessibility-api-0.3.0.tgz", "integrity": "sha512-PzwHEmsRP3IGY4gv/Ug+rMeaTIyTJvadCb+ujYXYeIylbHJezIyNToe8KfEgHTCEYyC+/bUghYOGg8yMGlZ6vA==" }, "dom-converter": { @@ -5186,23 +5164,6 @@ } } }, - "eslint-config-prettier": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.11.0.tgz", - "integrity": "sha512-oB8cpLWSAjOVFEJhhyMZh6NOEOtBVziaqdDQ86+qhDHFbZXoRTM7pNSvFRfW/W/L/LrQ38C99J5CGuRBBzBsdA==", - "dev": true, - "requires": { - "get-stdin": "^6.0.0" - }, - "dependencies": { - "get-stdin": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz", - "integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==", - "dev": true - } - } - }, "eslint-config-react-app": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/eslint-config-react-app/-/eslint-config-react-app-5.2.1.tgz", @@ -5404,15 +5365,6 @@ } } }, - "eslint-plugin-prettier": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.4.tgz", - "integrity": "sha512-jZDa8z76klRqo+TdGDTFJSavwbnWK2ZpqGKNZ+VvweMW516pDUMmQ2koXvxEE4JhzNvTv+radye/bWGBmA6jmg==", - "dev": true, - "requires": { - "prettier-linter-helpers": "^1.0.0" - } - }, "eslint-plugin-react": { "version": "7.19.0", "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.19.0.tgz", @@ -5450,12 +5402,6 @@ } } }, - "eslint-plugin-react-hooks": { - "version": "4.1.0", - "resolved": "https://npm.mlabs.pl:443/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.1.0.tgz", - "integrity": "sha512-36zilUcDwDReiORXmcmTc6rRumu9JIM3WjSvV0nclHoUQ0CNrX866EwONvLR/UqaeqFutbAnVu8PEmctdo2SRQ==", - "dev": true - }, "eslint-scope": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.0.tgz", @@ -5815,12 +5761,6 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==" }, - "fast-diff": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", - "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", - "dev": true - }, "fast-glob": { "version": "2.2.7", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-2.2.7.tgz", @@ -9148,7 +9088,7 @@ }, "node-sass": { "version": "4.14.1", - "resolved": "https://registry.npmjs.org/node-sass/-/node-sass-4.14.1.tgz", + "resolved": "https://npm.mlabs.pl:443/node-sass/-/node-sass-4.14.1.tgz", "integrity": "sha512-sjCuOlvGyCJS40R8BscF5vhVlQjNN069NtQ1gSxyK1u9iqvn6tf7O1R4GNowVZfiZUCRt5MmMs1xd+4V/7Yr0g==", "requires": { "async-foreach": "^0.1.3", @@ -9172,17 +9112,17 @@ "dependencies": { "ansi-regex": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "resolved": "https://npm.mlabs.pl:443/ansi-regex/-/ansi-regex-2.1.1.tgz", "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" }, "ansi-styles": { "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "resolved": "https://npm.mlabs.pl:443/ansi-styles/-/ansi-styles-2.2.1.tgz", "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" }, "chalk": { "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "resolved": "https://npm.mlabs.pl:443/chalk/-/chalk-1.1.3.tgz", "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", "requires": { "ansi-styles": "^2.2.1", @@ -9194,7 +9134,7 @@ }, "cross-spawn": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-3.0.1.tgz", + "resolved": "https://npm.mlabs.pl:443/cross-spawn/-/cross-spawn-3.0.1.tgz", "integrity": "sha1-ElYDfsufDF9549bvE14wdwGEuYI=", "requires": { "lru-cache": "^4.0.1", @@ -9203,7 +9143,7 @@ }, "lru-cache": { "version": "4.1.5", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "resolved": "https://npm.mlabs.pl:443/lru-cache/-/lru-cache-4.1.5.tgz", "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", "requires": { "pseudomap": "^1.0.2", @@ -9212,7 +9152,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "https://npm.mlabs.pl:443/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "requires": { "ansi-regex": "^2.0.0" @@ -9220,12 +9160,12 @@ }, "supports-color": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "resolved": "https://npm.mlabs.pl:443/supports-color/-/supports-color-2.0.0.tgz", "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" }, "yallist": { "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "resolved": "https://npm.mlabs.pl:443/yallist/-/yallist-2.1.2.tgz", "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" } } @@ -10880,19 +10820,10 @@ }, "prettier": { "version": "2.0.5", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz", + "resolved": "https://npm.mlabs.pl:443/prettier/-/prettier-2.0.5.tgz", "integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==", "dev": true }, - "prettier-linter-helpers": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", - "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", - "dev": true, - "requires": { - "fast-diff": "^1.1.2" - } - }, "pretty-bytes": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.3.0.tgz", @@ -11743,7 +11674,7 @@ }, "redent": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", + "resolved": "https://npm.mlabs.pl:443/redent/-/redent-3.0.0.tgz", "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", "requires": { "indent-string": "^4.0.0", @@ -13202,7 +13133,7 @@ }, "strip-indent": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", + "resolved": "https://npm.mlabs.pl:443/strip-indent/-/strip-indent-3.0.0.tgz", "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", "requires": { "min-indent": "^1.0.0" @@ -14007,7 +13938,7 @@ }, "wait-for-expect": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/wait-for-expect/-/wait-for-expect-3.0.2.tgz", + "resolved": "https://npm.mlabs.pl:443/wait-for-expect/-/wait-for-expect-3.0.2.tgz", "integrity": "sha512-cfS1+DZxuav1aBYbaO/kE06EOS8yRw7qOFoD3XtjTkYvCvh3zUvNST8DXK/nPaeqIzIv3P3kL3lRJn8iwOiSag==" }, "walker": { diff --git a/package.json b/package.json index e7ea6bd..9b6e4e6 100644 --- a/package.json +++ b/package.json @@ -21,11 +21,7 @@ "@types/react": "^16.9.46", "@types/react-dom": "^16.9.8", "@types/styled-components": "^5.1.2", - "@typescript-eslint/eslint-plugin": "^3.9.0", - "@typescript-eslint/parser": "^3.9.0", - "eslint-config-prettier": "^6.11.0", - "eslint-plugin-prettier": "^3.1.4", - "eslint-plugin-react-hooks": "^4.1.0", + "@typescript-eslint/parser": "^3.9.1", "prettier": "^2.0.5", "typescript": "^3.9.7" }, diff --git a/public/manifest.json b/public/manifest.json index a43a8e1..e631f33 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -1,13 +1,13 @@ { - "short_name": "PlanNaPlan", - "name": "PlanNaPlan", - "icons": [ - { - "src": "logo.svg" - } - ], - "start_url": ".", - "display": "standalone", - "theme_color": "#000000", - "background_color": "#ffffff" + "short_name": "PlanNaPlan", + "name": "PlanNaPlan", + "icons": [ + { + "src": "logo.svg" + } + ], + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" } diff --git a/src/App.tsx b/src/App.tsx deleted file mode 100644 index 2188477..0000000 --- a/src/App.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import React, { useState, useContext } from 'react'; -import TopBar from './components/TopBar/'; -import Transfer from './components/Transfer/'; -import { Scheduler } from './components/Scheduler'; -import RightBar from './components/RightBar'; -import { CASContext } from './contexts/CASProvider'; -import styled from 'styled-components'; - -const Wrapper = styled.div` - display: flex; -`; - -export const App = () => { - const [isOpenTransfer, setOpenTransfer] = useState(false); - - const { logout } = useContext(CASContext)!; - - const handleCloseTransfer = () => { - setOpenTransfer(!isOpenTransfer); - }; - - const onLangChange = () => { - console.log('Language changed'); - }; - - const onGroupMouseOver = () => { - console.log(`On groupmouse over`); - }; - - return ( - <> - - - - - - - - ); -}; diff --git a/src/components/TopBar/PL.png b/src/assets/PL.png similarity index 100% rename from src/components/TopBar/PL.png rename to src/assets/PL.png diff --git a/src/components/TopBar/UK.png b/src/assets/UK.png similarity index 100% rename from src/components/TopBar/UK.png rename to src/assets/UK.png diff --git a/src/components/TopBar/close.svg b/src/assets/close.svg similarity index 100% rename from src/components/TopBar/close.svg rename to src/assets/close.svg diff --git a/src/components/RightBar/CourseCard/expand.png b/src/assets/expand.png similarity index 100% rename from src/components/RightBar/CourseCard/expand.png rename to src/assets/expand.png diff --git a/src/components/TopBar/search.svg b/src/assets/search.svg similarity index 100% rename from src/components/TopBar/search.svg rename to src/assets/search.svg diff --git a/src/components/TopBar/transfer.png b/src/assets/transfer.png similarity index 100% rename from src/components/TopBar/transfer.png rename to src/assets/transfer.png diff --git a/src/components/TopBar/user.png b/src/assets/user.png similarity index 100% rename from src/components/TopBar/user.png rename to src/assets/user.png diff --git a/src/components/App.tsx b/src/components/App.tsx new file mode 100644 index 0000000..8a62321 --- /dev/null +++ b/src/components/App.tsx @@ -0,0 +1,32 @@ +import React, { useState, useContext } from 'react'; +import { Topbar } from './Topbar'; +import { Transfer } from './Transfer/Transfer'; +import { Scheduler } from './Scheduler'; +import RightBar from './Rightbar'; +import { CASContext } from '../contexts/CASProvider'; +import styled from 'styled-components'; + +const Wrapper = styled.div` + display: flex; +`; + +export const App = () => { + const [isOpenTransfer, setOpenTransfer] = useState(false); + + const { logout } = useContext(CASContext)!; + + const handleTransfer = () => { + setOpenTransfer(!isOpenTransfer); + }; + + return ( + <> + + + + + + + + ); +}; diff --git a/src/components/RightBar/CourseCard/index.tsx b/src/components/CourseCard.tsx similarity index 69% rename from src/components/RightBar/CourseCard/index.tsx rename to src/components/CourseCard.tsx index 68c5e98..1b85153 100644 --- a/src/components/RightBar/CourseCard/index.tsx +++ b/src/components/CourseCard.tsx @@ -1,25 +1,15 @@ import React, { useContext } from 'react'; import Collapse from '@material-ui/core/Collapse'; -import ExpandIcon from './expand.png'; -import { Course, Group } from '../../../types/index'; -import { coursesContext } from '../../../contexts/CoursesProvider'; -import { group } from 'console'; +import ExpandIcon from '../assets/expand.png'; +import { Course, Group } from '../types/index'; +import { coursesContext } from '../contexts/CoursesProvider'; import styled from 'styled-components'; import { makeStyles } from '@material-ui/core/styles'; -interface CourseCardProps { - onGroupMouseOver: (id: number, name: string) => void; - onCardClick: (e: React.MouseEvent) => void; - course: Course; - id: string; - isSelected: boolean; -} - interface ClassExandIconProps { isSelected: boolean; } - const ClassStyled = styled.div` display: flex; min-height: 50px; @@ -51,33 +41,40 @@ const ClassGroupStyled = styled.div` `; const ClassExandIconStyled = styled.img` - margin-top: 5px; - width: 20px; - transition: 0.2s; - transform: ${props => props.isSelected ? 'scaleY(-1);' : 'scaleY(1);'}; -` + margin-top: 5px; + width: 20px; + transition: 0.2s; + transform: ${(props) => (props.isSelected ? 'scaleY(-1);' : 'scaleY(1);')}; +`; const useStyles = makeStyles({ expanded: { - maxHeight: "244px", - overflowY: "auto", + maxHeight: '244px', + overflowY: 'auto', }, '@global': { '*::-webkit-scrollbar': { - width: '0.4em' + width: '0.4em', }, '*::-webkit-scrollbar-track': { - '-webkit-box-shadow': 'inset 0 0 6px rgba(1,0,0,0.1)' + '-webkit-box-shadow': 'inset 0 0 6px rgba(1,0,0,0.1)', }, '*::-webkit-scrollbar-thumb': { - borderRadius: "10px", + borderRadius: '10px', backgroundColor: '#d4b851', - outline: '1px solid slategrey' - } - } + outline: '1px solid slategrey', + }, + }, }); -export function CourseCard({ onGroupMouseOver, onCardClick, course, id, isSelected }: CourseCardProps) { +interface CourseCardProps { + onCardClick: (e: React.MouseEvent) => void; + course: Course; + id: string; + isSelected: boolean; +} + +export function CourseCard({ onCardClick, course, id, isSelected }: CourseCardProps) { const classes = useStyles(); const { addGroup, courses } = useContext(coursesContext)!; @@ -92,11 +89,7 @@ export function CourseCard({ onGroupMouseOver, onCardClick, course, id, isSelect {courses.map((course, index) => ( <> {course.groups.map((group, index) => ( - onGroupMouseOver(group.id, course.name)} - onClick={() => onGroupClick(group)} - > + onGroupClick(group)}>

{group.time} {group.room}

{group.lecturer}

{' '} diff --git a/src/components/TopBar/Profile.tsx b/src/components/Profile.tsx similarity index 100% rename from src/components/TopBar/Profile.tsx rename to src/components/Profile.tsx diff --git a/src/components/TopBar/Results/index.tsx b/src/components/Results.tsx similarity index 96% rename from src/components/TopBar/Results/index.tsx rename to src/components/Results.tsx index c397fca..31d8655 100644 --- a/src/components/TopBar/Results/index.tsx +++ b/src/components/Results.tsx @@ -2,8 +2,8 @@ import React, { useState, useContext, useEffect } from 'react'; import axios from 'axios'; import { Input } from '@material-ui/core'; import ClickAwayListener from '@material-ui/core/ClickAwayListener'; -import { coursesContext } from '../../../contexts/CoursesProvider'; -import { Course } from '../../../types'; +import { coursesContext } from '../contexts/CoursesProvider'; +import { Course } from '../types'; import styled from 'styled-components'; import { makeStyles } from '@material-ui/core/styles'; @@ -36,7 +36,7 @@ const Dropdown = styled.div` const useStyles = makeStyles({ topbarInput: { - marginTop:"8px", + marginTop: '8px', width: '100%', }, }); @@ -121,7 +121,6 @@ export const Results: React.FC = () => { // } }; - return (
diff --git a/src/components/RightBar/index.tsx b/src/components/Rightbar.tsx similarity index 71% rename from src/components/RightBar/index.tsx rename to src/components/Rightbar.tsx index 813a957..a3d7e51 100644 --- a/src/components/RightBar/index.tsx +++ b/src/components/Rightbar.tsx @@ -1,13 +1,9 @@ import React, { useState, useContext } from 'react'; -import { CourseCard } from './CourseCard/index'; -import { coursesContext } from '../../contexts/CoursesProvider'; +import { CourseCard } from './CourseCard'; +import { coursesContext } from '../contexts/CoursesProvider'; import styled from 'styled-components'; -interface RightBarProps { - onGroupMouseOver: (id: number, name: string) => void; -} - -const RightBarStyled = styled.div` +const RightbarStyled = styled.div` padding-top: 10px; padding-left: 15px; padding-right: 15px; @@ -30,11 +26,11 @@ const RightBarStyled = styled.div` border: 1px solid; } `; -const RightBarTextStyled = styled.div` +const RightbarTextStyled = styled.div` border-bottom: 1px solid; `; -export default function RightBar({ onGroupMouseOver }: RightBarProps) { +export default function Rightbar() { const [selectedCardId, setSelectedCardId] = useState(null); const { courses } = useContext(coursesContext)!; @@ -45,21 +41,20 @@ export default function RightBar({ onGroupMouseOver }: RightBarProps) { }; return ( - - + + Hubert Wrzesiński

Semestr zimowy 2020/2021 -
+
{courses.map((course, index) => ( ))} -
+ ); } diff --git a/src/components/Scheduler/index.tsx b/src/components/Scheduler.tsx similarity index 98% rename from src/components/Scheduler/index.tsx rename to src/components/Scheduler.tsx index 40522c9..8d31ff9 100644 --- a/src/components/Scheduler/index.tsx +++ b/src/components/Scheduler.tsx @@ -1,7 +1,7 @@ import React, { useEffect, useRef } from "react"; import { useState } from "react"; import { SchedulerEvents } from "./SchedulerEvents"; -import { days, hours } from "../../constants/index"; +import { days, hours } from "../constants/index"; import styled from "styled-components"; const SchedulerWrapper = styled.div` diff --git a/src/components/Scheduler/SchedulerEvents/index.tsx b/src/components/SchedulerEvents.tsx similarity index 93% rename from src/components/Scheduler/SchedulerEvents/index.tsx rename to src/components/SchedulerEvents.tsx index 665bbcf..0a635fb 100644 --- a/src/components/Scheduler/SchedulerEvents/index.tsx +++ b/src/components/SchedulerEvents.tsx @@ -1,7 +1,7 @@ import React, { useContext, useEffect, useState } from 'react'; -import { SchedulerRow } from '../SchedulerRow'; -import { coursesContext } from '../../../contexts/CoursesProvider'; -import { Group } from '../../../types'; +import { SchedulerRow } from './SchedulerRow'; +import { coursesContext } from '../contexts/CoursesProvider'; +import { Group } from '../types'; interface SchedulerEventsProps { cellTop: number; diff --git a/src/components/Scheduler/SchedulerRow/index.tsx b/src/components/SchedulerRow.tsx similarity index 96% rename from src/components/Scheduler/SchedulerRow/index.tsx rename to src/components/SchedulerRow.tsx index 5366158..94cf8b7 100644 --- a/src/components/Scheduler/SchedulerRow/index.tsx +++ b/src/components/SchedulerRow.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Group } from '../../../types'; +import { Group } from '../types'; import styled from 'styled-components'; interface SchedulerEventProps { diff --git a/src/components/TopBar/index.tsx b/src/components/TopBar/index.tsx deleted file mode 100644 index 5556ced..0000000 --- a/src/components/TopBar/index.tsx +++ /dev/null @@ -1,152 +0,0 @@ -import React from 'react'; -import Transfer from './transfer.png'; -import Search from './search.svg'; -import UK from './UK.png'; -import PL from './PL.png'; -import User from './user.png'; -import CloseIcon from './close.svg'; -import { Profile } from './Profile'; -import { Results } from './Results'; -import styled from 'styled-components'; - -interface TopBarProps { - handleTransfer: (e: React.MouseEvent) => void; - onLangChange: (lang: boolean) => void; - handleLogout: () => void; -} - -interface TopBarState { - isPolish: boolean; - anchorEl: HTMLElement | null; -} - -const TopBarTekstStyled = styled.div` - @media only screen and (max-width: 670px) { - display: none; - } -`; - -const TopBarStyled = styled.div` - background-color: #ffdc61; - height: 80px; - padding: 5px; - font-family: comic sans MS; - font-size: 24px; - font-weight: bold; - display: flex; - justify-content: space-between; -`; - -const TopBarLogoStyled = styled.div` - display: flex; - align-items: center; - flex-grow: 0.5; - justify-content: flex-start; -`; - -const TopBarLogoImageStyled = styled.img` - width: 80px; - height: 80px; - @media only screen and (max-width: 670px) { - width: 60px; - height: 60px; - } -`; - -const TopBarInputDivStyled = styled.div` - width: 70%; - display: flex; - flex-grow: 3; -`; - -const TopBarInputFieldStyled = styled.div` - width: 96%; - margin-top: 10px; -`; - -const TopBarInputIconStyled = styled.img` - width: 35px; - @media only screen and (max-width: 670px) { - width: 25px; - } -`; - -const TopBarIcon = styled.img` - width: 50px; - cursor: pointer; - @media only screen and (max-width: 670px) { - width: 35px; - } -`; - -const TopBarIconBox = styled.div` - display: flex; - align-items: center; - justify-content: space-around; - flex-grow: 1.5; -`; - -export default class TopBar extends React.Component { - constructor(props: TopBarProps) { - super(props); - this.handleProfile = this.handleProfile.bind(this); - this.handleClose = this.handleClose.bind(this); - this.onLangChange = this.onLangChange.bind(this); - this.handleTransfer = this.handleTransfer.bind(this); - this.state = { - isPolish: true, - anchorEl: null, - }; - } - - handleTransfer(e: React.MouseEvent) { - this.props.handleTransfer(e); - } - - onLangChange(e: React.MouseEvent) { - this.setState({ - isPolish: !this.state.isPolish, - }); - this.props.onLangChange(this.state.isPolish); - } - - handleProfile(event: React.MouseEvent) { - this.setState({ - anchorEl: event.currentTarget, - }); - } - - handleClose() { - this.setState({ - anchorEl: null, - }); - } - - render() { - return ( - - - - plan na plan - - - - - - - - - - - - - - - - ); - } -} diff --git a/src/components/Topbar.tsx b/src/components/Topbar.tsx new file mode 100644 index 0000000..0aa2742 --- /dev/null +++ b/src/components/Topbar.tsx @@ -0,0 +1,114 @@ +import React, { useState } from 'react'; +import Transfer from '../assets/transfer.png'; +import Search from '../assets/search.svg'; +import UK from '../assets/UK.png'; +import PL from '../assets/PL.png'; +import User from '../assets/user.png'; +import CloseIcon from '../assets/close.svg'; +import { Profile } from './Profile'; +import { Results } from './Results'; +import styled from 'styled-components'; + +const TopbarTextStyled = styled.div` + @media only screen and (max-width: 670px) { + display: none; + } +`; + +const TopbarStyled = styled.div` + background-color: #ffdc61; + height: 80px; + padding: 5px; + font-family: comic sans MS; + font-size: 24px; + font-weight: bold; + display: flex; + justify-content: space-between; +`; + +const TopbarLogoStyled = styled.div` + display: flex; + align-items: center; + flex-grow: 0.5; + justify-content: flex-start; +`; + +const TopbarLogoImageStyled = styled.img` + width: 80px; + height: 80px; + @media only screen and (max-width: 670px) { + width: 60px; + height: 60px; + } +`; + +const TopbarInputDivStyled = styled.div` + width: 70%; + display: flex; + flex-grow: 3; +`; + +const TopbarInputFieldStyled = styled.div` + width: 96%; + margin-top: 10px; +`; + +const TopbarInputIconStyled = styled.img` + width: 35px; + @media only screen and (max-width: 670px) { + width: 25px; + } +`; + +const TopbarIcon = styled.img` + width: 50px; + cursor: pointer; + @media only screen and (max-width: 670px) { + width: 35px; + } +`; + +const TopbarIconBox = styled.div` + display: flex; + align-items: center; + justify-content: space-around; + flex-grow: 1.5; +`; + +interface TopbarProps { + handleTransfer: (e: React.MouseEvent) => void; + handleLogout: () => void; +} + +export const Topbar = ({ handleTransfer, handleLogout }: TopbarProps) => { + const [isPolish, setIsPolish] = useState(false); + const [anchorEl, setAnchorEl] = useState(null); + + const onLangChange = (event: React.MouseEvent) => setIsPolish(!isPolish); + + const handleProfile = (event: React.MouseEvent) => setAnchorEl(event.currentTarget as HTMLImageElement); + + const handleClose = () => setAnchorEl(null); + + return ( + + + + plan na plan + + + + + + + + + + + + + + + + ); +}; diff --git a/src/components/Transfer/Transfer.tsx b/src/components/Transfer/Transfer.tsx new file mode 100644 index 0000000..59c66e6 --- /dev/null +++ b/src/components/Transfer/Transfer.tsx @@ -0,0 +1,57 @@ +import React from 'react'; +import Modal from '@material-ui/core/Modal'; +import './index.scss'; +import Fade from '@material-ui/core/Fade'; +import Input from '@material-ui/core/Input'; +import { makeStyles } from '@material-ui/core/styles'; +import styled from 'styled-components'; + +interface TransferProps { + handleClose: (e: React.MouseEvent) => void; + isOpen: boolean; +} + +const useStyles = makeStyles({ + wrapper: { + display: 'flex', + justifyContent: 'center', + textAlign: 'center', + alignItems: 'center', + }, +}); + +export const Transfer = ({ handleClose, isOpen }: TransferProps) => { + const classes = useStyles(); + + return ( +
+ + +
+
+
Oddam
+
+ {' '} + +
+
+
+
Przyjmę
+ +
+
+
+
+
+ ); +}; diff --git a/src/components/Transfer/index.tsx b/src/components/Transfer/index.tsx deleted file mode 100644 index 40ed89f..0000000 --- a/src/components/Transfer/index.tsx +++ /dev/null @@ -1,70 +0,0 @@ -import React from "react"; -import Modal from "@material-ui/core/Modal"; -import "./index.scss"; -import Fade from '@material-ui/core/Fade'; -import Input from "@material-ui/core/Input"; -import { makeStyles } from '@material-ui/core/styles'; -import styled from 'styled-components'; - -interface TransferProps { - handleClose: (e: React.MouseEvent) => void; - isOpen: boolean; -} - -interface TransferState {} - -const useStyles = makeStyles({ - wrapper: { - display: "flex", - justifyContent: "center", - textAlign: "center", - alignItems: "center", - }, -}); - -export default class Transfer extends React.Component< - TransferProps, - TransferState -> { - constructor(props: TransferProps) { - super(props); - - this.handleClose = this.handleClose.bind(this); - } - - handleClose(e: React.MouseEvent) { - this.props.handleClose(e); - } - - render() { - return ( -
- - -
-
-
Oddam
-
-
-
-
Przyjmę
- -
-
-
-
- -
- ); - } -} diff --git a/src/index.tsx b/src/index.tsx index 9c2e4c8..53cd61e 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,6 +1,6 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import { App } from './App'; +import { App } from './components/App'; import { CASProvider } from './contexts/CASProvider'; import { CoursesProvider } from './contexts/CoursesProvider'; import { GlobalStyles } from './styles/GlobalStyles'; From 74ad2e835c3b123e81b9d26597b270ac34c570d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciek=20G=C5=82owacki?= Date: Mon, 17 Aug 2020 23:56:34 +0200 Subject: [PATCH 21/27] Major refactor --- .env | 3 +- src/components/App.tsx | 7 +- src/components/CourseCard.tsx | 33 +++--- src/components/Dropdown.tsx | 110 ++++++++++++++++++++ src/components/Profile.tsx | 25 ++--- src/components/Results.tsx | 147 --------------------------- src/components/Rightbar.tsx | 16 +-- src/components/Scheduler.tsx | 23 ++--- src/components/SchedulerEvents.tsx | 33 +++--- src/components/SchedulerRow.tsx | 4 +- src/components/Topbar.tsx | 33 +++--- src/contexts/CASProvider.tsx | 1 - src/contexts/CoursesProvider.tsx | 40 ++++++-- src/{styles => contexts}/reducers.ts | 4 +- 14 files changed, 220 insertions(+), 259 deletions(-) create mode 100644 src/components/Dropdown.tsx delete mode 100644 src/components/Results.tsx rename src/{styles => contexts}/reducers.ts (56%) diff --git a/.env b/.env index c62b767..529f1dd 100644 --- a/.env +++ b/.env @@ -1,2 +1 @@ -REACT_APP_API_URL=http://localhost:5000/api -REACT_APP_API_HOST=http://localhost:5000 \ No newline at end of file +REACT_APP_API_URL=http://localhost:1285 \ No newline at end of file diff --git a/src/components/App.tsx b/src/components/App.tsx index 8a62321..3194e91 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -2,7 +2,7 @@ import React, { useState, useContext } from 'react'; import { Topbar } from './Topbar'; import { Transfer } from './Transfer/Transfer'; import { Scheduler } from './Scheduler'; -import RightBar from './Rightbar'; +import { Rightbar } from './Rightbar'; import { CASContext } from '../contexts/CASProvider'; import styled from 'styled-components'; @@ -13,7 +13,6 @@ const Wrapper = styled.div` export const App = () => { const [isOpenTransfer, setOpenTransfer] = useState(false); - const { logout } = useContext(CASContext)!; const handleTransfer = () => { setOpenTransfer(!isOpenTransfer); @@ -21,11 +20,11 @@ export const App = () => { return ( <> - + - + ); diff --git a/src/components/CourseCard.tsx b/src/components/CourseCard.tsx index 1b85153..eb54f2f 100644 --- a/src/components/CourseCard.tsx +++ b/src/components/CourseCard.tsx @@ -1,4 +1,4 @@ -import React, { useContext } from 'react'; +import React, { useContext, MouseEvent } from 'react'; import Collapse from '@material-ui/core/Collapse'; import ExpandIcon from '../assets/expand.png'; import { Course, Group } from '../types/index'; @@ -10,7 +10,7 @@ interface ClassExandIconProps { isSelected: boolean; } -const ClassStyled = styled.div` +const CourseStyled = styled.div` display: flex; min-height: 50px; background-color: rgb(100, 181, 246) !important; @@ -25,7 +25,7 @@ const ClassStyled = styled.div` align-items: stretch; `; -const ClassNameStyled = styled.div` +const CourseNameStyled = styled.div` padding-top: 10px; padding-bottom: 10px; `; @@ -68,39 +68,38 @@ const useStyles = makeStyles({ }); interface CourseCardProps { - onCardClick: (e: React.MouseEvent) => void; + onCardClick: (event: MouseEvent) => void; course: Course; id: string; isSelected: boolean; } -export function CourseCard({ onCardClick, course, id, isSelected }: CourseCardProps) { +export const CourseCard = ({ onCardClick, course, id, isSelected }: CourseCardProps) => { const classes = useStyles(); - const { addGroup, courses } = useContext(coursesContext)!; - function onGroupClick(group: Group) { - addGroup(group); - } + const { addChoosenGroup, choosenCourses } = useContext(coursesContext)!; + + const onGroupClick = (group: Group) => addChoosenGroup(group); return ( - - {course.name} + + {course.name} - {courses.map((course, index) => ( - <> + {choosenCourses.map((course) => ( +
{course.groups.map((group, index) => ( onGroupClick(group)}>

{group.time} {group.room}

{group.lecturer} -

{' '} +

))} - +
))}
-
+ ); -} +}; diff --git a/src/components/Dropdown.tsx b/src/components/Dropdown.tsx new file mode 100644 index 0000000..d266b2a --- /dev/null +++ b/src/components/Dropdown.tsx @@ -0,0 +1,110 @@ +import React, { useState, useContext, useEffect, MouseEvent } from 'react'; +import axios from 'axios'; +import { Input } from '@material-ui/core'; +import ClickAwayListener from '@material-ui/core/ClickAwayListener'; +import { coursesContext } from '../contexts/CoursesProvider'; +import { Course } from '../types'; +import styled from 'styled-components'; +import { makeStyles } from '@material-ui/core/styles'; + +const CourseStyled = styled.div` + position: relative; + z-index: 10; + padding: 5px; + padding-left: 20px; + background-color: #e6c759; + font-size: 18px; + font-family: Lato; + :hover { + background-color: #d4b851; + cursor: pointer; + } +`; + +const DropdownStyled = styled.div` + max-height: 400px; + overflow-y: auto; + ::-webkit-scrollbar { + display: none; + } +`; + +const useStyles = makeStyles({ + topbarInput: { + marginTop: '8px', + width: '100%', + }, +}); + +export const Dropdown = () => { + const classes = useStyles(); + + const [open, setOpen] = React.useState(false); + const [input, setInput] = useState(''); + + //courses - choosenCourses + const [filteredCourses, setFilteredCourses] = useState>([]); + + const { courses, choosenCourses, addChoosenCourse } = useContext(coursesContext)!; + + useEffect(() => { + const filterCourses = (input: string) => { + const choosenCoursesNames = choosenCourses.map(({ name }) => name.trim()); + const filteredCourses = courses.filter( + ({ name }) => name.toLowerCase().includes(input.toLowerCase()) && !choosenCoursesNames.includes(name), + ); + setFilteredCourses(filteredCourses); + }; + filterCourses(input); + }, [input, open, choosenCourses]); + + const handleChange = (event: React.ChangeEvent) => setInput(event.target.value); + + const handleClick = () => setOpen(true); + + const handleClickAway = () => setOpen(false); + + const onCourseClick = async (event: MouseEvent) => { + const target = event.currentTarget; + if (target.id && target.textContent) { + const id = target.id; + const name = target.textContent; + + const { data } = await axios.get(`${process.env.REACT_APP_API_URL}/getCourseGroups?id=${id}`); + + //porozmawiać z Filipem, żeby odrobinę przerobił endpoint + const course: Course = { + name: name, + id: parseInt(id), + groups: data, + }; + + addChoosenCourse(course); + setOpen(false); + } + }; + + return ( + +
+ + {open && ( + + {filteredCourses.map(({ name, id }, index) => ( + +

{name}

+
+ ))} +
+ )} +
+
+ ); +}; diff --git a/src/components/Profile.tsx b/src/components/Profile.tsx index ea05cc0..cb97783 100644 --- a/src/components/Profile.tsx +++ b/src/components/Profile.tsx @@ -1,31 +1,20 @@ import { Menu, MenuItem } from '@material-ui/core'; -import React, { FC } from 'react'; +import React, { useContext } from 'react'; +import { CASContext } from '../contexts/CASProvider'; interface ProfileProps { anchorEl: HTMLElement | null; handleClose: () => void; - handleLogout: () => void; } -export const Profile: FC = ({ anchorEl, handleClose, handleLogout, ...restProps }) => { +export const Profile = ({ anchorEl, handleClose }: ProfileProps) => { + const { logout } = useContext(CASContext)!; + return ( - + Profile My account - { - handleLogout(); - }} - > - Logout - + Logout ); }; diff --git a/src/components/Results.tsx b/src/components/Results.tsx deleted file mode 100644 index 31d8655..0000000 --- a/src/components/Results.tsx +++ /dev/null @@ -1,147 +0,0 @@ -import React, { useState, useContext, useEffect } from 'react'; -import axios from 'axios'; -import { Input } from '@material-ui/core'; -import ClickAwayListener from '@material-ui/core/ClickAwayListener'; -import { coursesContext } from '../contexts/CoursesProvider'; -import { Course } from '../types'; -import styled from 'styled-components'; -import { makeStyles } from '@material-ui/core/styles'; - -interface courseData { - name: string; - id: number; -} - -const CourseStyled = styled.div` - position: relative; - z-index: 10; - padding: 5px; - padding-left: 20px; - background-color: #e6c759; - font-size: 18px; - font-family: Lato; - :hover { - background-color: #d4b851; - cursor: pointer; - } -`; - -const Dropdown = styled.div` - max-height: 400px; - overflow-y: auto; - ::-webkit-scrollbar { - display: none; - } -`; - -const useStyles = makeStyles({ - topbarInput: { - marginTop: '8px', - width: '100%', - }, -}); - -export const Results: React.FC = () => { - const classes = useStyles(); - const [input, setInput] = useState(''); - const [coursesData, setcoursesData] = useState>([]); - const [filteredcoursesData, setFilteredcoursesData] = useState>([]); - const [open, setOpen] = React.useState(false); - - const { courses, addCourse } = useContext(coursesContext)!; - - useEffect(() => { - const fetchData = async () => { - const results = await axios.get(`http://localhost:1285/getCourses`); - const coursesData = results.data.map((result: { id: number; name: string }) => ({ - id: result.id, - name: result.name, - })); - - setcoursesData(coursesData); - }; - fetchData(); - }, []); - - useEffect(() => { - const names = courses.map((course) => course.name); - const filtercourses = (value: string) => { - let filteredcourses = coursesData.filter( - (course) => course.name.toLowerCase().includes(value.toLowerCase()) && !names.includes(course.name), - ); - setFilteredcoursesData(filteredcourses); - }; - filtercourses(input); - }, [input, open]); - - const getGroupsByCourseId = async (id: string) => { - const { data } = await axios.get(`http://localhost:1285/getCourseGroups?id=${id}`); - return data; - }; - - const handleChange = (event: React.ChangeEvent) => { - setInput(event.target.value); - }; - - const handleClick = () => { - setOpen(true); - }; - - const handleClickAway = () => { - setOpen(false); - }; - - const onCourseClick = async (e: React.MouseEvent) => { - const target = e.currentTarget as HTMLElement; - if (target.id && target.textContent) { - const id = target.id; - const name = target.textContent; - const groups = await getGroupsByCourseId(id); - const course: Course = { - name: name, - id: parseInt(id), - groups: groups, - }; - addCourse(course); - setOpen(false); - } - - // let groups: Array = []; - // let course = { groups: groups } as course; - // course.id = result[0].course.id; - // course.name = result[0].course.name; - // for (let i = 0; i < result.length; i++) { - // let group = {} as Group; - // group.id = result[i].id; - // group.day = result[i].day; - // group.time = result[i].time; - // group.courser = result[i].courser.title + ' ' + result[i].courser.name + ' ' + result[i].courser.surname; - // group.room = result[i].room.trim(); - // course.groups.push(group); - // } - }; - - return ( - -
- - {open ? ( - - {filteredcoursesData.map((course, index) => ( - -

{course.name}

-
- ))} -
- ) : null} -
-
- ); -}; diff --git a/src/components/Rightbar.tsx b/src/components/Rightbar.tsx index a3d7e51..a39fee6 100644 --- a/src/components/Rightbar.tsx +++ b/src/components/Rightbar.tsx @@ -1,4 +1,4 @@ -import React, { useState, useContext } from 'react'; +import React, { useState, useContext, MouseEvent } from 'react'; import { CourseCard } from './CourseCard'; import { coursesContext } from '../contexts/CoursesProvider'; import styled from 'styled-components'; @@ -30,23 +30,25 @@ const RightbarTextStyled = styled.div` border-bottom: 1px solid; `; -export default function Rightbar() { +export const Rightbar = () => { const [selectedCardId, setSelectedCardId] = useState(null); - const { courses } = useContext(coursesContext)!; + const { choosenCourses } = useContext(coursesContext)!; - const onCardClick = (e: React.MouseEvent) => { - const target = e.currentTarget as HTMLElement; + //działa clunky + const onCardClick = (event: MouseEvent) => { + const target = event.currentTarget; selectedCardId === target.id ? setSelectedCardId(null) : setSelectedCardId(target.id); }; + //need to insert student name from db and course maybe based on current time or from db too return ( Hubert Wrzesiński

Semestr zimowy 2020/2021
- {courses.map((course, index) => ( + {choosenCourses.map((course, index) => ( ); -} +}; diff --git a/src/components/Scheduler.tsx b/src/components/Scheduler.tsx index 8d31ff9..a4f851a 100644 --- a/src/components/Scheduler.tsx +++ b/src/components/Scheduler.tsx @@ -1,8 +1,8 @@ -import React, { useEffect, useRef } from "react"; -import { useState } from "react"; -import { SchedulerEvents } from "./SchedulerEvents"; -import { days, hours } from "../constants/index"; -import styled from "styled-components"; +import React, { useEffect, useRef } from 'react'; +import { useState } from 'react'; +import { SchedulerEvents } from './SchedulerEvents'; +import { days, hours } from '../constants/index'; +import styled from 'styled-components'; const SchedulerWrapper = styled.div` flex-grow: 3; @@ -55,7 +55,7 @@ export const Scheduler = () => { } }; handleResize(); - window.addEventListener("resize", handleResize); + window.addEventListener('resize', handleResize); }, []); useEffect(() => { @@ -63,7 +63,7 @@ export const Scheduler = () => { currentEventsIds.map((eventId: string) => { const event = document.getElementById(eventId); if (event) { - event.style.display = "block"; + event.style.display = 'block'; } }); }; @@ -90,15 +90,12 @@ export const Scheduler = () => { {hours.map((hour, indexRow) => ( - {[hour, "", "", "", "", ""].map((value, indexCell) => + {[hour, '', '', '', '', ''].map((value, indexCell) => indexRow === 0 && indexCell === 1 ? ( - + ) : ( {value} - ) + ), )} ))} diff --git a/src/components/SchedulerEvents.tsx b/src/components/SchedulerEvents.tsx index 0a635fb..8687e29 100644 --- a/src/components/SchedulerEvents.tsx +++ b/src/components/SchedulerEvents.tsx @@ -13,14 +13,10 @@ export const SchedulerEvents = ({ cellTop, cellWidth }: SchedulerEventsProps) => const [groupsMappedToEvents, setGroupsMappedToEvents] = useState([]); - // const groups: Array = [{ id: "5", day: "4", time: "11.45", courser: "dr Dorota Blinkiewicz", room: "A2-3" }, - // { id: "28", day: "1", time: "13.45", courser: "dr Barbara Kołodziejczak", room: "D-3" }, - // { id: "69", day: "4", time: "15.30", courser: "dr Karol Gierszewski", room: "A2-3" }]; - interface GroupTimeToEventRowMapping { [time: string]: number; } - + //delete later additional mappings const groupTimeToEventRowMapping: GroupTimeToEventRowMapping = { '08.15': 0, '10.00': 1, @@ -28,6 +24,8 @@ export const SchedulerEvents = ({ cellTop, cellWidth }: SchedulerEventsProps) => '13.45': 3, '15.30': 4, '17.15': 5, + '10.17': 0, + '13.55': 1, }; useEffect(() => { @@ -45,23 +43,20 @@ export const SchedulerEvents = ({ cellTop, cellWidth }: SchedulerEventsProps) => }; setGroupsMappedToEvents((groupsMappedToEvents: any) => [...groupsMappedToEvents, groupMappedToEvent]); } - function alternative(groups: Array) { - const groupsMapped = choosenGroups.map(({ id, day, lecturer, room, time }) => ({ - id, - day, - lecturer, - room, - eventRow: groupTimeToEventRowMapping[time], - })); - setGroupsMappedToEvents(groupsMapped); - } } - mapGroupTimeToEventRow(choosenGroups); + function alternative(choosenGroups: Array) { + const groupsMapped = choosenGroups.map(({ id, day, lecturer, room, time }) => ({ + id, + day, + lecturer, + room, + eventRow: groupTimeToEventRowMapping[time], + })); + setGroupsMappedToEvents(groupsMapped); + } + alternative(choosenGroups); }, [choosenGroups]); - useEffect(() => { - }, [groupsMappedToEvents]); - return (
{[...Array(6)].map((_, index) => ( diff --git a/src/components/SchedulerRow.tsx b/src/components/SchedulerRow.tsx index 94cf8b7..e01227b 100644 --- a/src/components/SchedulerRow.tsx +++ b/src/components/SchedulerRow.tsx @@ -26,8 +26,8 @@ interface SchedulerRowProps { } export const SchedulerRow = ({ groups, indexRow, cellTop, cellWidth }: SchedulerRowProps) => { - console.log(`You passed me these of a groupzzz`); - console.log(groups) + // console.log(`You passed me these of a groupzzz`); + // console.log(groups) return ( <> diff --git a/src/components/Topbar.tsx b/src/components/Topbar.tsx index 0aa2742..62a14de 100644 --- a/src/components/Topbar.tsx +++ b/src/components/Topbar.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useState, MouseEvent } from 'react'; import Transfer from '../assets/transfer.png'; import Search from '../assets/search.svg'; import UK from '../assets/UK.png'; @@ -6,7 +6,7 @@ import PL from '../assets/PL.png'; import User from '../assets/user.png'; import CloseIcon from '../assets/close.svg'; import { Profile } from './Profile'; -import { Results } from './Results'; +import { Dropdown } from './Dropdown'; import styled from 'styled-components'; const TopbarTextStyled = styled.div` @@ -26,14 +26,14 @@ const TopbarStyled = styled.div` justify-content: space-between; `; -const TopbarLogoStyled = styled.div` +const TopbarLogoWrapperStyled = styled.div` display: flex; align-items: center; flex-grow: 0.5; justify-content: flex-start; `; -const TopbarLogoImageStyled = styled.img` +const TopbarLogoStyled = styled.img` width: 80px; height: 80px; @media only screen and (max-width: 670px) { @@ -42,7 +42,7 @@ const TopbarLogoImageStyled = styled.img` } `; -const TopbarInputDivStyled = styled.div` +const TopbarInputStyled = styled.div` width: 70%; display: flex; flex-grow: 3; @@ -76,38 +76,37 @@ const TopbarIconBox = styled.div` `; interface TopbarProps { - handleTransfer: (e: React.MouseEvent) => void; - handleLogout: () => void; + handleTransfer: (e: MouseEvent) => void; } -export const Topbar = ({ handleTransfer, handleLogout }: TopbarProps) => { +export const Topbar = ({ handleTransfer }: TopbarProps) => { const [isPolish, setIsPolish] = useState(false); const [anchorEl, setAnchorEl] = useState(null); - const onLangChange = (event: React.MouseEvent) => setIsPolish(!isPolish); + const onLangChange = () => setIsPolish(!isPolish); - const handleProfile = (event: React.MouseEvent) => setAnchorEl(event.currentTarget as HTMLImageElement); + const handleProfile = (event: MouseEvent) => setAnchorEl(event.currentTarget); const handleClose = () => setAnchorEl(null); return ( - - + + plan na plan - - + + - + - + - + ); diff --git a/src/contexts/CASProvider.tsx b/src/contexts/CASProvider.tsx index a46f549..a983aff 100644 --- a/src/contexts/CASProvider.tsx +++ b/src/contexts/CASProvider.tsx @@ -27,7 +27,6 @@ export const CASProvider = ({ children }: CASProviderProps) => { redirectToCASLoginService(); } if (ticket) { - console.log(`Ticket is: ${ticket}`); setUser({ ...user, ticket: ticket }); } } diff --git a/src/contexts/CoursesProvider.tsx b/src/contexts/CoursesProvider.tsx index 6993e93..27772ec 100644 --- a/src/contexts/CoursesProvider.tsx +++ b/src/contexts/CoursesProvider.tsx @@ -1,13 +1,14 @@ import React, { useState, createContext, useEffect } from 'react'; import { Course, Group } from '../types'; - -interface courseContext { +import axios from 'axios'; +interface CourseContext { courses: Array; + choosenCourses: Array; choosenGroups: Array; - addCourse: (courses: Course) => void; - addGroup: (group: Group) => void; + addChoosenCourse: (courses: Course) => void; + addChoosenGroup: (group: Group) => void; } -export const coursesContext = createContext(null); +export const coursesContext = createContext(null); interface CoursesProviderProps { children: React.ReactNode; @@ -15,17 +16,36 @@ interface CoursesProviderProps { export const CoursesProvider = ({ children }: CoursesProviderProps) => { const [courses, setCourses] = useState>([]); + const [choosenCourses, setChoosenCourses] = useState>([]); const [choosenGroups, setChoosenGroups] = useState>([]); - const addCourse = (course: Course) => { - setCourses([...courses, course]); + const addChoosenCourse = (choosenCourse: Course) => { + console.log('adding course'); + setChoosenCourses([...choosenCourses, choosenCourse]); }; - const addGroup = (group: Group) => { - setChoosenGroups([...choosenGroups, group]); + const addChoosenGroup = (choosenGroup: Group) => { + setChoosenGroups([...choosenGroups, choosenGroup]); }; + useEffect(() => { + console.log('All courses'); + console.log(courses); + }, [courses]); + useEffect(() => { + console.log('Choosen courses'); + console.log(choosenCourses); + }, [choosenCourses]); + + useEffect(() => { + const fetchData = async () => { + const { data } = await axios.get(`${process.env.REACT_APP_API_URL}/getCourses`); + setCourses(data); + }; + fetchData(); + }, []); + return ( - + {children} ); diff --git a/src/styles/reducers.ts b/src/contexts/reducers.ts similarity index 56% rename from src/styles/reducers.ts rename to src/contexts/reducers.ts index c936812..b3f9ccb 100644 --- a/src/styles/reducers.ts +++ b/src/contexts/reducers.ts @@ -1,6 +1,6 @@ export enum Types { - addCourse = 'ADD_COURSE', + addChoosenCourse = 'ADD_COURSE', removecourse = 'REMOVE_COURSE', - addGroup = 'ADD_GROUP', + addChoosenGroup = 'ADD_GROUP', removeGroup = 'REMOVE_GROUP', } From 281a1742bc024a603c6e7b93a64547dd7c390ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciek=20G=C5=82owacki?= Date: Tue, 18 Aug 2020 00:21:21 +0200 Subject: [PATCH 22/27] More refactoring --- src/components/SchedulerEvents.tsx | 25 +++++------------------- src/components/SchedulerRow.tsx | 9 ++++----- src/contexts/reducers.ts | 31 ++++++++++++++++++++++++++---- 3 files changed, 36 insertions(+), 29 deletions(-) diff --git a/src/components/SchedulerEvents.tsx b/src/components/SchedulerEvents.tsx index 8687e29..963d83f 100644 --- a/src/components/SchedulerEvents.tsx +++ b/src/components/SchedulerEvents.tsx @@ -11,7 +11,7 @@ interface SchedulerEventsProps { export const SchedulerEvents = ({ cellTop, cellWidth }: SchedulerEventsProps) => { const { choosenGroups } = useContext(coursesContext)!; - const [groupsMappedToEvents, setGroupsMappedToEvents] = useState([]); + const [choosenGroupsMappedToEvents, setChoosenGroupsMappedToEvents] = useState([]); interface GroupTimeToEventRowMapping { [time: string]: number; @@ -29,22 +29,7 @@ export const SchedulerEvents = ({ cellTop, cellWidth }: SchedulerEventsProps) => }; useEffect(() => { - function mapGroupTimeToEventRow(groups: Array) { - const groupsMappedToEventsTemp = []; - for (const group of groups) { - const groupTime = group.time; - const eventRow: number = groupTimeToEventRowMapping[groupTime]; - const groupMappedToEvent: any = { - id: group.id, - day: group.day, - eventRow: eventRow, - lecturer: group.lecturer, - room: group.room, - }; - setGroupsMappedToEvents((groupsMappedToEvents: any) => [...groupsMappedToEvents, groupMappedToEvent]); - } - } - function alternative(choosenGroups: Array) { + function mapGroupTimeToEventRow(choosenGroups: Array) { const groupsMapped = choosenGroups.map(({ id, day, lecturer, room, time }) => ({ id, day, @@ -52,9 +37,9 @@ export const SchedulerEvents = ({ cellTop, cellWidth }: SchedulerEventsProps) => room, eventRow: groupTimeToEventRowMapping[time], })); - setGroupsMappedToEvents(groupsMapped); + setChoosenGroupsMappedToEvents(groupsMapped); } - alternative(choosenGroups); + mapGroupTimeToEventRow(choosenGroups); }, [choosenGroups]); return ( @@ -62,7 +47,7 @@ export const SchedulerEvents = ({ cellTop, cellWidth }: SchedulerEventsProps) => {[...Array(6)].map((_, index) => ( { + groups={choosenGroupsMappedToEvents.filter((group: any) => { return group.eventRow === index; })} indexRow={index} diff --git a/src/components/SchedulerRow.tsx b/src/components/SchedulerRow.tsx index e01227b..eb81f1c 100644 --- a/src/components/SchedulerRow.tsx +++ b/src/components/SchedulerRow.tsx @@ -26,21 +26,20 @@ interface SchedulerRowProps { } export const SchedulerRow = ({ groups, indexRow, cellTop, cellWidth }: SchedulerRowProps) => { - // console.log(`You passed me these of a groupzzz`); - // console.log(groups) + return ( <> - {[...Array(5)].map((value, eventIndex) => ( + {[...Array(5)].map((_, eventIndex) => ( {groups.map((group, index) => - group.day === eventIndex ?
{groups[index]?.lecturer}
: null, + group.day === eventIndex &&
{groups[index]?.lecturer}
, )}
))} diff --git a/src/contexts/reducers.ts b/src/contexts/reducers.ts index b3f9ccb..328938d 100644 --- a/src/contexts/reducers.ts +++ b/src/contexts/reducers.ts @@ -1,6 +1,29 @@ +// import { Group, Course } from '../types'; + export enum Types { - addChoosenCourse = 'ADD_COURSE', - removecourse = 'REMOVE_COURSE', - addChoosenGroup = 'ADD_GROUP', - removeGroup = 'REMOVE_GROUP', + addChoosenCourse = 'ADD_CHOOSEN_COURSE', + removeChoosenCourse = 'REMOVE_CHOOSEN_COURSE', + addChoosenGroup = 'ADD_CHOOSEN_GROUP', + removeChoosenGroup = 'REMOVE_CHOOSEN_GROUP', } + +// type ChoosenCoursesPayload = { +// [Types.addChoosenCourse]: {}; +// }; + +// type ChoosenGroupsPayload = { +// [Types.Create]: { +// id: number; +// name: string; +// price: number; +// }; +// }; + +// export const choosenGroupsReducer = (state, action) => { +// switch (action.type) { +// case Types.addChoosenGroup: +// return add; +// } +// }; + +//https://dev.to/elisealcala/react-context-with-usereducer-and-typescript-4obm From 8ebabcf8ef0b1b890c4bb30f5c3b1311e312d938 Mon Sep 17 00:00:00 2001 From: wrzesinski-hubert Date: Tue, 18 Aug 2020 18:32:26 +0200 Subject: [PATCH 23/27] styled components i przerwy miedzy godzinami --- src/components/App.tsx | 3 +- src/components/SchedulerEvents.tsx | 8 +- src/components/SchedulerRow.tsx | 2 +- src/components/Transfer.tsx | 115 +++++++++++++++++++++++++++ src/components/Transfer/Transfer.tsx | 57 ------------- src/components/Transfer/index.scss | 69 ---------------- 6 files changed, 124 insertions(+), 130 deletions(-) create mode 100644 src/components/Transfer.tsx delete mode 100644 src/components/Transfer/Transfer.tsx delete mode 100644 src/components/Transfer/index.scss diff --git a/src/components/App.tsx b/src/components/App.tsx index 3194e91..dbc7646 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -1,9 +1,8 @@ import React, { useState, useContext } from 'react'; import { Topbar } from './Topbar'; -import { Transfer } from './Transfer/Transfer'; +import { Transfer } from './Transfer'; import { Scheduler } from './Scheduler'; import { Rightbar } from './Rightbar'; -import { CASContext } from '../contexts/CASProvider'; import styled from 'styled-components'; const Wrapper = styled.div` diff --git a/src/components/SchedulerEvents.tsx b/src/components/SchedulerEvents.tsx index 963d83f..e9f3daf 100644 --- a/src/components/SchedulerEvents.tsx +++ b/src/components/SchedulerEvents.tsx @@ -51,7 +51,13 @@ export const SchedulerEvents = ({ cellTop, cellWidth }: SchedulerEventsProps) => return group.eventRow === index; })} indexRow={index} - cellTop={cellTop + (10 + 70 * index)} + cellTop={ + index == 3 + ? cellTop + (25 + 80 * index) + : index < 3 + ? cellTop + (12 + 80 * index) + : cellTop + (25 + 80 * index) + } cellWidth={cellWidth} /> ))} diff --git a/src/components/SchedulerRow.tsx b/src/components/SchedulerRow.tsx index eb81f1c..42fd6d6 100644 --- a/src/components/SchedulerRow.tsx +++ b/src/components/SchedulerRow.tsx @@ -13,7 +13,7 @@ const SchedulerEvent = styled.div` top: ${(props) => props.cellTop}px; left: ${(props) => props.cellWidth + 5 + props.cellWidth * props.eventIndex}px; width: ${(props) => (props.cellWidth * 2) / 3}px; - height: 60px; + height: 69px; background-color: lightblue; z-index: 2; `; diff --git a/src/components/Transfer.tsx b/src/components/Transfer.tsx new file mode 100644 index 0000000..58442b4 --- /dev/null +++ b/src/components/Transfer.tsx @@ -0,0 +1,115 @@ +import React from 'react'; +import Modal from '@material-ui/core/Modal'; +import Fade from '@material-ui/core/Fade'; +import Input from '@material-ui/core/Input'; +import { makeStyles } from '@material-ui/core/styles'; +import styled from 'styled-components'; + +interface TransferProps { + handleClose: (e: React.MouseEvent) => void; + isOpen: boolean; +} + +const useStyles = makeStyles({ + wrapper: { + display: 'flex', + justifyContent: 'center', + textAlign: 'center', + alignItems: 'center', + }, +}); + +const TransferStyled = styled.div` + display: flex; + + flex-direction: row; + + outline: none; + min-width: 35%; + height: 70%; + padding-top: 40px; + background: #006b96; + box-shadow: 0px 0px 0px 4px #006b96; + border: 4px solid #ffc400; + margin: 0 auto; + border-top-left-radius: 5px; + border-bottom-right-radius: 5px; + text-transform: uppercase; + letter-spacing: 0.3ch; +`; + +const TransferGiveStyled = styled.div` + flex-grow: 1; + display: flex; + flex-direction: column; + align-items: center; +`; + +const TransferReceiveStyled = styled.div` + flex-grow: 1; + display: flex; + flex-direction: column; + align-items: center; +`; + +const TransferTextStyled = styled.div` + font-family: Lato; + font-size: 30px; + margin-bottom: 10px; +`; + +const TransferInputStyled = styled.div` + width: 250px; + height: 25px; + padding: 10px; + font-size: 24px; + transition-duration: 0.3s; + input::placeholder { + color: black; + font-weight: bold; + text-align: center; + } +`; + +export const Transfer = ({ handleClose, isOpen }: TransferProps) => { + const classes = useStyles(); + + return ( +
+ + + + + Oddam + + {' '} + + + + + Przyjmę + + {' '} + + + + + + +
+ ); +}; diff --git a/src/components/Transfer/Transfer.tsx b/src/components/Transfer/Transfer.tsx deleted file mode 100644 index 59c66e6..0000000 --- a/src/components/Transfer/Transfer.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import React from 'react'; -import Modal from '@material-ui/core/Modal'; -import './index.scss'; -import Fade from '@material-ui/core/Fade'; -import Input from '@material-ui/core/Input'; -import { makeStyles } from '@material-ui/core/styles'; -import styled from 'styled-components'; - -interface TransferProps { - handleClose: (e: React.MouseEvent) => void; - isOpen: boolean; -} - -const useStyles = makeStyles({ - wrapper: { - display: 'flex', - justifyContent: 'center', - textAlign: 'center', - alignItems: 'center', - }, -}); - -export const Transfer = ({ handleClose, isOpen }: TransferProps) => { - const classes = useStyles(); - - return ( -
- - -
-
-
Oddam
-
- {' '} - -
-
-
-
Przyjmę
- -
-
-
-
-
- ); -}; diff --git a/src/components/Transfer/index.scss b/src/components/Transfer/index.scss deleted file mode 100644 index cef0e2b..0000000 --- a/src/components/Transfer/index.scss +++ /dev/null @@ -1,69 +0,0 @@ -.wrapper { - display: flex; - justify-content: center; - text-align: center; - align-items: center; -} - -.transfer { - display: flex; - - flex-direction: row; - - outline: none; - min-width: 35%; - height: 70%; - padding-top: 40px; - background: #006b96; - box-shadow: 0px 0px 0px 4px #006b96; - border: 4px solid #ffc400; - margin: 0 auto; - border-top-left-radius: 5px; - border-bottom-right-radius: 5px; - - text-transform: uppercase; - letter-spacing: 0.3ch; - - &__give { - flex-grow: 1; - display: flex; - flex-direction: column; - align-items: center; - } - &__receive { - flex-grow: 1; - } - &__text { - font-family: Lato; - font-size: 30px; - margin-bottom: 10px; - } - &__input { - width: 250px; - height: 25px; - background: #ffc400; - outline: none; - border: 1px solid; - border-radius: 10px; - padding: 10px; - font-size: 24px; - transition-duration: 0.3s; - } - &__input:focus { - -webkit-box-shadow: 0px 0px 34px 1px #ffae00; - -moz-box-shadow: 0px 0px 34px 1px #ffae00; - box-shadow: 0px 0px 34px 1px #ffae00; - } - &__input2 { - width: 250px; - height: 25px; - padding: 10px; - font-size: 24px; - transition-duration: 0.3s; - } - input::placeholder{ - color: black; - font-weight: bold; - text-align: center; - } -} From 3644b82e29052bfbcb2814880b96faa872f3c130 Mon Sep 17 00:00:00 2001 From: wrzesinski-hubert Date: Thu, 20 Aug 2020 18:14:28 +0200 Subject: [PATCH 24/27] X button --- src/components/App.tsx | 2 +- src/components/Dropdown.tsx | 14 +++++++++++++- src/components/SchedulerEvents.tsx | 4 +--- src/components/Topbar.tsx | 16 ++++++++++------ src/contexts/CoursesProvider.tsx | 14 ++++---------- 5 files changed, 29 insertions(+), 21 deletions(-) diff --git a/src/components/App.tsx b/src/components/App.tsx index dbc7646..14810b2 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -1,5 +1,5 @@ import React, { useState, useContext } from 'react'; -import { Topbar } from './Topbar'; +import Topbar from './Topbar'; import { Transfer } from './Transfer'; import { Scheduler } from './Scheduler'; import { Rightbar } from './Rightbar'; diff --git a/src/components/Dropdown.tsx b/src/components/Dropdown.tsx index d266b2a..6b76565 100644 --- a/src/components/Dropdown.tsx +++ b/src/components/Dropdown.tsx @@ -36,7 +36,12 @@ const useStyles = makeStyles({ }, }); -export const Dropdown = () => { +interface DropdownProps { + clearInput: boolean; + handleClearInput: ()=>void; +} + +export const Dropdown = ({clearInput,handleClearInput}:DropdownProps) => { const classes = useStyles(); const [open, setOpen] = React.useState(false); @@ -58,6 +63,13 @@ export const Dropdown = () => { filterCourses(input); }, [input, open, choosenCourses]); + useEffect(()=>{ + if(clearInput){ + setInput('') + handleClearInput() + } + },[clearInput]) + const handleChange = (event: React.ChangeEvent) => setInput(event.target.value); const handleClick = () => setOpen(true); diff --git a/src/components/SchedulerEvents.tsx b/src/components/SchedulerEvents.tsx index e9f3daf..38e25f7 100644 --- a/src/components/SchedulerEvents.tsx +++ b/src/components/SchedulerEvents.tsx @@ -18,14 +18,12 @@ export const SchedulerEvents = ({ cellTop, cellWidth }: SchedulerEventsProps) => } //delete later additional mappings const groupTimeToEventRowMapping: GroupTimeToEventRowMapping = { - '08.15': 0, + '8.15': 0, '10.00': 1, '11.45': 2, '13.45': 3, '15.30': 4, '17.15': 5, - '10.17': 0, - '13.55': 1, }; useEffect(() => { diff --git a/src/components/Topbar.tsx b/src/components/Topbar.tsx index 62a14de..c7cfcb7 100644 --- a/src/components/Topbar.tsx +++ b/src/components/Topbar.tsx @@ -15,7 +15,7 @@ const TopbarTextStyled = styled.div` } `; -const TopbarStyled = styled.div` +const Topbar = styled.div` background-color: #ffdc61; height: 80px; padding: 5px; @@ -58,6 +58,7 @@ const TopbarInputIconStyled = styled.img` @media only screen and (max-width: 670px) { width: 25px; } + cursor: pointer; `; const TopbarIcon = styled.img` @@ -79,7 +80,8 @@ interface TopbarProps { handleTransfer: (e: MouseEvent) => void; } -export const Topbar = ({ handleTransfer }: TopbarProps) => { +export default function ({ handleTransfer }: TopbarProps) { + const [clearInput, setClearInput] = useState(false); const [isPolish, setIsPolish] = useState(false); const [anchorEl, setAnchorEl] = useState(null); @@ -89,8 +91,10 @@ export const Topbar = ({ handleTransfer }: TopbarProps) => { const handleClose = () => setAnchorEl(null); + const handleClearInput = () => setClearInput(!clearInput); + return ( - + plan na plan @@ -98,9 +102,9 @@ export const Topbar = ({ handleTransfer }: TopbarProps) => { - + - + @@ -108,6 +112,6 @@ export const Topbar = ({ handleTransfer }: TopbarProps) => { - + ); }; diff --git a/src/contexts/CoursesProvider.tsx b/src/contexts/CoursesProvider.tsx index 27772ec..a60f27a 100644 --- a/src/contexts/CoursesProvider.tsx +++ b/src/contexts/CoursesProvider.tsx @@ -20,22 +20,16 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => { const [choosenGroups, setChoosenGroups] = useState>([]); const addChoosenCourse = (choosenCourse: Course) => { - console.log('adding course'); setChoosenCourses([...choosenCourses, choosenCourse]); }; const addChoosenGroup = (choosenGroup: Group) => { + //const choosenCourse = courses.filter(course=>(course.groups.map(group=>group.id).includes(choosenGroup.id))) + console.log("id" + choosenGroup.id ) + console.log("mapowanie: " + courses.filter(course=>(course.groups.map(group=>group.id)))); + //console.log("wybrane kursy: " + choosenCourse); setChoosenGroups([...choosenGroups, choosenGroup]); }; - useEffect(() => { - console.log('All courses'); - console.log(courses); - }, [courses]); - useEffect(() => { - console.log('Choosen courses'); - console.log(choosenCourses); - }, [choosenCourses]); - useEffect(() => { const fetchData = async () => { const { data } = await axios.get(`${process.env.REACT_APP_API_URL}/getCourses`); From a1953064d998ab710ddef930250def62c48aa60c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciek=20G=C5=82owacki?= Date: Sun, 23 Aug 2020 16:02:52 +0200 Subject: [PATCH 25/27] Checkpoint --- package-lock.json | 628 +---------------------------- package.json | 2 - src/components/CourseCard.tsx | 14 +- src/components/Dropdown.tsx | 22 +- src/components/SchedulerEvents.tsx | 1 - src/contexts/CoursesProvider.tsx | 57 ++- src/types/index.ts | 20 +- 7 files changed, 80 insertions(+), 664 deletions(-) diff --git a/package-lock.json b/package-lock.json index a4d832b..f7602f0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2220,11 +2220,6 @@ "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.3.tgz", "integrity": "sha512-tsFzPpcttalNjFBCFMqsKYQcWxxen1pgJR56by//QwvJc4/OUS3kPOOttx2tSIfjsylB0pYu7f5D3K1RCxUnUg==" }, - "abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" - }, "accepts": { "version": "1.3.7", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", @@ -2347,11 +2342,6 @@ "resolved": "https://registry.npmjs.org/alphanum-sort/-/alphanum-sort-1.0.2.tgz", "integrity": "sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM=" }, - "amdefine": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", - "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=" - }, "ansi-colors": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-3.2.4.tgz", @@ -2404,39 +2394,6 @@ "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==" }, - "are-we-there-yet": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", - "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", - "requires": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", @@ -2479,11 +2436,6 @@ "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=" }, - "array-find-index": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", - "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=" - }, "array-flatten": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-2.1.2.tgz", @@ -2602,11 +2554,6 @@ "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz", "integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==" }, - "async-foreach": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/async-foreach/-/async-foreach-0.1.3.tgz", - "integrity": "sha1-NhIfhFwFeBct5Bmpfb6x0W7DRUI=" - }, "async-limiter": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", @@ -3198,14 +3145,6 @@ "file-uri-to-path": "1.0.0" } }, - "block-stream": { - "version": "0.0.9", - "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", - "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", - "requires": { - "inherits": "~2.0.0" - } - }, "bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -3563,22 +3502,6 @@ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" }, - "camelcase-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", - "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", - "requires": { - "camelcase": "^2.0.0", - "map-obj": "^1.0.0" - }, - "dependencies": { - "camelcase": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", - "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=" - } - } - }, "camelize": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/camelize/-/camelize-1.0.0.tgz", @@ -4011,11 +3934,6 @@ "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz", "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==" }, - "console-control-strings": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=" - }, "constants-browserify": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", @@ -4489,14 +4407,6 @@ "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.10.tgz", "integrity": "sha512-D34BqZU4cIlMCY93rZHbrq9pjTAQJ3U8S8rfBqjwHxkGPThWFjzZDQpgMJY0QViLxth6ZKYiwFBo14RdN44U/w==" }, - "currently-unhandled": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", - "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", - "requires": { - "array-find-index": "^1.0.1" - } - }, "cyclist": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-1.0.1.tgz", @@ -4691,11 +4601,6 @@ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" }, - "delegates": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", - "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=" - }, "depd": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", @@ -6166,17 +6071,6 @@ "integrity": "sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA==", "optional": true }, - "fstream": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", - "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", - "requires": { - "graceful-fs": "^4.1.2", - "inherits": "~2.0.0", - "mkdirp": ">=0.5 0", - "rimraf": "2" - } - }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -6187,62 +6081,6 @@ "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=" }, - "gauge": { - "version": "2.7.4", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", - "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", - "requires": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "requires": { - "ansi-regex": "^2.0.0" - } - } - } - }, - "gaze": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/gaze/-/gaze-1.1.3.tgz", - "integrity": "sha512-BRdNm8hbWzFzWHERTrejLqwHDfS4GibPoq5wjTPIoJHoBtKGPg3xAFfxmM+9ztbXelxcf2hwQcaz1PtmFeue8g==", - "requires": { - "globule": "^1.0.0" - } - }, "gensync": { "version": "1.0.0-beta.1", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.1.tgz", @@ -6258,11 +6096,6 @@ "resolved": "https://registry.npmjs.org/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.2.tgz", "integrity": "sha512-I0UBV/XOz1XkIJHEUDMZAbzCThU/H8DxmSfmdGcKPnVhu2VfFqr34jr9777IyaTYvxjedWhqVIilEDsCdP5G6g==" }, - "get-stdin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", - "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=" - }, "get-stream": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", @@ -6366,16 +6199,6 @@ } } }, - "globule": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/globule/-/globule-1.3.1.tgz", - "integrity": "sha512-OVyWOHgw29yosRHCHo7NncwR1hW5ew0W/UrvtwvjefVJeQ26q4/8r8FmPsSF1hJ93IgWkyv16pCTz6WblMzm/g==", - "requires": { - "glob": "~7.1.1", - "lodash": "~4.17.12", - "minimatch": "~3.0.2" - } - }, "graceful-fs": { "version": "4.2.4", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", @@ -6459,11 +6282,6 @@ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==" }, - "has-unicode": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" - }, "has-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", @@ -6833,11 +6651,6 @@ "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=" }, - "in-publish": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/in-publish/-/in-publish-2.0.1.tgz", - "integrity": "sha512-oDM0kUSNFC31ShNxHKUyfZKy8ZeXZBWMjMdZHKLOk13uvT27VTL/QzRGfRUcevJhpkZAvlhPYuXkF7eNWrtyxQ==" - }, "indent-string": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", @@ -7123,11 +6936,6 @@ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" }, - "is-finite": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.1.0.tgz", - "integrity": "sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w==" - }, "is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -7252,11 +7060,6 @@ "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" }, - "is-utf8": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", - "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=" - }, "is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -7879,11 +7682,6 @@ } } }, - "js-base64": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.5.2.tgz", - "integrity": "sha512-Vg8czh0Q7sFBSUMWWArX/miJeBWYBPpdU/3M/DKSaekLMqrqVPaedp+5mZhie/r0lgrcaYBfwXatEew6gwgiQQ==" - }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -8322,15 +8120,6 @@ "js-tokens": "^3.0.0 || ^4.0.0" } }, - "loud-rejection": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", - "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", - "requires": { - "currently-unhandled": "^0.4.1", - "signal-exit": "^3.0.0" - } - }, "lower-case": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.1.tgz", @@ -8401,11 +8190,6 @@ "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=" }, - "map-obj": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", - "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=" - }, "map-visit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", @@ -8477,129 +8261,6 @@ } } }, - "meow": { - "version": "3.7.0", - "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", - "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", - "requires": { - "camelcase-keys": "^2.0.0", - "decamelize": "^1.1.2", - "loud-rejection": "^1.0.0", - "map-obj": "^1.0.1", - "minimist": "^1.1.3", - "normalize-package-data": "^2.3.4", - "object-assign": "^4.0.1", - "read-pkg-up": "^1.0.1", - "redent": "^1.0.0", - "trim-newlines": "^1.0.0" - }, - "dependencies": { - "find-up": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", - "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", - "requires": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "indent-string": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", - "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", - "requires": { - "repeating": "^2.0.0" - } - }, - "load-json-file": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", - "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "strip-bom": "^2.0.0" - } - }, - "parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", - "requires": { - "error-ex": "^1.2.0" - } - }, - "path-exists": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", - "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", - "requires": { - "pinkie-promise": "^2.0.0" - } - }, - "path-type": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", - "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", - "requires": { - "graceful-fs": "^4.1.2", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" - }, - "read-pkg": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", - "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", - "requires": { - "load-json-file": "^1.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^1.0.0" - } - }, - "read-pkg-up": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", - "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", - "requires": { - "find-up": "^1.0.0", - "read-pkg": "^1.0.0" - } - }, - "redent": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", - "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", - "requires": { - "indent-string": "^2.1.0", - "strip-indent": "^1.0.1" - } - }, - "strip-bom": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", - "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", - "requires": { - "is-utf8": "^0.2.0" - } - }, - "strip-indent": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", - "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", - "requires": { - "get-stdin": "^4.0.1" - } - } - } - }, "merge-deep": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/merge-deep/-/merge-deep-3.0.2.tgz", @@ -8884,7 +8545,8 @@ "nan": { "version": "2.14.1", "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz", - "integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==" + "integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==", + "optional": true }, "nanomatch": { "version": "1.2.13", @@ -8950,32 +8612,6 @@ "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.9.0.tgz", "integrity": "sha512-7ASaDa3pD+lJ3WvXFsxekJQelBKRpne+GOVbLbtHYdd7pFspyeuJHnWfLplGf3SwKGbfs/aYl5V/JCIaHVUKKQ==" }, - "node-gyp": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.8.0.tgz", - "integrity": "sha512-3g8lYefrRRzvGeSowdJKAKyks8oUpLEd/DyPV4eMhVlhJ0aNaZqIrNUIPuEWWTAoPqyFkfGrM67MC69baqn6vA==", - "requires": { - "fstream": "^1.0.0", - "glob": "^7.0.3", - "graceful-fs": "^4.1.2", - "mkdirp": "^0.5.0", - "nopt": "2 || 3", - "npmlog": "0 || 1 || 2 || 3 || 4", - "osenv": "0", - "request": "^2.87.0", - "rimraf": "2", - "semver": "~5.3.0", - "tar": "^2.0.0", - "which": "1" - }, - "dependencies": { - "semver": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", - "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=" - } - } - }, "node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -9086,98 +8722,6 @@ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.56.tgz", "integrity": "sha512-EVo605FhWLygH8a64TjgpjyHYOihkxECwX1bHHr8tETJKWEiWS2YJjPbvsX2jFjnjTNEgBCmk9mLjKG1Mf11cw==" }, - "node-sass": { - "version": "4.14.1", - "resolved": "https://npm.mlabs.pl:443/node-sass/-/node-sass-4.14.1.tgz", - "integrity": "sha512-sjCuOlvGyCJS40R8BscF5vhVlQjNN069NtQ1gSxyK1u9iqvn6tf7O1R4GNowVZfiZUCRt5MmMs1xd+4V/7Yr0g==", - "requires": { - "async-foreach": "^0.1.3", - "chalk": "^1.1.1", - "cross-spawn": "^3.0.0", - "gaze": "^1.0.0", - "get-stdin": "^4.0.1", - "glob": "^7.0.3", - "in-publish": "^2.0.0", - "lodash": "^4.17.15", - "meow": "^3.7.0", - "mkdirp": "^0.5.1", - "nan": "^2.13.2", - "node-gyp": "^3.8.0", - "npmlog": "^4.0.0", - "request": "^2.88.0", - "sass-graph": "2.2.5", - "stdout-stream": "^1.4.0", - "true-case-path": "^1.0.2" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://npm.mlabs.pl:443/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=" - }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://npm.mlabs.pl:443/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=" - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://npm.mlabs.pl:443/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "cross-spawn": { - "version": "3.0.1", - "resolved": "https://npm.mlabs.pl:443/cross-spawn/-/cross-spawn-3.0.1.tgz", - "integrity": "sha1-ElYDfsufDF9549bvE14wdwGEuYI=", - "requires": { - "lru-cache": "^4.0.1", - "which": "^1.2.9" - } - }, - "lru-cache": { - "version": "4.1.5", - "resolved": "https://npm.mlabs.pl:443/lru-cache/-/lru-cache-4.1.5.tgz", - "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", - "requires": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://npm.mlabs.pl:443/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://npm.mlabs.pl:443/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" - }, - "yallist": { - "version": "2.1.2", - "resolved": "https://npm.mlabs.pl:443/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" - } - } - }, - "nopt": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", - "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", - "requires": { - "abbrev": "1" - } - }, "normalize-package-data": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", @@ -9228,17 +8772,6 @@ "path-key": "^2.0.0" } }, - "npmlog": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", - "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", - "requires": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" - } - }, "nth-check": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", @@ -9485,11 +9018,6 @@ "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=" }, - "os-homedir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=" - }, "os-locale": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", @@ -9505,15 +9033,6 @@ "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" }, - "osenv": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", - "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", - "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" - } - }, "p-defer": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", @@ -10922,11 +10441,6 @@ "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=" }, - "pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=" - }, "psl": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", @@ -11841,14 +11355,6 @@ "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=" }, - "repeating": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", - "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", - "requires": { - "is-finite": "^1.0.0" - } - }, "request": { "version": "2.88.2", "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", @@ -12132,25 +11638,6 @@ "resolved": "https://registry.npmjs.org/sanitize.css/-/sanitize.css-10.0.0.tgz", "integrity": "sha512-vTxrZz4dX5W86M6oVWVdOVe72ZiPs41Oi7Z6Km4W5Turyz28mrXSJhhEBZoRtzJWIv3833WKVwLSDWWkEfupMg==" }, - "sass": { - "version": "1.26.5", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.26.5.tgz", - "integrity": "sha512-FG2swzaZUiX53YzZSjSakzvGtlds0lcbF+URuU9mxOv7WBh7NhXEVDa4kPKN4hN6fC2TkOTOKqiqp6d53N9X5Q==", - "requires": { - "chokidar": ">=2.0.0 <4.0.0" - } - }, - "sass-graph": { - "version": "2.2.5", - "resolved": "https://registry.npmjs.org/sass-graph/-/sass-graph-2.2.5.tgz", - "integrity": "sha512-VFWDAHOe6mRuT4mZRd4eKE+d8Uedrk6Xnh7Sh9b4NGufQLQjOrvf/MQoOdx+0s92L89FeyUUNfU597j/3uNpag==", - "requires": { - "glob": "^7.0.0", - "lodash": "^4.0.0", - "scss-tokenizer": "^0.2.3", - "yargs": "^13.3.2" - } - }, "sass-loader": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-8.0.2.tgz", @@ -12219,25 +11706,6 @@ "ajv-keywords": "^3.4.1" } }, - "scss-tokenizer": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/scss-tokenizer/-/scss-tokenizer-0.2.3.tgz", - "integrity": "sha1-jrBtualyMzOCTT9VMGQRSYR85dE=", - "requires": { - "js-base64": "^2.1.8", - "source-map": "^0.4.2" - }, - "dependencies": { - "source-map": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", - "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", - "requires": { - "amdefine": ">=0.0.4" - } - } - } - }, "select-hose": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", @@ -12845,38 +12313,6 @@ "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" }, - "stdout-stream": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/stdout-stream/-/stdout-stream-1.4.1.tgz", - "integrity": "sha512-j4emi03KXqJWcIeF8eIXkjMFN1Cmb8gUlDYGeBALLPo5qdyTfA9bOtl8m33lRoC+vFMkP3gl0WsDr6+gzxbbTA==", - "requires": { - "readable-stream": "^2.0.1" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, "stealthy-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", @@ -13280,16 +12716,6 @@ "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.3.tgz", "integrity": "sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==" }, - "tar": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.2.tgz", - "integrity": "sha512-FCEhQ/4rE1zYv9rYXJw/msRqsnmlje5jHP6huWeBZ704jUTy02c5AZyWujpMR1ax6mVw9NyJMfuK2CMDWVIfgA==", - "requires": { - "block-stream": "*", - "fstream": "^1.0.12", - "inherits": "2" - } - }, "terser": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/terser/-/terser-4.7.0.tgz", @@ -13576,19 +13002,6 @@ "punycode": "^2.1.0" } }, - "trim-newlines": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", - "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=" - }, - "true-case-path": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/true-case-path/-/true-case-path-1.0.3.tgz", - "integrity": "sha512-m6s2OdQe5wgpFMC+pAJ+q9djG82O2jcHPOI6RNg1yy9rCYR+WD6Nbpl32fDpfC56nirdRy+opFa/Vk7HYhqaew==", - "requires": { - "glob": "^7.1.2" - } - }, "ts-pnp": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/ts-pnp/-/ts-pnp-1.1.6.tgz", @@ -14657,43 +14070,6 @@ "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" }, - "wide-align": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", - "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", - "requires": { - "string-width": "^1.0.2 || 2" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, "word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", diff --git a/package.json b/package.json index 9b6e4e6..124c9f8 100644 --- a/package.json +++ b/package.json @@ -8,11 +8,9 @@ "@testing-library/react": "^9.5.0", "@testing-library/user-event": "^7.2.1", "axios": "^0.19.2", - "node-sass": "^4.14.1", "react": "^16.13.1", "react-dom": "^16.13.1", "react-scripts": "3.4.1", - "sass": "^1.26.5", "styled-components": "^5.1.1" }, "devDependencies": { diff --git a/src/components/CourseCard.tsx b/src/components/CourseCard.tsx index eb54f2f..0458292 100644 --- a/src/components/CourseCard.tsx +++ b/src/components/CourseCard.tsx @@ -77,18 +77,22 @@ interface CourseCardProps { export const CourseCard = ({ onCardClick, course, id, isSelected }: CourseCardProps) => { const classes = useStyles(); - const { addChoosenGroup, choosenCourses } = useContext(coursesContext)!; + const { addChoosenGroup, courses, choosenCourses } = useContext(coursesContext)!; - const onGroupClick = (group: Group) => addChoosenGroup(group); + const choosenCoursesIds = choosenCourses.map(({ id }) => id); + + const choosenCoursesWithGroups = courses.filter(({ id }) => choosenCoursesIds.includes(id)); + + const onGroupClick = (group: Group, id: number) => addChoosenGroup(group, id); return ( {course.name} - {choosenCourses.map((course) => ( + {choosenCoursesWithGroups.map((course) => (
- {course.groups.map((group, index) => ( - onGroupClick(group)}> + {course.groups!.map((group, index) => ( + onGroupClick(group, course.id)}>

{group.time} {group.room}

{group.lecturer}

diff --git a/src/components/Dropdown.tsx b/src/components/Dropdown.tsx index 6b76565..f107b2a 100644 --- a/src/components/Dropdown.tsx +++ b/src/components/Dropdown.tsx @@ -38,10 +38,10 @@ const useStyles = makeStyles({ interface DropdownProps { clearInput: boolean; - handleClearInput: ()=>void; + handleClearInput: () => void; } -export const Dropdown = ({clearInput,handleClearInput}:DropdownProps) => { +export const Dropdown = ({ clearInput, handleClearInput }: DropdownProps) => { const classes = useStyles(); const [open, setOpen] = React.useState(false); @@ -63,12 +63,12 @@ export const Dropdown = ({clearInput,handleClearInput}:DropdownProps) => { filterCourses(input); }, [input, open, choosenCourses]); - useEffect(()=>{ - if(clearInput){ - setInput('') - handleClearInput() + useEffect(() => { + if (clearInput) { + setInput(''); + handleClearInput(); } - },[clearInput]) + }, [clearInput]); const handleChange = (event: React.ChangeEvent) => setInput(event.target.value); @@ -82,16 +82,14 @@ export const Dropdown = ({clearInput,handleClearInput}:DropdownProps) => { const id = target.id; const name = target.textContent; - const { data } = await axios.get(`${process.env.REACT_APP_API_URL}/getCourseGroups?id=${id}`); - //porozmawiać z Filipem, żeby odrobinę przerobił endpoint - const course: Course = { + const choosenCourse = { name: name, id: parseInt(id), - groups: data, + groups: [], }; - addChoosenCourse(course); + addChoosenCourse(choosenCourse); setOpen(false); } }; diff --git a/src/components/SchedulerEvents.tsx b/src/components/SchedulerEvents.tsx index 38e25f7..c649935 100644 --- a/src/components/SchedulerEvents.tsx +++ b/src/components/SchedulerEvents.tsx @@ -16,7 +16,6 @@ export const SchedulerEvents = ({ cellTop, cellWidth }: SchedulerEventsProps) => interface GroupTimeToEventRowMapping { [time: string]: number; } - //delete later additional mappings const groupTimeToEventRowMapping: GroupTimeToEventRowMapping = { '8.15': 0, '10.00': 1, diff --git a/src/contexts/CoursesProvider.tsx b/src/contexts/CoursesProvider.tsx index a60f27a..2d77f71 100644 --- a/src/contexts/CoursesProvider.tsx +++ b/src/contexts/CoursesProvider.tsx @@ -1,12 +1,14 @@ import React, { useState, createContext, useEffect } from 'react'; -import { Course, Group } from '../types'; +import { Course, Group, CourseBasket } from '../types'; import axios from 'axios'; + interface CourseContext { courses: Array; choosenCourses: Array; choosenGroups: Array; + coursesBasket: Array; addChoosenCourse: (courses: Course) => void; - addChoosenGroup: (group: Group) => void; + addChoosenGroup: (group: Group, id: number) => void; } export const coursesContext = createContext(null); @@ -15,25 +17,60 @@ interface CoursesProviderProps { } export const CoursesProvider = ({ children }: CoursesProviderProps) => { + //fetch courses with groups const [courses, setCourses] = useState>([]); + const [coursesBasket, setCoursesBasket] = useState>([]); + //with groups const [choosenCourses, setChoosenCourses] = useState>([]); const [choosenGroups, setChoosenGroups] = useState>([]); const addChoosenCourse = (choosenCourse: Course) => { setChoosenCourses([...choosenCourses, choosenCourse]); }; - const addChoosenGroup = (choosenGroup: Group) => { - //const choosenCourse = courses.filter(course=>(course.groups.map(group=>group.id).includes(choosenGroup.id))) - console.log("id" + choosenGroup.id ) - console.log("mapowanie: " + courses.filter(course=>(course.groups.map(group=>group.id)))); - //console.log("wybrane kursy: " + choosenCourse); - setChoosenGroups([...choosenGroups, choosenGroup]); + const addChoosenGroup = (choosenGroup: Group, id: number) => { + //move to utilities + //change type to group type from api + function hasChoosenGroupType(type: string) { + const res = choosenCourse.groups!.find((group) => group.type === type); + console.log(`res is: ${JSON.stringify(res)}`); + return !!res; + } + + const choosenCourse = choosenCourses.find((cc) => cc.id === id)!; + + const type = choosenGroup.type; + console.log(`group type is: ${type}`); + if (hasChoosenGroupType(type)) { + const group = choosenCourse.groups!.find((group) => group.type === type); + console.log(`group is: ${JSON.stringify(group)}`); + console.log(choosenCourse.groups); + if (group) { + group.type = type; + } + setChoosenGroups([...choosenGroups, choosenGroup]); + } else { + console.log('pierwsza grupa/wykłąd'); + //może być złe + choosenCourse.groups!.push(choosenGroup); + // setChoosenCourses(course => course.id === choosenCourse.id) + setChoosenGroups([...choosenGroups, choosenGroup]); + } + console.log(`choosen courses after changing group: ${JSON.stringify(choosenCourses)}`); + + console.log(choosenCourse); }; useEffect(() => { const fetchData = async () => { - const { data } = await axios.get(`${process.env.REACT_APP_API_URL}/getCourses`); - setCourses(data); + const { data: courses } = await axios.get(`${process.env.REACT_APP_API_URL}/getCourses`); + + for (const course of courses) { + const { data: groups } = await axios.get(`${process.env.REACT_APP_API_URL}/getCourseGroups?id=${course.id}`); + //porozmawiać z Filipem, żeby odrobinę przerobił endpoint + course.groups = groups; + } + + setCourses(courses); }; fetchData(); }, []); diff --git a/src/types/index.ts b/src/types/index.ts index d514202..40adcdc 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,6 +1,13 @@ -export enum GroupType { - course = 'course', - CLASS = 'class', +const COURSE = 'course'; +const CLASS = 'class'; + +export type GroupType = typeof COURSE | typeof CLASS; + +export interface CourseBasket { + id: number; + name: string; + lecture: Group | null; + class: Group | null; } export interface Group { @@ -9,7 +16,7 @@ export interface Group { time: string; lecturer: string; room: string; - groupType: GroupType; + type: GroupType; capacity?: number; } @@ -18,10 +25,7 @@ export interface Course { name: string; groups: Array; } -export interface courseInit { - name: string; - id: number; -} + export interface User { name?: string; surname?: string; From 9a0ee683178448917f960eb713eccbcbce53da5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciek=20G=C5=82owacki?= Date: Sun, 23 Aug 2020 16:10:10 +0200 Subject: [PATCH 26/27] Add course to basket functionality --- src/components/Dropdown.tsx | 12 ++++-------- src/contexts/CoursesProvider.tsx | 19 +++++++++++-------- src/contexts/reducers.ts | 4 ++-- src/types/index.ts | 2 +- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/components/Dropdown.tsx b/src/components/Dropdown.tsx index f107b2a..76d41b6 100644 --- a/src/components/Dropdown.tsx +++ b/src/components/Dropdown.tsx @@ -3,7 +3,7 @@ import axios from 'axios'; import { Input } from '@material-ui/core'; import ClickAwayListener from '@material-ui/core/ClickAwayListener'; import { coursesContext } from '../contexts/CoursesProvider'; -import { Course } from '../types'; +import { Course, Basket } from '../types'; import styled from 'styled-components'; import { makeStyles } from '@material-ui/core/styles'; @@ -50,7 +50,7 @@ export const Dropdown = ({ clearInput, handleClearInput }: DropdownProps) => { //courses - choosenCourses const [filteredCourses, setFilteredCourses] = useState>([]); - const { courses, choosenCourses, addChoosenCourse } = useContext(coursesContext)!; + const { courses, choosenCourses, addToBasket } = useContext(coursesContext)!; useEffect(() => { const filterCourses = (input: string) => { @@ -83,13 +83,9 @@ export const Dropdown = ({ clearInput, handleClearInput }: DropdownProps) => { const name = target.textContent; //porozmawiać z Filipem, żeby odrobinę przerobił endpoint - const choosenCourse = { - name: name, - id: parseInt(id), - groups: [], - }; + const course: Basket = { name: name, id: parseInt(id), lecture: null, class: null }; - addChoosenCourse(choosenCourse); + addToBasket(course); setOpen(false); } }; diff --git a/src/contexts/CoursesProvider.tsx b/src/contexts/CoursesProvider.tsx index 2d77f71..a9c591c 100644 --- a/src/contexts/CoursesProvider.tsx +++ b/src/contexts/CoursesProvider.tsx @@ -1,13 +1,13 @@ import React, { useState, createContext, useEffect } from 'react'; -import { Course, Group, CourseBasket } from '../types'; +import { Course, Group, Basket } from '../types'; import axios from 'axios'; interface CourseContext { courses: Array; choosenCourses: Array; choosenGroups: Array; - coursesBasket: Array; - addChoosenCourse: (courses: Course) => void; + basket: Array; + addToBasket: (courses: Basket) => void; addChoosenGroup: (group: Group, id: number) => void; } export const coursesContext = createContext(null); @@ -19,14 +19,17 @@ interface CoursesProviderProps { export const CoursesProvider = ({ children }: CoursesProviderProps) => { //fetch courses with groups const [courses, setCourses] = useState>([]); - const [coursesBasket, setCoursesBasket] = useState>([]); + const [basket, setBasket] = useState>([]); //with groups const [choosenCourses, setChoosenCourses] = useState>([]); const [choosenGroups, setChoosenGroups] = useState>([]); - const addChoosenCourse = (choosenCourse: Course) => { - setChoosenCourses([...choosenCourses, choosenCourse]); - }; + const addToBasket = (course: Basket) => setBasket([...basket, course]); + + useEffect(() => { + console.log(basket); + }, [basket]); + const addChoosenGroup = (choosenGroup: Group, id: number) => { //move to utilities //change type to group type from api @@ -76,7 +79,7 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => { }, []); return ( - + {children} ); diff --git a/src/contexts/reducers.ts b/src/contexts/reducers.ts index 328938d..14a0316 100644 --- a/src/contexts/reducers.ts +++ b/src/contexts/reducers.ts @@ -1,14 +1,14 @@ // import { Group, Course } from '../types'; export enum Types { - addChoosenCourse = 'ADD_CHOOSEN_COURSE', + addToBasket = 'ADD_CHOOSEN_COURSE', removeChoosenCourse = 'REMOVE_CHOOSEN_COURSE', addChoosenGroup = 'ADD_CHOOSEN_GROUP', removeChoosenGroup = 'REMOVE_CHOOSEN_GROUP', } // type ChoosenCoursesPayload = { -// [Types.addChoosenCourse]: {}; +// [Types.addToBasket]: {}; // }; // type ChoosenGroupsPayload = { diff --git a/src/types/index.ts b/src/types/index.ts index 40adcdc..9846d9d 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -3,7 +3,7 @@ const CLASS = 'class'; export type GroupType = typeof COURSE | typeof CLASS; -export interface CourseBasket { +export interface Basket { id: number; name: string; lecture: Group | null; From 457169fe0ee65162bc0756a4bc562fd638972ce4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciek=20G=C5=82owacki?= Date: Sun, 23 Aug 2020 17:22:50 +0200 Subject: [PATCH 27/27] Classes display correctly, still need to work on lectures: --- src/components/CourseCard.tsx | 26 ++++++--------- src/components/Dropdown.tsx | 8 ++--- src/components/Rightbar.tsx | 11 +++++-- src/components/SchedulerEvents.tsx | 21 ++++++++---- src/contexts/CoursesProvider.tsx | 53 +++++++++--------------------- src/contexts/reducers.ts | 4 +-- src/types/index.ts | 10 +++--- 7 files changed, 60 insertions(+), 73 deletions(-) diff --git a/src/components/CourseCard.tsx b/src/components/CourseCard.tsx index 0458292..4995caf 100644 --- a/src/components/CourseCard.tsx +++ b/src/components/CourseCard.tsx @@ -77,28 +77,22 @@ interface CourseCardProps { export const CourseCard = ({ onCardClick, course, id, isSelected }: CourseCardProps) => { const classes = useStyles(); - const { addChoosenGroup, courses, choosenCourses } = useContext(coursesContext)!; + const { addGroup } = useContext(coursesContext)!; - const choosenCoursesIds = choosenCourses.map(({ id }) => id); - - const choosenCoursesWithGroups = courses.filter(({ id }) => choosenCoursesIds.includes(id)); - - const onGroupClick = (group: Group, id: number) => addChoosenGroup(group, id); + console.log(`course`); + console.log(course); + const onGroupClick = (group: Group, id: number) => addGroup(group, id); return ( {course.name} - {choosenCoursesWithGroups.map((course) => ( -
- {course.groups!.map((group, index) => ( - onGroupClick(group, course.id)}> -

- {group.time} {group.room}

{group.lecturer} -

-
- ))} -
+ {course.groups.map((group, index) => ( + onGroupClick(group, course.id)}> +

+ {group.time} {group.room}

{group.lecturer} +

+
))}
diff --git a/src/components/Dropdown.tsx b/src/components/Dropdown.tsx index 76d41b6..f77da72 100644 --- a/src/components/Dropdown.tsx +++ b/src/components/Dropdown.tsx @@ -50,18 +50,18 @@ export const Dropdown = ({ clearInput, handleClearInput }: DropdownProps) => { //courses - choosenCourses const [filteredCourses, setFilteredCourses] = useState>([]); - const { courses, choosenCourses, addToBasket } = useContext(coursesContext)!; + const { courses, basket, addToBasket } = useContext(coursesContext)!; useEffect(() => { const filterCourses = (input: string) => { - const choosenCoursesNames = choosenCourses.map(({ name }) => name.trim()); + const choosenCoursesNames = basket.map(({ name }) => name.trim()); const filteredCourses = courses.filter( ({ name }) => name.toLowerCase().includes(input.toLowerCase()) && !choosenCoursesNames.includes(name), ); setFilteredCourses(filteredCourses); }; filterCourses(input); - }, [input, open, choosenCourses]); + }, [input, open, basket]); useEffect(() => { if (clearInput) { @@ -83,7 +83,7 @@ export const Dropdown = ({ clearInput, handleClearInput }: DropdownProps) => { const name = target.textContent; //porozmawiać z Filipem, żeby odrobinę przerobił endpoint - const course: Basket = { name: name, id: parseInt(id), lecture: null, class: null }; + const course: Basket = { name: name, id: parseInt(id), lecture: null, classes: null }; addToBasket(course); setOpen(false); diff --git a/src/components/Rightbar.tsx b/src/components/Rightbar.tsx index a39fee6..5262df5 100644 --- a/src/components/Rightbar.tsx +++ b/src/components/Rightbar.tsx @@ -33,7 +33,14 @@ const RightbarTextStyled = styled.div` export const Rightbar = () => { const [selectedCardId, setSelectedCardId] = useState(null); - const { choosenCourses } = useContext(coursesContext)!; + const { courses, basket } = useContext(coursesContext)!; + + const getBasketGroups = () => { + const ids = basket.map(({ id }) => id); + return courses.filter(({ id }) => ids.includes(id)); + }; + + const filteredCourses = getBasketGroups(); //działa clunky const onCardClick = (event: MouseEvent) => { @@ -48,7 +55,7 @@ export const Rightbar = () => { Hubert Wrzesiński

Semestr zimowy 2020/2021 - {choosenCourses.map((course, index) => ( + {filteredCourses.map((course, index) => ( { - const { choosenGroups } = useContext(coursesContext)!; + const { basket } = useContext(coursesContext)!; const [choosenGroupsMappedToEvents, setChoosenGroupsMappedToEvents] = useState([]); @@ -26,8 +26,17 @@ export const SchedulerEvents = ({ cellTop, cellWidth }: SchedulerEventsProps) => }; useEffect(() => { - function mapGroupTimeToEventRow(choosenGroups: Array) { - const groupsMapped = choosenGroups.map(({ id, day, lecturer, room, time }) => ({ + function mapGroupTimeToEventRow(basket: Array) { + const basketGroups = basket.map(({ classes, lecture }) => ({ + ...classes, + ...lecture, + })) as Array; + + console.log('passed basket'); + console.log(basket); + console.log(`basketgroups`); + console.log(basketGroups); + const groupsMapped = basketGroups.map(({ id, day, lecturer, room, time }) => ({ id, day, lecturer, @@ -36,8 +45,8 @@ export const SchedulerEvents = ({ cellTop, cellWidth }: SchedulerEventsProps) => })); setChoosenGroupsMappedToEvents(groupsMapped); } - mapGroupTimeToEventRow(choosenGroups); - }, [choosenGroups]); + mapGroupTimeToEventRow(basket); + }, [basket]); return (
diff --git a/src/contexts/CoursesProvider.tsx b/src/contexts/CoursesProvider.tsx index a9c591c..7b49128 100644 --- a/src/contexts/CoursesProvider.tsx +++ b/src/contexts/CoursesProvider.tsx @@ -1,14 +1,12 @@ import React, { useState, createContext, useEffect } from 'react'; -import { Course, Group, Basket } from '../types'; +import { Course, Group, Basket, GroupType } from '../types'; import axios from 'axios'; interface CourseContext { courses: Array; - choosenCourses: Array; - choosenGroups: Array; basket: Array; addToBasket: (courses: Basket) => void; - addChoosenGroup: (group: Group, id: number) => void; + addGroup: (group: Group, id: number) => void; } export const coursesContext = createContext(null); @@ -20,47 +18,28 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => { //fetch courses with groups const [courses, setCourses] = useState>([]); const [basket, setBasket] = useState>([]); - //with groups - const [choosenCourses, setChoosenCourses] = useState>([]); - const [choosenGroups, setChoosenGroups] = useState>([]); const addToBasket = (course: Basket) => setBasket([...basket, course]); useEffect(() => { + console.log('BASKET'); console.log(basket); }, [basket]); - const addChoosenGroup = (choosenGroup: Group, id: number) => { - //move to utilities - //change type to group type from api - function hasChoosenGroupType(type: string) { - const res = choosenCourse.groups!.find((group) => group.type === type); - console.log(`res is: ${JSON.stringify(res)}`); - return !!res; - } - - const choosenCourse = choosenCourses.find((cc) => cc.id === id)!; + //immutability + const addGroup = (choosenGroup: Group, id: number) => { + const basketCourse = basket.filter((course) => course.id === id)[0]; const type = choosenGroup.type; - console.log(`group type is: ${type}`); - if (hasChoosenGroupType(type)) { - const group = choosenCourse.groups!.find((group) => group.type === type); - console.log(`group is: ${JSON.stringify(group)}`); - console.log(choosenCourse.groups); - if (group) { - group.type = type; - } - setChoosenGroups([...choosenGroups, choosenGroup]); - } else { - console.log('pierwsza grupa/wykłąd'); - //może być złe - choosenCourse.groups!.push(choosenGroup); - // setChoosenCourses(course => course.id === choosenCourse.id) - setChoosenGroups([...choosenGroups, choosenGroup]); + if (type === GroupType.CLASS) { + setBasket( + basket.map((basket) => (basket.id === basketCourse.id ? { ...basket, classes: choosenGroup } : basket)), + ); + } else if (type === GroupType.LECTURE) { + setBasket( + basket.map((basket) => (basket.id === basketCourse.id ? { ...basket, lecture: choosenGroup } : basket)), + ); } - console.log(`choosen courses after changing group: ${JSON.stringify(choosenCourses)}`); - - console.log(choosenCourse); }; useEffect(() => { @@ -79,8 +58,6 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => { }, []); return ( - - {children} - + {children} ); }; diff --git a/src/contexts/reducers.ts b/src/contexts/reducers.ts index 14a0316..90bf96a 100644 --- a/src/contexts/reducers.ts +++ b/src/contexts/reducers.ts @@ -3,7 +3,7 @@ export enum Types { addToBasket = 'ADD_CHOOSEN_COURSE', removeChoosenCourse = 'REMOVE_CHOOSEN_COURSE', - addChoosenGroup = 'ADD_CHOOSEN_GROUP', + addGroup = 'ADD_CHOOSEN_GROUP', removeChoosenGroup = 'REMOVE_CHOOSEN_GROUP', } @@ -21,7 +21,7 @@ export enum Types { // export const choosenGroupsReducer = (state, action) => { // switch (action.type) { -// case Types.addChoosenGroup: +// case Types.addGroup: // return add; // } // }; diff --git a/src/types/index.ts b/src/types/index.ts index 9846d9d..cdec17f 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,13 +1,13 @@ -const COURSE = 'course'; -const CLASS = 'class'; - -export type GroupType = typeof COURSE | typeof CLASS; +export enum GroupType { + LECTURE = 'LECTURE', + CLASS = 'CLASS', +} export interface Basket { id: number; name: string; lecture: Group | null; - class: Group | null; + classes: Group | null; } export interface Group {