From 547c8cb206a4b118f316079d89514dba967c35b8 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 6 Feb 2019 14:31:43 +0000 Subject: [PATCH] render badge on community --- src/components/views/elements/TagTile.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/components/views/elements/TagTile.js b/src/components/views/elements/TagTile.js index ecbcc7213d..f5ee60a2d8 100644 --- a/src/components/views/elements/TagTile.js +++ b/src/components/views/elements/TagTile.js @@ -23,9 +23,11 @@ import sdk from '../../../index'; import dis from '../../../dispatcher'; import { isOnlyCtrlOrCmdIgnoreShiftKeyEvent } from '../../../Keyboard'; import * as ContextualMenu from '../../structures/ContextualMenu'; +import * as FormattingUtils from '../../../utils/FormattingUtils'; import FlairStore from '../../../stores/FlairStore'; import GroupStore from '../../../stores/GroupStore'; +import TagOrderStore from '../../../stores/TagOrderStore'; // A class for a child of TagPanel (possibly wrapped in a DNDTagTile) that represents // a thing to click on for the user to filter the visible rooms in the RoomList to: @@ -168,6 +170,16 @@ export default React.createClass({ mx_TagTile_selected: this.props.selected, }); + const badge = TagOrderStore.getGroupBadge(this.props.tag); + let badgeElement; + if (badge && !this.state.hover) { + const badgeClasses = classNames({ + "mx_TagTile_badge": true, + "mx_TagTile_badgeHighlight": badge.highlight, + }); + badgeElement = (
{FormattingUtils.formatCount(badge.count)}
); + } + const tip = this.state.hover ? :
; @@ -186,6 +198,7 @@ export default React.createClass({ /> { tip } { contextButton } + { badgeElement }
; },