generated from RENCI/react-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'observation-chart' of https://github.com/RENCI/APSViz-U…
…I-V3 into use-reducer # Conflicts: # src/app.js # src/components/dialog/base-floating-dialog.js # src/components/dialog/observation-dialog.js
- Loading branch information
Showing
8 changed files
with
97 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 17 additions & 9 deletions
26
src/components/map/observation-dialog.js → src/components/dialog/observation-dialog.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React from 'react'; | ||
import { Stack } from '@mui/joy'; | ||
import { ClearAll as RemoveObservationsIcon} from '@mui/icons-material'; | ||
|
||
// import the component that will do the observation removal from state | ||
import { RemoveObservations } from "./removeObservations"; | ||
|
||
// get an icon for the tray | ||
export const icon = <RemoveObservationsIcon />; | ||
|
||
// create a title for this tray element | ||
export const title = 'Remove observations'; | ||
|
||
/** | ||
* render the removal component | ||
* | ||
* @returns {JSX.Element} | ||
*/ | ||
export const trayContents = () => ( | ||
<Stack gap={ 2 } p={ 2 }> | ||
<RemoveObservations /> | ||
</Stack> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React, { Fragment } from 'react'; | ||
import { Button } from '@mui/joy'; | ||
|
||
import {useLayers} from "@context"; | ||
|
||
/** | ||
* component that handles the removal of all observation selections from the map. | ||
* | ||
* @returns {JSX.Element} | ||
* @constructor | ||
*/ | ||
export const RemoveObservations = () => { | ||
// get references to the observation data/list | ||
const { | ||
selectedObservations, | ||
setSelectedObservations | ||
} = useLayers(); | ||
|
||
// remove the observation selections from state | ||
function removeAllObservations() { | ||
// remove all items from the data list | ||
setSelectedObservations(selectedObservations.filter(item => item === undefined)); | ||
} | ||
|
||
// render the button | ||
return ( | ||
<Fragment> | ||
<Button color="primary" onClick={() => removeAllObservations()}>Remove all observation selections</Button> | ||
</Fragment> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters