Proof of concept

This commit is contained in:
Filip Izydorczyk
2020-06-17 15:19:51 +02:00
parent ebebdd9def
commit 6992906450
7 changed files with 219 additions and 105 deletions

View File

@ -1,35 +1,43 @@
import React from "react";
import "./index.scss";
import Class, { Group } from "../Class";
import BusinessLogicContext from "../../buisnesslogic/BusinessLogicContext";
import { BuisnessProvided } from "../../buisnesslogic/BuisnessLogicProvider";
interface RightBarProps {
onClassHover: (group_id: String, class_id: String) => void;
onClassClick: (group_id: String, class_id: String) => void;
lectures: Array<Group>;
onClassHover: (group_id: String, class_id: String) => void;
onClassClick: (group_id: String, class_id: String) => void;
lectures: Array<Group>;
}
interface RightBarState {}
export default class RightBar extends React.Component<
RightBarProps,
RightBarState
RightBarProps,
RightBarState
> {
render() {
return (
<div className="right-bar">
<div className="right-bar__text">
Hubert Wrzesiński<br></br>
Semestr zimowy 2020/2021
</div>
{this.props.lectures.map((classgroup, index) => (
<Class
onClassHover={this.props.onClassHover}
onClassClick={this.props.onClassClick}
data={classgroup}
key={index}
/>
))}
</div>
);
}
render() {
return (
<div className="right-bar">
<BusinessLogicContext.Consumer>
{(context) => (
<h1>
{JSON.stringify(
(context as BuisnessProvided).states.user
?.ticket
)}
</h1>
)}
</BusinessLogicContext.Consumer>
{this.props.lectures.map((classgroup, index) => (
<Class
onClassHover={this.props.onClassHover}
onClassClick={this.props.onClassClick}
data={classgroup}
key={index}
/>
))}
</div>
);
}
}

View File

@ -1,15 +1,18 @@
import { Menu, MenuItem } from "@material-ui/core";
import React, { FC } from "react";
import BusinessLogicContext from "../../buisnesslogic/BusinessLogicContext";
import { BuisnessProvided } from "../../buisnesslogic/BuisnessLogicProvider";
interface ProfileProps {
anchorEl: HTMLElement | null;
handleClose: () => void
anchorEl: HTMLElement | null;
handleClose: () => void;
}
export const Profile : FC<ProfileProps> = ({anchorEl, handleClose, ...restProps}) => {
export const Profile: FC<ProfileProps> = ({
anchorEl,
handleClose,
...restProps
}) => {
return (
<Menu
className="top-bar__menu"
@ -21,7 +24,17 @@ export const Profile : FC<ProfileProps> = ({anchorEl, handleClose, ...restProps}
>
<MenuItem>Profile</MenuItem>
<MenuItem>My account</MenuItem>
<MenuItem>Logout</MenuItem>
<BusinessLogicContext.Consumer>
{(context) => (
<MenuItem
onClick={() => {
(context as BuisnessProvided).reducers();
}}
>
Logout
</MenuItem>
)}
</BusinessLogicContext.Consumer>
</Menu>
);
};