Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
topic_popover: Add support to follow a topic from the topic_popover.
Prakhar Pratyush237f9f4799c7
diff --git a/web/shared/icons/follow.svg b/web/shared/icons/follow.svgnew file mode 100644index 00000000000..208151efcb6--- /dev/null+++ b/web/shared/icons/follow.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><g fill="#000" fill-rule="evenodd" clip-rule="evenodd"><path d="M7.62 2.73c.23.11.38.35.38.6v9.34a.66.66 0 0 1-1.08.52l-3.15-2.53H1.33A.66.66 0 0 1 .67 10V6c0-.37.3-.67.66-.67h2.44l3.15-2.52c.2-.16.47-.19.7-.08Zm-.95 1.99-2.25 1.8a.66.66 0 0 1-.42.15H2v2.67h2c.15 0 .3.05.42.14l2.25 1.8V4.72Zm3.22.45a.67.67 0 0 1 .94 0 4 4 0 0 1 0 5.65.66.66 0 0 1-.94-.94 2.67 2.67 0 0 0 0-3.77.67.67 0 0 1 0-.94Z"/><path d="M12.24 2.82a.66.66 0 0 1 .94 0 7.33 7.33 0 0 1 0 10.36.66.66 0 0 1-.94-.94 6 6 0 0 0 0-8.48.66.66 0 0 1 0-.94Z"/></g></svg>\ No newline at end of filediff --git a/web/shared/icons/mute-new.svg b/web/shared/icons/mute-new.svgnew file mode 100644index 00000000000..91b0dcbfc6d--- /dev/null+++ b/web/shared/icons/mute-new.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><g fill="#000"><path fill-rule="evenodd" d="M7.62 2.73c.23.11.38.35.38.6v9.34a.66.66 0 0 1-1.08.52l-3.15-2.53H1.33A.66.66 0 0 1 .67 10V6c0-.37.3-.67.66-.67h2.44l3.15-2.52c.2-.16.47-.19.7-.08Zm-.95 1.99-2.25 1.8a.66.66 0 0 1-.42.15H2v2.67h2c.15 0 .3.05.42.14l2.25 1.8V4.72Z" clip-rule="evenodd"/><path d="M15.14 6.47a.66.66 0 1 0-.94-.94l-1.53 1.53-1.53-1.53a.67.67 0 0 0-.94.94L11.73 8 10.2 9.53a.66.66 0 1 0 .94.94l1.53-1.53 1.53 1.53a.67.67 0 0 0 .94-.94L13.6 8l1.53-1.53Z"/></g></svg>\ No newline at end of filediff --git a/web/shared/icons/unmute-new.svg b/web/shared/icons/unmute-new.svgnew file mode 100644index 00000000000..1a739a0dab4--- /dev/null+++ b/web/shared/icons/unmute-new.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="#000" fill-rule="evenodd" d="M7.62 2.73c.23.11.38.35.38.6v9.34a.66.66 0 0 1-1.08.52l-3.15-2.53H1.33A.66.66 0 0 1 .67 10V6c0-.37.3-.67.66-.67h2.44l3.15-2.52c.2-.16.47-.19.7-.08Zm-.95 1.99-2.25 1.8a.66.66 0 0 1-.42.15H2v2.67h2c.15 0 .3.05.42.14l2.25 1.8V4.72Zm3.22.45a.67.67 0 0 1 .94 0 4 4 0 0 1 0 5.65.66.66 0 0 1-.94-.94 2.67 2.67 0 0 0 0-3.77.66.66 0 0 1 0-.94Z" clip-rule="evenodd"/></svg>\ No newline at end of filediff --git a/web/src/popover_menus.js b/web/src/popover_menus.jsindex 6de87c33945..274a9e6415b 100644--- a/web/src/popover_menus.js+++ b/web/src/popover_menus.js@@ -483,6 +483,18 @@ export function initialize() {return;}+ $popper.on("click", ".tab-option", (e) => {+ $(".tab-option").removeClass("selected-tab");+ $(e.currentTarget).addClass("selected-tab");++ const visibility_policy = $(e.currentTarget).attr("data-visibility-policy");+ user_topics.set_user_topic_visibility_policy(+ stream_id,+ topic_name,+ visibility_policy,+ );+ });+$popper.one("click", ".sidebar-popover-unmute-topic", () => {user_topics.set_user_topic_visibility_policy(stream_id,diff --git a/web/src/popover_menus_data.js b/web/src/popover_menus_data.jsindex 39482f759ee..04c644f3966 100644--- a/web/src/popover_menus_data.js+++ b/web/src/popover_menus_data.js@@ -130,6 +130,8 @@ export function get_topic_popover_content_context({stream_id, topic_name, url})const has_starred_messages = starred_messages.get_count_in_topic(sub.stream_id, topic_name) > 0;const can_move_topic = settings_data.user_can_move_messages_between_streams();const can_rename_topic = settings_data.user_can_move_messages_to_another_topic();+ const visibility_policy = user_topics.get_topic_visibility_policy(sub.stream_id, topic_name);+ const all_visibility_policies = user_topics.all_visibility_policies;return {stream_name: sub.name,stream_id: sub.stream_id,@@ -144,5 +146,8 @@ export function get_topic_popover_content_context({stream_id, topic_name, url})color: sub.color,has_starred_messages,url,+ visibility_policy,+ all_visibility_policies,+ development: page_params.development_environment,};}diff --git a/web/styles/app_components.css b/web/styles/app_components.cssindex e6d96e583ad..d7c177c7f28 100644--- a/web/styles/app_components.css+++ b/web/styles/app_components.css@@ -1044,3 +1044,44 @@ div.overlay {0 0 8px hsl(206deg 80% 62% / 60%);}}++/* Icon-based tab picker used for topics popover. */+.tabs-container {+ display: flex;+ justify-content: center;+ align-items: center;+ box-sizing: border-box;+ width: 100%;+ height: 27px;+ background-color: hsl(0deg 0% 0% / 7%);+ position: relative;+ border-radius: 5px;++ & i {+ z-index: 2;+ color: hsl(200deg 100% 40%);+ font-size: 17px;+ }++ .selected-tab {+ background-color: hsl(0deg 0% 100%);+ border: 1px solid hsl(0deg 0% 0% / 30%);+ z-index: 1;+ }++ .tab-option {+ display: flex;+ justify-content: center;+ align-items: center;+ box-sizing: border-box;+ width: 100%;+ height: 100%;+ cursor: pointer;+ border-radius: 5px;++ &:hover:not(.selected-tab) {+ background-color: hsl(0deg 0% 100%);+ border: 1px solid hsl(0deg 0% 0% / 30%);+ }+ }+}diff --git a/web/styles/dark_theme.css b/web/styles/dark_theme.cssindex b736c80df6d..cbf035bb37e 100644--- a/web/styles/dark_theme.css+++ b/web/styles/dark_theme.css@@ -1543,6 +1543,26 @@}}}++ .tabs-container {+ background-color: hsl(0deg 0% 0% / 30%);++ & i {+ color: hsl(0deg 0% 80%);+ }++ .selected-tab {+ background-color: hsl(0deg 0% 17% / 50%);+ border: 1px solid hsl(0deg 0% 100% / 12%);+ }++ .tab-option {+ &:hover:not(.selected-tab) {+ background-color: hsl(0deg 0% 17% / 50%);+ border: 1px solid hsl(0deg 0% 100% / 12%);+ }+ }+ }}@supports (-moz-appearance: none) {diff --git a/web/templates/topic_sidebar_actions.hbs b/web/templates/topic_sidebar_actions.hbsindex efae0329b75..a2184adb43d 100644--- a/web/templates/topic_sidebar_actions.hbs+++ b/web/templates/topic_sidebar_actions.hbs@@ -8,38 +8,56 @@<hr />- {{#if stream_muted}}- {{#unless topic_unmuted}}- <li class="hidden-for-spectators">- <a tabindex="0" class="sidebar-popover-unmute-topic" data-stream-id="{{ stream_id }}" data-topic-name="{{ topic_name }}">- <i class="zulip-icon zulip-icon-unmute" aria-hidden="true"></i>- {{t "Unmute topic"}}- </a>- </li>+ {{#if development}}+ <li class="hidden-for-spectators">+ <div class="tabs-container">+ <div class="tab-option tippy-zulip-tooltip {{#if (eq visibility_policy all_visibility_policies.MUTED)}}selected-tab{{/if}}" data-visibility-policy="{{all_visibility_policies.MUTED}}" data-tippy-content="{{t 'Mute topic' }}" aria-label="{{t 'Mute topic' }}">+ <i class="zulip-icon zulip-icon-mute-new"></i>+ </div>+ <div class="tab-option tippy-zulip-tooltip {{#if (eq visibility_policy all_visibility_policies.UNMUTED)}}selected-tab{{/if}}" data-visibility-policy="{{all_visibility_policies.UNMUTED}}" data-tippy-content="{{t 'Unmute topic' }}" aria-label="{{t 'Unmute topic' }}">+ <i class="zulip-icon zulip-icon-unmute-new"></i>+ </div>+ <div class="tab-option tippy-zulip-tooltip {{#if (eq visibility_policy all_visibility_policies.FOLLOWED)}}selected-tab{{/if}}" data-visibility-policy="{{all_visibility_policies.FOLLOWED}}" data-tippy-content="{{t 'Follow topic' }}" aria-label="{{t 'Follow topic' }}">+ <i class="zulip-icon zulip-icon-follow"></i>+ </div>+ </div>+ </li>++ <hr/>+ {{else}}+ {{#if stream_muted}}+ {{#unless topic_unmuted}}+ <li class="hidden-for-spectators">+ <a tabindex="0" class="sidebar-popover-unmute-topic" data-stream-id="{{ stream_id }}" data-topic-name="{{ topic_name }}">+ <i class="zulip-icon zulip-icon-unmute" aria-hidden="true"></i>+ {{t "Unmute topic"}}+ </a>+ </li>+ {{else}}+ <li class="hidden-for-spectators">+ <a tabindex="0" class="sidebar-popover-remove-unmute" data-stream-id="{{ stream_id }}" data-topic-name="{{ topic_name }}">+ <i class="zulip-icon zulip-icon-mute" aria-hidden="true"></i>+ {{t "Mute topic"}}+ </a>+ </li>+ {{/unless}}{{else}}+ {{#unless topic_muted}}<li class="hidden-for-spectators">- <a tabindex="0" class="sidebar-popover-remove-unmute" data-stream-id="{{ stream_id }}" data-topic-name="{{ topic_name }}">+ <a tabindex="0" class="sidebar-popover-mute-topic" data-stream-id="{{ stream_id }}" data-topic-name="{{ topic_name }}"><i class="zulip-icon zulip-icon-mute" aria-hidden="true"></i>{{t "Mute topic"}}</a></li>- {{/unless}}- {{else}}- {{#unless topic_muted}}- <li class="hidden-for-spectators">- <a tabindex="0" class="sidebar-popover-mute-topic" data-stream-id="{{ stream_id }}" data-topic-name="{{ topic_name }}">- <i class="zulip-icon zulip-icon-mute" aria-hidden="true"></i>- {{t "Mute topic"}}- </a>- </li>- {{else}}- <li class="hidden-for-spectators">- <a tabindex="0" class="sidebar-popover-remove-mute" data-stream-id="{{ stream_id }}" data-topic-name="{{ topic_name }}">- <i class="zulip-icon zulip-icon-unmute" aria-hidden="true"></i>- {{t "Unmute topic"}}- </a>- </li>- {{/unless}}+ {{else}}+ <li class="hidden-for-spectators">+ <a tabindex="0" class="sidebar-popover-remove-mute" data-stream-id="{{ stream_id }}" data-topic-name="{{ topic_name }}">+ <i class="zulip-icon zulip-icon-unmute" aria-hidden="true"></i>+ {{t "Unmute topic"}}+ </a>+ </li>+ {{/unless}}+ {{/if}}{{/if}}{{#if has_starred_messages}}