-
Notifications
You must be signed in to change notification settings - Fork 13
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 #475 from xchem/staging
Push to production
Showing
17 changed files
with
542 additions
and
1,455 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
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 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
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,115 @@ | ||
import React, { memo, useState } from 'react'; | ||
import { useDispatch, useSelector } from 'react-redux'; | ||
import { Grid, makeStyles, Checkbox, Typography, FormControlLabel } from '@material-ui/core'; | ||
import { Button, Modal } from '../../common'; | ||
import { setSearchSettings } from '../../../reducers/selection/actions'; | ||
|
||
const useStyles = makeStyles(theme => ({ | ||
body: { | ||
width: '100%', | ||
marginTop: theme.spacing(2), | ||
marginBottom: theme.spacing(1) | ||
}, | ||
margin: { | ||
marginTop: theme.spacing(1) | ||
}, | ||
checkbox: { | ||
margin: theme.spacing(0) | ||
} | ||
})); | ||
|
||
export const SearchSettingsDialog = memo(({ openDialog, setOpenDialog }) => { | ||
const dispatch = useDispatch(); | ||
const classes = useStyles(); | ||
|
||
const searchSettings = useSelector(state => state.selectionReducers.searchSettings); | ||
|
||
const [shortcode, setShortcode] = useState(searchSettings.searchBy.shortcode); | ||
const [aliases, setAliases] = useState(searchSettings.searchBy.aliases); | ||
const [compoundId, setCompoundId] = useState(searchSettings.searchBy.compoundId); | ||
|
||
const handleCloseModal = () => { | ||
setOpenDialog(false); | ||
}; | ||
|
||
const handleSaveButton = () => { | ||
dispatch(setSearchSettings({ searchBy: { shortcode, aliases, compoundId } })); | ||
setOpenDialog(false); | ||
}; | ||
|
||
return ( | ||
<Modal open={openDialog}> | ||
<> | ||
<Typography variant="h4">Search settings</Typography> | ||
<Typography variant="subtitle1" gutterBottom className={classes.margin}> | ||
Search by: | ||
</Typography> | ||
<Grid container direction="column" className={classes.body}> | ||
<Grid item> | ||
<FormControlLabel | ||
control={ | ||
<Checkbox | ||
checked={shortcode} | ||
name="event" | ||
color="primary" | ||
onChange={() => { | ||
setShortcode(prev => !prev); | ||
}} | ||
/> | ||
} | ||
label="Observation shortcode" | ||
labelPlacement="end" | ||
className={classes.checkbox} | ||
/> | ||
</Grid> | ||
<Grid item> | ||
<FormControlLabel | ||
control={ | ||
<Checkbox | ||
checked={aliases} | ||
name="sigma" | ||
color="primary" | ||
onChange={() => { | ||
setAliases(prev => !prev); | ||
}} | ||
/> | ||
} | ||
label="Compound aliases" | ||
labelPlacement="end" | ||
className={classes.checkbox} | ||
/> | ||
</Grid> | ||
<Grid item> | ||
<FormControlLabel | ||
control={ | ||
<Checkbox | ||
checked={compoundId} | ||
name="diff" | ||
color="primary" | ||
onChange={() => { | ||
setCompoundId(prev => !prev); | ||
}} | ||
/> | ||
} | ||
label="Compound ID" | ||
labelPlacement="end" | ||
className={classes.checkbox} | ||
/> | ||
</Grid> | ||
</Grid> | ||
<Grid container justifyContent="flex-end" direction="row"> | ||
<Grid item> | ||
<Button color="secondary" onClick={handleCloseModal}> | ||
Cancel | ||
</Button> | ||
</Grid> | ||
<Grid item> | ||
<Button color="primary" onClick={handleSaveButton}> | ||
Save | ||
</Button> | ||
</Grid> | ||
</Grid> | ||
</> | ||
</Modal> | ||
); | ||
}); |
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
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