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 pull request #43 from RENCI/layer-selection
Cleaning up the removal functionality.
- Loading branch information
Showing
11 changed files
with
202 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import React, { Fragment } from 'react'; | ||
import {Button, Input, Stack, Tabs, TabList, Tab, TabPanel, Divider} from '@mui/joy'; | ||
import { useLayers } from "@context"; | ||
|
||
// import {LayerCard} from "@components/trays/layers/layer-card"; | ||
|
||
/** | ||
* This component renders the layer selection form | ||
* | ||
* @returns {JSX.Element} | ||
* @constructor | ||
*/ | ||
export const ModelSelectionForm = () => { | ||
// get references to the filtered layer state | ||
const { | ||
//filteredModelLayers | ||
} = useLayers(); | ||
|
||
// render the form | ||
return ( | ||
<Fragment> | ||
<Tabs aria-label="Type tabs" defaultValue={0}> | ||
<TabList> | ||
<Tab>Tropical</Tab> | ||
<Tab>Synoptic</Tab> | ||
</TabList> | ||
<TabPanel value={0}> | ||
<form onSubmit = { formHandler }> | ||
<Stack spacing={1}> | ||
<Input name="tropical-storm-name" placeholder="Tropical storm name control" /> | ||
<Input name="tropical-advisory" placeholder="Tropical advisory control" /> | ||
<Input name="tropical-grid" placeholder="Tropical grid control" /> | ||
<Input name="tropical-instance" placeholder="Tropical instance control" /> | ||
|
||
<Button type="submit">Submit</Button> | ||
<Button type="reset">Reset</Button> | ||
</Stack> | ||
|
||
<Divider sx={{m: 2}} /> | ||
|
||
<Stack sx={{ maxHeight: "400px", overflow: "auto" }}> | ||
{/* list of search results goes here | ||
may be able to leverage trays/layers/layer-card /> | ||
*/} | ||
</Stack> | ||
</form> | ||
</TabPanel> | ||
<TabPanel value={1}> | ||
<form onSubmit={ formHandler }> | ||
<Stack spacing={1}> | ||
<Input name="synoptic-date" placeholder="Synoptic date control" /> | ||
<Input name="synoptic-cycle" placeholder="Synoptic cycle control" /> | ||
<Input name="synoptic-grid" placeholder="Synoptic grid control" /> | ||
<Input name="synoptic-instance" placeholder="Synoptic instance control" /> | ||
|
||
<Button type="submit">Submit</Button> | ||
<Button type="reset">Reset</Button> | ||
</Stack> | ||
|
||
<Divider sx={{m: 2}} /> | ||
|
||
<Stack sx={{ maxHeight: "400px", overflow: "auto" }}> | ||
{/* list of search results goes here | ||
may be able to leverage trays/layers/layer-card /> | ||
*/} | ||
</Stack> | ||
</form> | ||
</TabPanel> | ||
</Tabs> | ||
</Fragment> | ||
); | ||
}; | ||
|
||
/** | ||
* this method populates the controls on the form. | ||
* | ||
*/ | ||
// const dataLoader = () => { | ||
// | ||
// }; | ||
|
||
/** | ||
* method to initiate a model search with the filter selections on the form | ||
* | ||
* @param event | ||
*/ | ||
const formHandler = (event) => { | ||
event.preventDefault(); | ||
const formData = new FormData(event.target); | ||
const formJson = Object.fromEntries(formData.entries()); | ||
alert(JSON.stringify(formJson)); | ||
}; |
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
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 { Checklist as ModelSelectionIcon} from '@mui/icons-material'; | ||
|
||
// import the component that will allow the user to make model selections | ||
import { ModelSelection } from "./model-selection.js"; | ||
|
||
// get an icon for the tray | ||
export const icon = <ModelSelectionIcon />; | ||
|
||
// create a title for this tray element | ||
export const title = 'ADCIRC Model selection'; | ||
|
||
/** | ||
* render the removal component | ||
* | ||
* @returns {JSX.Element} | ||
*/ | ||
export const trayContents = () => ( | ||
<Stack gap={ 2 } p={ 2 }> | ||
<ModelSelection /> | ||
</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,17 @@ | ||
import React, { Fragment } from 'react'; | ||
import { ModelSelectionForm } from "@model-selection/modelSelectionForm.js"; | ||
|
||
/** | ||
* component that handles the selection of layers for the map. | ||
* | ||
* @returns {JSX.Element} | ||
* @constructor | ||
*/ | ||
export const ModelSelection = () => { | ||
// render the layer selection component | ||
return ( | ||
<Fragment> | ||
<ModelSelectionForm /> | ||
</Fragment> | ||
); | ||
}; |
This file was deleted.
Oops, something went wrong.
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,25 @@ | ||
import React from 'react'; | ||
import { Stack } from '@mui/joy'; | ||
import { Delete as RemoveIcon} from '@mui/icons-material'; | ||
|
||
// import the components that will remove selected items from state | ||
import { RemoveObservations } from "./remove-observations"; | ||
import { RemoveModels } from "./remove-models"; | ||
|
||
// get an icon for the tray | ||
export const icon = <RemoveIcon />; | ||
|
||
// create a title for this tray element | ||
export const title = 'Remove items'; | ||
|
||
/** | ||
* render the tray | ||
* | ||
* @returns {JSX.Element} | ||
*/ | ||
export const trayContents = () => ( | ||
<Stack gap={ 2 } p={ 2 }> | ||
<RemoveObservations /> | ||
<RemoveModels /> | ||
</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,30 @@ | ||
import React, { Fragment } from 'react'; | ||
import { Button } from '@mui/joy'; | ||
import {useLayers} from "@context"; | ||
|
||
/** | ||
* component that handles the removal of models. | ||
* | ||
* @returns {JSX.Element} | ||
* @constructor | ||
*/ | ||
export const RemoveModels = () => { | ||
// get references to the model data/list | ||
const { | ||
|
||
} = useLayers(); | ||
|
||
/** | ||
* remove the observation selections from state and map | ||
*/ | ||
function removeModels() { | ||
alert("Not ready yet."); | ||
} | ||
|
||
// render the button | ||
return ( | ||
<Fragment> | ||
<Button color="primary" onClick={() => removeModels()}>Remove selected models</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
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