import { Badge, Button, ButtonGroup, Card, CardBody, Container, Collapse, Form, FormGroup, Nav, Navbar, NavbarBrand, NavbarToggler, NavItem, NavLink, Input, Label } from 'reactstrap'; import { connect } from 'react-redux'; import React from 'react'; import { login, logout } from './api'; export function BigImage(props) { return (

{props.text}

); } export class TurniereNavigation extends React.Component { constructor(props) { super(props); this.toggle = this.toggle.bind(this); this.state = { collapsed: true }; } toggle() { this.setState({ collapsed: !this.state.collapsed }); } render() { return ( turnie.re ); } } function Navlink(props) { return ( {props.text} ); } function Betabadge() { return (BETA); } class InvisibleLoginLogoutButtons extends React.Component { render() { const { isSignedIn, username } = this.props; if(isSignedIn) { return ( ); } else { return ( ); } } } const mapStateToLoginLogoutButtonProperties = (state) => { const { isSignedIn, username } = state.userinfo; return { isSignedIn, username }; }; const LoginLogoutButtons = connect( mapStateToLoginLogoutButtonProperties )(InvisibleLoginLogoutButtons); export function Footer() { return ( ); } /** * This component works just like a switch statement, although the conditions of the first items * are checked first, and the first component with a condition that is true will be shown. * * For single conditions and options any kind of component can be taken, while the Option-component * is dedicated for this job. The only important thing is that this component has to have a condition property. * * You should also give a default option with a condition that always evaluates to true. * * A quick example would be some content that is only to be shown when the user is logged in: * * function SomeRestrictedContent(props) { * const { isSignedIn } = props; * * return ( * * * * * ); * } * * In the example you'll have to note that the default option is at the bottom of all the options * since it would always be taken otherwise (the options' conditions are checked from top to bottom) */ export class UserRestrictor extends React.Component { render() { const { children } = this.props; for(var i in children) { var c = children[i]; if(c.props.condition) { return c; } } return null; } } export function Option(props) { return props.children; } export function Login(props) { return (

Login

); } class LoginErrorList extends React.Component { render() { const { error, errorMessages } = this.props; if(error) { return ( ); } else { return null; } } } const mapStateToErrorMessages = (state) => { const { errorMessages, error } = state.userinfo; return { errorMessages, error }; }; const VisibleLoginErrorList = connect( mapStateToErrorMessages )(LoginErrorList); class LoginForm extends React.Component { constructor(props) { super(props); this.state = { email : '', password : '' }; } render() { return (
); } handlePasswordInput(input) { this.setState({ password : input.target.value }); } handleEmailInput(input) { this.setState({ email : input.target.value }); } } function Hint(props) { if(props.hint != null) { return (

{ props.hint }

); } else { return null; } }