diff --git a/package.json b/package.json index 0c40d0c..f6ed8df 100644 --- a/package.json +++ b/package.json @@ -62,12 +62,10 @@ "@mui/icons-material": "^6.5.0", "@mui/lab": "^6.0.1-beta.36", "@mui/material": "^6.5.0", - "@mui/styles": "^6.5.0", "@sentry/electron": "^4.0.2", "allotment": "^1.20.4", "classnames": "^2.3.2", "clean-stack": "3.0.1", - "clsx": "^1.2.1", "computed-async-mobx": "^4.2.0", "cpus": "^1.0.3", "d3-array": "^3.2.4", diff --git a/src/app/AlignmentCard.js b/src/app/AlignmentCard.js index 2c138a3..6e6b97c 100644 --- a/src/app/AlignmentCard.js +++ b/src/app/AlignmentCard.js @@ -1,11 +1,9 @@ import React from 'react'; import { observer } from 'mobx-react'; import PropTypes from 'prop-types'; -import { makeStyles, withStyles } from '@mui/styles'; import IconButton from '@mui/material/IconButton'; import MoreVertIcon from '@mui/icons-material/MoreVert'; import DeleteForeverIcon from '@mui/icons-material/DeleteForever'; -import classNames from 'classnames'; import CircularProgress from '@mui/material/CircularProgress'; import Chip from '@mui/material/Chip'; import Switch from '@mui/material/Switch'; @@ -23,132 +21,21 @@ import CardActions from '@mui/material/CardActions'; import Box from '@mui/material/Box'; import Button from '@mui/material/Button'; -const InputSwitch = withStyles((theme) => ({ - switchBase: { - color: theme.palette.input.secondaryText, - '&.Mui-checked': { - color: theme.palette.input.dark, - }, - '&.Mui-checked + .Mui-track': { - backgroundColor: theme.palette.input.dark, - }, - }, - checked: {}, - track: {}, -}))(Switch); - -// const useStyles = makeStyles(theme => ({ -const useStyles = makeStyles((theme) => { - return { - AlignmentCard: { - backgroundColor: theme.palette.input.light, - border: `1px solid ${theme.palette.input.border}`, - }, - cardHeaderRoot: { - overflow: "hidden" - }, - cardHeaderContent: { - overflow: "hidden" - }, - heading: { - display: 'flex', - alignItems: 'center', - }, - content: { - display: 'flex', - alignItems: 'center', - marginLeft: '-10px', - }, - name: { - marginRight: theme.spacing(1), - }, - chip: { - height: '30px', - color: theme.palette.input.contrastText, - backgroundColor: theme.palette.input.main, - border: `1px solid ${theme.palette.input.darker}`, - }, - link: { - cursor: 'pointer', - color: theme.palette.secondary.main, - }, - secondaryText: { - color: theme.palette.primary.secondaryText, - }, - divider: { - margin: '0 4px', - }, - fileInfo: { - color: '#ccc', - fontSize: '0.75em', - marginTop: '0.25em', - overflowWrap: 'break-word', - }, - partitionFileContainer: { - overflowY: 'auto', - height: 50, - }, - partitionFileContent: { - color: theme.palette.primary.contrastText, - fontFamily: 'Consolas, "Liberation Mono", Menlo, Courier, monospace', - fontSize: '10px', - height: '100%', - overflowWrap: 'break-word', - whiteSpace: 'pre-wrap', - }, - path: { - cursor: 'pointer', - color: theme.palette.secondary.main, - marginLeft: 4, - }, - button: { - margin: theme.spacing(1), - }, - primaryButton: { - backgroundColor: theme.palette.input.main, - border: `1px solid ${theme.palette.input.darker}`, - color: theme.palette.input.contrastText, - '&:hover': { - backgroundColor: theme.palette.input.main, - }, - }, - rightIcon: { - marginLeft: theme.spacing(1), - }, - iconSmall: { - fontSize: 20, - }, - outputButton: { - marginLeft: theme.spacing(1), - }, - loading: { - marginLeft: '10px', - }, - remove: { - flexGrow: 1, - display: 'flex', - justifyContent: 'flex-end', - }, - select: { - marginLeft: '10px', - minWidth: '150px', - }, - selectWide: { - marginLeft: '10px', - minWidth: '200px', - }, - }; -}); - function _ModelTestButton({ alignment }) { - const classes = useStyles(); if (!alignment.modelTestCanRun) { return null; } return ( diff --git a/src/app/Console.js b/src/app/Console.js index e4a5ad5..15ae338 100644 --- a/src/app/Console.js +++ b/src/app/Console.js @@ -1,37 +1,7 @@ import React from 'react'; import { observer } from 'mobx-react'; import PropTypes from 'prop-types'; -import { withStyles } from '@mui/styles'; -import clsx from 'clsx'; - - -const styles = theme => ({ - Console: { - color: theme.palette.console.contrastText, - background: theme.palette.console.background, - // flexGrow: 1, - // padding: '0 4px', - padding: '10px', - width: '100% ', - height: '100%', - }, - stdoutContainer: { - overflowY: 'auto', - height: '100%', - position: 'relative', - }, - code: { - color: theme.palette.console.contrastText, - fontFamily: 'Consolas, "Liberation Mono", Menlo, Courier, monospace', - fontSize: '12px', - height: '100%', - position: 'absolute', - width: '100%', - // overflowWrap: 'anywhere', // currently not available in Chrome - whiteSpace: 'pre-wrap', - wordBreak: 'break-all', - } -}); +import Box from '@mui/material/Box'; @observer class Console extends React.Component { @@ -61,17 +31,57 @@ class Console extends React.Component { }; render() { - const { run, classes } = this.props; + const { run } = this.props; return ( -
theme.palette.console.contrastText, + background: (theme) => theme.palette.console.background, + padding: '10px', + width: '100%', + height: '100%', + overflowY: 'auto', + position: 'relative', + }} >
- {run.stdout && {run.stdout}} - {run.stderr && {run.stderr}} + {run.stdout && ( + theme.palette.console.contrastText, + fontFamily: 'Consolas, "Liberation Mono", Menlo, Courier, monospace', + fontSize: '12px', + height: '100%', + position: 'absolute', + width: '100%', + whiteSpace: 'pre-wrap', + wordBreak: 'break-all', + }} + > + {run.stdout} + + )} + {run.stderr && ( + theme.palette.console.contrastText, + fontFamily: 'Consolas, "Liberation Mono", Menlo, Courier, monospace', + fontSize: '12px', + height: '100%', + position: 'absolute', + width: '100%', + whiteSpace: 'pre-wrap', + wordBreak: 'break-all', + }} + > + {run.stderr} + + )}
-
+ ); } } @@ -80,4 +90,4 @@ Console.propTypes = { run: PropTypes.object.isRequired }; -export default withStyles(styles)(Console); +export default Console; diff --git a/src/app/Input.js b/src/app/Input.js index c872c3a..cfc71c2 100644 --- a/src/app/Input.js +++ b/src/app/Input.js @@ -1,7 +1,6 @@ import React from 'react'; import { observer } from 'mobx-react'; import PropTypes from 'prop-types'; -import { makeStyles } from '@mui/styles'; import Button from '@mui/material/Button'; import AlignmentCard, { FinalAlignmentCard } from './AlignmentCard'; import AstralTreeCard from './AstralTreeCard'; @@ -12,90 +11,7 @@ import { Typography } from '@mui/material'; import Dropzone from 'react-dropzone'; import { webUtils } from 'electron'; -const useStyles = makeStyles((theme) => ({ - Input: { - width: '100%', - }, - alignmentList: { - display: 'flex', - width: '100%', - flexWrap: 'nowrap', - overflowX: 'auto', - // borderLeft: `5px solid ${theme.palette.primary.main}`, - // paddingLeft: 10, - padding: '10px', - }, - treeList: { - display: 'flex', - flexWrap: 'nowrap', - overflowX: 'auto', - // borderLeft: `5px solid ${theme.palette.secondary.main}`, - padding: '10px', - }, - alignments: { - display: 'flex', - }, - addAlignment: { - width: '200px', - height: '200px', - }, - addAlignmentOrPartition: { - minWidth: '200px', - flexGrow: 1, - }, - treeCard: { - width: '380px', - height: '100px', - }, - finalInput: { - padding: '10px', - }, - concatenatedAlignment: { - width: '550px', - height: '200px', - }, - resultingPartitionCard: { - width: '350px', - height: '200px', - }, - output: { - marginTop: '20px', - }, - fileInfo: { - fontSize: '0.75em', - marginTop: '0.25em', - overflowWrap: 'break-word', - }, - path: { - cursor: 'pointer', - color: theme.palette.secondary.main, - marginLeft: 4, - }, - button: { - margin: theme.spacing(1), - }, - rightIcon: { - marginLeft: theme.spacing(1), - }, - iconSmall: { - fontSize: 20, - }, - outputButton: { - marginLeft: theme.spacing(1), - }, - outputDir: { - // flex: 'flex-grow', - }, - gridList: { - flexWrap: 'nowrap', - // Promote the list into his own layer on Chrome. This cost memory but helps keeping high FPS. - transform: 'translateZ(0)', - width: 500, - }, -})); - const Input = ({ run }) => { - const classes = useStyles(); // run.hasAstralTree is the condition on which to show an astral tree card // For some reason when changed in the mobx store a rerender is not triggered with this boolean with the conditional below alone // With this if the component rerenders as should be @@ -104,12 +20,21 @@ const Input = ({ run }) => { } // const SelectNumRuns = run. return ( - + { > {({ getRootProps, getInputProps }) => (
- + {run.inputIsAlignment ? run.alignments.map((alignment) => ( )) : null} {run.inputIsTree && run.hasAstralTree ? ( ) : null} @@ -146,7 +73,10 @@ const Input = ({ run }) => { {run.canLoadAstralTree ? ( )} -
+
)} {run.backboneConstraint.notAvailable ? null : ( - -
+ + {run.backboneConstraint.haveFile ? ( ) : ( )} -
+
)} {run.multifurcatingConstraint.notAvailable ? null : ( - -
+ + {run.multifurcatingConstraint.haveFile ? ( ) : ( )} -
+
)} {run.alignments.length <= 1 ? null : ( - + Concatenated alignment )} diff --git a/src/app/Model.js b/src/app/Model.js index b4dc3f2..a88cdee 100644 --- a/src/app/Model.js +++ b/src/app/Model.js @@ -1,59 +1,63 @@ import React from 'react'; import { observer } from 'mobx-react'; import PropTypes from 'prop-types'; -import { makeStyles } from '@mui/styles'; import Box from '@mui/material/Box'; import OptionSelect from './components/OptionSelect'; import OptionCheck from './components/OptionCheck'; import TextField from '@mui/material/TextField'; import Typography from '@mui/material/Typography'; -const useStyles = makeStyles(theme => ({ - Model: { - padding: '10px', - display: 'flex', - flexDirection: 'column', - }, - form: { - '& > *': { - marginRight: '10px', - } - }, -})); - const Model = ({ run }) => { - const classes = useStyles(); - // TODO: Check marginTop: 2 hack, doesn't seem exactly aligned to top if (run.usesModeltestNg) { return ( -
+ Select the best-fit model of evolution for a single DNA or protein alignment -
+
); } if (run.usesAstral) { return ( -
+ Calculate species tree from a set of gene trees -
+ ); } return ( -
+ @@ -72,7 +76,9 @@ const Model = ({ run }) => { mb={2} display="flex" alignItems="start" - className={classes.form} + sx={{ + gap: '10px', + }} noValidate autoComplete="off" > @@ -82,7 +88,7 @@ const Model = ({ run }) => { variant="standard" helperText="Seed" title="Random seed" - style={{ width: 60 }} + sx={{ width: 60 }} value={run.randomSeed} onChange={(e) => run.setRandomSeed(e.target.value)} /> ) : null} @@ -93,7 +99,9 @@ const Model = ({ run }) => { mb={2} display="flex" alignItems="start" - className={classes.form} + sx={{ + gap: '10px', + }} noValidate autoComplete="off" > @@ -106,7 +114,9 @@ const Model = ({ run }) => { mb={2} display="flex" alignItems="start" - className={classes.form} + sx={{ + gap: '10px', + }} noValidate autoComplete="off" > @@ -116,7 +126,7 @@ const Model = ({ run }) => { -
+ ); }; diff --git a/src/app/Output.js b/src/app/Output.js index 2e92401..a77f0c3 100644 --- a/src/app/Output.js +++ b/src/app/Output.js @@ -1,7 +1,6 @@ import React from 'react'; import { observer } from 'mobx-react'; import PropTypes from 'prop-types'; -import { makeStyles } from '@mui/styles'; import Box from '@mui/material/Box'; import TextField from '@mui/material/TextField'; import Button from '@mui/material/Button'; @@ -9,49 +8,35 @@ import { Link, Typography } from '@mui/material'; import FileIcon from '@mui/icons-material/InsertDriveFileSharp'; import { join } from 'path'; -const useStyles = makeStyles((theme) => ({ - Output: { - width: '100%', - padding: '10px', - }, - form: { - width: '100%', - '& > *:not(:first-child)': { - marginTop: theme.spacing(3), - }, - }, - formItem: {}, - result: { - // maxHeight: 200, - // overflowY: 'auto', - }, - resultFilenameRow: { - color: theme.palette.primary.contrastText, - display: 'flex', - alignItems: 'flex-end', - cursor: 'pointer', - }, - resultFilename: { - color: theme.palette.primary.contrastText, - }, -})); - const Output = ({ run }) => { - - const classes = useStyles(); - const { resultFilenames } = run; const haveResult = resultFilenames.length > 0; return ( - (
- + ( + { variant="standard" id="output-name" helperText={run.outputNameNotice || "Select output name"} - className={classes.formItem} value={run.outputName} placeholder={run.outputNamePlaceholder} onChange={e => run.setOutputName(e.target.value)} error={!run.outputNameOk} /> - + { haveResult ? Result for output id '{run.outputName}' : null } { resultFilenames.map(filename => theme.palette.primary.contrastText, + display: 'flex', + alignItems: 'flex-end', + cursor: 'pointer', + }} onClick={() => run.openFile(join(run.outputDir, filename))} underline="hover"> - {filename} + theme.palette.primary.contrastText, + }} + > + {filename} + )} @@ -87,7 +83,7 @@ const Output = ({ run }) => { ) : null } -
) + ) ); }; diff --git a/src/app/PartitionEditor.js b/src/app/PartitionEditor.js index befcdb9..f717343 100644 --- a/src/app/PartitionEditor.js +++ b/src/app/PartitionEditor.js @@ -1,7 +1,6 @@ import React from 'react'; import { observer } from 'mobx-react'; import PropTypes from 'prop-types'; -import { makeStyles } from '@mui/styles'; import Button from '@mui/material/Button'; import TextField from '@mui/material/TextField'; import Card from '@mui/material/Card'; @@ -14,51 +13,7 @@ import Grid from '@mui/material/Grid2'; import LinearProgress from '@mui/material/LinearProgress'; import Typography from '@mui/material/Typography'; -const useStyles = makeStyles(theme => ({ - Partition: { - backgroundColor: theme.palette.input.background, - display: 'flex', - flexDirection: 'column', - alignItems: 'flex-start' - }, - formControl: { - marginLeft: 5, - marginRight: 10 - }, - content: { - padding: 0 - }, - textField: { - // height: 80, - width: 250, - padding: 0, - marginTop: 10, - marginLeft: theme.spacing(1), - marginRight: theme.spacing(1) - }, - type: { - width: 100, - }, - aaType: { - width: 120, - }, - name: { - width: 200, - }, - start: { - width: 70, - }, - end: { - width: 70, - }, - codon: { - width: 200, - }, -})); - function PartitionEditor({ alignment }) { - const classes = useStyles(); - function handleAdd(event) { alignment.partition.addPart(); } @@ -71,7 +26,16 @@ function PartitionEditor({ alignment }) { const { partToAdd } = partition; return ( - ( + ( theme.palette.input.background, + display: 'flex', + flexDirection: 'column', + alignItems: 'flex-start' + }} + > Partition editor @@ -83,22 +47,40 @@ function PartitionEditor({ alignment }) { - + - + - + - + - + - + @@ -109,29 +91,24 @@ function PartitionEditor({ alignment }) { -
- {}} - margin="normal" - helperText={alignment.partitionHelperText || ''} - variant="outlined" - slotProps={{ - input: { - classes: { - input: 'pre', - } - } - }} - /> - + {}} + margin="normal" + helperText={alignment.partitionHelperText || ''} + variant="outlined" + />
{ partition.isDefault ? null : ( @@ -154,28 +131,7 @@ PartitionEditor.propTypes = { const PartitionEditorObserver = observer(PartitionEditor); -const useStylesOnCard = makeStyles(theme => ({ - partition: { - padding: 0, - marginTop: -30, - backgroundColor: 'rgba(0,0,0,0)', // transparent background - display: 'flex', - alignItems: 'flex-start' - }, - content: { - padding: 0 - }, - form: {}, - textField: { - width: 250, - padding: 0, - marginTop: 10, - marginLeft: theme.spacing(1), - marginRight: theme.spacing(1) - } -})); function PartitionOnCard({ alignment }) { - const classes = useStylesOnCard(); // const [partitionText, setPartitionText] = React.useState(alignment.partitionText); const [partitionText, setPartitionText] = React.useState( alignment.partitionFileContent @@ -197,22 +153,35 @@ function PartitionOnCard({ alignment }) { const hasChange = partitionText !== alignment.partitionText; return ( - - -
- - + + + ) : null} @@ -113,14 +85,13 @@ class Raxml extends React.Component {
Command
- + ); } } Raxml.propTypes = { - classes: PropTypes.object.isRequired, run: PropTypes.object.isRequired, }; -export default withStyles(styles)(Raxml); +export default Raxml; diff --git a/src/app/TreeCard.js b/src/app/TreeCard.js index 86fc0b7..2fedc38 100644 --- a/src/app/TreeCard.js +++ b/src/app/TreeCard.js @@ -1,10 +1,8 @@ import React from 'react'; import { observer } from 'mobx-react'; import PropTypes from 'prop-types'; -import { makeStyles } from '@mui/styles'; import IconButton from '@mui/material/IconButton'; import MoreVertIcon from '@mui/icons-material/MoreVert'; -import classNames from 'classnames'; import CircularProgress from "@mui/material/CircularProgress"; import Chip from "@mui/material/Chip"; import Menu from '@mui/material/Menu'; @@ -12,75 +10,9 @@ import MenuItem from '@mui/material/MenuItem'; import Card from '@mui/material/Card'; import CardHeader from '@mui/material/CardHeader'; import CardContent from '@mui/material/CardContent'; +import Box from '@mui/material/Box'; -const useStyles = makeStyles(theme => ({ - TreeCard: { - backgroundColor: theme.palette.input.main, - border: `1px solid ${theme.palette.input.light}`, - }, - heading: { - display: 'flex', - alignItems: 'center', - }, - content: { - display: 'flex', - alignItems: 'center', - }, - name: { - marginRight: theme.spacing(1), - }, - chip: { - height: '30px', - backgroundColor: theme.palette.input.dark, - border: `1px solid ${theme.palette.input.light}`, - }, - link: { - cursor: 'pointer', - color: theme.palette.secondary.main - }, - secondaryText: { - color: theme.palette.input.secondaryText, - }, - divider: { - margin: '0 4px', - }, - fileInfo: { - color: '#ccc', - fontSize: '0.75em', - marginTop: '0.25em', - overflowWrap: 'break-word', - }, - path: { - cursor: 'pointer', - color: theme.palette.secondary.main, - marginLeft: 4, - }, - button: { - margin: theme.spacing(1), - }, - rightIcon: { - marginLeft: theme.spacing(1), - }, - iconSmall: { - fontSize: 20, - }, - outputButton: { - marginLeft: theme.spacing(1), - }, - loading: { - marginLeft: '10px', - }, - remove: { - flexGrow: 1, - display: 'flex', - justifyContent: 'flex-end', - } - -})); - -function TreeCard({ className, tree }) { - - const classes = useStyles(); +function TreeCard({ sx, tree }) { const [anchorEl, setAnchorEl] = React.useState(null); function handleMenuClick(event) { @@ -99,13 +31,29 @@ function TreeCard({ className, tree }) { } return ( - + theme.palette.input.main, + border: (theme) => `1px solid ${theme.palette.input.light}`, + ...sx, + }} + > + theme.palette.input.contrastText, + backgroundColor: (theme) => theme.palette.input.main, + border: (theme) => `1px solid ${theme.palette.input.darker}`, + }} + /> } action={ -
+ Show folder Remove -
+ } title={ tree.name } subheader={ '' } /> -
+ { tree.loading ? ( -
+ -
+
) : null } -
+
@@ -141,7 +89,7 @@ function TreeCard({ className, tree }) { TreeCard.propTypes = { tree: PropTypes.object.isRequired, - className: PropTypes.string, + sx: PropTypes.object, }; export default observer(TreeCard); diff --git a/src/app/components/CodeHighlight.js b/src/app/components/CodeHighlight.js index 24db98b..7edd331 100644 --- a/src/app/components/CodeHighlight.js +++ b/src/app/components/CodeHighlight.js @@ -1,25 +1,15 @@ import React, { useRef, useEffect } from 'react'; import PropTypes from 'prop-types'; -import { makeStyles } from '@mui/styles'; +import { Box } from '@mui/material'; import Prism from 'prismjs'; import 'prismjs-bibtex'; import 'prismjs/themes/prism.css'; import 'prismjs/themes/prism-okaidia.css'; // coy, dark, funky, okaidia, solarizedlight, tomorrow, twilight -const useStyles = makeStyles(() => ({ - code: { - fontSize: 10, - overflowWrap: 'break-word', - whiteSpace: 'pre-wrap', - } -})); - -function CodeHighlight({ code, language, className }) { +function CodeHighlight({ code, language, sx }) { const codeNode = useRef(null); - const classes = useStyles(); useEffect(() => { - // const code = codeNode.current.textContent; if (Prism.languages.hasOwnProperty(language)) { const highlightHTML = Prism.highlight(code, Prism.languages[language], language); codeNode.current.innerHTML = highlightHTML; @@ -27,18 +17,26 @@ function CodeHighlight({ code, language, className }) { }, [code, language]); return ( -
-      
+    
+      
         { code }
-      
-    
+ + ); } CodeHighlight.propTypes = { code: PropTypes.string.isRequired, language: PropTypes.string.isRequired, - className: PropTypes.string, + sx: PropTypes.object, }; export default CodeHighlight; diff --git a/src/app/components/OptionCheck.js b/src/app/components/OptionCheck.js index eea1ebf..3e604e4 100644 --- a/src/app/components/OptionCheck.js +++ b/src/app/components/OptionCheck.js @@ -6,14 +6,13 @@ import Checkbox from '@mui/material/Checkbox'; import { FormControl } from '@mui/material'; -const OptionCheck = observer(({ option, className }) => { +const OptionCheck = observer(({ option, sx }) => { if (option.notAvailable) { return null; } return ( - + { OptionCheck.propTypes = { option: PropTypes.object.isRequired, - className: PropTypes.string, + sx: PropTypes.object, }; export default OptionCheck; diff --git a/src/app/components/OptionSelect.js b/src/app/components/OptionSelect.js index 83381c3..4a30c9a 100644 --- a/src/app/components/OptionSelect.js +++ b/src/app/components/OptionSelect.js @@ -8,7 +8,7 @@ import MenuItem from '@mui/material/MenuItem'; import TextField from '@mui/material/TextField'; -const OptionSelect = observer(({ option, className }) => { +const OptionSelect = observer(({ option, sx }) => { if (option.notAvailable || option.options.length === 0) { return null; } @@ -19,7 +19,7 @@ const OptionSelect = observer(({ option, className }) => { variant="standard" id={option.title} helperText={option.title} - className={className} + sx={sx} value={option.value} placeholder={option.placeholder} error={option.error} @@ -32,7 +32,7 @@ const OptionSelect = observer(({ option, className }) => { } return ( - +