Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

user_profile: Redesign subscribed channels to scrollable list.

Pratik Chanda7d754e92ff17
diff --git a/web/src/user_profile.ts b/web/src/user_profile.ts
index e73e962229d..b61817e0712 100644
--- a/web/src/user_profile.ts
+++ b/web/src/user_profile.ts
@@ -339,19 +339,11 @@ function render_user_stream_list(streams: StreamSubscription[], user: User): voi
modifier_html(item) {
return format_user_stream_list_item_html(item, user);
},
- callback_after_render() {
- $container.parent().removeClass("empty-list");
- },
filter: {
$element: $("#user-profile-streams-tab .stream-search"),
predicate(item, value) {
return item?.name.toLocaleLowerCase().includes(value);
},
- onupdate() {
- if ($container.find(".empty-table-message").length > 0) {
- $container.parent().addClass("empty-list");
- }
- },
},
$simplebar_container: $("#user-profile-modal .modal__body"),
});
@@ -1333,6 +1325,7 @@ export function initialize(): void {
$("body").on("click", "#user-profile-modal .remove-subscription-button", (e) => {
e.preventDefault();
+ e.stopPropagation();
const $remove_button = $(e.currentTarget).closest(".remove-subscription-button");
buttons.show_button_loading_indicator($remove_button);
const $stream_row = $(e.currentTarget).closest("[data-stream-id]");
diff --git a/web/styles/app_variables.css b/web/styles/app_variables.css
index c06fb63fa09..677419254f3 100644
--- a/web/styles/app_variables.css
+++ b/web/styles/app_variables.css
@@ -1475,6 +1475,22 @@
hsl(0deg 0% 87%),
hsl(0deg 0% 100% / 20%)
);
+ --color-border-user-profile-list-container: light-dark(
+ hsl(0deg 0% 0% / 35%),
+ hsl(0deg 0% 100% / 30%)
+ );
+ --background-color-user-profile-list-container: light-dark(
+ hsl(0deg 0% 100%),
+ hsl(0deg 0% 17%)
+ );
+ --color-user-profile-list-item-hover: light-dark(
+ hsl(0deg 0% 97%),
+ hsl(0deg 0% 21%)
+ );
+ --color-outline-user-profile-list-item: light-dark(
+ hsl(0deg 0% 0%),
+ hsl(0deg 0% 100%)
+ );
/* Link colors */
--color-text-link: light-dark(hsl(210deg 94% 42%), hsl(200deg 100% 50%));
diff --git a/web/styles/left_sidebar.css b/web/styles/left_sidebar.css
index 5d098f9015f..fe9b0c6da4a 100644
--- a/web/styles/left_sidebar.css
+++ b/web/styles/left_sidebar.css
@@ -15,7 +15,8 @@
white-space: nowrap;
}
-#left-sidebar .input-element-wrapper:not(.left-sidebar-search-section) {
+#left-sidebar .input-element-wrapper:not(.left-sidebar-search-section),
+#user-profile-modal .stream-list-container .input-element-wrapper {
/* We normalize this based on Firefox's 31px-tall input,
raising Chrome's (28px) and Safari's (30px) to all
match, so that `top:` and other offset values are
diff --git a/web/styles/popovers.css b/web/styles/popovers.css
index aaeb8be2280..54c4c068c01 100644
--- a/web/styles/popovers.css
+++ b/web/styles/popovers.css
@@ -547,6 +547,31 @@ ul.popover-group-menu-member-list {
font-size: 1.5em;
}
+ #user-profile-streams-tab {
+ height: calc(
+ var(--user-profile-modal-body-height) -
+ var(--user-profile-modal-body-margin-bottom)
+ );
+ display: grid;
+ grid-template:
+ "alert" auto
+ "top" minmax(0, 1fr)
+ "bottom" auto
+ / minmax(0, 1fr);
+
+ .stream_list_info {
+ grid-area: alert;
+ }
+
+ .stream-list-bottom-section {
+ grid-area: bottom;
+ }
+
+ .stream-list-top-section {
+ grid-area: top;
+ }
+ }
+
#user-profile-groups-tab,
#user-profile-streams-tab {
.stream_list_info {
@@ -580,15 +605,22 @@ ul.popover-group-menu-member-list {
}
}
- .group-list-top-section,
- .stream-list-top-section {
+ .group-list-top-section {
display: flex;
margin-top: 0.75em;
align-items: center;
margin-bottom: 0.3125em;
+ }
- .group-search-container,
- .stream-search-container {
+ .stream-list-top-section {
+ margin-top: 0.3125em;
+ margin-bottom: 0.75em;
+ }
+
+ .group-list-top-section,
+ .stream-list-top-section {
+
+ .group-search-container {
margin-left: auto;
display: grid;
grid-template:
@@ -596,8 +628,7 @@ ul.popover-group-menu-member-list {
30px;
}
- .group-search,
- .stream-search {
+ .group-search {
grid-column: search-input-start / clear-search-end;
grid-row: search-input;
padding-right: 1.75em;
@@ -618,8 +649,60 @@ ul.popover-group-menu-member-list {
}
}
- .subscription-group-list,
- .subscription-stream-list {
+ .stream-list-container {
+ height: calc(100% - var(--header-line-height));
+ border-radius: 4px;
+ background-color: var(--background-color-user-profile-list-container);
+ border: 1px solid var(--color-border-user-profile-list-container);
+ padding: 0.25em 0.25em 0;
+ margin-bottom: 5px;
+ -webkit-overflow-scrolling: touch;
+
+ .user-profile-channel-row {
+ display: flex;
+ justify-content: space-between;
+ padding: 0.3125em 0.625em;
+ align-items: center;
+ text-decoration: none;
+ border-radius: 4px;
+ color: var(--color-dropdown-item);
+ cursor: pointer;
+
+ .user-stream-list-item {
+ display: flex;
+ overflow: hidden;
+ }
+
+ &:hover {
+ background-color: var(--color-user-profile-list-item-hover);
+ }
+
+ &:focus-visible {
+ outline: 1px solid var(--color-outline-user-profile-list-item);
+ outline-offset: -2px;
+ }
+
+ .user-stream-name {
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ padding-right: 2px;
+ }
+ }
+
+ .subscription-stream-list {
+ /* We set max-height to remaining height of stream-list-container
+ so that we don't clip it. Search field height takes up 2em of total. */
+ height: calc(100% - 2em);
+
+ .user-stream-list {
+ list-style: none;
+ margin: 0;
+ }
+ }
+ }
+
+ .subscription-group-list {
border: 1px solid var(--color-border-user-profile-table);
border-radius: 4px;
overflow: auto;
@@ -627,7 +710,6 @@ ul.popover-group-menu-member-list {
margin-bottom: 5px;
-webkit-overflow-scrolling: touch;
- .user-stream-list,
.user-group-list {
width: 100%;
margin: auto;
@@ -647,20 +729,13 @@ ul.popover-group-menu-member-list {
& td {
padding: 4px 0;
- &.remove_subscription,
&.remove_member {
padding-right: 10px;
}
- &.user-profile-channel-row,
&.user-profile-group-row {
text-align: left;
padding-left: 10px;
-
- & .user-profile-channel-container {
- display: flex;
- gap: 3px;
- }
}
}
}
@@ -746,13 +821,11 @@ ul.popover-group-menu-member-list {
width: 100%;
}
- .group-search,
- .stream-search {
+ .group-search {
margin-bottom: 8px;
}
- #clear_groups_search,
- #clear_stream_search {
+ #clear_groups_search {
padding-top: 1px;
}
}
diff --git a/web/templates/user_profile_modal.hbs b/web/templates/user_profile_modal.hbs
index 9eb8dac2139..c300a404f5a 100644
--- a/web/templates/user_profile_modal.hbs
+++ b/web/templates/user_profile_modal.hbs
@@ -110,26 +110,31 @@
<div class="tabcontent" id="user-profile-streams-tab">
<div class="alert stream_list_info"></div>
- {{#if show_user_subscribe_widget}}
- <div class="header-section">
- <h3 class="stream-tab-element-header">{{t 'Subscribe {full_name} to channels'}}</h3>
- </div>
- {{> user_profile_subscribe_widget}}
- {{/if}}
<div class="stream-list-top-section">
<div class="header-section">
<h3 class="stream-tab-element-header">{{t 'Subscribed channels' }}</h3>
</div>
- <div class="stream-search-container">
- <input type="text" class="stream-search modal_text_input" placeholder="{{t 'Filter' }}" />
- <button type="button" class="clear_search_button" id="clear_stream_search">
- <i class="zulip-icon zulip-icon-close" aria-hidden="true"></i>
- </button>
+ <div class="stream-list-container">
+ <div class="stream-search-container filter-input has-input-icon has-input-button input-element-wrapper">
+ <i class="input-icon zulip-icon zulip-icon-search" aria-hidden="true"></i>
+ <input type="text" class="input-element stream-search" placeholder="{{t 'Filter' }}" />
+ <button type="button" class="input-button input-close-filter-button icon-button icon-button-square icon-button-neutral " id="clear_stream_search">
+ <i class="zulip-icon zulip-icon-close" aria-hidden="true"></i>
+ </button>
+ </div>
+ <div class="subscription-stream-list" data-simplebar data-simplebar-tab-index="-1">
+ <ul class="user-stream-list" data-empty="{{t 'No channel subscriptions.' }}" data-search-results-empty="{{t 'No matching channels.' }}"></ul>
+ </div>
</div>
</div>
- <div class="subscription-stream-list empty-list">
- <table class="user-stream-list" data-empty="{{t 'No channel subscriptions.'}}" data-search-results-empty="{{t 'No matching channels' }}"></table>
- </div>
+ {{#if show_user_subscribe_widget}}
+ <div class="stream-list-bottom-section">
+ <div class="header-section">
+ <h3 class="stream-tab-element-header">{{t 'Subscribe {full_name} to channels'}}</h3>
+ </div>
+ {{> user_profile_subscribe_widget}}
+ </div>
+ {{/if}}
</div>
<div class="tabcontent" id="user-profile-groups-tab">
diff --git a/web/templates/user_stream_list_item.hbs b/web/templates/user_stream_list_item.hbs
index db02798f626..75458f2fc40 100644
--- a/web/templates/user_stream_list_item.hbs
+++ b/web/templates/user_stream_list_item.hbs
@@ -1,23 +1,21 @@
-<tr data-stream-id="{{stream_id}}" class="hidden-remove-button-row">
- <td class="user-profile-channel-row">
- <div class="user-profile-channel-container">
+<li class="stream-list-item" role="presentation" data-stream-id="{{stream_id}}">
+ <a class="user-profile-channel-row hidden-remove-button-row" href="{{stream_edit_url}}">
+ <span class="user-stream-list-item">
<span class="stream-privacy-original-color-{{stream_id}} stream-privacy filter-icon" style="color: {{stream_color}}">
{{> stream_privacy . }}
</span>
- <a class="user-profile-channel-list-item" href="{{stream_edit_url}}">{{name}}</a>
- </div>
- </td>
- {{#if show_unsubscribe_button}}
- <td class="remove_subscription">
+ <span class="user-stream-name">{{name}}</span>
+ </span>
<div class="remove-button-wrapper">
- {{#if show_private_stream_unsub_tooltip}}
- {{> components/icon_button icon="close" custom_classes="hidden-remove-button remove-subscription-button tippy-zulip-tooltip" intent="danger" aria-label=(t "Unsubscribe") data-tippy-content=(t "Use channel settings to unsubscribe from private channels.") }}
- {{else if show_last_user_in_private_stream_unsub_tooltip}}
- {{> components/icon_button icon="close" custom_classes="hidden-remove-button remove-subscription-button tippy-zulip-tooltip" intent="danger" aria-label=(t "Unsubscribe") data-tippy-content=(t "Use channel settings to unsubscribe the last user from a private channel.") }}
- {{else}}
- {{> components/icon_button icon="close" custom_classes="hidden-remove-button remove-subscription-button tippy-zulip-delayed-tooltip" intent="danger" aria-label=(t "Unsubscribe") data-tippy-content=(t "Unsubscribe") }}
+ {{#if show_unsubscribe_button}}
+ {{#if show_private_stream_unsub_tooltip}}
+ {{> components/icon_button icon="close" custom_classes="hidden-remove-button remove-subscription-button tippy-zulip-tooltip" intent="danger" aria-label=(t "Unsubscribe") data-tippy-content=(t "Use channel settings to unsubscribe from private channels.") }}
+ {{else if show_last_user_in_private_stream_unsub_tooltip}}
+ {{> components/icon_button icon="close" custom_classes="hidden-remove-button remove-subscription-button tippy-zulip-tooltip" intent="danger" aria-label=(t "Unsubscribe") data-tippy-content=(t "Use channel settings to unsubscribe the last user from a private channel.") }}
+ {{else}}
+ {{> components/icon_button icon="close" custom_classes="hidden-remove-button remove-subscription-button tippy-zulip-delayed-tooltip" intent="danger" aria-label=(t "Unsubscribe") data-tippy-content=(t "Unsubscribe") }}
+ {{/if}}
{{/if}}
</div>
- </td>
- {{/if}}
-</tr>
+ </a>
+</li>