/** @jsx jsx */ import {jsx} from "@emotion/react"; import React, {useState} from "react"; import {Link} from "react-router-dom"; import * as styles from "../../commonStyles"; import {checkScopes, OAuthScopes} from "../../api/auth"; import OAuth2Button from "../../components/OAuth2Button"; interface NavigationProps { form_state: boolean, // Whether the form is open or not scopes: OAuthScopes[] } export default function Navigation(props: NavigationProps): JSX.Element { const [authorized, setAuth] = useState(!( props.scopes.includes(OAuthScopes.Identify) && !checkScopes(props.scopes) )); let submit = null; if (props.form_state) { let innerElement; if (!authorized) { innerElement = setAuth(true)} scopes={props.scopes}/>; } else { innerElement = ; } submit =
{innerElement}
; } return (
Return Home { submit }
); }