Merge branch '14841-link-workbench1' refs #14841 refs #14720
[arvados-workbench2.git] / src / views / inactive-panel / inactive-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 { connect, DispatchProp } from 'react-redux';
7 import { Grid, Typography, Button, Select } from '@material-ui/core';
8 import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
9 import { login, authActions } from '~/store/auth/auth-action';
10 import { ArvadosTheme } from '~/common/custom-theme';
11 import { RootState } from '~/store/store';
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     remoteHosts: { [key: string]: string },
54     homeCluster: string,
55     uuidPrefix: string
56 };
57
58 export const InactivePanel = withStyles(styles)(
59     connect((state: RootState) => ({
60         remoteHosts: state.auth.remoteHosts,
61         homeCluster: state.auth.homeCluster,
62         uuidPrefix: state.auth.localCluster
63     }))(({ classes, dispatch, remoteHosts, homeCluster, uuidPrefix }: LoginPanelProps) =>
64         <Grid container justify="center" alignItems="center"
65             className={classes.root}
66             style={{ marginTop: 56, overflowY: "auto", height: "100%" }}>
67             <Grid item className={classes.container}>
68                 <Typography variant='h6' align="center" className={classes.title}>
69                     Hi! You're logged in, but...
70                 </Typography>
71                 <Typography>
72                     Your account is inactive.
73
74                     An administrator must activate your account before you can get any further.
75                 </Typography>
76             </Grid>
77         </Grid >
78     ));