dce-reactkit 1.0.20 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +95 -0
- package/lib/components/LoadingSpinner.d.ts +6 -0
- package/lib/components/LoadingSpinner.js +41 -0
- package/lib/components/LoadingSpinner.js.map +1 -0
- package/lib/components/Modal.d.ts +69 -0
- package/lib/components/Modal.js +315 -0
- package/lib/components/Modal.js.map +1 -0
- package/lib/errors/ErrorWithCode.d.ts +9 -0
- package/lib/errors/ErrorWithCode.js +33 -0
- package/lib/errors/ErrorWithCode.js.map +1 -0
- package/lib/helpers/abbreviate.d.ts +9 -0
- package/lib/helpers/abbreviate.js +21 -0
- package/lib/helpers/abbreviate.js.map +1 -0
- package/lib/helpers/avg.d.ts +8 -0
- package/lib/helpers/avg.js +24 -0
- package/lib/helpers/avg.js.map +1 -0
- package/lib/helpers/ceilToNumDecimals.d.ts +9 -0
- package/lib/helpers/ceilToNumDecimals.js +15 -0
- package/lib/helpers/ceilToNumDecimals.js.map +1 -0
- package/lib/helpers/floorToNumDecimals.d.ts +9 -0
- package/lib/helpers/floorToNumDecimals.js +15 -0
- package/lib/helpers/floorToNumDecimals.js.map +1 -0
- package/lib/helpers/forceNumIntoBounds.d.ts +10 -0
- package/lib/helpers/forceNumIntoBounds.js +15 -0
- package/lib/helpers/forceNumIntoBounds.js.map +1 -0
- package/lib/helpers/padDecimalZeros.d.ts +10 -0
- package/lib/helpers/padDecimalZeros.js +30 -0
- package/lib/helpers/padDecimalZeros.js.map +1 -0
- package/lib/helpers/padZerosLeft.d.ts +9 -0
- package/lib/helpers/padZerosLeft.js +21 -0
- package/lib/helpers/padZerosLeft.js.map +1 -0
- package/lib/helpers/roundToNumDecimals.d.ts +9 -0
- package/lib/helpers/roundToNumDecimals.js +15 -0
- package/lib/helpers/roundToNumDecimals.js.map +1 -0
- package/lib/helpers/sum.d.ts +8 -0
- package/lib/helpers/sum.js +15 -0
- package/lib/helpers/sum.js.map +1 -0
- package/lib/helpers/visitServerEndpoint.d.ts +17 -0
- package/lib/helpers/visitServerEndpoint.js +84 -0
- package/lib/helpers/visitServerEndpoint.js.map +1 -0
- package/lib/helpers/waitMs.d.ts +7 -0
- package/lib/helpers/waitMs.js +55 -0
- package/lib/helpers/waitMs.js.map +1 -0
- package/lib/types/ReactKitErrorCode.d.ts +9 -0
- package/lib/types/ReactKitErrorCode.js +14 -0
- package/lib/types/ReactKitErrorCode.js.map +1 -0
- package/lib/types/Variant.d.ts +15 -0
- package/lib/types/Variant.js +19 -0
- package/lib/types/Variant.js.map +1 -0
- package/package.json +22 -40
- package/src/components/LoadingSpinner.tsx +105 -0
- package/src/components/Modal.tsx +447 -0
- package/src/errors/ErrorWithCode.tsx +15 -0
- package/src/helpers/abbreviate.tsx +23 -0
- package/src/helpers/avg.tsx +22 -0
- package/src/helpers/ceilToNumDecimals.tsx +13 -0
- package/src/helpers/floorToNumDecimals.tsx +13 -0
- package/src/helpers/forceNumIntoBounds.tsx +19 -0
- package/src/helpers/padDecimalZeros.tsx +32 -0
- package/src/helpers/padZerosLeft.tsx +21 -0
- package/src/helpers/roundToNumDecimals.tsx +13 -0
- package/src/helpers/sum.tsx +16 -0
- package/src/helpers/visitServerEndpoint.tsx +59 -0
- package/src/helpers/waitMs.tsx +12 -0
- package/src/types/ReactKitErrorCode.tsx +12 -0
- package/src/types/Variant.tsx +16 -0
- package/tsconfig.json +24 -0
- package/index.js +0 -1
- package/lib/Bar.js +0 -169
- package/lib/Donut.js +0 -145
- package/lib/DownloadButton.js +0 -81
- package/lib/Histogram.js +0 -193
- package/lib/Scatter.js +0 -162
- package/lib/StackedBar.js +0 -243
- package/lib/common/chart/Holder/index.js +0 -182
- package/lib/common/chart/Holder/style.css +0 -41
- package/lib/common/chart/colors.js +0 -12
- package/lib/common/csvToString.js +0 -23
- package/lib/common/isFloat.js +0 -14
- package/lib/common/isInteger.js +0 -24
- package/lib/common/math.js +0 -21
- package/lib/common/validators.js +0 -18
- package/lib/glyph/Adjust.js +0 -13
- package/lib/glyph/Angle.js +0 -44
- package/lib/glyph/Archive.js +0 -13
- package/lib/glyph/Arrow.js +0 -49
- package/lib/glyph/ArrowsHorizontal.js +0 -13
- package/lib/glyph/ArrowsVertical.js +0 -13
- package/lib/glyph/Award.js +0 -13
- package/lib/glyph/Ban.js +0 -13
- package/lib/glyph/Barcode.js +0 -13
- package/lib/glyph/Bed.js +0 -13
- package/lib/glyph/Bell.js +0 -35
- package/lib/glyph/Bolt.js +0 -13
- package/lib/glyph/Bookmark.js +0 -37
- package/lib/glyph/Bug.js +0 -13
- package/lib/glyph/Calendar.js +0 -13
- package/lib/glyph/Check.js +0 -36
- package/lib/glyph/Checkbox.js +0 -40
- package/lib/glyph/Chevron.js +0 -63
- package/lib/glyph/Circle.js +0 -15
- package/lib/glyph/Cog.js +0 -13
- package/lib/glyph/DoubleAngle.js +0 -45
- package/lib/glyph/Download.js +0 -13
- package/lib/glyph/Ellipsis.js +0 -36
- package/lib/glyph/Envelope.js +0 -13
- package/lib/glyph/File.js +0 -37
- package/lib/glyph/IdCard.js +0 -13
- package/lib/glyph/Menu.js +0 -13
- package/lib/glyph/Minus.js +0 -13
- package/lib/glyph/Move.js +0 -13
- package/lib/glyph/Plus.js +0 -13
- package/lib/glyph/Square.js +0 -47
- package/lib/glyph/Teacher.js +0 -13
- package/lib/glyph/TextAlign.js +0 -53
- package/lib/glyph/Times.js +0 -36
- package/lib/glyph/WarningTriangle.js +0 -13
- package/lib/index.js +0 -1
- package/src-old/common/csvToString.js +0 -5
- package/src-old/common/isFloat.js +0 -3
- package/src-old/common/isInteger.js +0 -14
- package/src-old/common/math.js +0 -16
- package/src-old/common/validators.js +0 -14
- package/src-old/components/Alert.js +0 -79
- package/src-old/components/Button.js +0 -64
- package/src-old/components/CSV/autoMatch.js +0 -174
- package/src-old/components/CSV/getNumCols.js +0 -15
- package/src-old/components/CSV/index.js +0 -743
- package/src-old/components/Card.js +0 -64
- package/src-old/components/Chart/Bar.js +0 -169
- package/src-old/components/Chart/Donut.js +0 -160
- package/src-old/components/Chart/Histogram.js +0 -189
- package/src-old/components/Chart/Scatter.js +0 -162
- package/src-old/components/Chart/colors.js +0 -20
- package/src-old/components/Checkbox/index.js +0 -106
- package/src-old/components/Checkbox/style.css +0 -11
- package/src-old/components/DatePicker.js +0 -59
- package/src-old/components/DownloadButton.js +0 -72
- package/src-old/components/Dropdown.js +0 -120
- package/src-old/components/Layout/LeftAddon.js +0 -63
- package/src-old/components/Layout/RightAddon.js +0 -64
- package/src-old/components/Layout/TwoCol.js +0 -67
- package/src-old/components/Modal.js +0 -161
- package/src-old/components/PhotoRoster.js +0 -152
- package/src-old/components/Pills.js +0 -117
- package/src-old/components/Radio.js +0 -94
- package/src-old/components/Splash/Error.js +0 -62
- package/src-old/components/Splash/Load/index.js +0 -32
- package/src-old/components/Splash/Load/style.css +0 -51
- package/src-old/components/Stat/General.js +0 -252
- package/src-old/components/Stat/helpers/calcAverage.js +0 -20
- package/src-old/components/Stat/helpers/calcExtremes.js +0 -27
- package/src-old/components/Stat/helpers/calcMedian.js +0 -32
- package/src-old/components/Stat/helpers/calcStdDev.js +0 -30
- package/src-old/components/Stat/helpers/calcSum.js +0 -8
- package/src-old/components/UserProfile/index.js +0 -151
- package/src-old/components/UserProfile/style.css +0 -33
- package/src-old/components/Well.js +0 -28
- package/src-old/components/Wizard/Question/CSV.js +0 -307
- package/src-old/components/Wizard/Question/Chooser/Assignment.js +0 -108
- package/src-old/components/Wizard/Question/Chooser/Course.js +0 -214
- package/src-old/components/Wizard/Question/Chooser/helpers/divideIntoSections.js +0 -16
- package/src-old/components/Wizard/Question/Chooser/helpers/genGetItemsPromise.js +0 -20
- package/src-old/components/Wizard/Question/Chooser/helpers/preprocessSections.js +0 -36
- package/src-old/components/Wizard/Question/Chooser/index.js +0 -306
- package/src-old/components/Wizard/Question/Form/Field/CheckableItem.js +0 -155
- package/src-old/components/Wizard/Question/Form/Field/Input.js +0 -149
- package/src-old/components/Wizard/Question/Form/Field/NumberItem.js +0 -374
- package/src-old/components/Wizard/Question/Form/Field/index.js +0 -34
- package/src-old/components/Wizard/Question/Form/Field/readme.md +0 -7
- package/src-old/components/Wizard/Question/Form/index.js +0 -175
- package/src-old/components/Wizard/Question/Form/style.css +0 -3
- package/src-old/components/Wizard/Question/OneButton.js +0 -80
- package/src-old/components/Wizard/Question/index.js +0 -46
- package/src-old/components/Wizard/Question/readme.md +0 -10
- package/src-old/components/Wizard/QuestionGroup/AnswerAll.js +0 -126
- package/src-old/components/Wizard/QuestionGroup/AnswerAny.js +0 -60
- package/src-old/components/Wizard/index.js +0 -233
- package/src-old/components/Wizard/style.css +0 -21
- package/src-old/glyphs/Adjust.js +0 -13
- package/src-old/glyphs/Angle.js +0 -57
- package/src-old/glyphs/Archive.js +0 -13
- package/src-old/glyphs/Arrow.js +0 -85
- package/src-old/glyphs/ArrowsHorizontal.js +0 -13
- package/src-old/glyphs/ArrowsVertical.js +0 -13
- package/src-old/glyphs/Award.js +0 -13
- package/src-old/glyphs/Ban.js +0 -13
- package/src-old/glyphs/Barcode.js +0 -13
- package/src-old/glyphs/Bed.js +0 -13
- package/src-old/glyphs/Bell.js +0 -34
- package/src-old/glyphs/Bolt.js +0 -13
- package/src-old/glyphs/Bookmark.js +0 -36
- package/src-old/glyphs/Bug.js +0 -13
- package/src-old/glyphs/Calendar.js +0 -13
- package/src-old/glyphs/Check.js +0 -34
- package/src-old/glyphs/Checkbox.js +0 -42
- package/src-old/glyphs/Chevron.js +0 -88
- package/src-old/glyphs/Circle.js +0 -16
- package/src-old/glyphs/Cog.js +0 -13
- package/src-old/glyphs/DoubleAngle.js +0 -58
- package/src-old/glyphs/Download.js +0 -13
- package/src-old/glyphs/Ellipsis.js +0 -35
- package/src-old/glyphs/Envelope.js +0 -13
- package/src-old/glyphs/File.js +0 -40
- package/src-old/glyphs/IdCard.js +0 -13
- package/src-old/glyphs/Menu.js +0 -13
- package/src-old/glyphs/Minus.js +0 -13
- package/src-old/glyphs/Move.js +0 -13
- package/src-old/glyphs/Plus.js +0 -13
- package/src-old/glyphs/Square.js +0 -48
- package/src-old/glyphs/Teacher.js +0 -13
- package/src-old/glyphs/TextAlign.js +0 -58
- package/src-old/glyphs/Times.js +0 -34
- package/src-old/glyphs/WarningTriangle.js +0 -13
- package/src-old/index.js +0 -1
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
.container {
|
|
2
|
-
/* Loading splash container */
|
|
3
|
-
text-align: center;
|
|
4
|
-
padding-top: 50px;
|
|
5
|
-
padding-bottom: 50px;
|
|
6
|
-
|
|
7
|
-
/* Circle size */
|
|
8
|
-
font-size: 25px;
|
|
9
|
-
color: #4aa0b5;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/* Add animation to every circle */
|
|
13
|
-
.circle-1,.circle-2,.circle-3,.circle-4 {
|
|
14
|
-
animation: pulse 1.5s infinite;
|
|
15
|
-
-webkit-animation: pulse 1.5s infinite;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/* Delay subsequent circles to give animation movement */
|
|
19
|
-
.circle-2 {
|
|
20
|
-
animation-delay: 0.1s;
|
|
21
|
-
-webkit-animation-delay: 0.1s;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.circle-3 {
|
|
25
|
-
animation-delay: 0.2s;
|
|
26
|
-
-webkit-animation-delay: 0.2s;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.circle-4 {
|
|
30
|
-
animation-delay: 0.3s;
|
|
31
|
-
-webkit-animation-delay: 0.3s;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/* Pulse animation */
|
|
35
|
-
@-webkit-keyframes pulse {
|
|
36
|
-
0% {
|
|
37
|
-
transform: scale(0.9);
|
|
38
|
-
opacity: 1;
|
|
39
|
-
}
|
|
40
|
-
80% {
|
|
41
|
-
transform: scale(0.9);
|
|
42
|
-
}
|
|
43
|
-
90% {
|
|
44
|
-
transform: scale(1.5);
|
|
45
|
-
opacity: 0.5;
|
|
46
|
-
}
|
|
47
|
-
100% {
|
|
48
|
-
transform: scale(0.9);
|
|
49
|
-
opacity: 1;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
// Import bootstrap components
|
|
5
|
-
import { ListGroup, ListGroupItem } from 'reactstrap';
|
|
6
|
-
// Import bootstrap stylesheet
|
|
7
|
-
import 'bootstrap/dist/css/bootstrap.min.css';
|
|
8
|
-
|
|
9
|
-
// Import other components
|
|
10
|
-
import Well from '../Well';
|
|
11
|
-
import TwoCol from '../Layout/TwoCol';
|
|
12
|
-
import Radio from '../Radio';
|
|
13
|
-
|
|
14
|
-
// Helpers
|
|
15
|
-
import calcAverage from './helpers/calcAverage';
|
|
16
|
-
import calcExtremes from './helpers/calcExtremes';
|
|
17
|
-
import calcMedian from './helpers/calcMedian';
|
|
18
|
-
import calcStdDev from './helpers/calcStdDev';
|
|
19
|
-
|
|
20
|
-
class General extends Component {
|
|
21
|
-
constructor(props) {
|
|
22
|
-
super(props);
|
|
23
|
-
|
|
24
|
-
// Deconstruct props
|
|
25
|
-
const { data } = this.props;
|
|
26
|
-
|
|
27
|
-
// Show error if no data
|
|
28
|
-
if (!data || data.length === 0) {
|
|
29
|
-
this.state = {
|
|
30
|
-
error: 'We can\'t calculate these stats because we have no data.',
|
|
31
|
-
};
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// Calculate stats with and without zeros
|
|
36
|
-
const dataWithoutZeros = data.filter((x) => {
|
|
37
|
-
return x !== 0;
|
|
38
|
-
});
|
|
39
|
-
const showToggle = dataWithoutZeros.length !== data.length;
|
|
40
|
-
|
|
41
|
-
const [
|
|
42
|
-
statsWithZeros,
|
|
43
|
-
statsWithoutZeros,
|
|
44
|
-
] = [data, dataWithoutZeros].map((currentData) => {
|
|
45
|
-
const {
|
|
46
|
-
low,
|
|
47
|
-
high,
|
|
48
|
-
} = calcExtremes(currentData);
|
|
49
|
-
const average = calcAverage(currentData);
|
|
50
|
-
const stdDev = calcStdDev(currentData);
|
|
51
|
-
const median = calcMedian(currentData);
|
|
52
|
-
|
|
53
|
-
return {
|
|
54
|
-
low,
|
|
55
|
-
high,
|
|
56
|
-
average,
|
|
57
|
-
stdDev,
|
|
58
|
-
median,
|
|
59
|
-
numItems: currentData.length,
|
|
60
|
-
};
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
this.state = {
|
|
64
|
-
statsWithZeros,
|
|
65
|
-
statsWithoutZeros,
|
|
66
|
-
showToggle,
|
|
67
|
-
displayingStatsWithZeros: true,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
render() {
|
|
72
|
-
// Deconstruct props
|
|
73
|
-
const {
|
|
74
|
-
title,
|
|
75
|
-
numDecimals,
|
|
76
|
-
} = this.props;
|
|
77
|
-
|
|
78
|
-
// Deconstruct state
|
|
79
|
-
const {
|
|
80
|
-
error,
|
|
81
|
-
showToggle,
|
|
82
|
-
statsWithZeros,
|
|
83
|
-
statsWithoutZeros,
|
|
84
|
-
displayingStatsWithZeros,
|
|
85
|
-
} = this.state;
|
|
86
|
-
|
|
87
|
-
// Display error
|
|
88
|
-
if (error) {
|
|
89
|
-
return (
|
|
90
|
-
<Well>
|
|
91
|
-
{title && (
|
|
92
|
-
<h3>{title}</h3>
|
|
93
|
-
)}
|
|
94
|
-
<div>
|
|
95
|
-
{error}
|
|
96
|
-
</div>
|
|
97
|
-
</Well>
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// Create toggle switch
|
|
102
|
-
let toggle;
|
|
103
|
-
if (showToggle) {
|
|
104
|
-
toggle = (
|
|
105
|
-
<div className="text-center mb-2">
|
|
106
|
-
<Radio
|
|
107
|
-
items={[
|
|
108
|
-
'Include Zeros',
|
|
109
|
-
'Exclude Zeros',
|
|
110
|
-
]}
|
|
111
|
-
initialSelectedIndex={0}
|
|
112
|
-
color="info"
|
|
113
|
-
onChange={(option, index) => {
|
|
114
|
-
this.setState({
|
|
115
|
-
displayingStatsWithZeros: (index === 0),
|
|
116
|
-
});
|
|
117
|
-
}}
|
|
118
|
-
/>
|
|
119
|
-
</div>
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// Get current stats
|
|
124
|
-
const {
|
|
125
|
-
low,
|
|
126
|
-
high,
|
|
127
|
-
average,
|
|
128
|
-
median,
|
|
129
|
-
stdDev,
|
|
130
|
-
numItems,
|
|
131
|
-
} = (
|
|
132
|
-
displayingStatsWithZeros
|
|
133
|
-
? statsWithZeros
|
|
134
|
-
: statsWithoutZeros
|
|
135
|
-
);
|
|
136
|
-
|
|
137
|
-
return (
|
|
138
|
-
<Well>
|
|
139
|
-
{title && (
|
|
140
|
-
<h3 className="text-center mb-2">
|
|
141
|
-
{title}
|
|
142
|
-
</h3>
|
|
143
|
-
)}
|
|
144
|
-
{toggle}
|
|
145
|
-
<TwoCol>
|
|
146
|
-
<ListGroup>
|
|
147
|
-
<ListGroupItem>
|
|
148
|
-
<TwoCol
|
|
149
|
-
col1Align="right"
|
|
150
|
-
col2Align="left"
|
|
151
|
-
>
|
|
152
|
-
<div>
|
|
153
|
-
<strong>Average:</strong>
|
|
154
|
-
</div>
|
|
155
|
-
<div>
|
|
156
|
-
{average.toFixed(numDecimals)}
|
|
157
|
-
</div>
|
|
158
|
-
</TwoCol>
|
|
159
|
-
</ListGroupItem>
|
|
160
|
-
<ListGroupItem>
|
|
161
|
-
<TwoCol
|
|
162
|
-
col1Align="right"
|
|
163
|
-
col2Align="left"
|
|
164
|
-
>
|
|
165
|
-
<div>
|
|
166
|
-
<strong>Median:</strong>
|
|
167
|
-
</div>
|
|
168
|
-
<div>
|
|
169
|
-
{median.toFixed(numDecimals)}
|
|
170
|
-
</div>
|
|
171
|
-
</TwoCol>
|
|
172
|
-
</ListGroupItem>
|
|
173
|
-
<ListGroupItem>
|
|
174
|
-
<TwoCol
|
|
175
|
-
col1Align="right"
|
|
176
|
-
col2Align="left"
|
|
177
|
-
>
|
|
178
|
-
<div>
|
|
179
|
-
<strong>Standard Dev:</strong>
|
|
180
|
-
</div>
|
|
181
|
-
<div>
|
|
182
|
-
{stdDev.toFixed(numDecimals)}
|
|
183
|
-
</div>
|
|
184
|
-
</TwoCol>
|
|
185
|
-
</ListGroupItem>
|
|
186
|
-
</ListGroup>
|
|
187
|
-
<ListGroup>
|
|
188
|
-
<ListGroupItem>
|
|
189
|
-
<TwoCol
|
|
190
|
-
col1Align="right"
|
|
191
|
-
col2Align="left"
|
|
192
|
-
>
|
|
193
|
-
<div>
|
|
194
|
-
<strong>High:</strong>
|
|
195
|
-
</div>
|
|
196
|
-
<div>
|
|
197
|
-
{high.toFixed(numDecimals)}
|
|
198
|
-
</div>
|
|
199
|
-
</TwoCol>
|
|
200
|
-
</ListGroupItem>
|
|
201
|
-
<ListGroupItem>
|
|
202
|
-
<TwoCol
|
|
203
|
-
col1Align="right"
|
|
204
|
-
col2Align="left"
|
|
205
|
-
>
|
|
206
|
-
<div>
|
|
207
|
-
<strong>
|
|
208
|
-
Low:
|
|
209
|
-
</strong>
|
|
210
|
-
</div>
|
|
211
|
-
<div>
|
|
212
|
-
{low.toFixed(numDecimals)}
|
|
213
|
-
</div>
|
|
214
|
-
</TwoCol>
|
|
215
|
-
</ListGroupItem>
|
|
216
|
-
<ListGroupItem>
|
|
217
|
-
<TwoCol
|
|
218
|
-
col1Align="right"
|
|
219
|
-
col2Align="left"
|
|
220
|
-
>
|
|
221
|
-
<div>
|
|
222
|
-
<strong>
|
|
223
|
-
Num Items:
|
|
224
|
-
</strong>
|
|
225
|
-
</div>
|
|
226
|
-
<div>
|
|
227
|
-
{numItems}
|
|
228
|
-
</div>
|
|
229
|
-
</TwoCol>
|
|
230
|
-
</ListGroupItem>
|
|
231
|
-
</ListGroup>
|
|
232
|
-
</TwoCol>
|
|
233
|
-
</Well>
|
|
234
|
-
);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
General.propTypes = {
|
|
239
|
-
// Title of the chart
|
|
240
|
-
title: PropTypes.string,
|
|
241
|
-
// The data
|
|
242
|
-
data: PropTypes.arrayOf(PropTypes.number).isRequired,
|
|
243
|
-
// The number of decimals
|
|
244
|
-
numDecimals: PropTypes.number,
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
General.defaultProps = {
|
|
248
|
-
title: null,
|
|
249
|
-
numDecimals: 2,
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
export default General;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// Import math
|
|
2
|
-
import math from '../../../common/math';
|
|
3
|
-
|
|
4
|
-
// Import other helpers
|
|
5
|
-
import calcSum from './calcSum';
|
|
6
|
-
|
|
7
|
-
export default (data) => {
|
|
8
|
-
// No data
|
|
9
|
-
if (
|
|
10
|
-
!data
|
|
11
|
-
|| data.length === 0
|
|
12
|
-
) {
|
|
13
|
-
return 0;
|
|
14
|
-
}
|
|
15
|
-
// Only one element
|
|
16
|
-
if (data.length === 1) {
|
|
17
|
-
return data[0];
|
|
18
|
-
}
|
|
19
|
-
return math.div(calcSum(data), data.length);
|
|
20
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export default (data) => {
|
|
2
|
-
let low;
|
|
3
|
-
let lowNonzero;
|
|
4
|
-
let high;
|
|
5
|
-
data.forEach((x) => {
|
|
6
|
-
// Low
|
|
7
|
-
if (low === undefined || x < low) {
|
|
8
|
-
low = x;
|
|
9
|
-
}
|
|
10
|
-
// Low (nonzero)
|
|
11
|
-
if (
|
|
12
|
-
(lowNonzero === undefined || x < lowNonzero)
|
|
13
|
-
&& x !== 0
|
|
14
|
-
) {
|
|
15
|
-
lowNonzero = x;
|
|
16
|
-
}
|
|
17
|
-
// High
|
|
18
|
-
if (high === undefined || x > high) {
|
|
19
|
-
high = x;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
return {
|
|
23
|
-
low,
|
|
24
|
-
lowNonzero,
|
|
25
|
-
high,
|
|
26
|
-
};
|
|
27
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// Import math
|
|
2
|
-
import math from '../../../common/math';
|
|
3
|
-
|
|
4
|
-
export default (data) => {
|
|
5
|
-
// No data
|
|
6
|
-
if (
|
|
7
|
-
!data
|
|
8
|
-
|| data.length === 0
|
|
9
|
-
) {
|
|
10
|
-
return 0;
|
|
11
|
-
}
|
|
12
|
-
// Only one element
|
|
13
|
-
if (data.length === 1) {
|
|
14
|
-
return data[0];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const sortedData = data;
|
|
18
|
-
sortedData.sort();
|
|
19
|
-
|
|
20
|
-
// Find middle index
|
|
21
|
-
const middleIndex = Math.floor(math.div(data.length, 2));
|
|
22
|
-
const evenNumElems = (data.length % 2 === 0);
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
evenNumElems
|
|
26
|
-
? math.div(
|
|
27
|
-
math.add(sortedData[middleIndex], sortedData[middleIndex - 1]),
|
|
28
|
-
2
|
|
29
|
-
)
|
|
30
|
-
: sortedData[middleIndex]
|
|
31
|
-
);
|
|
32
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// Import math
|
|
2
|
-
import math from '../../../common/math';
|
|
3
|
-
|
|
4
|
-
// Import other helpers
|
|
5
|
-
import calcAverage from './calcAverage';
|
|
6
|
-
|
|
7
|
-
export default (data) => {
|
|
8
|
-
// No data
|
|
9
|
-
if (
|
|
10
|
-
!data
|
|
11
|
-
|| data.length <= 1
|
|
12
|
-
) {
|
|
13
|
-
return 0;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// Get average
|
|
17
|
-
const average = calcAverage(data);
|
|
18
|
-
|
|
19
|
-
// Get squared diffs
|
|
20
|
-
const squaredDiffs = data.map((x) => {
|
|
21
|
-
const diff = math.sub(x, average);
|
|
22
|
-
return math.mult(diff, diff);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
// Get average of squared diffs
|
|
26
|
-
const avgSquaredDiff = calcAverage(squaredDiffs);
|
|
27
|
-
|
|
28
|
-
// Get square root of squared diff
|
|
29
|
-
return Math.sqrt(avgSquaredDiff);
|
|
30
|
-
};
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
// Import custom styles
|
|
5
|
-
import './style.css';
|
|
6
|
-
|
|
7
|
-
// Import bootstrap stylesheet
|
|
8
|
-
import 'bootstrap/dist/css/bootstrap.min.css';
|
|
9
|
-
|
|
10
|
-
// Import other components
|
|
11
|
-
import Alert from '../Alert';
|
|
12
|
-
|
|
13
|
-
// Import glyphs
|
|
14
|
-
import Envelope from '../../glyphs/Envelope';
|
|
15
|
-
import IdCard from '../../glyphs/IdCard';
|
|
16
|
-
|
|
17
|
-
class UserProfile extends Component {
|
|
18
|
-
render() {
|
|
19
|
-
// Deconstruct props
|
|
20
|
-
const {
|
|
21
|
-
user,
|
|
22
|
-
size,
|
|
23
|
-
color,
|
|
24
|
-
marginLeft,
|
|
25
|
-
marginRight,
|
|
26
|
-
marginTop,
|
|
27
|
-
marginBottom,
|
|
28
|
-
} = this.props;
|
|
29
|
-
|
|
30
|
-
// Deconstruct user information
|
|
31
|
-
const {
|
|
32
|
-
name,
|
|
33
|
-
email,
|
|
34
|
-
} = user;
|
|
35
|
-
const sisUserId = user.sis_user_id;
|
|
36
|
-
const avatarURL = user.avatar_url;
|
|
37
|
-
|
|
38
|
-
// Dynamically size everything
|
|
39
|
-
let wellWidth = '250px';
|
|
40
|
-
let imageHeight = '150px';
|
|
41
|
-
if (size === 'lg') {
|
|
42
|
-
wellWidth = '500px';
|
|
43
|
-
imageHeight = '300px';
|
|
44
|
-
} else if (size === 'sm') {
|
|
45
|
-
wellWidth = '200px';
|
|
46
|
-
imageHeight = '100px';
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Set text color to black if color is light
|
|
50
|
-
const textColor = (
|
|
51
|
-
color === 'light'
|
|
52
|
-
? 'black'
|
|
53
|
-
: undefined
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<Alert
|
|
58
|
-
className="profile-well"
|
|
59
|
-
style={{
|
|
60
|
-
marginRight,
|
|
61
|
-
marginLeft,
|
|
62
|
-
marginTop,
|
|
63
|
-
marginBottom,
|
|
64
|
-
width: wellWidth,
|
|
65
|
-
color: textColor,
|
|
66
|
-
}}
|
|
67
|
-
color={color}
|
|
68
|
-
>
|
|
69
|
-
<img
|
|
70
|
-
className="img-fluid profile-image"
|
|
71
|
-
src={avatarURL}
|
|
72
|
-
alt={`${name}'s profile`}
|
|
73
|
-
style={{
|
|
74
|
-
height: imageHeight,
|
|
75
|
-
}}
|
|
76
|
-
/>
|
|
77
|
-
<div>
|
|
78
|
-
<div>
|
|
79
|
-
<strong>{name}</strong>
|
|
80
|
-
</div>
|
|
81
|
-
<div className="data-container">
|
|
82
|
-
{email && (
|
|
83
|
-
<div
|
|
84
|
-
className="datum-container"
|
|
85
|
-
title={email}
|
|
86
|
-
>
|
|
87
|
-
<div className="icon-container">
|
|
88
|
-
<Envelope />
|
|
89
|
-
</div>
|
|
90
|
-
{email}
|
|
91
|
-
</div>
|
|
92
|
-
)}
|
|
93
|
-
{sisUserId && (
|
|
94
|
-
<div
|
|
95
|
-
className="datum-container"
|
|
96
|
-
title={sisUserId}
|
|
97
|
-
>
|
|
98
|
-
<div className="icon-container">
|
|
99
|
-
<IdCard />
|
|
100
|
-
</div>
|
|
101
|
-
{sisUserId}
|
|
102
|
-
</div>
|
|
103
|
-
)}
|
|
104
|
-
</div>
|
|
105
|
-
</div>
|
|
106
|
-
</Alert>
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
UserProfile.propTypes = {
|
|
112
|
-
/* Canvas user object */
|
|
113
|
-
user: PropTypes.shape({
|
|
114
|
-
name: PropTypes.string.isRequired,
|
|
115
|
-
sis_user_id: PropTypes.string.isRequired,
|
|
116
|
-
avatar_url: PropTypes.string.isRequired,
|
|
117
|
-
email: PropTypes.string.isRequired,
|
|
118
|
-
}).isRequired,
|
|
119
|
-
/* Size of the profile */
|
|
120
|
-
size: PropTypes.string,
|
|
121
|
-
/* Bootstrap color of the background of the profile */
|
|
122
|
-
color: PropTypes.string,
|
|
123
|
-
/* Margins */
|
|
124
|
-
marginLeft: PropTypes.oneOfType([
|
|
125
|
-
PropTypes.string,
|
|
126
|
-
PropTypes.number,
|
|
127
|
-
]),
|
|
128
|
-
marginRight: PropTypes.oneOfType([
|
|
129
|
-
PropTypes.string,
|
|
130
|
-
PropTypes.number,
|
|
131
|
-
]),
|
|
132
|
-
marginTop: PropTypes.oneOfType([
|
|
133
|
-
PropTypes.string,
|
|
134
|
-
PropTypes.number,
|
|
135
|
-
]),
|
|
136
|
-
marginBottom: PropTypes.oneOfType([
|
|
137
|
-
PropTypes.string,
|
|
138
|
-
PropTypes.number,
|
|
139
|
-
]),
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
UserProfile.defaultProps = {
|
|
143
|
-
size: 'md',
|
|
144
|
-
color: 'secondary',
|
|
145
|
-
marginLeft: null,
|
|
146
|
-
marginRight: null,
|
|
147
|
-
marginTop: null,
|
|
148
|
-
marginBottom: null,
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
export default UserProfile;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
.profile-well {
|
|
2
|
-
display: inline-block;
|
|
3
|
-
overflow: hidden;
|
|
4
|
-
text-align: center;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.profile-image {
|
|
8
|
-
-webkit-box-shadow: 5px 5px 19px 0px rgba(207,207,207,1);
|
|
9
|
-
-moz-box-shadow: 5px 5px 19px 0px rgba(207,207,207,1);
|
|
10
|
-
box-shadow: 5px 5px 19px 0px rgba(207,207,207,1);
|
|
11
|
-
|
|
12
|
-
border-radius: 5px;
|
|
13
|
-
margin-bottom: 5px;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.data-container {
|
|
17
|
-
display: inline-block;
|
|
18
|
-
max-width: 100%;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.datum-container {
|
|
22
|
-
text-align: left;
|
|
23
|
-
white-space: nowrap;
|
|
24
|
-
text-overflow: ellipsis;
|
|
25
|
-
overflow: hidden;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.icon-container {
|
|
29
|
-
display: inline-block;
|
|
30
|
-
width: 1.3em;
|
|
31
|
-
margin-right: 3px;
|
|
32
|
-
text-align: center;
|
|
33
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
// Import other components
|
|
5
|
-
import Alert from './Alert';
|
|
6
|
-
|
|
7
|
-
class Well extends Component {
|
|
8
|
-
render() {
|
|
9
|
-
// Deconstruct properties
|
|
10
|
-
const { children } = this.props;
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<Alert color="secondary">
|
|
14
|
-
{children}
|
|
15
|
-
</Alert>
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
Well.propTypes = {
|
|
21
|
-
/* Children (body) of the well */
|
|
22
|
-
children: PropTypes.oneOfType([
|
|
23
|
-
PropTypes.arrayOf(PropTypes.node),
|
|
24
|
-
PropTypes.node,
|
|
25
|
-
]).isRequired,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export default Well;
|