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 group membership list to scrollable container.

Pratik Chanda6ca112024d55
diff --git a/web/src/user_profile.ts b/web/src/user_profile.ts
index b61817e0712..8ef44bf9802 100644
--- a/web/src/user_profile.ts
+++ b/web/src/user_profile.ts
@@ -356,9 +356,6 @@ function render_user_group_list(groups: UserGroup[], user: User): void {
user_groups_list_widget = ListWidget.create($container, groups, {
name: `user-${user.user_id}-group-list`,
get_item: ListWidget.default_get_item,
- callback_after_render() {
- $container.parent().removeClass("empty-list");
- },
modifier_html(item) {
return format_user_group_list_item_html(item, user);
},
@@ -367,11 +364,6 @@ function render_user_group_list(groups: UserGroup[], user: User): void {
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"),
});
@@ -1391,6 +1383,7 @@ export function initialize(): void {
$("body").on("click", "#user-profile-modal .remove-member-button", (e) => {
e.preventDefault();
+ e.stopPropagation();
const $remove_button = $(e.currentTarget).closest(".remove-member-button");
buttons.show_button_loading_indicator($remove_button);
const $group_row = $(e.currentTarget).closest("[data-group-id]");
diff --git a/web/styles/left_sidebar.css b/web/styles/left_sidebar.css
index fe9b0c6da4a..16bf715b3b1 100644
--- a/web/styles/left_sidebar.css
+++ b/web/styles/left_sidebar.css
@@ -16,7 +16,8 @@
}
#left-sidebar .input-element-wrapper:not(.left-sidebar-search-section),
-#user-profile-modal .stream-list-container .input-element-wrapper {
+#user-profile-modal .stream-list-container .input-element-wrapper,
+#user-profile-modal .group-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 54c4c068c01..826200858ad 100644
--- a/web/styles/popovers.css
+++ b/web/styles/popovers.css
@@ -547,6 +547,7 @@ ul.popover-group-menu-member-list {
font-size: 1.5em;
}
+ #user-profile-groups-tab,
#user-profile-streams-tab {
height: calc(
var(--user-profile-modal-body-height) -
@@ -559,27 +560,15 @@ ul.popover-group-menu-member-list {
"bottom" auto
/ minmax(0, 1fr);
- .stream_list_info {
+ .stream_list_info,
+ .user-profile-group-list-alert {
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 {
margin-bottom: 8px;
}
- .user-profile-group-list-alert {
- margin-bottom: 8px;
+ .stream-list-bottom-section,
+ .group-list-bottom-section {
+ grid-area: bottom;
}
.stream-privacy {
@@ -605,43 +594,11 @@ ul.popover-group-menu-member-list {
}
}
- .group-list-top-section {
- display: flex;
- margin-top: 0.75em;
- align-items: center;
- margin-bottom: 0.3125em;
- }
-
+ .group-list-top-section,
.stream-list-top-section {
+ grid-area: top;
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:
- "search-input clear-search" auto / minmax(0, 1fr)
- 30px;
- }
-
- .group-search {
- grid-column: search-input-start / clear-search-end;
- grid-row: search-input;
- padding-right: 1.75em;
- white-space: nowrap;
- text-overflow: ellipsis;
- overflow: hidden;
- margin-bottom: 0;
- /* Override default modal input width, since that overflows.
- This is 185px (the default "width: unset" width) at 14px/em */
- width: 13.2142em;
- /* subtract padding (6px on left and 28px on right) and border (1px each side) */
- max-width: calc(100% - 36px);
- }
.group-search:placeholder-shown + #clear_groups_search,
.stream-search:placeholder-shown + #clear_stream_search {
@@ -649,6 +606,7 @@ ul.popover-group-menu-member-list {
}
}
+ .group-list-container,
.stream-list-container {
height: calc(100% - var(--header-line-height));
border-radius: 4px;
@@ -658,6 +616,7 @@ ul.popover-group-menu-member-list {
margin-bottom: 5px;
-webkit-overflow-scrolling: touch;
+ .user-profile-group-row,
.user-profile-channel-row {
display: flex;
justify-content: space-between;
@@ -668,6 +627,7 @@ ul.popover-group-menu-member-list {
color: var(--color-dropdown-item);
cursor: pointer;
+ .user-group-list-item,
.user-stream-list-item {
display: flex;
overflow: hidden;
@@ -682,6 +642,7 @@ ul.popover-group-menu-member-list {
outline-offset: -2px;
}
+ .user-group-name,
.user-stream-name {
white-space: nowrap;
overflow: hidden;
@@ -690,11 +651,13 @@ ul.popover-group-menu-member-list {
}
}
+ .subscription-group-list,
.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-group-list,
.user-stream-list {
list-style: none;
margin: 0;
@@ -702,51 +665,6 @@ ul.popover-group-menu-member-list {
}
}
- .subscription-group-list {
- border: 1px solid var(--color-border-user-profile-table);
- border-radius: 4px;
- overflow: auto;
- text-align: left;
- margin-bottom: 5px;
- -webkit-overflow-scrolling: touch;
-
- .user-group-list {
- width: 100%;
- margin: auto;
- border-radius: 6px;
- border-collapse: collapse;
-
- & tr {
- border-bottom: 1px solid var(--color-border-user-profile-table);
- /* Ensure equal height for rows with a remove-subscription-button and
- those without one. */
- height: 34px;
-
- &:last-of-type {
- border-bottom: none;
- }
-
- & td {
- padding: 4px 0;
-
- &.remove_member {
- padding-right: 10px;
- }
-
- &.user-profile-group-row {
- text-align: left;
- padding-left: 10px;
- }
- }
- }
-
- .remove-button-wrapper {
- display: flex;
- justify-content: flex-end;
- }
- }
- }
-
.manage-profile-tab-footer {
height: 0;
@@ -767,14 +685,6 @@ ul.popover-group-menu-member-list {
}
}
}
-
- .empty-list {
- border: none;
-
- .empty-table-message {
- padding: 3em 1em;
- }
- }
}
@media (width < $md_min) {
@@ -820,14 +730,6 @@ ul.popover-group-menu-member-list {
.header-section {
width: 100%;
}
-
- .group-search {
- margin-bottom: 8px;
- }
-
- #clear_groups_search {
- padding-top: 1px;
- }
}
}
}
diff --git a/web/templates/user_group_list_item.hbs b/web/templates/user_group_list_item.hbs
index 4f9996dd8cc..73c4b203038 100644
--- a/web/templates/user_group_list_item.hbs
+++ b/web/templates/user_group_list_item.hbs
@@ -1,22 +1,18 @@
-<tr data-group-id="{{group_id}}" class="hidden-remove-button-row">
- <td class="user-profile-group-row">
- {{#if is_guest}}
+<li class="group-list-item" role="presentation" data-group-id="{{group_id}}">
+ <a class="user-profile-group-row hidden-remove-button-row" href="{{group_edit_url}}">
+ <span class="user-group-name">
{{name}}
- {{else}}
- <a class="group_list_item_link" href="{{group_edit_url}}">{{name}}</a>
+ </span>
+ {{#if can_remove_members }}
+ <div class="remove-button-wrapper">
+ {{#if is_direct_member}}
+ {{> components/icon_button icon="close" custom_classes="hidden-remove-button remove-member-button tippy-zulip-delayed-tooltip" intent="danger" aria-label=(t "Remove") data-tippy-content=(t "Remove") }}
+ {{else}}
+ <span class="tippy-zulip-tooltip" data-tippy-content="{{#if is_me}}{{t 'You are a member of {name} because you are a member of a subgroup ({subgroups_name}).'}} {{else}}{{t 'This user is a member of {name} because they are a member of a subgroup ({subgroups_name}).'}}{{/if}}">
+ {{> components/icon_button icon="close" custom_classes="hidden-remove-button remove-member-button tippy-zulip-delayed-tooltip" intent="danger" aria-label=(t "Remove") data-tippy-content=(t "Remove") disabled="disabled" }}
+ </span>
+ {{/if}}
+ </div>
{{/if}}
- </td>
- {{#if can_remove_members }}
- <td class="remove_member">
- <div class="remove-button-wrapper">
- {{#if is_direct_member}}
- {{> components/icon_button icon="close" custom_classes="hidden-remove-button remove-member-button tippy-zulip-delayed-tooltip" intent="danger" aria-label=(t "Remove") data-tippy-content=(t "Remove") }}
- {{else}}
- <span class="tippy-zulip-tooltip" data-tippy-content="{{#if is_me}}{{t 'You are a member of {name} because you are a member of a subgroup ({subgroups_name}).'}} {{else}}{{t 'This user is a member of {name} because they are a member of a subgroup ({subgroups_name}).'}}{{/if}}">
- {{> components/icon_button icon="close" custom_classes="hidden-remove-button remove-member-button tippy-zulip-delayed-tooltip" intent="danger" aria-label=(t "Remove") data-tippy-content=(t "Remove") disabled="disabled" }}
- </span>
- {{/if}}
- </div>
- </td>
- {{/if}}
-</tr>
+ </a>
+</li>
diff --git a/web/templates/user_profile_modal.hbs b/web/templates/user_profile_modal.hbs
index c300a404f5a..6bb31323d13 100644
--- a/web/templates/user_profile_modal.hbs
+++ b/web/templates/user_profile_modal.hbs
@@ -139,38 +139,43 @@
<div class="tabcontent" id="user-profile-groups-tab">
<div class="alert user-profile-group-list-alert"></div>
- {{#if show_user_group_container}}
+ <div class="group-list-top-section">
<div class="header-section">
- <h3 class="group-tab-element-header">{{t 'Add {full_name} to groups'}}</h3>
+ <h3 class="group-tab-element-header">{{t 'Group membership' }}</h3>
+ </div>
+ <div class="group-list-container">
+ <div class="group-search-container filter-input has-input-icon has-input-button input-element-wrapper">
+ <i class="input-icon zulip-icon zulip-icon-search"></i>
+ <input type="text" class="input-element group-search" placeholder="{{t 'Filter' }}" />
+ <button type="button" class="input-button input-close-filter-button icon-button icon-button-square icon-button-neutral " id="clear_groups_search">
+ <i class="zulip-icon zulip-icon-close" aria-hidden="true"></i>
+ </button>
+ </div>
+ <div class="subscription-group-list" data-simplebar data-simplebar-tab-index="-1">
+ <ul class="user-group-list" data-empty="{{t 'Not a member of any groups.' }}" data-search-results-empty="{{t 'No matching user groups' }}"></ul>
+ </div>
</div>
- <div id="groups-to-add" class="add-button-container">
- <div id="user-group-to-add">
- <div class="add-user-group-container">
- <div class="pill-container">
- <div class="input" contenteditable="true"
- data-placeholder="{{t 'Add user groups' }}">
- {{~! Squash whitespace so that placeholder is displayed when empty. ~}}
+ </div>
+ {{#if show_user_group_container}}
+ <div class="group-list-bottom-section">
+ <div class="header-section">
+ <h3 class="group-tab-element-header">{{t 'Add {full_name} to groups'}}</h3>
+ </div>
+ <div id="groups-to-add" class="add-button-container">
+ <div id="user-group-to-add">
+ <div class="add-user-group-container">
+ <div class="pill-container">
+ <div class="input" contenteditable="true"
+ data-placeholder="{{t 'Add user groups' }}">
+ {{~! Squash whitespace so that placeholder is displayed when empty. ~}}
+ </div>
</div>
</div>
</div>
+ {{> components/action_button label=(t "Add") custom_classes="add-groups-button" attention="quiet" intent="brand" aria-label=(t "Add") }}
</div>
- {{> components/action_button label=(t "Add") custom_classes="add-groups-button" attention="quiet" intent="brand" aria-label=(t "Add") }}
</div>
{{/if}}
- <div class="group-list-top-section">
- <div class="header-section">
- <h3 class="group-tab-element-header">{{t 'Group membership' }}</h3>
- </div>
- <div class="group-search-container">
- <input type="text" class="group-search modal_text_input" placeholder="{{t 'Filter' }}" />
- <button type="button" class="clear_search_button" id="clear_groups_search">
- <i class="zulip-icon zulip-icon-close" aria-hidden="true"></i>
- </button>
- </div>
- </div>
- <div class="subscription-group-list empty-list">
- <table class="user-group-list" data-empty="{{t 'Not a member of any groups.'}}" data-search-results-empty="{{t 'No matching user groups' }}"></table>
- </div>
</div>
<div class="tabcontent" id="manage-profile-tab"></div>
</div>