Merge branch '13935-login-page-and-main-panel'
[arvados-workbench2.git] / src / views / login-panel / login-panel.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import * as React from 'react';
6 import { compose } from 'redux';
7 import { connect, DispatchProp } from 'react-redux';
8 import { Grid, Typography, Button } from '@material-ui/core';
9 import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
10 import { login } from '~/store/auth/auth-action';
11 import { ArvadosTheme } from '~/common/custom-theme';
12 import * as classNames from 'classnames';
13
14 type CssRules = 'root' | 'container' | 'title' | 'content' | 'content__bolder' | 'button';
15
16 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
17     root: {
18         position: 'relative',
19         backgroundColor: theme.palette.grey["200"],
20         '&::after': {
21             content: `''`,
22             position: 'absolute',
23             top: 0,
24             left: 0,
25             bottom: 0,
26             right: 0,
27             background: 'url("arvados-logo-big.png") no-repeat center center',
28             opacity: 0.2,
29         }
30     },
31     container: {
32         width: '560px',
33         zIndex: 10
34     },
35     title: {
36         marginBottom: theme.spacing.unit * 6,
37         color: theme.palette.grey["800"]
38     },
39     content: {
40         marginBottom: theme.spacing.unit * 3,
41         lineHeight: '1.2rem',
42         color: theme.palette.grey["800"]
43     },
44     'content__bolder': {
45         fontWeight: 'bolder'
46     },
47     button: {
48         boxShadow: 'none'
49     }
50 });
51
52 type LoginPanelProps = DispatchProp<any> & WithStyles<CssRules>;
53
54 export const LoginPanel = compose(
55     withStyles(styles),
56     connect()
57 )(({ classes, dispatch }: LoginPanelProps) => 
58     <Grid container direction="column" item xs alignItems="center" justify="center" className={classes.root}>
59         <Grid item className={classes.container}>
60             <Typography variant="title" align="center" className={classes.title}>
61                 Welcome to the Arvados Wrokbench
62             </Typography>
63             <Typography variant="body1" className={classes.content}>
64                 The "Log in" button below will show you a Google sign-in page. 
65                 After you assure Google that you want to log in here with your Google account, you will be redirected back here to Arvados Workbench.
66             </Typography>
67             <Typography variant="body1" className={classes.content}>
68                 If you have never used Arvados Workbench before, logging in for the first time will automatically create a new account.
69             </Typography>
70             <Typography variant="body2" className={classNames(classes.content, classes.content__bolder)}>
71                 IMPORTANT: Please keep in mind to store exploratory data only but not any information used for clinical decision making.
72             </Typography>
73             <Typography variant="body1" className={classes.content}>
74                 Arvados Workbench uses your name and email address only for identification, and does not retrieve any other personal information from Google.
75             </Typography>
76             <Typography component="div" align="right">
77                 <Button variant="contained" color="primary" className={classes.button} onClick={() => dispatch(login())}>
78                     Log in
79                 </Button>
80             </Typography>
81         </Grid>
82     </Grid>
83 );