@plusscommunities/pluss-core-web 1.4.20 → 1.4.22
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/dist/index.cjs.js +74 -7
- package/dist/index.esm.js +74 -7
- package/dist/index.umd.js +75 -11
- package/package.json +4 -1
- package/src/apis/analyticsActions.js +6 -2
- package/src/components/StatBox.js +49 -0
- package/src/components/index.js +1 -0
package/dist/index.cjs.js
CHANGED
|
@@ -32,6 +32,9 @@ var reactCsv = require('react-csv');
|
|
|
32
32
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
33
33
|
var reactColor = require('react-color');
|
|
34
34
|
var tinycolor = require('tinycolor2');
|
|
35
|
+
var reactRouterDom = require('react-router-dom');
|
|
36
|
+
var reactFontawesome = require('@fortawesome/react-fontawesome');
|
|
37
|
+
var freeSolidSvgIcons = require('@fortawesome/free-solid-svg-icons');
|
|
35
38
|
|
|
36
39
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
37
40
|
|
|
@@ -2008,15 +2011,21 @@ var analyticsActions = {
|
|
|
2008
2011
|
})
|
|
2009
2012
|
});
|
|
2010
2013
|
},
|
|
2011
|
-
getAggregateEntityStats: function getAggregateEntityStats(site, type, minTime, maxTime) {
|
|
2014
|
+
getAggregateEntityStats: function getAggregateEntityStats(site, type, minTime, maxTime, raw) {
|
|
2015
|
+
var query = {
|
|
2016
|
+
site: site,
|
|
2017
|
+
type: type,
|
|
2018
|
+
minTime: minTime,
|
|
2019
|
+
maxTime: maxTime
|
|
2020
|
+
};
|
|
2021
|
+
|
|
2022
|
+
if (raw) {
|
|
2023
|
+
query.raw = raw;
|
|
2024
|
+
}
|
|
2025
|
+
|
|
2012
2026
|
return authedFunction({
|
|
2013
2027
|
method: 'GET',
|
|
2014
|
-
url: getUrl('analytics', 'aggregate',
|
|
2015
|
-
site: site,
|
|
2016
|
-
type: type,
|
|
2017
|
-
minTime: minTime,
|
|
2018
|
-
maxTime: maxTime
|
|
2019
|
-
})
|
|
2028
|
+
url: getUrl('analytics', 'aggregate', query)
|
|
2020
2029
|
});
|
|
2021
2030
|
}
|
|
2022
2031
|
};
|
|
@@ -11547,6 +11556,63 @@ var ColourPicker = /*#__PURE__*/function (_Component) {
|
|
|
11547
11556
|
return ColourPicker;
|
|
11548
11557
|
}(React.Component);
|
|
11549
11558
|
|
|
11559
|
+
var StatBox = function StatBox(_ref) {
|
|
11560
|
+
var title = _ref.title,
|
|
11561
|
+
icon = _ref.icon,
|
|
11562
|
+
value = _ref.value,
|
|
11563
|
+
previousValue = _ref.previousValue,
|
|
11564
|
+
prevText = _ref.prevText,
|
|
11565
|
+
viewGraphLink = _ref.viewGraphLink,
|
|
11566
|
+
isLoading = _ref.isLoading;
|
|
11567
|
+
var change = (value / previousValue - 1) * 100;
|
|
11568
|
+
|
|
11569
|
+
if (isNaN(change)) {
|
|
11570
|
+
change = 0;
|
|
11571
|
+
}
|
|
11572
|
+
|
|
11573
|
+
if (!isFinite(change)) {
|
|
11574
|
+
change = 100;
|
|
11575
|
+
}
|
|
11576
|
+
|
|
11577
|
+
change = parseInt(change);
|
|
11578
|
+
var opacity = isLoading ? 0 : 1;
|
|
11579
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11580
|
+
className: "dashboardBox dashboardBox-stats dashboardBox-inline".concat(change > 0 ? ' dashboardBox-stats-positive' : '').concat(change < 0 ? ' dashboardBox-stats-negative' : '')
|
|
11581
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11582
|
+
className: "dashboardBox-stats_title"
|
|
11583
|
+
}, /*#__PURE__*/React__default['default'].createElement(Text, {
|
|
11584
|
+
type: "h6"
|
|
11585
|
+
}, title)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11586
|
+
className: "dashboardBox-stats_mid",
|
|
11587
|
+
style: {
|
|
11588
|
+
opacity: opacity
|
|
11589
|
+
}
|
|
11590
|
+
}, /*#__PURE__*/React__default['default'].createElement(reactFontawesome.FontAwesomeIcon, {
|
|
11591
|
+
className: "dashboardBox-stats_icon",
|
|
11592
|
+
icon: icon
|
|
11593
|
+
}), /*#__PURE__*/React__default['default'].createElement(Text, {
|
|
11594
|
+
type: "h2",
|
|
11595
|
+
className: "dashboardBox-stats_count"
|
|
11596
|
+
}, value), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
11597
|
+
className: "dashboardBox-stats_change"
|
|
11598
|
+
}, change === 0 ? 'No change' : "".concat(change, "% ").concat(change < 0 ? '↓' : '↑'))), /*#__PURE__*/React__default['default'].createElement(Text, {
|
|
11599
|
+
type: "help",
|
|
11600
|
+
style: {
|
|
11601
|
+
opacity: opacity
|
|
11602
|
+
}
|
|
11603
|
+
}, "Compared to ", prevText), viewGraphLink && /*#__PURE__*/React__default['default'].createElement(reactRouterDom.Link, {
|
|
11604
|
+
to: "".concat(viewGraphLink, "&title=").concat(title)
|
|
11605
|
+
}, /*#__PURE__*/React__default['default'].createElement(Text, {
|
|
11606
|
+
type: "h5-noUpper",
|
|
11607
|
+
className: "text-link marginTop-10"
|
|
11608
|
+
}, /*#__PURE__*/React__default['default'].createElement(reactFontawesome.FontAwesomeIcon, {
|
|
11609
|
+
icon: freeSolidSvgIcons.faChartLine,
|
|
11610
|
+
style: {
|
|
11611
|
+
marginRight: 4
|
|
11612
|
+
}
|
|
11613
|
+
}), "View Graph")));
|
|
11614
|
+
};
|
|
11615
|
+
|
|
11550
11616
|
var index = /*#__PURE__*/Object.freeze({
|
|
11551
11617
|
__proto__: null,
|
|
11552
11618
|
AddButton: AddButton,
|
|
@@ -11589,6 +11655,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
11589
11655
|
ExportCsvPopup: ExportCsvPopup,
|
|
11590
11656
|
InputGroup: InputGroup,
|
|
11591
11657
|
ColourPicker: ColourPicker,
|
|
11658
|
+
StatBox: StatBox,
|
|
11592
11659
|
Tabs: Tabs
|
|
11593
11660
|
});
|
|
11594
11661
|
|
package/dist/index.esm.js
CHANGED
|
@@ -28,6 +28,9 @@ import { CSVLink } from 'react-csv';
|
|
|
28
28
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
29
29
|
import { ChromePicker } from 'react-color';
|
|
30
30
|
import tinycolor from 'tinycolor2';
|
|
31
|
+
import { Link } from 'react-router-dom';
|
|
32
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
33
|
+
import { faChartLine } from '@fortawesome/free-solid-svg-icons';
|
|
31
34
|
|
|
32
35
|
var CoreConfig = {
|
|
33
36
|
env: {
|
|
@@ -1978,15 +1981,21 @@ var analyticsActions = {
|
|
|
1978
1981
|
})
|
|
1979
1982
|
});
|
|
1980
1983
|
},
|
|
1981
|
-
getAggregateEntityStats: function getAggregateEntityStats(site, type, minTime, maxTime) {
|
|
1984
|
+
getAggregateEntityStats: function getAggregateEntityStats(site, type, minTime, maxTime, raw) {
|
|
1985
|
+
var query = {
|
|
1986
|
+
site: site,
|
|
1987
|
+
type: type,
|
|
1988
|
+
minTime: minTime,
|
|
1989
|
+
maxTime: maxTime
|
|
1990
|
+
};
|
|
1991
|
+
|
|
1992
|
+
if (raw) {
|
|
1993
|
+
query.raw = raw;
|
|
1994
|
+
}
|
|
1995
|
+
|
|
1982
1996
|
return authedFunction({
|
|
1983
1997
|
method: 'GET',
|
|
1984
|
-
url: getUrl('analytics', 'aggregate',
|
|
1985
|
-
site: site,
|
|
1986
|
-
type: type,
|
|
1987
|
-
minTime: minTime,
|
|
1988
|
-
maxTime: maxTime
|
|
1989
|
-
})
|
|
1998
|
+
url: getUrl('analytics', 'aggregate', query)
|
|
1990
1999
|
});
|
|
1991
2000
|
}
|
|
1992
2001
|
};
|
|
@@ -11517,6 +11526,63 @@ var ColourPicker = /*#__PURE__*/function (_Component) {
|
|
|
11517
11526
|
return ColourPicker;
|
|
11518
11527
|
}(Component);
|
|
11519
11528
|
|
|
11529
|
+
var StatBox = function StatBox(_ref) {
|
|
11530
|
+
var title = _ref.title,
|
|
11531
|
+
icon = _ref.icon,
|
|
11532
|
+
value = _ref.value,
|
|
11533
|
+
previousValue = _ref.previousValue,
|
|
11534
|
+
prevText = _ref.prevText,
|
|
11535
|
+
viewGraphLink = _ref.viewGraphLink,
|
|
11536
|
+
isLoading = _ref.isLoading;
|
|
11537
|
+
var change = (value / previousValue - 1) * 100;
|
|
11538
|
+
|
|
11539
|
+
if (isNaN(change)) {
|
|
11540
|
+
change = 0;
|
|
11541
|
+
}
|
|
11542
|
+
|
|
11543
|
+
if (!isFinite(change)) {
|
|
11544
|
+
change = 100;
|
|
11545
|
+
}
|
|
11546
|
+
|
|
11547
|
+
change = parseInt(change);
|
|
11548
|
+
var opacity = isLoading ? 0 : 1;
|
|
11549
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
11550
|
+
className: "dashboardBox dashboardBox-stats dashboardBox-inline".concat(change > 0 ? ' dashboardBox-stats-positive' : '').concat(change < 0 ? ' dashboardBox-stats-negative' : '')
|
|
11551
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
11552
|
+
className: "dashboardBox-stats_title"
|
|
11553
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
11554
|
+
type: "h6"
|
|
11555
|
+
}, title)), /*#__PURE__*/React.createElement("div", {
|
|
11556
|
+
className: "dashboardBox-stats_mid",
|
|
11557
|
+
style: {
|
|
11558
|
+
opacity: opacity
|
|
11559
|
+
}
|
|
11560
|
+
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
11561
|
+
className: "dashboardBox-stats_icon",
|
|
11562
|
+
icon: icon
|
|
11563
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
11564
|
+
type: "h2",
|
|
11565
|
+
className: "dashboardBox-stats_count"
|
|
11566
|
+
}, value), /*#__PURE__*/React.createElement("p", {
|
|
11567
|
+
className: "dashboardBox-stats_change"
|
|
11568
|
+
}, change === 0 ? 'No change' : "".concat(change, "% ").concat(change < 0 ? '↓' : '↑'))), /*#__PURE__*/React.createElement(Text, {
|
|
11569
|
+
type: "help",
|
|
11570
|
+
style: {
|
|
11571
|
+
opacity: opacity
|
|
11572
|
+
}
|
|
11573
|
+
}, "Compared to ", prevText), viewGraphLink && /*#__PURE__*/React.createElement(Link, {
|
|
11574
|
+
to: "".concat(viewGraphLink, "&title=").concat(title)
|
|
11575
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
11576
|
+
type: "h5-noUpper",
|
|
11577
|
+
className: "text-link marginTop-10"
|
|
11578
|
+
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
11579
|
+
icon: faChartLine,
|
|
11580
|
+
style: {
|
|
11581
|
+
marginRight: 4
|
|
11582
|
+
}
|
|
11583
|
+
}), "View Graph")));
|
|
11584
|
+
};
|
|
11585
|
+
|
|
11520
11586
|
var index = /*#__PURE__*/Object.freeze({
|
|
11521
11587
|
__proto__: null,
|
|
11522
11588
|
AddButton: AddButton,
|
|
@@ -11559,6 +11625,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
11559
11625
|
ExportCsvPopup: ExportCsvPopup,
|
|
11560
11626
|
InputGroup: InputGroup,
|
|
11561
11627
|
ColourPicker: ColourPicker,
|
|
11628
|
+
StatBox: StatBox,
|
|
11562
11629
|
Tabs: Tabs
|
|
11563
11630
|
});
|
|
11564
11631
|
|
package/dist/index.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@babel/runtime/helpers/asyncToGenerator'), require('@babel/runtime/regenerator'), require('lodash'), require('axios'), require('aws-amplify'), require('@babel/runtime/helpers/defineProperty'), require('moment'), require('react'), require('jquery'), require('js-cookie'), require('@babel/runtime/helpers/classCallCheck'), require('@babel/runtime/helpers/createClass'), require('@babel/runtime/helpers/inherits'), require('@babel/runtime/helpers/possibleConstructorReturn'), require('@babel/runtime/helpers/getPrototypeOf'), require('react-fontawesome'), require('@babel/runtime/helpers/extends'), require('@babel/runtime/helpers/assertThisInitialized'), require('react-redux'), require('react-textarea-autosize'), require('@babel/runtime/helpers/toConsumableArray'), require('@babel/runtime/helpers/typeof'), require('react-dropzone'), require('react-router'), require('react-bootstrap'), require('@crello/react-lottie'), require('react-csv'), require('@babel/runtime/helpers/objectWithoutProperties'), require('react-color'), require('tinycolor2')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@babel/runtime/helpers/asyncToGenerator', '@babel/runtime/regenerator', 'lodash', 'axios', 'aws-amplify', '@babel/runtime/helpers/defineProperty', 'moment', 'react', 'jquery', 'js-cookie', '@babel/runtime/helpers/classCallCheck', '@babel/runtime/helpers/createClass', '@babel/runtime/helpers/inherits', '@babel/runtime/helpers/possibleConstructorReturn', '@babel/runtime/helpers/getPrototypeOf', 'react-fontawesome', '@babel/runtime/helpers/extends', '@babel/runtime/helpers/assertThisInitialized', 'react-redux', 'react-textarea-autosize', '@babel/runtime/helpers/toConsumableArray', '@babel/runtime/helpers/typeof', 'react-dropzone', 'react-router', 'react-bootstrap', '@crello/react-lottie', 'react-csv', '@babel/runtime/helpers/objectWithoutProperties', 'react-color', 'tinycolor2'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['@plusscommunities/pluss-core-web'] = {}, global._asyncToGenerator, global._regeneratorRuntime, global._, global.axios, global.awsAmplify, global._defineProperty, global.moment, global.React, global.$, global.Cookies, global._classCallCheck, global._createClass, global._inherits, global._possibleConstructorReturn, global._getPrototypeOf, global.FontAwesome, global._extends, global._assertThisInitialized, global.reactRedux, global.Textarea, global._toConsumableArray, global._typeof, global.Dropzone, global.reactRouter, global.reactBootstrap, global.reactLottie, global.reactCsv, global._objectWithoutProperties, global.reactColor, global.tinycolor));
|
|
5
|
-
}(this, (function (exports, _asyncToGenerator, _regeneratorRuntime, _, axios, awsAmplify, _defineProperty, moment, React, $, Cookies, _classCallCheck, _createClass, _inherits, _possibleConstructorReturn, _getPrototypeOf, FontAwesome, _extends, _assertThisInitialized, reactRedux, Textarea, _toConsumableArray, _typeof, Dropzone, reactRouter, reactBootstrap, reactLottie, reactCsv, _objectWithoutProperties, reactColor, tinycolor) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@babel/runtime/helpers/asyncToGenerator'), require('@babel/runtime/regenerator'), require('lodash'), require('axios'), require('aws-amplify'), require('@babel/runtime/helpers/defineProperty'), require('moment'), require('react'), require('jquery'), require('js-cookie'), require('@babel/runtime/helpers/classCallCheck'), require('@babel/runtime/helpers/createClass'), require('@babel/runtime/helpers/inherits'), require('@babel/runtime/helpers/possibleConstructorReturn'), require('@babel/runtime/helpers/getPrototypeOf'), require('react-fontawesome'), require('@babel/runtime/helpers/extends'), require('@babel/runtime/helpers/assertThisInitialized'), require('react-redux'), require('react-textarea-autosize'), require('@babel/runtime/helpers/toConsumableArray'), require('@babel/runtime/helpers/typeof'), require('react-dropzone'), require('react-router'), require('react-bootstrap'), require('@crello/react-lottie'), require('react-csv'), require('@babel/runtime/helpers/objectWithoutProperties'), require('react-color'), require('tinycolor2'), require('react-router-dom'), require('@fortawesome/react-fontawesome'), require('@fortawesome/free-solid-svg-icons')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@babel/runtime/helpers/asyncToGenerator', '@babel/runtime/regenerator', 'lodash', 'axios', 'aws-amplify', '@babel/runtime/helpers/defineProperty', 'moment', 'react', 'jquery', 'js-cookie', '@babel/runtime/helpers/classCallCheck', '@babel/runtime/helpers/createClass', '@babel/runtime/helpers/inherits', '@babel/runtime/helpers/possibleConstructorReturn', '@babel/runtime/helpers/getPrototypeOf', 'react-fontawesome', '@babel/runtime/helpers/extends', '@babel/runtime/helpers/assertThisInitialized', 'react-redux', 'react-textarea-autosize', '@babel/runtime/helpers/toConsumableArray', '@babel/runtime/helpers/typeof', 'react-dropzone', 'react-router', 'react-bootstrap', '@crello/react-lottie', 'react-csv', '@babel/runtime/helpers/objectWithoutProperties', 'react-color', 'tinycolor2', 'react-router-dom', '@fortawesome/react-fontawesome', '@fortawesome/free-solid-svg-icons'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['@plusscommunities/pluss-core-web'] = {}, global._asyncToGenerator, global._regeneratorRuntime, global._, global.axios, global.awsAmplify, global._defineProperty, global.moment, global.React, global.$, global.Cookies, global._classCallCheck, global._createClass, global._inherits, global._possibleConstructorReturn, global._getPrototypeOf, global.FontAwesome, global._extends, global._assertThisInitialized, global.reactRedux, global.Textarea, global._toConsumableArray, global._typeof, global.Dropzone, global.reactRouter, global.reactBootstrap, global.reactLottie, global.reactCsv, global._objectWithoutProperties, global.reactColor, global.tinycolor, global.reactRouterDom, global.reactFontawesome, global.freeSolidSvgIcons));
|
|
5
|
+
}(this, (function (exports, _asyncToGenerator, _regeneratorRuntime, _, axios, awsAmplify, _defineProperty, moment, React, $, Cookies, _classCallCheck, _createClass, _inherits, _possibleConstructorReturn, _getPrototypeOf, FontAwesome, _extends, _assertThisInitialized, reactRedux, Textarea, _toConsumableArray, _typeof, Dropzone, reactRouter, reactBootstrap, reactLottie, reactCsv, _objectWithoutProperties, reactColor, tinycolor, reactRouterDom, reactFontawesome, freeSolidSvgIcons) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -1979,15 +1979,21 @@
|
|
|
1979
1979
|
})
|
|
1980
1980
|
});
|
|
1981
1981
|
},
|
|
1982
|
-
getAggregateEntityStats: function getAggregateEntityStats(site, type, minTime, maxTime) {
|
|
1982
|
+
getAggregateEntityStats: function getAggregateEntityStats(site, type, minTime, maxTime, raw) {
|
|
1983
|
+
var query = {
|
|
1984
|
+
site: site,
|
|
1985
|
+
type: type,
|
|
1986
|
+
minTime: minTime,
|
|
1987
|
+
maxTime: maxTime
|
|
1988
|
+
};
|
|
1989
|
+
|
|
1990
|
+
if (raw) {
|
|
1991
|
+
query.raw = raw;
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1983
1994
|
return authedFunction({
|
|
1984
1995
|
method: 'GET',
|
|
1985
|
-
url: getUrl('analytics', 'aggregate',
|
|
1986
|
-
site: site,
|
|
1987
|
-
type: type,
|
|
1988
|
-
minTime: minTime,
|
|
1989
|
-
maxTime: maxTime
|
|
1990
|
-
})
|
|
1996
|
+
url: getUrl('analytics', 'aggregate', query)
|
|
1991
1997
|
});
|
|
1992
1998
|
}
|
|
1993
1999
|
};
|
|
@@ -11518,6 +11524,63 @@
|
|
|
11518
11524
|
return ColourPicker;
|
|
11519
11525
|
}(React.Component);
|
|
11520
11526
|
|
|
11527
|
+
var StatBox = function StatBox(_ref) {
|
|
11528
|
+
var title = _ref.title,
|
|
11529
|
+
icon = _ref.icon,
|
|
11530
|
+
value = _ref.value,
|
|
11531
|
+
previousValue = _ref.previousValue,
|
|
11532
|
+
prevText = _ref.prevText,
|
|
11533
|
+
viewGraphLink = _ref.viewGraphLink,
|
|
11534
|
+
isLoading = _ref.isLoading;
|
|
11535
|
+
var change = (value / previousValue - 1) * 100;
|
|
11536
|
+
|
|
11537
|
+
if (isNaN(change)) {
|
|
11538
|
+
change = 0;
|
|
11539
|
+
}
|
|
11540
|
+
|
|
11541
|
+
if (!isFinite(change)) {
|
|
11542
|
+
change = 100;
|
|
11543
|
+
}
|
|
11544
|
+
|
|
11545
|
+
change = parseInt(change);
|
|
11546
|
+
var opacity = isLoading ? 0 : 1;
|
|
11547
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11548
|
+
className: "dashboardBox dashboardBox-stats dashboardBox-inline".concat(change > 0 ? ' dashboardBox-stats-positive' : '').concat(change < 0 ? ' dashboardBox-stats-negative' : '')
|
|
11549
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11550
|
+
className: "dashboardBox-stats_title"
|
|
11551
|
+
}, /*#__PURE__*/React__default['default'].createElement(Text, {
|
|
11552
|
+
type: "h6"
|
|
11553
|
+
}, title)), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
11554
|
+
className: "dashboardBox-stats_mid",
|
|
11555
|
+
style: {
|
|
11556
|
+
opacity: opacity
|
|
11557
|
+
}
|
|
11558
|
+
}, /*#__PURE__*/React__default['default'].createElement(reactFontawesome.FontAwesomeIcon, {
|
|
11559
|
+
className: "dashboardBox-stats_icon",
|
|
11560
|
+
icon: icon
|
|
11561
|
+
}), /*#__PURE__*/React__default['default'].createElement(Text, {
|
|
11562
|
+
type: "h2",
|
|
11563
|
+
className: "dashboardBox-stats_count"
|
|
11564
|
+
}, value), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
11565
|
+
className: "dashboardBox-stats_change"
|
|
11566
|
+
}, change === 0 ? 'No change' : "".concat(change, "% ").concat(change < 0 ? '↓' : '↑'))), /*#__PURE__*/React__default['default'].createElement(Text, {
|
|
11567
|
+
type: "help",
|
|
11568
|
+
style: {
|
|
11569
|
+
opacity: opacity
|
|
11570
|
+
}
|
|
11571
|
+
}, "Compared to ", prevText), viewGraphLink && /*#__PURE__*/React__default['default'].createElement(reactRouterDom.Link, {
|
|
11572
|
+
to: "".concat(viewGraphLink, "&title=").concat(title)
|
|
11573
|
+
}, /*#__PURE__*/React__default['default'].createElement(Text, {
|
|
11574
|
+
type: "h5-noUpper",
|
|
11575
|
+
className: "text-link marginTop-10"
|
|
11576
|
+
}, /*#__PURE__*/React__default['default'].createElement(reactFontawesome.FontAwesomeIcon, {
|
|
11577
|
+
icon: freeSolidSvgIcons.faChartLine,
|
|
11578
|
+
style: {
|
|
11579
|
+
marginRight: 4
|
|
11580
|
+
}
|
|
11581
|
+
}), "View Graph")));
|
|
11582
|
+
};
|
|
11583
|
+
|
|
11521
11584
|
var index = /*#__PURE__*/Object.freeze({
|
|
11522
11585
|
__proto__: null,
|
|
11523
11586
|
AddButton: AddButton,
|
|
@@ -11560,6 +11623,7 @@
|
|
|
11560
11623
|
ExportCsvPopup: ExportCsvPopup,
|
|
11561
11624
|
InputGroup: InputGroup,
|
|
11562
11625
|
ColourPicker: ColourPicker,
|
|
11626
|
+
StatBox: StatBox,
|
|
11563
11627
|
Tabs: Tabs
|
|
11564
11628
|
});
|
|
11565
11629
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plusscommunities/pluss-core-web",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.22",
|
|
4
4
|
"description": "Core extension package for Pluss Communities platform",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"scripts": {
|
|
@@ -29,6 +29,9 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@babel/runtime": "^7.14.0",
|
|
32
|
+
"@fortawesome/fontawesome-svg-core": "^6.4.0",
|
|
33
|
+
"@fortawesome/free-solid-svg-icons": "^6.4.0",
|
|
34
|
+
"@fortawesome/react-fontawesome": "^0.2.0",
|
|
32
35
|
"jquery": "^3.2.1",
|
|
33
36
|
"js-cookie": "^2.2.0",
|
|
34
37
|
"lodash": "^4.17.4",
|
|
@@ -40,10 +40,14 @@ export const analyticsActions = {
|
|
|
40
40
|
url: getUrl('analytics', 'users', { site }),
|
|
41
41
|
});
|
|
42
42
|
},
|
|
43
|
-
getAggregateEntityStats: (site, type, minTime, maxTime) => {
|
|
43
|
+
getAggregateEntityStats: (site, type, minTime, maxTime, raw) => {
|
|
44
|
+
const query = { site, type, minTime, maxTime };
|
|
45
|
+
if (raw) {
|
|
46
|
+
query.raw = raw;
|
|
47
|
+
}
|
|
44
48
|
return authedFunction({
|
|
45
49
|
method: 'GET',
|
|
46
|
-
url: getUrl('analytics', 'aggregate',
|
|
50
|
+
url: getUrl('analytics', 'aggregate', query),
|
|
47
51
|
});
|
|
48
52
|
},
|
|
49
53
|
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Link } from 'react-router-dom';
|
|
3
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
4
|
+
import { faChartLine } from '@fortawesome/free-solid-svg-icons';
|
|
5
|
+
import { Text } from './Text';
|
|
6
|
+
|
|
7
|
+
// StatBox Component
|
|
8
|
+
const StatBox = ({ title, icon, value, previousValue, prevText, viewGraphLink, isLoading }) => {
|
|
9
|
+
let change = (value / previousValue - 1) * 100;
|
|
10
|
+
if (isNaN(change)) {
|
|
11
|
+
change = 0;
|
|
12
|
+
}
|
|
13
|
+
if (!isFinite(change)) {
|
|
14
|
+
change = 100;
|
|
15
|
+
}
|
|
16
|
+
change = parseInt(change);
|
|
17
|
+
const opacity = isLoading ? 0 : 1;
|
|
18
|
+
return (
|
|
19
|
+
<div
|
|
20
|
+
className={`dashboardBox dashboardBox-stats dashboardBox-inline${change > 0 ? ' dashboardBox-stats-positive' : ''}${
|
|
21
|
+
change < 0 ? ' dashboardBox-stats-negative' : ''
|
|
22
|
+
}`}
|
|
23
|
+
>
|
|
24
|
+
<div className="dashboardBox-stats_title">
|
|
25
|
+
<Text type="h6">{title}</Text>
|
|
26
|
+
</div>
|
|
27
|
+
<div className="dashboardBox-stats_mid" style={{ opacity }}>
|
|
28
|
+
<FontAwesomeIcon className="dashboardBox-stats_icon" icon={icon} />
|
|
29
|
+
<Text type="h2" className="dashboardBox-stats_count">
|
|
30
|
+
{value}
|
|
31
|
+
</Text>
|
|
32
|
+
<p className="dashboardBox-stats_change">{change === 0 ? 'No change' : `${change}% ${change < 0 ? '↓' : '↑'}`}</p>
|
|
33
|
+
</div>
|
|
34
|
+
<Text type="help" style={{ opacity }}>
|
|
35
|
+
Compared to {prevText}
|
|
36
|
+
</Text>
|
|
37
|
+
{viewGraphLink && (
|
|
38
|
+
<Link to={`${viewGraphLink}&title=${title}`}>
|
|
39
|
+
<Text type="h5-noUpper" className="text-link marginTop-10">
|
|
40
|
+
<FontAwesomeIcon icon={faChartLine} style={{ marginRight: 4 }} />
|
|
41
|
+
View Graph
|
|
42
|
+
</Text>
|
|
43
|
+
</Link>
|
|
44
|
+
)}
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export { StatBox };
|