Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Observation chart - A good place #31

Merged
merged 57 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
4058b8c
generalizing its usage better by passing the data key and state data/…
PhillipsOwen May 3, 2024
6d5dfeb
now calling an object to render the graph and the generalized params …
PhillipsOwen May 3, 2024
8ad109e
adding an id to the feature props to remove it from the selected list…
PhillipsOwen May 3, 2024
e1daa6d
adjusting the params sent to BaseFloatingDialog
PhillipsOwen May 3, 2024
f2a5ce9
generalizing the id used for removing data list items from state
PhillipsOwen May 3, 2024
a317555
new component to render the observation data as a chart
PhillipsOwen May 3, 2024
d96611e
checkpointing current state of branch
PhillipsOwen May 6, 2024
6760c13
removing TODO as it is done
PhillipsOwen May 6, 2024
294a3b3
checkpointing current state of code
PhillipsOwen May 6, 2024
89fa591
tidying up
PhillipsOwen May 6, 2024
e561cb9
tidying up
PhillipsOwen May 6, 2024
ae04250
definition for the remove all observations sidebar
PhillipsOwen May 6, 2024
109e730
adding a component that will be rendered on the sidebar to remove all…
PhillipsOwen May 6, 2024
8a572f5
adding a component to the sibebar
PhillipsOwen May 6, 2024
fb03178
tidying up, adding comments
PhillipsOwen May 6, 2024
02b2ccf
updates for addition and removal of target icon for observations sele…
lstillwe May 6, 2024
88583f5
moving files around, working on line chart
PhillipsOwen May 7, 2024
9e82a77
Merge branch 'observation-chart' of https://github.com/RENCI/APSViz-U…
PhillipsOwen May 7, 2024
d784a2d
changing imports to reference a new location for dialog components
PhillipsOwen May 7, 2024
2b68fd1
fixing linting issue
PhillipsOwen May 7, 2024
f1c3c5b
fixing linting issue
PhillipsOwen May 7, 2024
ce61067
adding new map bullseye references
PhillipsOwen May 7, 2024
2ed09ec
correcting merge mishap
PhillipsOwen May 7, 2024
d8bc7be
adjusting sizing
PhillipsOwen May 7, 2024
1b195b2
adjusting sizing
PhillipsOwen May 7, 2024
bd53023
trying to resync with main
PhillipsOwen May 7, 2024
4da51cc
Merge remote-tracking branch 'origin/observation-chart' into observat…
PhillipsOwen May 7, 2024
c2a03ec
generalizing its usage better by passing the data key and state data/…
PhillipsOwen May 3, 2024
efc3f2e
now calling an object to render the graph and the generalized params …
PhillipsOwen May 3, 2024
54c50ce
adding an id to the feature props to remove it from the selected list…
PhillipsOwen May 3, 2024
29d5434
adjusting the params sent to BaseFloatingDialog
PhillipsOwen May 3, 2024
45010dd
generalizing the id used for removing data list items from state
PhillipsOwen May 3, 2024
78457f4
new component to render the observation data as a chart
PhillipsOwen May 3, 2024
7bf94d0
checkpointing current state of branch
PhillipsOwen May 6, 2024
c9f2f4b
removing TODO as it is done
PhillipsOwen May 6, 2024
387e3d4
checkpointing current state of code
PhillipsOwen May 6, 2024
7379c41
updates for addition and removal of target icon for observations sele…
lstillwe May 6, 2024
f777c41
tidying up
PhillipsOwen May 6, 2024
d2d6e15
tidying up
PhillipsOwen May 6, 2024
ca1016d
definition for the remove all observations sidebar
PhillipsOwen May 6, 2024
1183561
adding a component that will be rendered on the sidebar to remove all…
PhillipsOwen May 6, 2024
5243175
adding a component to the sibebar
PhillipsOwen May 6, 2024
7157d31
tidying up, adding comments
PhillipsOwen May 6, 2024
ca4524b
moving files around, working on line chart
PhillipsOwen May 7, 2024
c0f7282
changing imports to reference a new location for dialog components
PhillipsOwen May 7, 2024
3b4c8b3
fixing linting issue
PhillipsOwen May 7, 2024
f27466f
fixing linting issue
PhillipsOwen May 7, 2024
043c3b0
adding new map bullseye references
PhillipsOwen May 7, 2024
17bebb0
correcting merge mishap
PhillipsOwen May 7, 2024
94f193d
trying to resync with main
PhillipsOwen May 7, 2024
b12b534
Merge remote-tracking branch 'origin/observation-chart' into observat…
PhillipsOwen May 7, 2024
fce2723
Merge remote-tracking branch 'origin/main' into observation-chart
PhillipsOwen May 8, 2024
f04c47c
tidying up
PhillipsOwen May 8, 2024
57a741f
commenting out console log
PhillipsOwen May 8, 2024
f79a860
correcting the prop name for the map reference
PhillipsOwen May 8, 2024
859f81e
correcting the look of the graph
PhillipsOwen May 8, 2024
ecfcd31
correcting the look of the graph
PhillipsOwen May 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ dist
node_modules

.env*
.DS_Store
src/.DS_Store
151 changes: 146 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@
"react-leaflet": "^4.2.1",
"react-map-gl": "^7.1.7",
"react-query": "^3.39.3",
"react-timeago": "^7.2.0"
"react-timeago": "^7.2.0",
"recharts": "^2.12.6"
},
"overrides": {
"json5": "^2.2.2",
Expand Down
12 changes: 6 additions & 6 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Fragment } from 'react';
import { Map } from '@components/map';
import ObservationDialog from "@components/map/observation-dialog";
import { ObservationDialog } from "@components/dialog/observation-dialog";
import { useLayers } from '@context';
import { Sidebar } from '@components/sidebar';

Expand All @@ -11,16 +11,16 @@ export const App = () => {
} = useLayers();

return (
<Fragment>
<Fragment>
{
// for each observation selected
selectedObservations.map (function (obs) {
// render the observation
return <ObservationDialog key={obs.station_name} obs={obs} />;
return <ObservationDialog key={obs["station_name"]} obs={obs} />;
})
}
<Map />
<Sidebar />
</Fragment>
<Map />
<Sidebar />
</Fragment>
);
};
98 changes: 98 additions & 0 deletions src/components/dialog/base-floating-dialog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import React, {Fragment} from 'react';
import Draggable from 'react-draggable';
import PropTypes from 'prop-types';

import Button from '@mui/material/Button';
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 DialogTitle from '@mui/material/DialogTitle';
import Paper from '@mui/material/Paper';
import Slide from '@mui/material/Slide';
import { markUnclicked } from '@utils/map-utils';

// define the properties of this component
BaseFloatingDialog.propTypes = {
title: PropTypes.string,
dialogObject: PropTypes.any,
dataKey: PropTypes.any,
dataList: PropTypes.any,
setDataList: PropTypes.func,
map: PropTypes.any
};

/**
* This is a component that displays a floating dialog with the content passed.
* Note: this component
*
* @param title: string
* @param dialogObject: {JSX.Element}
* @param dataKey:
* @param dataList:
* @param setDataList:
*/
export default function BaseFloatingDialog({ title, dialogObject, dataKey, dataList, setDataList, map} ) {
/**
* the close dialog handler
*/
const handleClose = () => {
// if there was a data key defined, use it
if (dataKey !== undefined) {
// remove the bullseye
markUnclicked(map, dataKey);

// remove this item from the data list
setDataList(dataList.filter(item => item.id !== dataKey));
}
};

/**
* configure and render the floating dialog
*/
return (
<Fragment>
<CssBaseline />
<Dialog
aria-labelledby="draggable-dialog-title"
open={true}
onClose={handleClose}
PaperComponent={PaperComponent}
TransitionComponent={Transition}
disableEnforceFocus
style={{ pointerEvents: 'none' }}
PaperProps={{ sx: { width: 750, height: 485, pointerEvents: 'auto'} }}
sx={{ width: 750, height: 485, '.MuiBackdrop-root': { backgroundColor: 'transparent' }}}
>
<DialogTitle sx={{cursor: 'move', backgroundColor: 'lightblue', textAlign: 'center', fontSize: 14, height: 35, m: 0, p: 1 }} id="draggable-dialog-title"> { title } </DialogTitle>

<DialogContent sx={{backgroundColor: 'white', fontSize: 14, m: 0, width: 590, height: 350 }}>{ dialogObject }</DialogContent>

<DialogActions sx={{backgroundColor: 'lightgray', height: 35, m: 0, p: 1}}><Button style={{fontSize: 14}} autoFocus onClick={handleClose}> Close </Button></DialogActions>
</Dialog>
</Fragment>
);
};

/**
* This creates a 3D dialog.
*
* @param props
* @returns {JSX.Element}
* @constructor
*/
function PaperComponent(props) {
return (
<Draggable handle="#draggable-dialog-title" cancel={'[class*="MuiDialogContent-root"]'}>
<Paper {...props} />
</Draggable>
);
}

/**
* This creates an animated transition for the dialog that pops up
* @type {React.ForwardRefExoticComponent<React.PropsWithoutRef<{}> & React.RefAttributes<any>>}
*/
const Transition = React.forwardRef(function Transition(props, ref) {
return <Slide direction="up" ref={ref} {...props} />;
});
Loading