1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.ActivityItem = void 0;
|
4 | var tslib_1 = require("tslib");
|
5 | var React = require("react");
|
6 | var ActivityItem_classNames_1 = require("./ActivityItem.classNames");
|
7 | var ActivityItem_styles_1 = require("./ActivityItem.styles");
|
8 | var Persona_1 = require("../../Persona");
|
9 |
|
10 |
|
11 |
|
12 | var ActivityItem = (function (_super) {
|
13 | tslib_1.__extends(ActivityItem, _super);
|
14 | function ActivityItem(props) {
|
15 | var _this = _super.call(this, props) || this;
|
16 | _this._onRenderIcon = function (props) {
|
17 | if (props.activityPersonas) {
|
18 | return _this._onRenderPersonaArray(props);
|
19 | }
|
20 | else {
|
21 | return _this.props.activityIcon;
|
22 | }
|
23 | };
|
24 | _this._onRenderActivityDescription = function (props) {
|
25 | var classNames = _this._getClassNames(props);
|
26 |
|
27 | var activityDescription = props.activityDescription || props.activityDescriptionText;
|
28 | if (activityDescription) {
|
29 | return React.createElement("span", { className: classNames.activityText }, activityDescription);
|
30 | }
|
31 | return null;
|
32 | };
|
33 | _this._onRenderComments = function (props) {
|
34 | var classNames = _this._getClassNames(props);
|
35 |
|
36 | var comments = props.comments || props.commentText;
|
37 | if (!props.isCompact && comments) {
|
38 | return React.createElement("div", { className: classNames.commentText }, comments);
|
39 | }
|
40 | return null;
|
41 | };
|
42 | _this._onRenderTimeStamp = function (props) {
|
43 | var classNames = _this._getClassNames(props);
|
44 | if (!props.isCompact && props.timeStamp) {
|
45 | return React.createElement("div", { className: classNames.timeStamp }, props.timeStamp);
|
46 | }
|
47 | return null;
|
48 | };
|
49 |
|
50 | _this._onRenderPersonaArray = function (props) {
|
51 | var classNames = _this._getClassNames(props);
|
52 | var personaElement = null;
|
53 | var activityPersonas = props.activityPersonas;
|
54 | if (activityPersonas[0].imageUrl || activityPersonas[0].imageInitials) {
|
55 | var personaList_1 = [];
|
56 | var showSize16Personas_1 = activityPersonas.length > 1 || props.isCompact;
|
57 | var personaLimit_1 = props.isCompact ? 3 : 4;
|
58 | var style_1 = undefined;
|
59 | if (props.isCompact) {
|
60 | style_1 = {
|
61 | display: 'inline-block',
|
62 | width: '10px',
|
63 | minWidth: '10px',
|
64 | overflow: 'visible',
|
65 | };
|
66 | }
|
67 | activityPersonas
|
68 | .filter(function (person, index) { return index < personaLimit_1; })
|
69 | .forEach(function (person, index) {
|
70 | personaList_1.push(React.createElement(Persona_1.PersonaCoin, tslib_1.__assign({}, person, { key: person.key || index, className: classNames.activityPersona,
|
71 |
|
72 | size: showSize16Personas_1 ? Persona_1.PersonaSize.size16 : Persona_1.PersonaSize.size32, style: style_1 })));
|
73 | });
|
74 | personaElement = React.createElement("div", { className: classNames.personaContainer }, personaList_1);
|
75 | }
|
76 | return personaElement;
|
77 | };
|
78 | return _this;
|
79 | }
|
80 | ActivityItem.prototype.render = function () {
|
81 | var _a = this.props, _b = _a.onRenderIcon, onRenderIcon = _b === void 0 ? this._onRenderIcon : _b, _c = _a.onRenderActivityDescription, onRenderActivityDescription = _c === void 0 ? this._onRenderActivityDescription : _c, _d = _a.onRenderComments, onRenderComments = _d === void 0 ? this._onRenderComments : _d, _e = _a.onRenderTimeStamp, onRenderTimeStamp = _e === void 0 ? this._onRenderTimeStamp : _e, animateBeaconSignal = _a.animateBeaconSignal, isCompact = _a.isCompact;
|
82 | var classNames = this._getClassNames(this.props);
|
83 | return (React.createElement("div", { className: classNames.root, style: this.props.style },
|
84 | (this.props.activityPersonas || this.props.activityIcon || this.props.onRenderIcon) && (React.createElement("div", { className: classNames.activityTypeIcon },
|
85 | animateBeaconSignal && isCompact && React.createElement("div", { className: classNames.pulsingBeacon }),
|
86 | onRenderIcon(this.props))),
|
87 | React.createElement("div", { className: classNames.activityContent },
|
88 | onRenderActivityDescription(this.props, this._onRenderActivityDescription),
|
89 | onRenderComments(this.props, this._onRenderComments),
|
90 | onRenderTimeStamp(this.props, this._onRenderTimeStamp))));
|
91 | };
|
92 | ActivityItem.prototype._getClassNames = function (props) {
|
93 | return ActivityItem_classNames_1.getClassNames(ActivityItem_styles_1.getStyles(undefined, props.styles, props.animateBeaconSignal, props.beaconColorOne, props.beaconColorTwo, props.isCompact), props.className, props.activityPersonas, props.isCompact);
|
94 | };
|
95 | return ActivityItem;
|
96 | }(React.Component));
|
97 | exports.ActivityItem = ActivityItem;
|
98 |
|
\ | No newline at end of file |