Skip to content

Commit

Permalink
fix: fixed info panel for CV layout (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
baolanlequang authored Sep 22, 2023
1 parent 0350482 commit c3bd7d2
Show file tree
Hide file tree
Showing 18 changed files with 2,245 additions and 1,902 deletions.
8 changes: 8 additions & 0 deletions dist/components/cmd_bar/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ const commonStyle = {
},
selectInput: {
height: 30
},
txtLabelBottomInput: {
fontFamily: 'Helvetica',
backgroundColor: 'white',
fontSize: 12,
margin: '22% 0 0 7px',
padding: '0 10px 0 10px',
transform: 'scale(0.75)'
}
};
exports.commonStyle = commonStyle;
Expand Down
12 changes: 7 additions & 5 deletions dist/components/cmd_bar/r03_threshold.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var _reactRedux = require("react-redux");
var _redux = require("redux");
var _TextField = _interopRequireDefault(require("@material-ui/core/TextField"));
var _InputAdornment = _interopRequireDefault(require("@material-ui/core/InputAdornment"));
var _core = require("@material-ui/core");
var _styles = require("@material-ui/core/styles");
var _Tooltip = _interopRequireDefault(require("@material-ui/core/Tooltip"));
var _CloudDoneOutlined = _interopRequireDefault(require("@material-ui/icons/CloudDoneOutlined"));
Expand Down Expand Up @@ -42,7 +43,9 @@ const setThreshold = (classes, thresVal, updateThresholdValueAct) => {
updateThresholdValueAct(e.target.value);
}
};
return /*#__PURE__*/_react.default.createElement(_TextField.default, {
return /*#__PURE__*/_react.default.createElement(_core.FormControl, {
variant: "outlined"
}, /*#__PURE__*/_react.default.createElement(_TextField.default, {
className: classes.field,
id: "outlined-name",
placeholder: "N.A.",
Expand All @@ -56,14 +59,13 @@ const setThreshold = (classes, thresVal, updateThresholdValueAct) => {
min: 0.01
}
},
label: /*#__PURE__*/_react.default.createElement("span", {
className: (0, _classnames.default)(classes.txtLabel, 'txtfield-sv-bar-label')
}, "Threshold"),
onChange: onChange,
onBlur: onBlur,
onKeyPress: onEnterPress,
variant: "outlined"
});
}), /*#__PURE__*/_react.default.createElement(_core.InputLabel, {
className: (0, _classnames.default)(classes.txtLabelBottomInput)
}, "Threshold"));
};
const restoreIcon = (classes, hasEdit, isEdit) => hasEdit && isEdit ? /*#__PURE__*/_react.default.createElement(_HowToRegOutlined.default, {
className: classes.icon
Expand Down
7 changes: 3 additions & 4 deletions dist/components/panel/compare.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
var _reactRedux = require("react-redux");
var _redux = require("redux");
var _reactDropzone = _interopRequireDefault(require("react-dropzone"));
var _ExpansionPanel = _interopRequireDefault(require("@material-ui/core/ExpansionPanel"));
var _ExpansionPanelSummary = _interopRequireDefault(require("@material-ui/core/ExpansionPanelSummary"));
var _core = require("@material-ui/core");
var _ExpandMore = _interopRequireDefault(require("@material-ui/icons/ExpandMore"));
var _HighlightOff = _interopRequireDefault(require("@material-ui/icons/HighlightOff"));
var _Table = _interopRequireDefault(require("@material-ui/core/Table"));
Expand Down Expand Up @@ -218,14 +217,14 @@ const ComparePanel = _ref2 => {
rmOthersOneAct,
toggleShowAct
} = _ref2;
return /*#__PURE__*/_react.default.createElement(_ExpansionPanel.default, {
return /*#__PURE__*/_react.default.createElement(_core.Accordion, {
expanded: expand,
onChange: onExapnd,
className: (0, _classnames.default)(classes.panel),
TransitionProps: {
unmountOnExit: true
} // increase ExpansionPanel performance
}, /*#__PURE__*/_react.default.createElement(_ExpansionPanelSummary.default, {
}, /*#__PURE__*/_react.default.createElement(_core.AccordionSummary, {
expandIcon: /*#__PURE__*/_react.default.createElement(_ExpandMore.default, null),
className: (0, _classnames.default)(classes.panelSummary)
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
Expand Down
8 changes: 4 additions & 4 deletions dist/components/panel/cyclic_voltamery_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const styles = () => ({
},
table: {
width: '100%',
wordWrap: 'break-all',
overflowWrap: 'anywhere',
fontSize: '14px !important'
},
td: {
Expand Down Expand Up @@ -137,13 +137,13 @@ const CyclicVoltammetryPanel = _ref => {
}
};
const getDelta = data => {
return data.max && data.min ? (0, _chem.GetCyclicVoltaPeakSeparate)(data.max.x, data.min.x) : 'undefined';
return data.max && data.min ? (0, _chem.GetCyclicVoltaPeakSeparate)(data.max.x, data.min.x).toFixed(5) : 'undefined';
};
const getRatio = (feature, data) => {
const featureData = feature.data[0];
const idx = featureData.x.indexOf(feature.maxX);
const y_pecker = data.pecker ? data.pecker.y : featureData.y[idx];
return data.max && data.min ? (0, _chem.GetCyclicVoltaRatio)(data.max.y, data.min.y, y_pecker).toFixed(8) : 'undefined';
return data.max && data.min ? (0, _chem.GetCyclicVoltaRatio)(data.max.y, data.min.y, y_pecker).toFixed(5) : 'undefined';
};
const rows = list.map((o, idx) => ({
idx,
Expand All @@ -159,7 +159,7 @@ const CyclicVoltammetryPanel = _ref => {
jcampIdx
})
}));
return /*#__PURE__*/_react.default.createElement(_core.ExpansionPanel, null, /*#__PURE__*/_react.default.createElement(_core.ExpansionPanelSummary, {
return /*#__PURE__*/_react.default.createElement(_core.Accordion, null, /*#__PURE__*/_react.default.createElement(_core.AccordionSummary, {
expandIcon: /*#__PURE__*/_react.default.createElement(_ExpandMore.default, null),
className: (0, _classnames.default)(classes.panelSummary)
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
Expand Down
8 changes: 6 additions & 2 deletions dist/components/panel/graph_selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,17 @@ const styles = () => ({
backgroundColor: '#fff',
fontSize: '0.8em',
margin: '0',
padding: '10px 2px 2px 10px'
padding: '10px 2px 2px 10px',
maxWidth: '95%',
overflowWrap: 'anywhere'
},
curveSelected: {
backgroundColor: '#2196f3',
fontSize: '0.8em',
color: '#fff',
padding: '10px 2px 2px 10px'
padding: '10px 2px 2px 10px',
maxWidth: '95%',
overflowWrap: 'anywhere'
}
});
const GraphSelectionPanel = _ref => {
Expand Down
2 changes: 1 addition & 1 deletion dist/components/panel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var _graph_selection = _interopRequireDefault(require("./graph_selection"));
var _cfg = _interopRequireDefault(require("../../helpers/cfg"));
/* eslint-disable react/prop-types, react/require-default-props */

const theme = (0, _styles.createMuiTheme)({
const theme = (0, _styles.createTheme)({
typography: {
useNextVariants: true
}
Expand Down
7 changes: 3 additions & 4 deletions dist/components/panel/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ var _reactRedux = require("react-redux");
var _redux = require("redux");
var _reactSvgFileZoomPan = _interopRequireDefault(require("@complat/react-svg-file-zoom-pan"));
var _reactQuill = _interopRequireDefault(require("react-quill"));
var _ExpansionPanel = _interopRequireDefault(require("@material-ui/core/ExpansionPanel"));
var _ExpansionPanelSummary = _interopRequireDefault(require("@material-ui/core/ExpansionPanelSummary"));
var _core = require("@material-ui/core");
var _ExpandMore = _interopRequireDefault(require("@material-ui/icons/ExpandMore"));
var _Divider = _interopRequireDefault(require("@material-ui/core/Divider"));
var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
Expand Down Expand Up @@ -155,14 +154,14 @@ const InfoPanel = _ref => {
originStack = integration.originStack; // eslint-disable-line
}

return /*#__PURE__*/_react.default.createElement(_ExpansionPanel.default, {
return /*#__PURE__*/_react.default.createElement(_core.Accordion, {
expanded: expand,
onChange: onExapnd,
className: (0, _classnames.default)(classes.panel),
TransitionProps: {
unmountOnExit: true
} // increase ExpansionPanel performance
}, /*#__PURE__*/_react.default.createElement(_ExpansionPanelSummary.default, {
}, /*#__PURE__*/_react.default.createElement(_core.AccordionSummary, {
expandIcon: /*#__PURE__*/_react.default.createElement(_ExpandMore.default, null),
className: (0, _classnames.default)(classes.panelSummary)
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
Expand Down
7 changes: 3 additions & 4 deletions dist/components/panel/multiplicity.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
var _classnames = _interopRequireDefault(require("classnames"));
var _reactRedux = require("react-redux");
var _redux = require("redux");
var _ExpansionPanel = _interopRequireDefault(require("@material-ui/core/ExpansionPanel"));
var _ExpansionPanelSummary = _interopRequireDefault(require("@material-ui/core/ExpansionPanelSummary"));
var _core = require("@material-ui/core");
var _ExpandMore = _interopRequireDefault(require("@material-ui/icons/ExpandMore"));
var _Divider = _interopRequireDefault(require("@material-ui/core/Divider"));
var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
Expand Down Expand Up @@ -248,14 +247,14 @@ const MultiplicityPanel = _ref => {
resetMpyOneAct
} = _ref;
const digits = 4;
return /*#__PURE__*/_react.default.createElement(_ExpansionPanel.default, {
return /*#__PURE__*/_react.default.createElement(_core.Accordion, {
expanded: expand,
onChange: onExapnd,
className: (0, _classnames.default)(classes.panel),
TransitionProps: {
unmountOnExit: true
} // increase ExpansionPanel performance
}, /*#__PURE__*/_react.default.createElement(_ExpansionPanelSummary.default, {
}, /*#__PURE__*/_react.default.createElement(_core.AccordionSummary, {
expandIcon: /*#__PURE__*/_react.default.createElement(_ExpandMore.default, null),
className: (0, _classnames.default)(classes.panelSummary)
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@complat/react-spectra-editor",
"version": "1.0.0-rc16",
"version": "1.0.0-rc17.beta-2",
"description": "An editor to View and Edit Chemical Spectra data (NMR, IR and MS, CV, UIVIS, XRD).",
"repository": {
"type": "git",
Expand Down Expand Up @@ -34,7 +34,6 @@
"react-dropzone": "^8.0.3",
"react-quill": "^2.0.0",
"react-redux": "^7.2.0",
"react-svg-file-zoom-pan": "^1.0.5",
"react-svg-inline": "^2.1.1",
"redux": "^4.1.1",
"redux-saga": "^1.1.3",
Expand Down
8 changes: 8 additions & 0 deletions src/components/cmd_bar/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ const commonStyle = {
selectInput: {
height: 30,
},
txtLabelBottomInput: {
fontFamily: 'Helvetica',
backgroundColor: 'white',
fontSize: 12,
margin: '22% 0 0 7px',
padding: '0 10px 0 10px',
transform: 'scale(0.75)',
},
};

const focusStyle = (criteria, cls) => (criteria ? [cls.btnHt] : []);
Expand Down
39 changes: 21 additions & 18 deletions src/components/cmd_bar/r03_threshold.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { bindActionCreators } from 'redux';

import TextField from '@material-ui/core/TextField';
import InputAdornment from '@material-ui/core/InputAdornment';
import { FormControl, InputLabel } from '@material-ui/core';
import { withStyles } from '@material-ui/core/styles';
import Tooltip from '@material-ui/core/Tooltip';
import CloudDoneOutlinedIcon from '@material-ui/icons/CloudDoneOutlined';
Expand Down Expand Up @@ -53,24 +54,26 @@ const setThreshold = (
};

return (
<TextField
className={classes.field}
id="outlined-name"
placeholder="N.A."
type="number"
value={thresVal || 0.01}
margin="none"
InputProps={{
endAdornment: txtPercent(),
className: classNames(classes.txtInput, 'txtfield-sv-bar-input'),
inputProps: { min: 0.01 },
}}
label={<span className={classNames(classes.txtLabel, 'txtfield-sv-bar-label')}>Threshold</span>}
onChange={onChange}
onBlur={onBlur}
onKeyPress={onEnterPress}
variant="outlined"
/>
<FormControl variant="outlined">
<TextField
className={classes.field}
id="outlined-name"
placeholder="N.A."
type="number"
value={thresVal || 0.01}
margin="none"
InputProps={{
endAdornment: txtPercent(),
className: classNames(classes.txtInput, 'txtfield-sv-bar-input'),
inputProps: { min: 0.01 },
}}
onChange={onChange}
onBlur={onBlur}
onKeyPress={onEnterPress}
variant="outlined"
/>
<InputLabel className={classNames(classes.txtLabelBottomInput)}>Threshold</InputLabel>
</FormControl>
);
};

Expand Down
13 changes: 7 additions & 6 deletions src/components/panel/compare.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import Dropzone from 'react-dropzone';

import ExpansionPanel from '@material-ui/core/ExpansionPanel';
import ExpansionPanelSummary from '@material-ui/core/ExpansionPanelSummary';
import {
Accordion, AccordionSummary,
} from '@material-ui/core';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
import HighlightOffIcon from '@material-ui/icons/HighlightOff';
import Table from '@material-ui/core/Table';
Expand Down Expand Up @@ -237,13 +238,13 @@ const ComparePanel = ({
classes, expand, onExapnd, jcampSt,
rmOthersOneAct, toggleShowAct,
}) => (
<ExpansionPanel
<Accordion
expanded={expand}
onChange={onExapnd}
className={classNames(classes.panel)}
TransitionProps={{ unmountOnExit: true }} // increase ExpansionPanel performance
>
<ExpansionPanelSummary
<AccordionSummary
expandIcon={<ExpandMoreIcon />}
className={classNames(classes.panelSummary)}
>
Expand All @@ -252,15 +253,15 @@ const ComparePanel = ({
Spectra Comparisons
</span>
</Typography>
</ExpansionPanelSummary>
</AccordionSummary>
<Divider />
{ inputOthers(classes, jcampSt) }
<div className={classNames(classes.panelDetail)}>
{
compareList(classes, jcampSt, rmOthersOneAct, toggleShowAct)
}
</div>
</ExpansionPanel>
</Accordion>
);

const mapStateToProps = (state, props) => ( // eslint-disable-line
Expand Down
16 changes: 8 additions & 8 deletions src/components/panel/cyclic_voltamery_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Divider from '@material-ui/core/Divider';
import Typography from '@material-ui/core/Typography';
import { withStyles } from '@material-ui/core/styles';
import {
ExpansionPanel, ExpansionPanelSummary, Table, TableHead, TableBody, TableCell, TableRow,
Accordion, AccordionSummary, Table, TableHead, TableBody, TableCell, TableRow,
} from '@material-ui/core';
import {
addNewCylicVoltaPairPeak, setWorkWithMaxPeak, selectPairPeak, removeCylicVoltaPairPeak,
Expand All @@ -43,7 +43,7 @@ const styles = () => ({
},
table: {
width: '100%',
wordWrap: 'break-all',
overflowWrap: 'anywhere',
fontSize: '14px !important',
},
td: {
Expand Down Expand Up @@ -120,14 +120,14 @@ const CyclicVoltammetryPanel = ({
};

const getDelta = (data) => {
return (data.max && data.min) ? GetCyclicVoltaPeakSeparate(data.max.x, data.min.x) : 'undefined';
return (data.max && data.min) ? GetCyclicVoltaPeakSeparate(data.max.x, data.min.x).toFixed(5) : 'undefined';
};

const getRatio = (feature, data) => {
const featureData = feature.data[0];
const idx = featureData.x.indexOf(feature.maxX);
const y_pecker = data.pecker ? data.pecker.y : featureData.y[idx];
return (data.max && data.min) ? GetCyclicVoltaRatio(data.max.y, data.min.y, y_pecker).toFixed(8) : 'undefined';
return (data.max && data.min) ? GetCyclicVoltaRatio(data.max.y, data.min.y, y_pecker).toFixed(5) : 'undefined';
};

const rows = list.map((o, idx) => (
Expand All @@ -145,8 +145,8 @@ const CyclicVoltammetryPanel = ({
));

return (
<ExpansionPanel>
<ExpansionPanelSummary
<Accordion>
<AccordionSummary
expandIcon={<ExpandMoreIcon />}
className={classNames(classes.panelSummary)}
>
Expand All @@ -155,7 +155,7 @@ const CyclicVoltammetryPanel = ({
Voltammetry data
</span>
</Typography>
</ExpansionPanelSummary>
</AccordionSummary>
<Divider />
<Table className={classes.table}>
<TableHead>
Expand Down Expand Up @@ -301,7 +301,7 @@ https://doi.org/10.1021/ac60242a030</i>
</span>
</Tooltip>
</div>
</ExpansionPanel>
</Accordion>
);
};

Expand Down
Loading

0 comments on commit c3bd7d2

Please sign in to comment.