import './App.css';
import React from "react";
import {
    AppBar,
    Button,
    Container,
    createTheme,
    Grid2,
    IconButton,
    ThemeProvider,
    Toolbar,
    Typography
} from "@mui/material";
import {MyRoutes} from "./Routes";

function App() {
  console.log(process.env);

    const steamLogin = (event: React.MouseEvent<HTMLButtonElement>) => {
        (document.getElementById('submit-steam-login') as HTMLFormElement).click()
    };

    const theme = createTheme({
        palette: {
            primary: {
                main: "#191919",
            },
        },
    });


  return (
      <div >
          <ThemeProvider theme={theme}>
          <AppBar position="static">
              <Toolbar>
                  <IconButton
                      size="large"
                      edge="start"
                      color="inherit"
                      aria-label="menu"
                      sx={{mr: 2}}
                  >
                  </IconButton>
                  <Typography variant="h6" component="div" sx={{flexGrow: 1}}>
                      Autogeneration wiki (by Anibus)
                  </Typography>
                  <Button color="inherit" onClick={steamLogin}>
                      Log in through Steam
                  </Button>
              </Toolbar>
          </AppBar>
          <Container>
              <MyRoutes/>
          </Container>
          </ThemeProvider>
         

          <form action="https://steamcommunity.com/openid/login" method="post">
              <input type="hidden" name="openid.identity"
                     value="http://specs.openid.net/auth/2.0/identifier_select"/>
              <input type="hidden" name="openid.claimed_id"
                     value="http://specs.openid.net/auth/2.0/identifier_select"/>
              <input type="hidden" name="openid.ns" value="http://specs.openid.net/auth/2.0"/>
              <input type="hidden" name="openid.mode" value="checkid_setup"/>
              <input type="hidden" name="openid.realm" value={process.env.REACT_APP_HOST_URL}/>
              <input type="hidden" name="openid.return_to"
                     value={process.env.REACT_APP_HOST_URL + "\\login"}/>
              <button id="submit-steam-login" type="submit" hidden={true}></button>

          </form>
      </div>
  );
}

export default App;