From 4058b8c536a481c7d51c91f2492b79eb049b6ccb Mon Sep 17 00:00:00 2001
From: Phil Owen <19691521+PhillipsOwen@users.noreply.github.com>
Date: Fri, 3 May 2024 16:30:27 -0400
Subject: [PATCH] generalizing its usage better by passing the data key and
state data/setter references
---
src/utils/base-floating-dialog.js | 131 ++++++++++++++----------------
1 file changed, 62 insertions(+), 69 deletions(-)
diff --git a/src/utils/base-floating-dialog.js b/src/utils/base-floating-dialog.js
index 8c598e82..91d79b56 100644
--- a/src/utils/base-floating-dialog.js
+++ b/src/utils/base-floating-dialog.js
@@ -7,98 +7,91 @@ import CssBaseline from '@mui/material/CssBaseline';
import Dialog from '@mui/material/Dialog';
import DialogActions from '@mui/material/DialogActions';
import DialogContent from '@mui/material/DialogActions';
-import DialogContentText from '@mui/material/DialogContentText';
import DialogTitle from '@mui/material/DialogTitle';
import Paper from '@mui/material/Paper';
import Slide from '@mui/material/Slide';
-import { useLayers } from '@context';
-
// define the properties of this component
BaseFloatingDialog.propTypes = {
- title: PropTypes.string,
- description: PropTypes.string,
- openDialogImmediately: PropTypes.bool,
- dialogObject: PropTypes.any
+ title: PropTypes.string,
+ dialogObject: PropTypes.any,
+ dataKey: PropTypes.any,
+ dataList: PropTypes.any,
+ setDataList: PropTypes.func
};
/**
- * This is a component that displays a floating dialog with the content passed
+ * This is a component that displays a floating dialog with the content passed.
+ * Note: this component
*
* @param title: string
- * @param description: string
- * @param openDialogImmediately: boolean
* @param dialogObject: {JSX.Element}
- * @returns {JSX.Element}
+ * @param dataKey:
+ * @param dataList:
+ * @param setDataList:
*/
-export default function BaseFloatingDialog({ title, description, openDialogImmediately, dialogObject} ) {
- // define the dialog open/close session state
- const [open, setOpen] = React.useState(openDialogImmediately);
-
- const {
- selectedObservations,
- setSelectedObservations
- } = useLayers();
-
- /**
- * the close dialog handler
- */
- const handleClose = () => {
- // close the dialog
- setOpen(false);
-
- // remove this item from the selected observations list
- setSelectedObservations(selectedObservations.filter(item => item.station_name !== title));
- };
+export default function BaseFloatingDialog({ title, dialogObject, dataKey, dataList, setDataList} ) {
+ // define the dialog open/close session state
+ //const [open, setOpen] = React.useState(true);
- /**
- * configure and render the floating dialog
- */
- return (
-
-
-
+
+ );
};
/**
- * This creates a 3D dialog.
- *
- * @param props
- * @returns {JSX.Element}
- * @constructor
- */
+* This creates a 3D dialog.
+*
+* @param props
+* @returns {JSX.Element}
+* @constructor
+*/
function PaperComponent(props) {
- return (
-
-
-
- );
+ return (
+
+
+
+ );
}
/**
- * This creates an animated transition for the dialog that pops up
- * @type {React.ForwardRefExoticComponent & React.RefAttributes>}
- */
+* This creates an animated transition for the dialog that pops up
+* @type {React.ForwardRefExoticComponent & React.RefAttributes>}
+*/
const Transition = React.forwardRef(function Transition(props, ref) {
- return ;
+ return ;
});
\ No newline at end of file