A lot of stuff to refactor, have fun

This commit is contained in:
wrzesinski-hubert 2020-07-01 00:59:19 +02:00
parent b45457b614
commit 5b24b5fd59
11 changed files with 188 additions and 115 deletions

View File

@ -7,8 +7,9 @@ body {
} }
.wraper{ .wraper{
display: flex; display: flex;
&__calendar{ &__rightbar{
width: 85%; width: 80%;
} }
} }

View File

@ -45,7 +45,6 @@ function App() {
<RightBar <RightBar
lectures={lectures} lectures={lectures}
onGroupMouseOver={(id, name) => { onGroupMouseOver={(id, name) => {
console.log("XD");
}} }}
onGroupClick={(id, name) => {}} onGroupClick={(id, name) => {}}
/> />

View File

@ -11,7 +11,7 @@ export const LecturesProvider : React.FC = (props) => {
const [lectures, setLectures] = useState<Array<Lecture>>([]); const [lectures, setLectures] = useState<Array<Lecture>>([]);
const updateLectures = (lecture : Lecture) => {setLectures([...lectures, lecture]); console.log(`Lectures xd are: ${JSON.stringify(lectures)}\n`)} const updateLectures = (lecture : Lecture) => { setLectures([...lectures, lecture])}
return ( return (
<LecturesContext.Provider value={{lectures: lectures, updateLectures : updateLectures}}> <LecturesContext.Provider value={{lectures: lectures, updateLectures : updateLectures}}>

View File

@ -1,38 +1,59 @@
.class { .class {
display: flex; display: flex;
min-height: 50px; min-height: 50px;
background-color: rgb(100, 181, 246) !important; background-color: rgb(100, 181, 246) !important;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
margin-top: 10px; margin-top: 10px;
padding-top:10px; padding-top: 10px;
padding-bottom:10px; padding-bottom: 10px;
border-radius: 10px; border-radius: 10px;
cursor: pointer; cursor: pointer;
align-items: stretch; align-items: stretch;
&__group{ &__group {
padding-top: 1px; padding-top: 1px;
padding-bottom: 1px; padding-bottom: 1px;
&:hover{ &:hover {
cursor: pointer; cursor: pointer;
transition: 1s; transition: 1s;
background-color: #8BC8FB; 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);
} }
} }
&__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;
}
}

View File

@ -5,35 +5,51 @@ import ExpandIcon from "./expand.png";
import { Lecture } from "../../../lectures"; import { Lecture } from "../../../lectures";
interface LectureCardProps { interface LectureCardProps {
onGroupMouseOver: (id: string, name: string) => void; onGroupMouseOver: (id: string, name: string) => void;
onGroupClick: (id: string, name: string) => void; onGroupClick: (id: string, name: string) => void;
onCardClick: (e: React.MouseEvent) => void; onCardClick: (e: React.MouseEvent) => void;
lecture: Lecture; lecture: Lecture;
id: string; id: string;
isSelected: boolean; isSelected: boolean;
} }
export default function LectureCard({ onGroupMouseOver, onGroupClick, onCardClick, lecture, id, isSelected }: LectureCardProps) { export default function LectureCard({
return ( onGroupMouseOver,
<div className="class" onClick={onCardClick} id={id}> onGroupClick,
<div className="class__name">{lecture.name}</div> onCardClick,
<Collapse in={isSelected} timeout="auto" unmountOnExit> lecture,
{lecture.groups.map((group, index) => ( id,
<div isSelected,
className="class__group" }: LectureCardProps) {
key={index} return (
onMouseOver={() => onGroupMouseOver(group.id, lecture.name)} <div className="class" onClick={onCardClick} id={id}>
onClick={() => onGroupClick(group.id, lecture.name)} <div className="class__name">{lecture.name}</div>
> <Collapse
<p> className="expanded"
{group.id} {group.day} {group.time} {group.room} <br></br> {group.lecturer} in={isSelected}
</p>{" "} timeout="auto"
</div> unmountOnExit
))} >
</Collapse> {lecture.groups.map((group, index) => (
<div onClick={onCardClick} id={id}> <div
<img alt="expand" src={ExpandIcon} className={`class__expandIcon${isSelected ? "Rotate" : ""}`} /> className="class__group"
</div> key={index}
</div> onMouseOver={() => onGroupMouseOver(group.id, lecture.name)}
); onClick={() => onGroupClick(group.id, lecture.name)}
>
<p>
{group.time} {group.room} <br></br> {group.lecturer}
</p>{" "}
</div>
))}
</Collapse>
<div onClick={onCardClick} id={id}>
<img
alt="expand"
src={ExpandIcon}
className={`class__expandIcon${isSelected ? "Rotate" : ""}`}
/>
</div>
</div>
);
} }

View File

@ -4,10 +4,28 @@
padding-right: 15px; padding-right: 15px;
text-align: center; text-align: center;
font-family: Lato; font-family: Lato;
width: 300px;
&__text { &__text {
border-bottom: 1px solid; border-bottom: 1px solid;
} }
height:85vh; height:85vh;
overflow-y: scroll; 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;
}

View File

@ -2,8 +2,6 @@ import React, { useState, useContext } from "react";
import "./index.scss"; import "./index.scss";
import { Lecture } from "../../lectures"; import { Lecture } from "../../lectures";
import LectureCard from "./LectureCard"; import LectureCard from "./LectureCard";
import BusinessLogicContext from "../../businesslogic/BusinessLogicContext";
import { BuisnessProvided } from "../../businesslogic/BusinessLogicProvider";
import { LecturesContext } from "../../businesslogic/LecturesProvider"; import { LecturesContext } from "../../businesslogic/LecturesProvider";
interface RightBarProps { interface RightBarProps {
@ -25,9 +23,9 @@ export default function RightBar({ lectures, onGroupMouseOver, onGroupClick }: R
return ( return (
<div className="right-bar"> <div className="right-bar">
<BusinessLogicContext.Consumer> {/* <BusinessLogicContext.Consumer>
{(context) => <p>{JSON.stringify((context as BuisnessProvided).states.user?.ticket)}</p>} {(context) => <p>{JSON.stringify((context as BuisnessProvided).states.user?.ticket)}</p>}
</BusinessLogicContext.Consumer> </BusinessLogicContext.Consumer> */}
<div className="right-bar__text"> <div className="right-bar__text">
Hubert Wrzesiński<br></br> Hubert Wrzesiński<br></br>
Semestr zimowy 2020/2021 Semestr zimowy 2020/2021

View File

@ -2,8 +2,10 @@
position: relative; position: relative;
z-index: 10; z-index: 10;
padding: 5px; padding: 5px;
padding-left: 20px;
background-color: #e6c759; background-color: #e6c759;
font-size: 18px; font-size: 18px;
font-family: Lato;
} }
.lecture:hover{ .lecture:hover{
background-color: #d4b851; background-color: #d4b851;
@ -19,3 +21,4 @@
.top-bar__input-field { .top-bar__input-field {
width: 100%; width: 100%;
} }

View File

@ -5,8 +5,7 @@ import "./index.scss";
import ClickAwayListener from "@material-ui/core/ClickAwayListener"; import ClickAwayListener from "@material-ui/core/ClickAwayListener";
import { LecturesContext } from "../../../businesslogic/LecturesProvider"; import { LecturesContext } from "../../../businesslogic/LecturesProvider";
import { Lecture, Group } from "../../../lectures"; import { Lecture, Group } from "../../../lectures";
import { GroupingPanel } from "@devexpress/dx-react-scheduler"; import { EDEADLK } from "constants";
import { group } from "console";
interface data { interface data {
id: number; id: number;
@ -30,20 +29,29 @@ export const Results: React.FC = () => {
setInput(event.target.value); setInput(event.target.value);
//query should be updated on backend to not accept empty string //query should be updated on backend to not accept empty string
if (event.target.value !== "") { if (event.target.value !== "") {
console.log(event.target.value); console.log("Jeste w okej")
search(event.target.value); search(event.target.value);
} else { } else {
console.log("Jeste w dupuie")
search("xxxxxxxxxxxxxxx"); search("xxxxxxxxxxxxxxx");
} }
}; };
const search = (text: string) => { const search = (text: string) => {
axios axios
.get(`http://localhost:1287/getCourses?name=${text}`) .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 = () => { const handleClick = () => {
setOpen(true); setOpen(true);
console.log("OPWENEE")
}; };
const handleClickAway = () => { const handleClickAway = () => {
@ -56,13 +64,10 @@ export const Results: React.FC = () => {
const lecture = {name: "", groups: []} as Lecture; const lecture = {name: "", groups: []} as Lecture;
console.log(id);
axios axios
.get(`http://localhost:1287/getClassesByCourseId?id=${id}`) .get(`http://localhost:1287/getClassesByCourseId?id=${id}`)
.then((response) => { .then((response) => {
for(let data of response.data){ for(let data of response.data){
console.log("XDD");
console.log(data);
let group = {} as Group; let group = {} as Group;
lecture.name = data.course.name; lecture.name = data.course.name;
group.id = data.id; 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.lecturer = `${data.lecturer.title} ${data.lecturer.name} ${data.lecturer.surname}`;
group.room = data.room.trim(); group.room = data.room.trim();
lecture.groups.push(group); lecture.groups.push(group);
console.log("XDDD");
console.log(lecture.groups);
lecturesContext.updateLectures(lecture); lecturesContext.updateLectures(lecture);
} }
setOpen(false); setOpen(false);
}); }).then(()=>{search(input)});
} }
return ( return (
@ -89,6 +91,7 @@ export const Results: React.FC = () => {
className="top-bar__input-field" className="top-bar__input-field"
onChange={handleChange} onChange={handleChange}
onClick={handleClick} onClick={handleClick}
value={input}
/> />
{open ? ( {open ? (
<div className="dropdown"> <div className="dropdown">

View File

@ -3,51 +3,67 @@
justify-content: center; justify-content: center;
text-align: center; text-align: center;
align-items: center; align-items: center;
} }
.transfer { .transfer {
display: flex; display: flex;
outline:none;
width: 80%; flex-direction: row;
outline: none;
min-width: 35%;
height: 70%; height: 70%;
padding-top: 40px; 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; text-transform: uppercase;
letter-spacing: 0.3ch; letter-spacing: 0.3ch;
&__left { &__give {
display: flex;
justify-content: space-around;
flex-grow: 1; flex-grow: 1;
display: flex;
flex-direction: column;
align-items: center;
} }
&__right { &__receive {
flex-grow: 4; flex-grow: 1;
} }
&__text { &__text {
font-family: Lato; font-family: Lato;
font-size: 50px; font-size: 30px;
margin-bottom: 10px; margin-bottom: 10px;
} }
&__input { &__input {
width: 300px; width: 250px;
height: 45px; height: 25px;
background: #ffc400; background: #ffc400;
outline:none; outline: none;
border: 1px solid; border: 1px solid;
border-radius: 22px ; border-radius: 10px;
padding: 10px; padding: 10px;
font-size: 24px; font-size: 24px;
transition-duration: 0.3s; transition-duration: 0.3s;
} }
input:focus { &__input:focus {
-webkit-box-shadow: 0px 0px 18px 8px #ffae00; -webkit-box-shadow: 0px 0px 34px 1px #ffae00;
-moz-box-shadow: 0px 0px 18px 8px #ffae00; -moz-box-shadow: 0px 0px 34px 1px #ffae00;
box-shadow: 0px 0px 18px 8px #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;
} }
} }

View File

@ -2,7 +2,7 @@ import React from "react";
import Modal from "@material-ui/core/Modal"; import Modal from "@material-ui/core/Modal";
import "./index.scss"; import "./index.scss";
import Fade from '@material-ui/core/Fade'; import Fade from '@material-ui/core/Fade';
import Input from "@material-ui/core/Input";
interface TransferProps { interface TransferProps {
handleClose: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void; handleClose: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
isOpen: boolean; isOpen: boolean;
@ -36,20 +36,18 @@ export default class Transfer extends React.Component<
> >
<Fade in={this.props.isOpen}> <Fade in={this.props.isOpen}>
<div className="transfer"> <div className="transfer">
<div className="transfer__left">
{/* <button className="transfer__add">chuj</button> */}
<div className="transfer__give"> <div className="transfer__give">
<div className="transfer__text">Oddam</div> <div className="transfer__text">Oddam</div>
<input className="transfer__input"></input> <div className="transfer__input2"> <Input
</div> placeholder="Wyszukaj..."
inputProps={{ "aria-label": "description" }}
className="top-bar__input-field"
/></div>
</div>
<div className="transfer__receive"> <div className="transfer__receive">
<div className="transfer__text">Przyjmę</div> <div className="transfer__text">Przyjmę</div>
<input className="transfer__input"></input> <input className="transfer__input"></input>
</div> </div>
</div>
<div className="transfer__right">
<div className="transfer__proposition"></div>
</div>
</div> </div>
</Fade> </Fade>
</Modal> </Modal>