@plusscommunities/pluss-core-web 1.4.24 → 1.4.26
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 +100 -13
- package/dist/index.esm.js +100 -13
- package/dist/index.umd.js +100 -13
- package/package.json +1 -1
- package/src/components/UserListing.js +62 -4
- package/src/helper/helper.js +26 -9
package/dist/index.cjs.js
CHANGED
|
@@ -1126,21 +1126,38 @@ var getDateFromTimeDatePickers = function getDateFromTimeDatePickers(dateInput,
|
|
|
1126
1126
|
dateObject.setMinutes(time.minutes);
|
|
1127
1127
|
return dateObject;
|
|
1128
1128
|
};
|
|
1129
|
-
var
|
|
1129
|
+
var formatTime = function formatTime(hours, minutes) {
|
|
1130
|
+
var period = hours >= 12 ? 'pm' : 'am'; // Convert 24-hour format to 12-hour format
|
|
1131
|
+
|
|
1132
|
+
var adjustedHours = hours > 12 ? hours - 12 : hours === 0 ? 12 : hours; // Ensure minutes are two digits
|
|
1133
|
+
|
|
1134
|
+
var adjustedMinutes = String(minutes).padStart(2, '0');
|
|
1135
|
+
return "".concat(adjustedHours, ":").concat(adjustedMinutes).concat(period);
|
|
1136
|
+
};
|
|
1137
|
+
var minutesToString = function minutesToString(minutes, isTimeOfDay) {
|
|
1130
1138
|
var hours = Math.floor(minutes / 60);
|
|
1131
1139
|
var remainingMinutes = minutes % 60;
|
|
1140
|
+
|
|
1141
|
+
if (isTimeOfDay) {
|
|
1142
|
+
return formatTime(hours, remainingMinutes);
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1132
1145
|
var hoursString = hours > 1 ? "".concat(hours, " hours") : "".concat(hours, " hour");
|
|
1133
1146
|
var minutesString = remainingMinutes > 1 ? "".concat(remainingMinutes, " minutes") : "".concat(remainingMinutes, " minute");
|
|
1134
1147
|
|
|
1135
1148
|
if (hours && remainingMinutes) {
|
|
1136
1149
|
return "".concat(hoursString, " ").concat(minutesString);
|
|
1137
|
-
}
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
if (hours) {
|
|
1138
1153
|
return hoursString;
|
|
1139
|
-
}
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
if (remainingMinutes) {
|
|
1140
1157
|
return minutesString;
|
|
1141
|
-
} else {
|
|
1142
|
-
return '0 minutes';
|
|
1143
1158
|
}
|
|
1159
|
+
|
|
1160
|
+
return '0 minutes';
|
|
1144
1161
|
};
|
|
1145
1162
|
var getUTCFromTimeDatePickers = function getUTCFromTimeDatePickers(dateInput, timeInput) {
|
|
1146
1163
|
var dateObject = getDateFromTimeDatePickers(dateInput, timeInput);
|
|
@@ -1804,6 +1821,7 @@ var index$3 = /*#__PURE__*/Object.freeze({
|
|
|
1804
1821
|
hasTimeframeOverlap: hasTimeframeOverlap,
|
|
1805
1822
|
timepickerToMinutes: timepickerToMinutes,
|
|
1806
1823
|
getDateFromTimeDatePickers: getDateFromTimeDatePickers,
|
|
1824
|
+
formatTime: formatTime,
|
|
1807
1825
|
minutesToString: minutesToString,
|
|
1808
1826
|
getUTCFromTimeDatePickers: getUTCFromTimeDatePickers,
|
|
1809
1827
|
getPluralS: getPluralS,
|
|
@@ -8885,6 +8903,55 @@ var UserListing = /*#__PURE__*/function (_Component) {
|
|
|
8885
8903
|
value: function getSize() {
|
|
8886
8904
|
return this.props.size || 30;
|
|
8887
8905
|
}
|
|
8906
|
+
}, {
|
|
8907
|
+
key: "getImage",
|
|
8908
|
+
value: function getImage() {
|
|
8909
|
+
if (this.props.user && this.props.user.profilePic) {
|
|
8910
|
+
return this.props.user.profilePic;
|
|
8911
|
+
}
|
|
8912
|
+
|
|
8913
|
+
if (this.props.image) {
|
|
8914
|
+
return this.props.image;
|
|
8915
|
+
}
|
|
8916
|
+
|
|
8917
|
+
return undefined;
|
|
8918
|
+
}
|
|
8919
|
+
}, {
|
|
8920
|
+
key: "getKey",
|
|
8921
|
+
value: function getKey() {
|
|
8922
|
+
if (this.props.user && this.props.user.id) {
|
|
8923
|
+
return this.props.user.id;
|
|
8924
|
+
}
|
|
8925
|
+
|
|
8926
|
+
return this.props.id;
|
|
8927
|
+
}
|
|
8928
|
+
}, {
|
|
8929
|
+
key: "getText",
|
|
8930
|
+
value: function getText() {
|
|
8931
|
+
if (this.props.user && this.props.user.displayName) {
|
|
8932
|
+
return this.props.user.displayName;
|
|
8933
|
+
}
|
|
8934
|
+
|
|
8935
|
+
return this.props.title;
|
|
8936
|
+
}
|
|
8937
|
+
}, {
|
|
8938
|
+
key: "getBorderRadius",
|
|
8939
|
+
value: function getBorderRadius() {
|
|
8940
|
+
if (this.props.squareImage) {
|
|
8941
|
+
return 4;
|
|
8942
|
+
}
|
|
8943
|
+
|
|
8944
|
+
return this.getSize() / 2;
|
|
8945
|
+
}
|
|
8946
|
+
}, {
|
|
8947
|
+
key: "isLoading",
|
|
8948
|
+
value: function isLoading() {
|
|
8949
|
+
if (this.props.user && this.props.user.loading) {
|
|
8950
|
+
return this.props.user && this.props.user.loading;
|
|
8951
|
+
}
|
|
8952
|
+
|
|
8953
|
+
return this.props.isLoading;
|
|
8954
|
+
}
|
|
8888
8955
|
}, {
|
|
8889
8956
|
key: "renderRight",
|
|
8890
8957
|
value: function renderRight() {
|
|
@@ -8903,25 +8970,45 @@ var UserListing = /*#__PURE__*/function (_Component) {
|
|
|
8903
8970
|
|
|
8904
8971
|
return this.props.subContent;
|
|
8905
8972
|
}
|
|
8973
|
+
}, {
|
|
8974
|
+
key: "renderImage",
|
|
8975
|
+
value: function renderImage() {
|
|
8976
|
+
if (this.props.squareImage) {
|
|
8977
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
8978
|
+
style: {
|
|
8979
|
+
height: this.getSize(),
|
|
8980
|
+
width: this.getSize(),
|
|
8981
|
+
borderRadius: this.getBorderRadius(),
|
|
8982
|
+
marginRight: 8,
|
|
8983
|
+
backgroundSize: 'cover',
|
|
8984
|
+
backgroundPosition: 'center',
|
|
8985
|
+
backgroundImage: "url(".concat(this.getImage(), ")")
|
|
8986
|
+
},
|
|
8987
|
+
alt: "".concat(this.getText(), " Image")
|
|
8988
|
+
});
|
|
8989
|
+
}
|
|
8990
|
+
|
|
8991
|
+
return /*#__PURE__*/React__default['default'].createElement(ProfilePic, {
|
|
8992
|
+
size: this.getSize(),
|
|
8993
|
+
className: "userListing_profilePic",
|
|
8994
|
+
image: this.getImage()
|
|
8995
|
+
});
|
|
8996
|
+
}
|
|
8906
8997
|
}, {
|
|
8907
8998
|
key: "render",
|
|
8908
8999
|
value: function render() {
|
|
8909
9000
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
8910
|
-
key: this.
|
|
9001
|
+
key: this.getKey(),
|
|
8911
9002
|
className: "userListing",
|
|
8912
9003
|
style: {
|
|
8913
9004
|
minHeight: this.getSize() + 5,
|
|
8914
9005
|
cursor: this.props.onClick ? 'pointer' : 'inherit',
|
|
8915
|
-
opacity: this.
|
|
9006
|
+
opacity: this.isLoading() ? 0.5 : 1
|
|
8916
9007
|
},
|
|
8917
9008
|
onClick: this.props.onClick
|
|
8918
9009
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
8919
9010
|
className: "userListing_inner"
|
|
8920
|
-
}, /*#__PURE__*/React__default['default'].createElement(
|
|
8921
|
-
size: this.getSize(),
|
|
8922
|
-
className: "userListing_profilePic",
|
|
8923
|
-
image: this.props.user.profilePic
|
|
8924
|
-
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
9011
|
+
}, this.renderImage(), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
8925
9012
|
className: "userListing_middle",
|
|
8926
9013
|
style: {
|
|
8927
9014
|
height: this.getSize()
|
|
@@ -8932,7 +9019,7 @@ var UserListing = /*#__PURE__*/function (_Component) {
|
|
|
8932
9019
|
color: '#fff'
|
|
8933
9020
|
} : null,
|
|
8934
9021
|
className: this.props.textClass
|
|
8935
|
-
}, this.
|
|
9022
|
+
}, this.getText()), this.renderSub())), this.renderRight());
|
|
8936
9023
|
}
|
|
8937
9024
|
}]);
|
|
8938
9025
|
|
package/dist/index.esm.js
CHANGED
|
@@ -1096,21 +1096,38 @@ var getDateFromTimeDatePickers = function getDateFromTimeDatePickers(dateInput,
|
|
|
1096
1096
|
dateObject.setMinutes(time.minutes);
|
|
1097
1097
|
return dateObject;
|
|
1098
1098
|
};
|
|
1099
|
-
var
|
|
1099
|
+
var formatTime = function formatTime(hours, minutes) {
|
|
1100
|
+
var period = hours >= 12 ? 'pm' : 'am'; // Convert 24-hour format to 12-hour format
|
|
1101
|
+
|
|
1102
|
+
var adjustedHours = hours > 12 ? hours - 12 : hours === 0 ? 12 : hours; // Ensure minutes are two digits
|
|
1103
|
+
|
|
1104
|
+
var adjustedMinutes = String(minutes).padStart(2, '0');
|
|
1105
|
+
return "".concat(adjustedHours, ":").concat(adjustedMinutes).concat(period);
|
|
1106
|
+
};
|
|
1107
|
+
var minutesToString = function minutesToString(minutes, isTimeOfDay) {
|
|
1100
1108
|
var hours = Math.floor(minutes / 60);
|
|
1101
1109
|
var remainingMinutes = minutes % 60;
|
|
1110
|
+
|
|
1111
|
+
if (isTimeOfDay) {
|
|
1112
|
+
return formatTime(hours, remainingMinutes);
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1102
1115
|
var hoursString = hours > 1 ? "".concat(hours, " hours") : "".concat(hours, " hour");
|
|
1103
1116
|
var minutesString = remainingMinutes > 1 ? "".concat(remainingMinutes, " minutes") : "".concat(remainingMinutes, " minute");
|
|
1104
1117
|
|
|
1105
1118
|
if (hours && remainingMinutes) {
|
|
1106
1119
|
return "".concat(hoursString, " ").concat(minutesString);
|
|
1107
|
-
}
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
if (hours) {
|
|
1108
1123
|
return hoursString;
|
|
1109
|
-
}
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
if (remainingMinutes) {
|
|
1110
1127
|
return minutesString;
|
|
1111
|
-
} else {
|
|
1112
|
-
return '0 minutes';
|
|
1113
1128
|
}
|
|
1129
|
+
|
|
1130
|
+
return '0 minutes';
|
|
1114
1131
|
};
|
|
1115
1132
|
var getUTCFromTimeDatePickers = function getUTCFromTimeDatePickers(dateInput, timeInput) {
|
|
1116
1133
|
var dateObject = getDateFromTimeDatePickers(dateInput, timeInput);
|
|
@@ -1774,6 +1791,7 @@ var index$3 = /*#__PURE__*/Object.freeze({
|
|
|
1774
1791
|
hasTimeframeOverlap: hasTimeframeOverlap,
|
|
1775
1792
|
timepickerToMinutes: timepickerToMinutes,
|
|
1776
1793
|
getDateFromTimeDatePickers: getDateFromTimeDatePickers,
|
|
1794
|
+
formatTime: formatTime,
|
|
1777
1795
|
minutesToString: minutesToString,
|
|
1778
1796
|
getUTCFromTimeDatePickers: getUTCFromTimeDatePickers,
|
|
1779
1797
|
getPluralS: getPluralS,
|
|
@@ -8855,6 +8873,55 @@ var UserListing = /*#__PURE__*/function (_Component) {
|
|
|
8855
8873
|
value: function getSize() {
|
|
8856
8874
|
return this.props.size || 30;
|
|
8857
8875
|
}
|
|
8876
|
+
}, {
|
|
8877
|
+
key: "getImage",
|
|
8878
|
+
value: function getImage() {
|
|
8879
|
+
if (this.props.user && this.props.user.profilePic) {
|
|
8880
|
+
return this.props.user.profilePic;
|
|
8881
|
+
}
|
|
8882
|
+
|
|
8883
|
+
if (this.props.image) {
|
|
8884
|
+
return this.props.image;
|
|
8885
|
+
}
|
|
8886
|
+
|
|
8887
|
+
return undefined;
|
|
8888
|
+
}
|
|
8889
|
+
}, {
|
|
8890
|
+
key: "getKey",
|
|
8891
|
+
value: function getKey() {
|
|
8892
|
+
if (this.props.user && this.props.user.id) {
|
|
8893
|
+
return this.props.user.id;
|
|
8894
|
+
}
|
|
8895
|
+
|
|
8896
|
+
return this.props.id;
|
|
8897
|
+
}
|
|
8898
|
+
}, {
|
|
8899
|
+
key: "getText",
|
|
8900
|
+
value: function getText() {
|
|
8901
|
+
if (this.props.user && this.props.user.displayName) {
|
|
8902
|
+
return this.props.user.displayName;
|
|
8903
|
+
}
|
|
8904
|
+
|
|
8905
|
+
return this.props.title;
|
|
8906
|
+
}
|
|
8907
|
+
}, {
|
|
8908
|
+
key: "getBorderRadius",
|
|
8909
|
+
value: function getBorderRadius() {
|
|
8910
|
+
if (this.props.squareImage) {
|
|
8911
|
+
return 4;
|
|
8912
|
+
}
|
|
8913
|
+
|
|
8914
|
+
return this.getSize() / 2;
|
|
8915
|
+
}
|
|
8916
|
+
}, {
|
|
8917
|
+
key: "isLoading",
|
|
8918
|
+
value: function isLoading() {
|
|
8919
|
+
if (this.props.user && this.props.user.loading) {
|
|
8920
|
+
return this.props.user && this.props.user.loading;
|
|
8921
|
+
}
|
|
8922
|
+
|
|
8923
|
+
return this.props.isLoading;
|
|
8924
|
+
}
|
|
8858
8925
|
}, {
|
|
8859
8926
|
key: "renderRight",
|
|
8860
8927
|
value: function renderRight() {
|
|
@@ -8873,25 +8940,45 @@ var UserListing = /*#__PURE__*/function (_Component) {
|
|
|
8873
8940
|
|
|
8874
8941
|
return this.props.subContent;
|
|
8875
8942
|
}
|
|
8943
|
+
}, {
|
|
8944
|
+
key: "renderImage",
|
|
8945
|
+
value: function renderImage() {
|
|
8946
|
+
if (this.props.squareImage) {
|
|
8947
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
8948
|
+
style: {
|
|
8949
|
+
height: this.getSize(),
|
|
8950
|
+
width: this.getSize(),
|
|
8951
|
+
borderRadius: this.getBorderRadius(),
|
|
8952
|
+
marginRight: 8,
|
|
8953
|
+
backgroundSize: 'cover',
|
|
8954
|
+
backgroundPosition: 'center',
|
|
8955
|
+
backgroundImage: "url(".concat(this.getImage(), ")")
|
|
8956
|
+
},
|
|
8957
|
+
alt: "".concat(this.getText(), " Image")
|
|
8958
|
+
});
|
|
8959
|
+
}
|
|
8960
|
+
|
|
8961
|
+
return /*#__PURE__*/React.createElement(ProfilePic, {
|
|
8962
|
+
size: this.getSize(),
|
|
8963
|
+
className: "userListing_profilePic",
|
|
8964
|
+
image: this.getImage()
|
|
8965
|
+
});
|
|
8966
|
+
}
|
|
8876
8967
|
}, {
|
|
8877
8968
|
key: "render",
|
|
8878
8969
|
value: function render() {
|
|
8879
8970
|
return /*#__PURE__*/React.createElement("div", {
|
|
8880
|
-
key: this.
|
|
8971
|
+
key: this.getKey(),
|
|
8881
8972
|
className: "userListing",
|
|
8882
8973
|
style: {
|
|
8883
8974
|
minHeight: this.getSize() + 5,
|
|
8884
8975
|
cursor: this.props.onClick ? 'pointer' : 'inherit',
|
|
8885
|
-
opacity: this.
|
|
8976
|
+
opacity: this.isLoading() ? 0.5 : 1
|
|
8886
8977
|
},
|
|
8887
8978
|
onClick: this.props.onClick
|
|
8888
8979
|
}, /*#__PURE__*/React.createElement("div", {
|
|
8889
8980
|
className: "userListing_inner"
|
|
8890
|
-
}, /*#__PURE__*/React.createElement(
|
|
8891
|
-
size: this.getSize(),
|
|
8892
|
-
className: "userListing_profilePic",
|
|
8893
|
-
image: this.props.user.profilePic
|
|
8894
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
8981
|
+
}, this.renderImage(), /*#__PURE__*/React.createElement("div", {
|
|
8895
8982
|
className: "userListing_middle",
|
|
8896
8983
|
style: {
|
|
8897
8984
|
height: this.getSize()
|
|
@@ -8902,7 +8989,7 @@ var UserListing = /*#__PURE__*/function (_Component) {
|
|
|
8902
8989
|
color: '#fff'
|
|
8903
8990
|
} : null,
|
|
8904
8991
|
className: this.props.textClass
|
|
8905
|
-
}, this.
|
|
8992
|
+
}, this.getText()), this.renderSub())), this.renderRight());
|
|
8906
8993
|
}
|
|
8907
8994
|
}]);
|
|
8908
8995
|
|
package/dist/index.umd.js
CHANGED
|
@@ -1094,21 +1094,38 @@
|
|
|
1094
1094
|
dateObject.setMinutes(time.minutes);
|
|
1095
1095
|
return dateObject;
|
|
1096
1096
|
};
|
|
1097
|
-
var
|
|
1097
|
+
var formatTime = function formatTime(hours, minutes) {
|
|
1098
|
+
var period = hours >= 12 ? 'pm' : 'am'; // Convert 24-hour format to 12-hour format
|
|
1099
|
+
|
|
1100
|
+
var adjustedHours = hours > 12 ? hours - 12 : hours === 0 ? 12 : hours; // Ensure minutes are two digits
|
|
1101
|
+
|
|
1102
|
+
var adjustedMinutes = String(minutes).padStart(2, '0');
|
|
1103
|
+
return "".concat(adjustedHours, ":").concat(adjustedMinutes).concat(period);
|
|
1104
|
+
};
|
|
1105
|
+
var minutesToString = function minutesToString(minutes, isTimeOfDay) {
|
|
1098
1106
|
var hours = Math.floor(minutes / 60);
|
|
1099
1107
|
var remainingMinutes = minutes % 60;
|
|
1108
|
+
|
|
1109
|
+
if (isTimeOfDay) {
|
|
1110
|
+
return formatTime(hours, remainingMinutes);
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1100
1113
|
var hoursString = hours > 1 ? "".concat(hours, " hours") : "".concat(hours, " hour");
|
|
1101
1114
|
var minutesString = remainingMinutes > 1 ? "".concat(remainingMinutes, " minutes") : "".concat(remainingMinutes, " minute");
|
|
1102
1115
|
|
|
1103
1116
|
if (hours && remainingMinutes) {
|
|
1104
1117
|
return "".concat(hoursString, " ").concat(minutesString);
|
|
1105
|
-
}
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
if (hours) {
|
|
1106
1121
|
return hoursString;
|
|
1107
|
-
}
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
if (remainingMinutes) {
|
|
1108
1125
|
return minutesString;
|
|
1109
|
-
} else {
|
|
1110
|
-
return '0 minutes';
|
|
1111
1126
|
}
|
|
1127
|
+
|
|
1128
|
+
return '0 minutes';
|
|
1112
1129
|
};
|
|
1113
1130
|
var getUTCFromTimeDatePickers = function getUTCFromTimeDatePickers(dateInput, timeInput) {
|
|
1114
1131
|
var dateObject = getDateFromTimeDatePickers(dateInput, timeInput);
|
|
@@ -1772,6 +1789,7 @@
|
|
|
1772
1789
|
hasTimeframeOverlap: hasTimeframeOverlap,
|
|
1773
1790
|
timepickerToMinutes: timepickerToMinutes,
|
|
1774
1791
|
getDateFromTimeDatePickers: getDateFromTimeDatePickers,
|
|
1792
|
+
formatTime: formatTime,
|
|
1775
1793
|
minutesToString: minutesToString,
|
|
1776
1794
|
getUTCFromTimeDatePickers: getUTCFromTimeDatePickers,
|
|
1777
1795
|
getPluralS: getPluralS,
|
|
@@ -8853,6 +8871,55 @@
|
|
|
8853
8871
|
value: function getSize() {
|
|
8854
8872
|
return this.props.size || 30;
|
|
8855
8873
|
}
|
|
8874
|
+
}, {
|
|
8875
|
+
key: "getImage",
|
|
8876
|
+
value: function getImage() {
|
|
8877
|
+
if (this.props.user && this.props.user.profilePic) {
|
|
8878
|
+
return this.props.user.profilePic;
|
|
8879
|
+
}
|
|
8880
|
+
|
|
8881
|
+
if (this.props.image) {
|
|
8882
|
+
return this.props.image;
|
|
8883
|
+
}
|
|
8884
|
+
|
|
8885
|
+
return undefined;
|
|
8886
|
+
}
|
|
8887
|
+
}, {
|
|
8888
|
+
key: "getKey",
|
|
8889
|
+
value: function getKey() {
|
|
8890
|
+
if (this.props.user && this.props.user.id) {
|
|
8891
|
+
return this.props.user.id;
|
|
8892
|
+
}
|
|
8893
|
+
|
|
8894
|
+
return this.props.id;
|
|
8895
|
+
}
|
|
8896
|
+
}, {
|
|
8897
|
+
key: "getText",
|
|
8898
|
+
value: function getText() {
|
|
8899
|
+
if (this.props.user && this.props.user.displayName) {
|
|
8900
|
+
return this.props.user.displayName;
|
|
8901
|
+
}
|
|
8902
|
+
|
|
8903
|
+
return this.props.title;
|
|
8904
|
+
}
|
|
8905
|
+
}, {
|
|
8906
|
+
key: "getBorderRadius",
|
|
8907
|
+
value: function getBorderRadius() {
|
|
8908
|
+
if (this.props.squareImage) {
|
|
8909
|
+
return 4;
|
|
8910
|
+
}
|
|
8911
|
+
|
|
8912
|
+
return this.getSize() / 2;
|
|
8913
|
+
}
|
|
8914
|
+
}, {
|
|
8915
|
+
key: "isLoading",
|
|
8916
|
+
value: function isLoading() {
|
|
8917
|
+
if (this.props.user && this.props.user.loading) {
|
|
8918
|
+
return this.props.user && this.props.user.loading;
|
|
8919
|
+
}
|
|
8920
|
+
|
|
8921
|
+
return this.props.isLoading;
|
|
8922
|
+
}
|
|
8856
8923
|
}, {
|
|
8857
8924
|
key: "renderRight",
|
|
8858
8925
|
value: function renderRight() {
|
|
@@ -8871,25 +8938,45 @@
|
|
|
8871
8938
|
|
|
8872
8939
|
return this.props.subContent;
|
|
8873
8940
|
}
|
|
8941
|
+
}, {
|
|
8942
|
+
key: "renderImage",
|
|
8943
|
+
value: function renderImage() {
|
|
8944
|
+
if (this.props.squareImage) {
|
|
8945
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
8946
|
+
style: {
|
|
8947
|
+
height: this.getSize(),
|
|
8948
|
+
width: this.getSize(),
|
|
8949
|
+
borderRadius: this.getBorderRadius(),
|
|
8950
|
+
marginRight: 8,
|
|
8951
|
+
backgroundSize: 'cover',
|
|
8952
|
+
backgroundPosition: 'center',
|
|
8953
|
+
backgroundImage: "url(".concat(this.getImage(), ")")
|
|
8954
|
+
},
|
|
8955
|
+
alt: "".concat(this.getText(), " Image")
|
|
8956
|
+
});
|
|
8957
|
+
}
|
|
8958
|
+
|
|
8959
|
+
return /*#__PURE__*/React__default['default'].createElement(ProfilePic, {
|
|
8960
|
+
size: this.getSize(),
|
|
8961
|
+
className: "userListing_profilePic",
|
|
8962
|
+
image: this.getImage()
|
|
8963
|
+
});
|
|
8964
|
+
}
|
|
8874
8965
|
}, {
|
|
8875
8966
|
key: "render",
|
|
8876
8967
|
value: function render() {
|
|
8877
8968
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
8878
|
-
key: this.
|
|
8969
|
+
key: this.getKey(),
|
|
8879
8970
|
className: "userListing",
|
|
8880
8971
|
style: {
|
|
8881
8972
|
minHeight: this.getSize() + 5,
|
|
8882
8973
|
cursor: this.props.onClick ? 'pointer' : 'inherit',
|
|
8883
|
-
opacity: this.
|
|
8974
|
+
opacity: this.isLoading() ? 0.5 : 1
|
|
8884
8975
|
},
|
|
8885
8976
|
onClick: this.props.onClick
|
|
8886
8977
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
8887
8978
|
className: "userListing_inner"
|
|
8888
|
-
}, /*#__PURE__*/React__default['default'].createElement(
|
|
8889
|
-
size: this.getSize(),
|
|
8890
|
-
className: "userListing_profilePic",
|
|
8891
|
-
image: this.props.user.profilePic
|
|
8892
|
-
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
8979
|
+
}, this.renderImage(), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
8893
8980
|
className: "userListing_middle",
|
|
8894
8981
|
style: {
|
|
8895
8982
|
height: this.getSize()
|
|
@@ -8900,7 +8987,7 @@
|
|
|
8900
8987
|
color: '#fff'
|
|
8901
8988
|
} : null,
|
|
8902
8989
|
className: this.props.textClass
|
|
8903
|
-
}, this.
|
|
8990
|
+
}, this.getText()), this.renderSub())), this.renderRight());
|
|
8904
8991
|
}
|
|
8905
8992
|
}]);
|
|
8906
8993
|
|
package/package.json
CHANGED
|
@@ -7,6 +7,44 @@ class UserListing extends Component {
|
|
|
7
7
|
return this.props.size || 30;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
getImage() {
|
|
11
|
+
if (this.props.user && this.props.user.profilePic) {
|
|
12
|
+
return this.props.user.profilePic;
|
|
13
|
+
}
|
|
14
|
+
if (this.props.image) {
|
|
15
|
+
return this.props.image;
|
|
16
|
+
}
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
getKey() {
|
|
21
|
+
if (this.props.user && this.props.user.id) {
|
|
22
|
+
return this.props.user.id;
|
|
23
|
+
}
|
|
24
|
+
return this.props.id;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
getText() {
|
|
28
|
+
if (this.props.user && this.props.user.displayName) {
|
|
29
|
+
return this.props.user.displayName;
|
|
30
|
+
}
|
|
31
|
+
return this.props.title;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
getBorderRadius() {
|
|
35
|
+
if (this.props.squareImage) {
|
|
36
|
+
return 4;
|
|
37
|
+
}
|
|
38
|
+
return this.getSize() / 2;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
isLoading() {
|
|
42
|
+
if (this.props.user && this.props.user.loading) {
|
|
43
|
+
return this.props.user && this.props.user.loading;
|
|
44
|
+
}
|
|
45
|
+
return this.props.isLoading;
|
|
46
|
+
}
|
|
47
|
+
|
|
10
48
|
renderRight() {
|
|
11
49
|
if (!this.props.rightContent) {
|
|
12
50
|
return null;
|
|
@@ -21,23 +59,43 @@ class UserListing extends Component {
|
|
|
21
59
|
return this.props.subContent;
|
|
22
60
|
}
|
|
23
61
|
|
|
62
|
+
renderImage() {
|
|
63
|
+
if (this.props.squareImage) {
|
|
64
|
+
return (
|
|
65
|
+
<div
|
|
66
|
+
style={{
|
|
67
|
+
height: this.getSize(),
|
|
68
|
+
width: this.getSize(),
|
|
69
|
+
borderRadius: this.getBorderRadius(),
|
|
70
|
+
marginRight: 8,
|
|
71
|
+
backgroundSize: 'cover',
|
|
72
|
+
backgroundPosition: 'center',
|
|
73
|
+
backgroundImage: `url(${this.getImage()})`,
|
|
74
|
+
}}
|
|
75
|
+
alt={`${this.getText()} Image`}
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
return <ProfilePic size={this.getSize()} className="userListing_profilePic" image={this.getImage()} />;
|
|
80
|
+
}
|
|
81
|
+
|
|
24
82
|
render() {
|
|
25
83
|
return (
|
|
26
84
|
<div
|
|
27
|
-
key={this.
|
|
85
|
+
key={this.getKey()}
|
|
28
86
|
className="userListing"
|
|
29
87
|
style={{
|
|
30
88
|
minHeight: this.getSize() + 5,
|
|
31
89
|
cursor: this.props.onClick ? 'pointer' : 'inherit',
|
|
32
|
-
opacity: this.
|
|
90
|
+
opacity: this.isLoading() ? 0.5 : 1,
|
|
33
91
|
}}
|
|
34
92
|
onClick={this.props.onClick}
|
|
35
93
|
>
|
|
36
94
|
<div className="userListing_inner">
|
|
37
|
-
|
|
95
|
+
{this.renderImage()}
|
|
38
96
|
<div className="userListing_middle" style={{ height: this.getSize() }}>
|
|
39
97
|
<Text type="name" style={this.props.whiteText ? { color: '#fff' } : null} className={this.props.textClass}>
|
|
40
|
-
{this.
|
|
98
|
+
{this.getText()}
|
|
41
99
|
</Text>
|
|
42
100
|
{this.renderSub()}
|
|
43
101
|
</div>
|
package/src/helper/helper.js
CHANGED
|
@@ -134,22 +134,39 @@ export const getDateFromTimeDatePickers = (dateInput, timeInput) => {
|
|
|
134
134
|
return dateObject;
|
|
135
135
|
};
|
|
136
136
|
|
|
137
|
-
export const
|
|
138
|
-
|
|
139
|
-
let remainingMinutes = minutes % 60;
|
|
137
|
+
export const formatTime = (hours, minutes) => {
|
|
138
|
+
const period = hours >= 12 ? 'pm' : 'am'; // Convert 24-hour format to 12-hour format
|
|
140
139
|
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
const adjustedHours = hours > 12 ? hours - 12 : hours === 0 ? 12 : hours; // Ensure minutes are two digits
|
|
141
|
+
|
|
142
|
+
const adjustedMinutes = String(minutes).padStart(2, '0');
|
|
143
|
+
return `${adjustedHours}:${adjustedMinutes}${period}`;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export const minutesToString = (minutes, isTimeOfDay) => {
|
|
147
|
+
const hours = Math.floor(minutes / 60);
|
|
148
|
+
const remainingMinutes = minutes % 60;
|
|
149
|
+
|
|
150
|
+
if (isTimeOfDay) {
|
|
151
|
+
return formatTime(hours, remainingMinutes);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const hoursString = hours > 1 ? `${hours} hours` : `${hours} hour`;
|
|
155
|
+
const minutesString = remainingMinutes > 1 ? `${remainingMinutes} minutes` : `${remainingMinutes} minute`;
|
|
143
156
|
|
|
144
157
|
if (hours && remainingMinutes) {
|
|
145
158
|
return `${hoursString} ${minutesString}`;
|
|
146
|
-
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (hours) {
|
|
147
162
|
return hoursString;
|
|
148
|
-
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (remainingMinutes) {
|
|
149
166
|
return minutesString;
|
|
150
|
-
} else {
|
|
151
|
-
return '0 minutes';
|
|
152
167
|
}
|
|
168
|
+
|
|
169
|
+
return '0 minutes';
|
|
153
170
|
};
|
|
154
171
|
|
|
155
172
|
export const getUTCFromTimeDatePickers = (dateInput, timeInput) => {
|