How to use the matrix-react-sdk/lib/utils/FormattingUtils.formatCount function in matrix-react-sdk

To help you get started, we’ve selected a few matrix-react-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vector-im / riot-web / src / components / structures / RoomSubList.js View on Github external
var roomCount = this.props.list.length > 0 ? this.props.list.length : '';

        var chevronClasses = classNames({
            'mx_RoomSubList_chevron': true,
            'mx_RoomSubList_chevronRight': this.state.hidden,
            'mx_RoomSubList_chevronDown': !this.state.hidden,
        });

        var badgeClasses = classNames({
            'mx_RoomSubList_badge': true,
            'mx_RoomSubList_badgeHighlight': subListNotifHighlight,
        });

        var badge;
        if (subListNotifCount > 0) {
            badge = <div>{ FormattingUtils.formatCount(subListNotifCount) }</div>;
        }

        // When collapsed, allow a long hover on the header to show user
        // the full tag name and room count
        var title;
        if (this.props.collapsed) {
            title = this.props.label;
            if (roomCount !== '') {
                title += " [" + roomCount + "]";
            }
        }

        var incomingCall;
        if (this.props.incomingCall) {
            var self = this;
            // Check if the incoming call is for this section
github vector-im / riot-web / src / components / structures / RoomSubList.js View on Github external
var roomCount = this.props.list.length &gt; 0 ? this.props.list.length : '';

        var chevronClasses = classNames({
            'mx_RoomSubList_chevron': true,
            'mx_RoomSubList_chevronRight': this.state.hidden,
            'mx_RoomSubList_chevronDown': !this.state.hidden,
        });

        var badgeClasses = classNames({
            'mx_RoomSubList_badge': true,
            'mx_RoomSubList_badgeHighlight': subListNotifHighlight,
        });

        var badge;
        if (subListNotifCount &gt; 0) {
            badge = <div>{ FormattingUtils.formatCount(subListNotifCount) }</div>;
        }

        // When collapsed, allow a long hover on the header to show user
        // the full tag name and room count
        var title;
        if (this.props.collapsed) {
            title = this.props.label;
            if (roomCount !== '') {
                title += " [" + roomCount + "]";
            }
        }

        var incomingCall;
        if (this.props.incomingCall) {
            var self = this;
            // Check if the incoming call is for this section
github vector-im / riot-web / src / components / structures / RoomSubListHeader.js View on Github external
const subListNotifHighlight = subListNotifications[1];

        const chevronClasses = classNames({
            'mx_RoomSubList_chevron': true,
            'mx_RoomSubList_chevronRight': this.props.hidden,
            'mx_RoomSubList_chevronDown': !this.props.hidden,
        });

        const badgeClasses = classNames({
            'mx_RoomSubList_badge': true,
            'mx_RoomSubList_badgeHighlight': subListNotifHighlight,
        });

        let badge;
        if (subListNotifCount &gt; 0) {
            badge = <div>{ formatCount(subListNotifCount) }</div>;
        } else if (subListNotifHighlight) {
            badge = <div>!</div>;   
        }

        // When collapsed, allow a long hover on the header to show user
        // the full tag name and room count
        let title;
        const roomCount = this.props.roomCount;
        if (this.props.collapsed) {
            title = this.props.label;
            if (roomCount !== '') {
                title += " [" + roomCount + "]";
            }
        }

        let incomingCall;
github vector-im / riot-web / src / components / structures / RoomSubList.js View on Github external
_createOverflowTile: function(overflowCount, totalCount) {
        var content = <div></div>;

        var overflowNotifications = this.roomNotificationCount(TRUNCATE_AT);
        var overflowNotifCount = overflowNotifications[0];
        var overflowNotifHighlight = overflowNotifications[1];
        if (overflowNotifCount &amp;&amp; !this.props.collapsed) {
            content = FormattingUtils.formatCount(overflowNotifCount);
        }

        var badgeClasses = classNames({
            'mx_RoomSubList_moreBadge': true,
            'mx_RoomSubList_moreBadgeNotify': overflowNotifCount &amp;&amp; !this.props.collapsed,
            'mx_RoomSubList_moreBadgeHighlight': overflowNotifHighlight &amp;&amp; !this.props.collapsed,
        });

        return (
            
                <div></div>
                <div>more</div>
                <div>{ content }</div>
            
        );
    },
github vector-im / riot-web / src / components / structures / RoomSubList.js View on Github external
_createOverflowTile: function(overflowCount, totalCount) {
        var content = <div></div>;

        var overflowNotifications = this.roomNotificationCount(TRUNCATE_AT);
        var overflowNotifCount = overflowNotifications[0];
        var overflowNotifHighlight = overflowNotifications[1];
        if (overflowNotifCount &amp;&amp; !this.props.collapsed) {
            content = FormattingUtils.formatCount(overflowNotifCount);
        }

        var badgeClasses = classNames({
            'mx_RoomSubList_moreBadge': true,
            'mx_RoomSubList_moreBadgeNotify': overflowNotifCount &amp;&amp; !this.props.collapsed,
            'mx_RoomSubList_moreBadgeHighlight': overflowNotifHighlight &amp;&amp; !this.props.collapsed,
        });

        return (
            
                <div></div>
                <div>{ _t("more") }</div>
                <div>{ content }</div>
            
        );
    },