frontend/src/components/RightBar/index.tsx

45 lines
1.1 KiB
TypeScript
Raw Normal View History

2020-06-07 15:57:51 +02:00
import React from "react";
import "./index.scss";
2020-06-14 14:24:49 +02:00
import Class, { Group } from "../Class";
2020-06-20 11:13:12 +02:00
import BusinessLogicContext from "../../businesslogic/BusinessLogicContext";
import { BuisnessProvided } from "../../businesslogic/BusinessLogicProvider";
2020-06-09 20:07:54 +02:00
2020-06-14 14:24:49 +02:00
interface RightBarProps {
2020-06-17 15:19:51 +02:00
onClassHover: (group_id: String, class_id: String) => void;
onClassClick: (group_id: String, class_id: String) => void;
lectures: Array<Group>;
2020-06-14 14:24:49 +02:00
}
2020-06-07 15:57:51 +02:00
interface RightBarState {}
export default class RightBar extends React.Component<
2020-06-17 15:19:51 +02:00
RightBarProps,
RightBarState
2020-06-07 15:57:51 +02:00
> {
2020-06-17 15:19:51 +02:00
render() {
return (
<div className="right-bar">
<BusinessLogicContext.Consumer>
{(context) => (
2020-06-20 14:10:58 +02:00
<p>
2020-06-17 15:19:51 +02:00
{JSON.stringify(
(context as BuisnessProvided).states.user
?.ticket
)}
2020-06-20 14:10:58 +02:00
</p>
2020-06-17 15:19:51 +02:00
)}
</BusinessLogicContext.Consumer>
2020-06-20 14:10:58 +02:00
<p>Semestr zimowy 2020/2021</p>
2020-06-17 15:19:51 +02:00
{this.props.lectures.map((classgroup, index) => (
<Class
onClassHover={this.props.onClassHover}
onClassClick={this.props.onClassClick}
data={classgroup}
key={index}
/>
))}
</div>
);
}
2020-06-07 15:57:51 +02:00
}