Advertisement
Guest User

waiting

a guest
Mar 29th, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React from 'react';
  2. import { Link } from 'react-router-dom'
  3. import AppBar from "@material-ui/core/AppBar";
  4. import Toolbar from "@material-ui/core/Toolbar";
  5. import Typography from "@material-ui/core/Typography";
  6. import Button from "@material-ui/core/Button";
  7. import makeStyles from "@material-ui/core/styles/makeStyles";
  8. import {MAIN_URL} from "../constants"
  9. import Paper from "@material-ui/core/Paper";
  10. import Grid from "@material-ui/core/Grid";
  11. import {blue, pink} from "@material-ui/core/colors";
  12. import CircularProgress from "@material-ui/core/CircularProgress";
  13. import {Container} from "@material-ui/core";
  14.  
  15.  
  16. const useStyles = makeStyles(theme => ({
  17.     root: {
  18.         flexGrow: 1,
  19.     },
  20.     title: {
  21.         marginLeft: theme.spacing(1),
  22.         flexGrow: 1,
  23.     },
  24.     rating: {
  25.         color: 'white',
  26.         backgroundColor: 'transparent',
  27.  
  28.         '&:hover': {
  29.             color: 'lightgreen',
  30.             backgroundColor: 'transparent',
  31.         },
  32.     },
  33.     userMenu: {
  34.         padding: theme.spacing(2),
  35.         '&:hover': {
  36.             color: 'lightgreen',
  37.         },
  38.     },
  39.     popover: {
  40.         padding: theme.spacing(2),
  41.     },
  42.     paper: {
  43.         marginRight: theme.spacing(5),
  44.     },
  45.     cards: {
  46.         margin: theme.spacing(2),
  47.         padding: theme.spacing(2),
  48.         flexGrow: 1,
  49.         minWidth: 200,
  50.     },
  51.     radio: {
  52.         '&$checked': {
  53.             color: "primary",
  54.         },
  55.     },
  56.     option: {
  57.         flexGrow: 1,
  58.         height: 200,
  59.     },
  60.     startButton: {
  61.         padding: theme.spacing(1),
  62.         marginLeft: theme.spacing(1),
  63.         marginRight: theme.spacing(1),
  64.         paddingLeft: theme.spacing(3),
  65.         paddingRight: theme.spacing(3),
  66.         marginTop: theme.spacing(1),
  67.         marginBottom:theme.spacing(1),
  68.         borderRadius: 100,
  69.         fontSize: "large",
  70.         '&:hover': {
  71.             color: 'white',
  72.             backgroundColor: pink[400],
  73.         },
  74.     },
  75.  
  76.     startButton1: {
  77.         padding: theme.spacing(1),
  78.         marginLeft: theme.spacing(1),
  79.         marginRight: theme.spacing(1),
  80.         paddingLeft: theme.spacing(3),
  81.         paddingRight: theme.spacing(3),
  82.         marginTop: theme.spacing(1),
  83.         marginBottom:theme.spacing(1),
  84.         borderRadius: 100,
  85.         fontSize: "large",
  86.         '&:hover': {
  87.             color: 'white',
  88.             backgroundColor: blue[400],
  89.         },
  90.     },
  91.  
  92.     words: {
  93.         fontSize: "large",
  94.     },
  95.  
  96.     circle: {
  97.         margin: theme.spacing(5),
  98.     },
  99.  
  100.     startTitle: {
  101.         margin: theme.spacing(2),
  102.         padding: theme.spacing(2),
  103.     },
  104.  
  105.     table: {
  106.         margin: theme.spacing(7),
  107.         padding: theme.spacing(2),
  108.         backgroundColor: blue[50],
  109.     }
  110. }));
  111.  
  112.  
  113. function WaitingPage() {
  114.     const classes = useStyles();
  115.  
  116.     const redirectTimeout = setTimeout(function(){
  117.         window.location.href="/stop-waiting/";
  118.     }, 10 * 1000);
  119.  
  120.     React.useEffect(function() {
  121.         return function cleanup() {
  122.             clearTimeout(redirectTimeout)
  123.         }
  124.     });
  125.  
  126.     return (
  127.         <div>
  128.             <AppBar position="static">
  129.                 <Toolbar>
  130.                     <Typography variant="h6" className={classes.title}>
  131.                         <Button component={Link} to={MAIN_URL.RATING} className={classes.rating}>
  132.                             Рейтинг
  133.                         </Button>
  134.                     </Typography>
  135.  
  136.                 </Toolbar>
  137.             </AppBar>
  138.             <Paper className={classes.table}>
  139.                 <Container
  140.                     maxWidth={"xs"}
  141.                 >
  142.  
  143.                         <Paper className={classes.cards}>
  144.                             <Grid container
  145.                                   direction="column"
  146.                                   justify="center"
  147.                                   alignItems="center"
  148.                                   className={classes.option}>
  149.                                 <Grid className={classes.words} key={0} item>
  150.                                     Ожидаем соперника...
  151.                                 </Grid>
  152.                                 <Grid className={classes.circle} key={1} item>
  153.                                     <CircularProgress color="secondary" />
  154.                                 </Grid>
  155.                             </Grid>
  156.                         </Paper>
  157.                 </Container>
  158.                 <Grid container
  159.                       direction="row"
  160.                       justify="space-evenly"
  161.                       alignItems="center">
  162.                     <Typography variant="h6" className={classes.startTitle}>
  163.                         <Button variant="contained" color="secondary" size="large" component={Link}
  164.                                 to={MAIN_URL.START_GAME} className={classes.startButton}>
  165.                             ОТМЕНИТЬ ПОИСК!
  166.                         </Button>
  167.                         <Button variant="contained" color="primary" size="large" component={Link}
  168.                                 to={MAIN_URL.GAME} className={classes.startButton1}>
  169.                             ИГРАТЬ С БОТОМ!
  170.                         </Button>
  171.                     </Typography>
  172.                 </Grid>
  173.             </Paper>
  174.         </div>
  175.     );
  176. }
  177.  
  178. export default WaitingPage;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement