diff --git a/web/src/Components/Bridging/BridgeContainer.jsx b/web/src/Components/Bridging/BridgeContainer.jsx index bf6f5f8..ea718e3 100644 --- a/web/src/Components/Bridging/BridgeContainer.jsx +++ b/web/src/Components/Bridging/BridgeContainer.jsx @@ -1,18 +1,20 @@ import React, { useContext, useEffect, useState } from 'react' import styled from 'styled-components' -import { Radio, TextField, Typography } from '@equinor/eds-core-react' +import { Radio, TextField, Typography, Tabs } from '@equinor/eds-core-react' import { FractionsAPI } from '../../Api' -import { BridgingOption, CeramicDiscsValues } from "../../Enums" +import { BridgingOption, CeramicDiscsValues } from '../../Enums' import { AuthContext } from 'react-oauth2-code-pkce' -import BridgeGraph from "./BridgeGraph" -import {Tooltip} from "../Common/Tooltip"; -import {findDValue, findGraphData} from "../../Utils"; +import BridgeGraph from './BridgeGraph' +import { Tooltip } from '../Common/Tooltip' +import { findGraphData } from '../../Utils' import { ErrorToast } from '../Common/Toast' const InputWrapper = styled.div` display: flex; flex-direction: column; - justify-content: space-between; + background-color: white; + border-radius: 4px 0 4px 4px; + padding: 1rem; ` const RadioWrapper = styled.div` @@ -36,25 +38,29 @@ export default ({ bridges, mode, setMode, bridgeValue, setValue }) => { const [bridgeValueHelperText, setBridgeValueHelperText] = useState(undefined) const [bridgeValueVariant, setBridgeValueVariant] = useState(undefined) const [optimalBridgeGraphData, setOptimalBridgeGraphData] = useState([]) - const { token} = useContext(AuthContext) + const { token } = useContext(AuthContext) + const [activeTab, setActiveTab] = useState(1) + const handleChange = index => { + setActiveTab(index) + } // Load size fractions once on first render useEffect(() => { FractionsAPI.getFractionsApi(token) - .then(response => { - setSizeFractions(response.data.size_fractions) - }) - .catch(error => { - ErrorToast(`${error.response.data}`, error.response.status) - console.error('fetch error' + error) - }) + .then(response => { + setSizeFractions(response.data.size_fractions) + }) + .catch(error => { + ErrorToast(`${error.response.data}`, error.response.status) + console.error('fetch error' + error) + }) }, []) useEffect(() => { - if (bridges["Bridge"].length && sizeFractions.length ) { - const x = (findGraphData(sizeFractions, {"Bridge": bridges["Bridge"]})) + if (bridges['Bridge'].length && sizeFractions.length) { + const x = findGraphData(sizeFractions, { Bridge: bridges['Bridge'] }) setOptimalBridgeGraphData(x) - } + } }, [bridges, sizeFractions]) function bridgingOptionChange(event) { @@ -98,75 +104,89 @@ export default ({ bridges, mode, setMode, bridgeValue, setValue }) => { } return ( -
- - Bridging options - Bridging based on: - - +
+ + Bridging options +
Bridging based on:
+ + + + - - - - + + +
+ {mode === BridgingOption.CERAMIC_DISCS ? ( +
+ + onBridgeValueChange(event.target.value)}> + {CeramicDiscsValues.map((value, index) => { + return ( + + ) + })} + + microns +
+ ) : ( + onBridgeValueChange(event.target.value)} + variant={bridgeValueVariant} + helperText={bridgeValueHelperText} /> - -
- {mode === BridgingOption.CERAMIC_DISCS ? -
- - onBridgeValueChange(event.target.value)}> - {CeramicDiscsValues.map((value, index)=>{ - return - })} - - microns -
- : - onBridgeValueChange(event.target.value)} - variant={bridgeValueVariant} - helperText={bridgeValueHelperText} - /> - } - -
- - - {optimalBridgeGraphData.length > 0 &&
-

Optimal bridge:

-

D10: {findDValue(optimalBridgeGraphData, 10, "Bridge")}µ

-

D50: {findDValue(optimalBridgeGraphData, 50, "Bridge")}µ

-

D90: {findDValue(optimalBridgeGraphData, 90, "Bridge")}µ

-
} -
+ )} +
+
+ + + Cumulative + Relative + + + + + + + + + + +
) } diff --git a/web/src/Components/Bridging/BridgeGraph.jsx b/web/src/Components/Bridging/BridgeGraph.jsx index 8acc53b..bdfb3ee 100644 --- a/web/src/Components/Bridging/BridgeGraph.jsx +++ b/web/src/Components/Bridging/BridgeGraph.jsx @@ -73,7 +73,7 @@ export function BridgeGraph({ bridges, sizeFractions }) { }, [bridges, sizeFractions]) return ( -
+
{/* Defines a gradient applied to the areaPlot to highlight selected particle size range*/}