Skip to content

Commit

Permalink
now calling an object to render the graph and the generalized params …
Browse files Browse the repository at this point in the history
…for the floating dialog
  • Loading branch information
PhillipsOwen committed May 3, 2024
1 parent 4058b8c commit 6d5dfeb
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/components/map/observation-dialog.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
import React, {Fragment} from 'react';
import PropTypes from 'prop-types';
import BaseFloatingDialog from "@utils/base-floating-dialog";
import {useLayers} from "@context";
import ObservationChart from "@utils/observation-chart";

// define the properties of this component
ObservationDialog.propTypes = {
obs_data: PropTypes.object
};

export default function ObservationDialog(obs_data) {
// TODO: the url is put in here but it will eventually
// return a graph using data from this url

// get references to the observation data/list
const {
selectedObservations,
setSelectedObservations
} = useLayers();

// create a graph using data from this url
const graphObj = (url) => {
const args = {dataUrl: url};

return (
<Fragment>
<div>
{url}
</div>
<ObservationChart {...args}/>
</Fragment>
);
};

// create an object for the base dialog
const floaterArgs = {title: obs_data.obs.station_name, description: obs_data.obs.location_name, openDialogImmediately:true, "dialogObject": {...graphObj(obs_data.obs.csvurl)}};
const floaterArgs = {title: obs_data.obs.location_name, dialogObject: {...graphObj(obs_data.obs.csvurl)}, dataKey: obs_data.obs.location_name, dataList: selectedObservations, setDataList: setSelectedObservations};

// render the dialog.
// the key here will be used to remove the dialog from the selected observation list when the dialog is closed
Expand Down

0 comments on commit 6d5dfeb

Please sign in to comment.