Merge branch 'master' into 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         background: theme.palette.background.default
19     },
20     container: {
21         width: '560px'
22     },
23     title: {
24         marginBottom: theme.spacing.unit * 6,
25         color: theme.palette.grey["800"]
26     },
27     content: {
28         marginBottom: theme.spacing.unit * 3,
29         lineHeight: '1.2rem',
30         color: theme.palette.grey["800"]
31     },
32     'content__bolder': {
33         fontWeight: 'bolder'
34     },
35     button: {
36         boxShadow: 'none'
37     }
38 });
39
40 type LoginPanelProps = DispatchProp<any> & WithStyles<CssRules>;
41
42 export const LoginPanel = compose(
43     withStyles(styles),
44     connect()
45 )(({ classes, dispatch }: LoginPanelProps) => 
46     <Grid container direction="column" item xs alignItems="center" justify="center" className={classes.root}>
47         <Grid item className={classes.container}>
48             <Typography variant="title" align="center" className={classes.title}>
49                 Welcome to the Arvados Wrokbench
50             </Typography>
51             <Typography variant="body1" className={classes.content}>
52                 The "Log in" button below will show you a Google sign-in page.
53                 After you assure Google that you want to log in here with your Google account,
54                 you will be redirected back here to Arvados Workbench.
55             </Typography>
56             <Typography variant="body1" className={classes.content}>
57                 If you have never used Arvados Workbench before, logging in for the first time will automatically create a new account.
58             </Typography>
59             <Typography variant="body2" className={classNames(classes.content, classes.content__bolder)}>
60                 IMPORTANT: Please keep in mind to store exploratory data only but not any information used for clinical decision making.
61             </Typography>
62             <Typography variant="body1" className={classes.content}>
63                 Arvados Workbench uses your name and email address only for identification, and does not retrieve any other personal information from Google.
64             </Typography>
65             <Typography component="div" align="right">
66                 <Button variant="contained" color="primary" className={classes.button} onClick={() => dispatch(login())}>
67                     Log in
68                 </Button>
69             </Typography>
70         </Grid>
71     </Grid>
72 );