import * as React from "react";

import AppBar from "@material-ui/core/AppBar";
import Toolbar from "@material-ui/core/Toolbar";
import Typography from "@material-ui/core/Typography";

import LoginPage from "../pages/login";

interface IState {
    loggedIn: boolean;
}

export default class Application extends React.Component<{}, IState> {
    constructor(props: any) {
        super(props);

        this.state = {
            loggedIn: false,
        };

        this.login = this.login.bind(this);
    }

    login(username: string, password: string): Promise<boolean> {
        return new Promise((res, rej) => {
            // TODO
            res();
        });
    }

    render() {
        return <div className="flex">
            <AppBar position="static">
                <Toolbar>
                    <Typography className="flex" variant="title" color="inherit">
                        Lateinicus
                    </Typography>
                </Toolbar>
            </AppBar>

            <LoginPage login={this.login} />
        </div>;
    }
};
