18692: changed snackbar autohide
[arvados-workbench2.git] / src / views-components / not-found-dialog / not-found-dialog.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import React from "react";
6 import { Dispatch } from "redux";
7 import { connect } from "react-redux";
8 import { RootState } from 'store/store';
9 import { withDialog, WithDialogProps } from "store/dialog/with-dialog";
10 import { NOT_FOUND_DIALOG_NAME } from 'store/not-found-panel/not-found-panel-action';
11 import { Dialog, DialogContent, DialogActions, Button, withStyles, StyleRulesCallback, WithStyles } from '@material-ui/core';
12 import { ArvadosTheme } from 'common/custom-theme';
13 import { NotFoundPanel } from "views/not-found-panel/not-found-panel";
14
15 type CssRules = 'tag';
16
17 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
18     tag: {
19         marginRight: theme.spacing.unit,
20         marginBottom: theme.spacing.unit
21     }
22 });
23
24 interface NotFoundDialogDataProps {
25
26 }
27
28 interface NotFoundDialogActionProps {
29
30 }
31
32 const mapStateToProps = (state: RootState): NotFoundDialogDataProps => ({
33
34 });
35
36 const mapDispatchToProps = (dispatch: Dispatch): NotFoundDialogActionProps => ({
37
38 });
39
40 type NotFoundDialogProps =  NotFoundDialogDataProps & NotFoundDialogActionProps & WithDialogProps<{}> & WithStyles<CssRules>;
41
42 export const NotFoundDialog = connect(mapStateToProps, mapDispatchToProps)(
43     withStyles(styles)(
44     withDialog(NOT_FOUND_DIALOG_NAME)(
45         ({ open, closeDialog }: NotFoundDialogProps) =>
46             <Dialog open={open}
47                 onClose={closeDialog}
48                 fullWidth
49                 maxWidth='md'
50                 disableBackdropClick
51                 disableEscapeKeyDown>
52                 <DialogContent>
53                     <NotFoundPanel notWrapped />
54                 </DialogContent>
55                 <DialogActions>
56                     <Button
57                         variant='text'
58                         color='primary'
59                         onClick={closeDialog}>
60                         Close
61                     </Button>
62                 </DialogActions>
63             </Dialog>
64     )
65 ));