Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
typeahead: Place availability indicator on avatar in user typeaheads.
Evy Kassirerdce3c41c28fd
diff --git a/web/styles/typeahead.css b/web/styles/typeahead.cssindex 68cd2adb2e6..d5de475c4c5 100644--- a/web/styles/typeahead.css+++ b/web/styles/typeahead.css@@ -52,17 +52,6 @@outline: 0;}- .user-circle {- /* 11px at 16px/1em */- font-size: 0.6875em;- align-self: center;- /* TODO: A grid rewrite of typeahead rows- should help to obviate these kinds of- fiddly spacing hacks. */- margin-right: 2px;- margin-left: -2px;- }-&.topic-typeahead-link {gap: 5px;}@@ -193,24 +182,53 @@}}+.typeahead-image.zulip-icon {+ display: flex;+ justify-content: center;+ align-items: center;+}+/* For FontAwesome icons and zulip icons used in place of images for some users. */.typeahead-image {flex: 0 0 auto;+ position: relative;height: 1.3125em; /* 21px at 16px/1em */width: 1.3125em; /* 21px at 16px/1em */border-radius: 4px;- &.no-presence-circle {- /* 0.6875em at 16px/1em is the width of presence circle,- no margin (-2px left margin + 2px right margin = 0px),- and 0.3571 is the gap between the presence circle and- image avatars. */- margin-left: calc(0.6875em + 0.3571em);- /* To properly align icons within the 21px square box- defined on .typeahead-image, we establish a flexbox: */- display: flex;- align-items: center;- justify-content: center;+ .typeahead-image-avatar {+ border-radius: 4px;+ /* Override bootstrap img */+ vertical-align: baseline;+ }++ .user-circle {+ position: absolute;+ /* This is smaller than the sidebar because avatars here are smaller */+ font-size: 0.4375em; /* 7px at 16px/1em */+ line-height: 1;+ bottom: -0.5px;+ right: -0.5px;+ background-color: var(--color-background-dropdown-widget);+ padding: 1px;+ border-radius: 50%;++ &.user-circle-offline {+ display: none;+ }+ }++ /* Move the background styles onto the :before element so that the 1px padding+ outline still works. */+ .user-circle-idle {+ background: var(--color-background-dropdown-widget);+ }++ .user-circle-idle::before {+ background: var(--gradient-user-circle-idle);+ background-clip: text;+ -webkit-text-fill-color: transparent;+ border-radius: 50%;}}diff --git a/web/templates/typeahead_list_item.hbs b/web/templates/typeahead_list_item.hbsindex 3c681c8a3f2..c3ccab3d411 100644--- a/web/templates/typeahead_list_item.hbs+++ b/web/templates/typeahead_list_item.hbs@@ -5,16 +5,18 @@<span class='emoji emoji-{{ emoji_code }}'></span>{{/if}}{{else if is_person}}- {{#if user_circle_class}}- <span class="zulip-icon zulip-icon-{{user_circle_class}} {{user_circle_class}} user-circle"></span>- {{/if}}{{#if has_image}}- <img class="typeahead-image" src="{{ img_src }}" />+ <div class="typeahead-image">+ <img class="typeahead-image-avatar" src="{{ img_src }}" />+ {{#if user_circle_class}}+ <span class="zulip-icon zulip-icon-{{user_circle_class}} {{user_circle_class}} user-circle"></span>+ {{/if}}+ </div>{{else}}- <i class='typeahead-image zulip-icon zulip-icon-user-group no-presence-circle'></i>+ <i class='typeahead-image zulip-icon zulip-icon-user-group'></i>{{/if}}{{else if is_user_group}}- <i class="typeahead-image zulip-icon zulip-icon-user-group no-presence-circle" aria-hidden="true"></i>+ <i class="typeahead-image zulip-icon zulip-icon-user-group" aria-hidden="true"></i>{{/if}}{{#if is_stream_topic}}<div class="typeahead-text-container">diff --git a/web/templates/user_group_display_only_pill.hbs b/web/templates/user_group_display_only_pill.hbsindex 144db0128e1..c5d571ca9aa 100644--- a/web/templates/user_group_display_only_pill.hbs+++ b/web/templates/user_group_display_only_pill.hbs@@ -1,6 +1,6 @@<span class="pill-container display_only_group_pill"><a data-user-group-id="{{group_id}}" class="view_user_group pill" tabindex="0">- <i class="zulip-icon zulip-icon-user-group no-presence-circle" aria-hidden="true"></i>+ <i class="zulip-icon zulip-icon-user-group" aria-hidden="true"></i><span class="pill-label {{#if strikethrough}} strikethrough {{/if}}" ><span class="pill-value">{{display_value}}</span></span>diff --git a/web/tests/composebox_typeahead.test.cjs b/web/tests/composebox_typeahead.test.cjsindex 5a640276a23..acd3eff6a5d 100644--- a/web/tests/composebox_typeahead.test.cjs+++ b/web/tests/composebox_typeahead.test.cjs@@ -1460,8 +1460,10 @@ test("initialize", ({override, override_rewire, mock_template}) => {ct.get_or_set_token_for_testing("othello");actual_value = options.item_html(othello_item);expected_value =- ` <span class="zulip-icon zulip-icon-user-circle-offline user-circle-offline user-circle"></span>\n` +- ` <img class="typeahead-image" src="/avatar/${othello.user_id}" />\n` ++ ' <div class="typeahead-image">\n' ++ ` <img class="typeahead-image-avatar" src="/avatar/${othello.user_id}" />\n` ++ ' <span class="zulip-icon zulip-icon-user-circle-offline user-circle-offline user-circle"></span>\n' ++ " </div>\n" +'<div class="typeahead-text-container">\n' +' <strong class="typeahead-strong-section">Othello, the Moor of Venice</strong> <span class="autocomplete_secondary">[email protected]</span>' +"</div>\n";@@ -1473,7 +1475,7 @@ test("initialize", ({override, override_rewire, mock_template}) => {ct.get_or_set_token_for_testing("hamletcharacters");actual_value = options.item_html(hamletcharacters);expected_value =- ' <i class="typeahead-image zulip-icon zulip-icon-user-group no-presence-circle" aria-hidden="true"></i>\n' ++ ' <i class="typeahead-image zulip-icon zulip-icon-user-group" aria-hidden="true"></i>\n' +'<div class="typeahead-text-container">\n' +' <strong class="typeahead-strong-section">hamletcharacters</strong> <span class="autocomplete_secondary">Characters of Hamlet</span>' +"</div>\n";