import * as React from "react"; import { Link } from "react-router-dom"; import AppBar from "@material-ui/core/AppBar"; import Toolbar from "@material-ui/core/Toolbar"; import Typography from "@material-ui/core/Typography"; import IconButton from "@material-ui/core/IconButton"; import Button from "@material-ui/core/Button"; import Popover from "@material-ui/core/Popover"; import SwipeableDrawer from "@material-ui/core/SwipeableDrawer"; import List from "@material-ui/core/List"; import ListItem from "@material-ui/core/ListItem"; import ListItemIcon from "@material-ui/core/ListItemIcon"; import ListItemText from "@material-ui/core/ListItemText"; import Divider from "@material-ui/core/Divider"; import Avatar from "@material-ui/core/Avatar"; import MenuIcon from "@material-ui/icons/Menu"; /* import SettingsIcon from "@material-ui/icons/Settings"; * import PersonIcon from "@material-ui/icons/Person"; */ import ListIcon from "@material-ui/icons/List"; import InfoIcon from "@material-ui/icons/Info"; import HomeIcon from "@material-ui/icons/Home"; import BookIcon from "@material-ui/icons/Book"; import ViewWeekIcon from "@material-ui/icons/ViewWeek"; import { IUser, userScoreToLevel } from "../models/user"; interface IProps { logout: () => void; user: IUser; open: boolean; scorePopoverOpen: boolean; showButton: boolean; authenticated: boolean; setDrawer: (state: boolean) => void; setScorePopover: (state: boolean) => void; }; export default class Drawer extends React.Component { private scoreBtnRef: HTMLButtonElement = undefined; openDrawer = () => { this.props.setDrawer(true); } closeDrawer = () => { this.props.setDrawer(false); } toggleScorePopover = () => { this.props.setScorePopover(!this.props.scorePopoverOpen); } closeScorePopover = () => { this.props.setScorePopover(false); } render() { const { score } = this.props.user; const level = userScoreToLevel(score); // Determine whether we hit the maximum level const maxLevel = score >= level.levelCap; const scoreStr = maxLevel ? ( `${score}` ) : ( `${score} / ${level.levelCap}` ); return (
{ (this.props.authenticated && this.props.showButton) ? ( ) : undefined } Lateinicus { this.props.authenticated ? ( ) : undefined }
Du bist: {level.name} { maxLevel ? ( Veni Vidi Vici... ) : ( Dir fehlen noch {level.levelCap - this.props.user.score} Erfahrungspunkte bis zum nächsten Level ) }
{/* */} Vokabeln üben Levelübersicht { this.closeDrawer(); this.props.logout(); }}> Abmelden window.location = "https://gitlab.com/Polynomdivision/Lateinicus/tree/master"}>
); } };