From 8b2fd4cd9188668457a08b789c6d5ace33e41404 Mon Sep 17 00:00:00 2001 From: Luciano Maiwald Date: Mon, 23 Sep 2024 12:11:03 +0200 Subject: [PATCH] Update ViewSpectra to new bootstrap version --- .../global-styles/utilities/sizing.scss | 6 +- app/assets/stylesheets/legacy/spectra.scss | 27 ---- .../apps/mydb/elements/details/ViewSpectra.js | 142 ++++++++---------- .../nmriumWrapper/NMRiumDisplayer.js | 22 ++- 4 files changed, 79 insertions(+), 118 deletions(-) diff --git a/app/assets/stylesheets/global-styles/utilities/sizing.scss b/app/assets/stylesheets/global-styles/utilities/sizing.scss index 774ca3600e..2f71d6c2c2 100644 --- a/app/assets/stylesheets/global-styles/utilities/sizing.scss +++ b/app/assets/stylesheets/global-styles/utilities/sizing.scss @@ -8,4 +8,8 @@ .vh-70 { height: 70vh; -} \ No newline at end of file +} + +.vh-80 { + height: 80vh; +} diff --git a/app/assets/stylesheets/legacy/spectra.scss b/app/assets/stylesheets/legacy/spectra.scss index a693ef1af4..027b4d6ca4 100644 --- a/app/assets/stylesheets/legacy/spectra.scss +++ b/app/assets/stylesheets/legacy/spectra.scss @@ -12,22 +12,6 @@ } } -.spectra-editor { - text-align: right; -} - -#ChemSpectra, -#ChemSpectraEditor, -.spectra-editor-title { - margin: 5px 5px 0 5px; - - .txt-spectra-editor-title { - font-size: 22px; - margin: 0 0 0 30px; - } -} - - #ChemSpectra, #ChemSpectraEditor, .spectra-editor-dialog .modal-dialog { @@ -36,17 +20,6 @@ top: 45% !important; width: 98vw !important; - .card-box { - display: -webkit-flex; - display: flex; - -webkit-align-items: center; - align-items: center; - -webkit-justify-content: center; - justify-content: center; - - text-align: center; - } - .txt-sv-panel-head { font-size: 12px !important; font-family: 'Helvetica'!important; diff --git a/app/packs/src/apps/mydb/elements/details/ViewSpectra.js b/app/packs/src/apps/mydb/elements/details/ViewSpectra.js index c03b037337..e650efbd7e 100644 --- a/app/packs/src/apps/mydb/elements/details/ViewSpectra.js +++ b/app/packs/src/apps/mydb/elements/details/ViewSpectra.js @@ -1,7 +1,7 @@ /* eslint-disable react/forbid-prop-types */ import React from 'react'; import { SpectraEditor, FN } from '@complat/react-spectra-editor'; -import { Modal, Button } from 'react-bootstrap'; +import { Alert, Modal, Button } from 'react-bootstrap'; import Select from 'react-select'; import PropTypes from 'prop-types'; import TreeSelect from 'antd/lib/tree-select'; @@ -13,7 +13,6 @@ import SpectraStore from 'src/stores/alt/stores/SpectraStore'; import { SpectraOps } from 'src/utilities/quillToolbarSymbol'; import ResearchPlan from 'src/models/ResearchPlan'; import { inlineNotation } from 'src/utilities/SpectraHelper'; -import Well from 'src/components/legacyBootstrap/Well' const rmRefreshed = (analysis) => { if (!analysis) return analysis; @@ -632,46 +631,42 @@ class ViewSpectra extends React.Component { }; } - renderEmpty() { + renderAlert({icon, title, message, variant}) { const { fetched } = this.state; - const content = fetched - ? ( - - -

No Spectra Found!

-

Please refresh the page!

-
-
Click here to close the window...
-
- ) - : ; - return ( -
- {content} +
+ {fetched ? ( + + + + {title} + +

{message}

+ +
+ ) : ( + + )}
); } - renderInvalid() { - const { fetched } = this.state; - const content = fetched - ? ( - - -

Invalid spectrum!

-

Please delete it and upload a valid file!

-
-
Click here to close the window...
-
- ) - : ; + renderEmpty() { + return this.renderAlert({ + icon: 'fa-exclamation-triangle', + title: 'No Spectra Found!', + message: 'Please refresh the page!', + variant: 'warning', + }); + } - return ( -
- {content} -
- ); + renderInvalid() { + return this.renderAlert({ + icon: 'fa-chain-broken', + title: 'Invalid spectrum!', + message: 'Please delete it and upload a valid file!', + variant: 'danger', + }); } renderSpectraEditor(jcamp, predictions, listMuliSpcs, listEntityFiles) { @@ -708,28 +703,22 @@ class ViewSpectra extends React.Component { predictions, }; - return ( - - { - !isExist && multiEntities.length === 0 - ? this.renderInvalid() - : - } - - ); + return !isExist && multiEntities.length === 0 + ? this.renderInvalid() + : } renderTitle(idx) { @@ -753,11 +742,11 @@ class ViewSpectra extends React.Component { const dsOptions = dses.map((x) => ({ value: x.id, label: x.name })); return ( -
- + + {modalTitle} -
+