frontend/src/components/RightBar/index.tsx

44 lines
1.0 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-17 15:19:51 +02:00
import BusinessLogicContext from "../../buisnesslogic/BusinessLogicContext";
import { BuisnessProvided } from "../../buisnesslogic/BuisnessLogicProvider";
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) => (
<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>
);
}
2020-06-07 15:57:51 +02:00
}