Skip to content

Commit 59d4371

Browse files
authored
Merge pull request #454 from tidepool-org/WEB-3501-range-thresholds
WEB-3501 - Adjust Thresholds for Displayed Ranges
2 parents 782566a + 20f1d2c commit 59d4371

31 files changed

+373
-130
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"node": "20.8.0"
55
},
66
"packageManager": "[email protected]",
7-
"version": "1.46.0-develop.1",
7+
"version": "1.46.0-web-3501-range-thresholds.5",
88
"description": "Tidepool data visualization for diabetes device data.",
99
"keywords": [
1010
"data visualization"

src/components/common/stat/BgBar.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { classifyBgValue } from '../../../utils/bloodglucose';
1111
export const BgBar = props => {
1212
const {
1313
barWidth,
14-
bgPrefs: { bgBounds } = {},
14+
bgPrefs: { bgBounds, bgUnits } = {},
1515
chartLabelWidth,
1616
datum = {},
1717
domain,
@@ -120,7 +120,7 @@ export const BgBar = props => {
120120
x={datumX}
121121
y={datumY}
122122
style={{
123-
fill: colors[classifyBgValue(bgBounds, datum._y)],
123+
fill: colors[classifyBgValue(bgBounds, bgUnits, datum._y, 'threeWay')],
124124
stroke: colors.white,
125125
strokeWidth: 2,
126126
}}
@@ -140,7 +140,7 @@ export const BgBar = props => {
140140
style={{
141141
stroke: 'white',
142142
strokeWidth: 2,
143-
fill: colors[classifyBgValue(bgBounds, _.max([dev1Value, 0.1]))],
143+
fill: colors[classifyBgValue(bgBounds, bgUnits, _.max([dev1Value, 0.1]), 'threeWay')],
144144
}}
145145
/>
146146

@@ -153,7 +153,7 @@ export const BgBar = props => {
153153
style={{
154154
stroke: 'white',
155155
strokeWidth: 2,
156-
fill: colors[classifyBgValue(bgBounds, dev2Value)],
156+
fill: colors[classifyBgValue(bgBounds, bgUnits, dev2Value, 'threeWay')],
157157
}}
158158
/>
159159
</g>

src/components/daily/cbgtooltip/CBGTooltip.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class CBGTooltip extends PureComponent {
5353
if (!_.isEmpty(outOfRangeMessage)) {
5454
const bgClass = classifyBgValue(
5555
reshapeBgClassesToBgBounds(this.props.bgPrefs),
56+
this.props.bgPrefs.bgUnits,
5657
this.props.cbg.value,
5758
'fiveWay'
5859
);
@@ -76,6 +77,7 @@ class CBGTooltip extends PureComponent {
7677
render() {
7778
const bgClass = classifyBgValue(
7879
reshapeBgClassesToBgBounds(this.props.bgPrefs),
80+
this.props.bgPrefs.bgUnits,
7981
this.props.cbg.value,
8082
'fiveWay'
8183
);

src/components/daily/smbgtooltip/SMBGTooltip.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class SMBGTooltip extends PureComponent {
6969
if (!_.isEmpty(outOfRangeMessage)) {
7070
const bgClass = classifyBgValue(
7171
reshapeBgClassesToBgBounds(this.props.bgPrefs),
72+
this.props.bgPrefs.bgUnits,
7273
this.props.smbg.value,
7374
'fiveWay'
7475
);
@@ -92,6 +93,7 @@ class SMBGTooltip extends PureComponent {
9293
render() {
9394
const bgClass = classifyBgValue(
9495
reshapeBgClassesToBgBounds(this.props.bgPrefs),
96+
this.props.bgPrefs.bgUnits,
9597
this.props.smbg.value,
9698
'fiveWay'
9799
);

src/components/trends/cbg/CBGDateTraceAnimated.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export class CBGDateTraceAnimated extends PureComponent {
2121
targetLowerBound: PropTypes.number.isRequired,
2222
veryLowThreshold: PropTypes.number.isRequired,
2323
}).isRequired,
24+
bgUnits: PropTypes.string.isRequired,
2425
cbgRadius: PropTypes.number.isRequired,
2526
data: PropTypes.arrayOf(PropTypes.shape({
2627
// here only documenting the properties we actually use rather than the *whole* data model!
@@ -71,12 +72,13 @@ export class CBGDateTraceAnimated extends PureComponent {
7172
}
7273

7374
render() {
74-
const { bgBounds, cbgRadius, data, date, topMargin, xScale, yScale } = this.props;
75+
const { bgBounds, bgUnits, cbgRadius, data, date, topMargin, xScale, yScale } = this.props;
76+
7577
return (
7678
<g id={`cbgDateTrace-${date}`}>
7779
{_.map(data, (d) => (
7880
<circle
79-
className={styles[classifyBgValue(bgBounds, d.value, 'fiveWay')]}
81+
className={styles[classifyBgValue(bgBounds, bgUnits, d.value, 'fiveWay')]}
8082
cx={xScale(d.msPer24)}
8183
cy={yScale(d.value)}
8284
id={`cbgCircle-${d.id}`}

src/components/trends/cbg/CBGDateTracesAnimationContainer.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ import TransitionGroupPlus from 'react-transition-group-plus';
66
import CBGDateTraceAnimated from './CBGDateTraceAnimated';
77

88
const CBGDateTracesAnimationContainer = (props) => {
9-
const { bgBounds, data, dates, topMargin, xScale, yScale } = props;
9+
const { bgBounds, bgUnits, data, dates, topMargin, xScale, yScale } = props;
1010
return (
1111
<TransitionGroupPlus component="g" id="cbgDateTraces" transitionMode="simultaneous">
1212
{_.map(dates, (localDate) => (
1313
<CBGDateTraceAnimated
1414
bgBounds={bgBounds}
15+
bgUnits={bgUnits}
1516
data={data[localDate]}
1617
date={localDate}
1718
focusDateTrace={props.focusCbgDateTrace}

src/components/trends/cbg/CBGMedianAnimated.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export class CBGMedianAnimated extends PureComponent {
2222
targetLowerBound: PropTypes.number.isRequired,
2323
veryLowThreshold: PropTypes.number.isRequired,
2424
}).isRequired,
25+
bgUnits: PropTypes.string.isRequired,
2526
datum: PropTypes.shape({
2627
firstQuartile: PropTypes.number,
2728
id: PropTypes.string.isRequired,
@@ -73,6 +74,7 @@ export class CBGMedianAnimated extends PureComponent {
7374
render() {
7475
const {
7576
bgBounds,
77+
bgUnits,
7678
datum,
7779
defaultY,
7880
displayingMedian,
@@ -85,8 +87,8 @@ export class CBGMedianAnimated extends PureComponent {
8587
const medianClasses = datum.median ?
8688
cx({
8789
[styles.median]: true,
88-
[styles[`${classifyBgValue(bgBounds, datum.median, 'fiveWay')}FadeIn`]]: !showingCbgDateTraces,
89-
[styles[`${classifyBgValue(bgBounds, datum.median, 'fiveWay')}FadeOut`]]: showingCbgDateTraces,
90+
[styles[`${classifyBgValue(bgBounds, bgUnits, datum.median, 'fiveWay')}FadeIn`]]: !showingCbgDateTraces,
91+
[styles[`${classifyBgValue(bgBounds, bgUnits, datum.median, 'fiveWay')}FadeOut`]]: showingCbgDateTraces,
9092
}) :
9193
cx({
9294
[styles.median]: true,

src/components/trends/cbg/CBGSlicesContainer.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export default class CBGSlicesContainer extends PureComponent {
1515
targetLowerBound: PropTypes.number.isRequired,
1616
veryLowThreshold: PropTypes.number.isRequired,
1717
}).isRequired,
18+
bgUnits: PropTypes.string.isRequired,
1819
binSize: PropTypes.number.isRequired,
1920
sliceWidth: PropTypes.number.isRequired,
2021
data: PropTypes.arrayOf(PropTypes.shape({
@@ -85,6 +86,7 @@ export default class CBGSlicesContainer extends PureComponent {
8586
/>
8687
<CBGMedianAnimated
8788
bgBounds={this.props.bgBounds}
89+
bgUnits={this.props.bgUnits}
8890
datum={bin}
8991
displayingMedian={this.props.displayFlags.cbgMedianEnabled}
9092
showingCbgDateTraces={this.props.showingCbgDateTraces}

src/components/trends/common/TrendsSVGContainer.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ export class TrendsSVGContainer extends PureComponent {
141141
return (
142142
<SMBGRangeAvgContainer
143143
bgBounds={this.props.bgPrefs.bgBounds}
144+
bgUnits={this.props.bgPrefs.bgUnits}
144145
data={data}
145146
focusSmbgRange={this.props.focusSmbgRange}
146147
unfocusSmbgRange={this.props.unfocusSmbgRange}
@@ -160,6 +161,7 @@ export class TrendsSVGContainer extends PureComponent {
160161
const slices = (
161162
<CBGSlicesContainer
162163
bgBounds={this.props.bgPrefs.bgBounds}
164+
bgUnits={this.props.bgPrefs.bgUnits}
163165
sliceWidth={this.state.chartWidth / 56}
164166
data={this.props.cbgData}
165167
displayFlags={this.props.displayFlags}
@@ -177,6 +179,7 @@ export class TrendsSVGContainer extends PureComponent {
177179
const dateTraces = (
178180
<CBGDateTracesAnimationContainer
179181
bgBounds={this.props.bgPrefs.bgBounds}
182+
bgUnits={this.props.bgPrefs.bgUnits}
180183
data={focusedSegmentDataGroupedByDate}
181184
dates={_.keys(focusedSegmentDataGroupedByDate) || []}
182185
focusCbgDateTrace={this.props.focusCbgDateTrace}
@@ -217,6 +220,7 @@ export class TrendsSVGContainer extends PureComponent {
217220
<SMBGsByDateContainer
218221
anSmbgRangeAvgIsFocused={this.props.focusedSmbgRangeAvg !== null}
219222
bgBounds={this.props.bgPrefs.bgBounds}
223+
bgUnits={this.props.bgPrefs.bgUnits}
220224
data={this.props.smbgData}
221225
dates={this.props.dates}
222226
focusSmbg={this.props.focusSmbg}
@@ -239,6 +243,7 @@ export class TrendsSVGContainer extends PureComponent {
239243
<SMBGsByDateContainer
240244
anSmbgRangeAvgIsFocused={false}
241245
bgBounds={this.props.bgPrefs.bgBounds}
246+
bgUnits={this.props.bgPrefs.bgUnits}
242247
data={this.props.focusedSmbg.allSmbgsOnDate}
243248
dates={[this.props.focusedSmbg.date]}
244249
focusSmbg={this.props.focusSmbg}

src/components/trends/smbg/SMBGDatePointsAnimated.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ export class SMBGDatePointsAnimated extends PureComponent {
122122
const {
123123
anSmbgRangeAvgIsFocused,
124124
bgBounds,
125+
bgUnits,
125126
data,
126127
date,
127128
focusSmbg,
@@ -151,7 +152,7 @@ export class SMBGDatePointsAnimated extends PureComponent {
151152
return {
152153
key: smbg.id,
153154
data: {
154-
classes: styles[classifyBgValue(bgBounds, smbg.value, 'fiveWay')],
155+
classes: styles[classifyBgValue(bgBounds, bgUnits, smbg.value, 'fiveWay')],
155156
position,
156157
smbg,
157158
},

0 commit comments

Comments
 (0)