21702: Merge branch 'main' into 21702-keep-web-replace_files
[arvados.git] / services / workbench2 / 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 { CustomStyleRulesCallback } from 'common/custom-theme';
12 import { Dialog, DialogContent, DialogActions, Button } from '@mui/material';
13 import { WithStyles } from '@mui/styles';
14 import withStyles from '@mui/styles/withStyles';
15 import { ArvadosTheme } from 'common/custom-theme';
16 import { NotFoundPanel } from "views/not-found-panel/not-found-panel";
17
18 type CssRules = 'tag';
19
20 const styles: CustomStyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
21     tag: {
22         marginRight: theme.spacing(1),
23         marginBottom: theme.spacing(1)
24     }
25 });
26
27 interface NotFoundDialogDataProps {
28
29 }
30
31 interface NotFoundDialogActionProps {
32
33 }
34
35 const mapStateToProps = (state: RootState): NotFoundDialogDataProps => ({
36
37 });
38
39 const mapDispatchToProps = (dispatch: Dispatch): NotFoundDialogActionProps => ({
40
41 });
42
43 type NotFoundDialogProps =  NotFoundDialogDataProps & NotFoundDialogActionProps & WithDialogProps<{}> & WithStyles<CssRules>;
44
45 export const NotFoundDialog = connect(mapStateToProps, mapDispatchToProps)(
46     withStyles(styles)(
47     withDialog(NOT_FOUND_DIALOG_NAME)(
48         ({ open, closeDialog }: NotFoundDialogProps) =>
49             <Dialog
50                 open={open}
51                 onClose={closeDialog}
52                 fullWidth
53                 maxWidth='md'
54                 disableEscapeKeyDown>
55                 <DialogContent>
56                     <NotFoundPanel notWrapped />
57                 </DialogContent>
58                 <DialogActions>
59                     <Button
60                         variant='text'
61                         color='primary'
62                         onClick={closeDialog}>
63                         Close
64                     </Button>
65                 </DialogActions>
66             </Dialog>
67     )
68 ));