Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
user_circles: Introduce circle icons in sidebars.
Karl Stolley1113bd53b688
diff --git a/web/shared/icons/user-circle-active.svg b/web/shared/icons/user-circle-active.svgnew file mode 100644index 00000000000..a2dd6a7f044--- /dev/null+++ b/web/shared/icons/user-circle-active.svg@@ -0,0 +1,4 @@+<svg viewBox="0 0 11 11" xmlns="http://www.w3.org/2000/svg">+ <path fill="#000000" d="M 0 5.5 C 0 2.462433 2.462432 0 5.5 0 C 8.53754 0 11 2.462433 11 5.5 C 11 8.53754 8.53754 11 5.5 11 C 2.462432 11 0 8.53754 0 5.5 Z"/>+</svg>+diff --git a/web/shared/icons/user-circle-idle.svg b/web/shared/icons/user-circle-idle.svgnew file mode 100644index 00000000000..fe8701e9690--- /dev/null+++ b/web/shared/icons/user-circle-idle.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 11 11" xmlns="http://www.w3.org/2000/svg">+ <path fill="#000000" d="m 5.5,0.825 c -2.581931,0 -4.6095887,2.3055538 -4.6095887,4.8766848 l 9.2518827,0 C 10.142294,3.1231918 8.081921,0.825 5.5,0.825 Z M 0,5.5 C 0,2.462433 2.462432,0 5.5,0 8.53754,0 11,2.462433 11,5.5 11,8.53754 8.53754,11 5.5,11 2.462432,11 0,8.53754 0,5.5 Z" />+</svg>diff --git a/web/shared/icons/user-circle-offline.svg b/web/shared/icons/user-circle-offline.svgnew file mode 100644index 00000000000..01214d74dd5--- /dev/null+++ b/web/shared/icons/user-circle-offline.svg@@ -0,0 +1,3 @@+<svg viewBox="0 0 11 11" xmlns="http://www.w3.org/2000/svg">+ <path fill="#000000" d="M 5.5 0.825 C 2.918069 0.825 0.825 2.918069 0.825 5.5 C 0.825 8.081921 2.918069 10.175 5.5 10.175 C 8.081921 10.175 10.175 8.081921 10.175 5.5 C 10.175 2.918069 8.081921 0.825 5.5 0.825 Z M 0 5.5 C 0 2.462433 2.462432 0 5.5 0 C 8.53754 0 11 2.462433 11 5.5 C 11 8.53754 8.53754 11 5.5 11 C 2.462432 11 0 8.53754 0 5.5 Z"/>+</svg>diff --git a/web/src/activity_ui.ts b/web/src/activity_ui.tsindex cb5b01aa88c..843ba0bc0d3 100644--- a/web/src/activity_ui.ts+++ b/web/src/activity_ui.ts@@ -64,9 +64,16 @@ export let update_presence_indicators = (): void => {const user_id = Number.parseInt($(this).attr("data-presence-indicator-user-id") ?? "", 10);assert(!Number.isNaN(user_id));const user_circle_class = buddy_data.get_user_circle_class(user_id);+ const user_circle_class_with_icon = `${user_circle_class} zulip-icon-${user_circle_class}`;$(this)- .removeClass("user-circle-active user-circle-idle user-circle-offline")- .addClass(user_circle_class);+ .removeClass(+ `+ user-circle-active zulip-icon-user-circle-active+ user-circle-idle zulip-icon-user-circle-idle+ user-circle-offline zulip-icon-user-circle-offline+ `,+ )+ .addClass(user_circle_class_with_icon);});};diff --git a/web/styles/app_variables.css b/web/styles/app_variables.cssindex 65ea0a7a823..9315af24b33 100644--- a/web/styles/app_variables.css+++ b/web/styles/app_variables.css@@ -880,6 +880,7 @@--color-tab-picker-icon: hsl(200deg 100% 40%);--color-user-circle-active: hsl(106deg 74% 44%);--color-user-circle-idle: hsl(29deg 84% 51%);+ --color-user-circle-offline: hsl(0deg 0% 50%);/* hsl(229deg 9% 36%) corresponds to --grey-600.We use the hsl() equivalent directly since postcss-color-mix-functioncannot dynamically resolve var() arguments. */diff --git a/web/styles/left_sidebar.css b/web/styles/left_sidebar.cssindex a44c3be6d7f..d170274aca1 100644--- a/web/styles/left_sidebar.css+++ b/web/styles/left_sidebar.css@@ -290,7 +290,7 @@color: inherit;}- .zulip-icon {+ .zulip-icon:not(.user-circle) {color: var(--color-left-sidebar-dm-partners-icon);}}@@ -1492,18 +1492,10 @@ li.topic-list-item {}.user-circle {- width: var(--length-user-status-circle);- height: var(--length-user-status-circle);-- @media screen and (resolution <= 1x) {- /* User circles appear to sag a bit on- low-resolution screens, so this fix- targets them without disrupting- line-height values that may become- important in multi-line DM groups, etc.- in the future. */- margin-top: -2.5px;- }+ /* Tighten the line-height to match the icon's size... */+ line-height: 1;+ /* ...which is approximately 11px at 16px/1em. */+ font-size: 0.6875em;}.unread_count {diff --git a/web/styles/right_sidebar.css b/web/styles/right_sidebar.cssindex 719270a6dbc..7fc08322006 100644--- a/web/styles/right_sidebar.css+++ b/web/styles/right_sidebar.css@@ -142,46 +142,39 @@ $user_status_emoji_width: 24px;&.highlighted_user {background-color: var(--color-buddy-list-highlighted-user);box-shadow: inset 0 0 0 1px var(--color-shadow-sidebar-row-hover);-- .user-circle {- outline: 1px solid var(--color-buddy-list-highlighted-user);- }}}.user-circle {- width: var(--length-user-status-circle);- height: var(--length-user-status-circle);grid-area: starting-anchor-element;place-self: center center;-- @media screen and (resolution <= 1x) {- /* User circles appear to sag a bit on- low-resolution screens, so this fix- targets them without disrupting- line-height values. */- margin-top: -2.5px;- }+ /* Tighten the line-height to match the icon's size... */+ line-height: 1;+ /* ...which is approximately 11px at 16px/1em. */+ font-size: 0.6875em;}- .user_sidebar_entry.with_avatar .user-circle {- display: inline-block;- position: absolute;- width: 0.5em;- height: 0.5em;- top: 1.7em;- left: 1.7em;-- &.user-circle-idle {- background: linear-gradient(- to bottom,- var(--color-background) 50%,- var(--color-user-circle-idle) 50%- );+ .user_sidebar_entry.with_avatar {+ .user-profile-picture {+ /* Establish positioning context for user circle. */+ position: relative;}- &.user-circle-offline {- display: none;+ .user-circle {+ position: absolute;+ /* 10px at 16px/1em */+ font-size: 0.625em;+ bottom: -1px;+ right: -1px;+ background-color: var(--color-background);+ /* A 1.5px border provides better results than+ a 1px border, especially at smaller font sizes. */+ border: 1.5px solid var(--color-background);+ border-radius: 50%;++ &.user-circle-offline {+ display: none;+ }}}diff --git a/web/styles/user_circles.css b/web/styles/user_circles.cssindex c942012845f..8711d4d97a9 100644--- a/web/styles/user_circles.css+++ b/web/styles/user_circles.css@@ -1,29 +1,11 @@-.user-circle-active,-.user-circle-idle,-.user-circle-offline {- border-radius: 50%;- border: 1px solid;-}--.user_sidebar_entry.with_avatar .user-circle {- outline: 1px solid var(--color-background);-}-.user-circle-active {- background-color: var(--color-user-circle-active);- border-color: var(--color-user-circle-active);+ color: var(--color-user-circle-active);}.user-circle-idle {- border-color: var(--color-user-circle-idle);- background: linear-gradient(- to bottom,- hsl(0deg 0% 100% / 0%) 50%,- var(--color-user-circle-idle) 50%- );+ color: var(--color-user-circle-idle);}.user-circle-offline {- background-color: transparent;- border-color: hsl(0deg 0% 50%);+ color: var(--color-user-circle-offline);}diff --git a/web/templates/pm_list_item.hbs b/web/templates/pm_list_item.hbsindex dc00d09f4b8..81298dcdd03 100644--- a/web/templates/pm_list_item.hbs+++ b/web/templates/pm_list_item.hbs@@ -6,7 +6,7 @@{{else if is_bot}}<span class="conversation-partners-icon zulip-icon zulip-icon-bot" aria-hidden="true"></span>{{else}}- <span class="conversation-partners-icon {{user_circle_class}} user-circle"></span>+ <span class="conversation-partners-icon zulip-icon zulip-icon-{{user_circle_class}} {{user_circle_class}} user-circle"></span>{{/if}}<a href="{{url}}" class="conversation-partners">diff --git a/web/templates/presence_row.hbs b/web/templates/presence_row.hbsindex 1c4752a4f8a..ba309d4d22a 100644--- a/web/templates/presence_row.hbs+++ b/web/templates/presence_row.hbs@@ -1,7 +1,7 @@<li data-user-id="{{user_id}}" data-name="{{name}}" class="user_sidebar_entry {{#if user_list_style.WITH_AVATAR}}with_avatar{{/if}} {{#if has_status_text}}with_status{{/if}} {{#if is_current_user}}user_sidebar_entry_me {{/if}} narrow-filter {{#if faded}} user-fade {{/if}}"><div class="selectable_sidebar_block">{{#if user_list_style.WITH_STATUS}}- <span class="{{user_circle_class}} user-circle"></span>+ <span class="zulip-icon zulip-icon-{{user_circle_class}} {{user_circle_class}} user-circle"></span><a class="user-presence-link" href="{{href}}"><div class="user-name-and-status-wrapper"><div class="user-name-and-status-emoji">@@ -14,7 +14,7 @@{{else if user_list_style.WITH_AVATAR}}<div class="user-profile-picture avatar-preload-background"><img loading="lazy" src="{{profile_picture}}"/>- <span class="{{user_circle_class}} user-circle"></span>+ <span class="zulip-icon zulip-icon-{{user_circle_class}} {{user_circle_class}} user-circle"></span></div><a class="user-presence-link" href="{{href}}"><div class="user-name-and-status-wrapper">@@ -26,7 +26,7 @@</div></a>{{else}}- <span class="{{user_circle_class}} user-circle"></span>+ <span class="zulip-icon zulip-icon-{{user_circle_class}} {{user_circle_class}} user-circle"></span><a class="user-presence-link" href="{{href}}"><div class="user-name-and-status-emoji">{{> user_full_name .}}