Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
user_profile: Fix inconsistent height of user profile switching tabs.
palashb01c2f878638b5b
diff --git a/web/src/user_profile.js b/web/src/user_profile.jsindex 0e8155d5791..b5a589c1d30 100644--- a/web/src/user_profile.js+++ b/web/src/user_profile.js@@ -193,6 +193,11 @@ function render_user_group_list(groups, user) {}function render_manage_profile_content(user) {+ // Since we want the height of the profile modal to remain consistent when switching tabs,+ // we need to restrict the height of the main body. This will ensure that the footer of+ // the "Manage User" tab can adjust within the provided height without expanding the modal.+ $("#user-profile-modal .modal__body").addClass("modal__body__manage_profile_height");+ $("#user-profile-modal .manage-profile-tab-footer").addClass("modal__footer_wrapper");const $container = $("#manage-profile-tab");$container.empty();if (user.is_bot) {@@ -353,6 +358,10 @@ export function show_user_profile(user, default_tab_key = "profile-tab") {callback(_name, key) {$(".tabcontent").hide();$(`#${CSS.escape(key)}`).show();+ $("#user-profile-modal .modal__body").removeClass("modal__body__manage_profile_height");+ $("#user-profile-modal .manage-profile-tab-footer").removeClass(+ "modal__footer_wrapper",+ );switch (key) {case "profile-tab":$("#user-profile-modal .modal__footer").hide();diff --git a/web/styles/dark_theme.css b/web/styles/dark_theme.cssindex d7e00940a35..8bea4a3abbc 100644--- a/web/styles/dark_theme.css+++ b/web/styles/dark_theme.css@@ -1300,6 +1300,12 @@.subscription-group-list .user-group-list tr {border-color: hsl(0deg 0% 0% / 40%);}++ .manage-profile-tab-footer {+ &.modal__footer_wrapper {+ border-top: 1px solid hsl(0deg 0% 100% / 20%);+ }+ }}/* Arrows: */diff --git a/web/styles/popovers.css b/web/styles/popovers.cssindex 26e0041c268..edf30adb421 100644--- a/web/styles/popovers.css+++ b/web/styles/popovers.css@@ -378,6 +378,17 @@ ul {height: 60vh;padding-left: 16px;padding-right: 16px;++ /*+ The height of the main body of the profile modal is 60vh. However,+ the footer is only present in the manage user tab. To make sure the+ modal doesn't expand while switching between tabs, we can reduce+ the height of the main body to 52vh - 1px (border radius of the footer)+ and add a footer of 8vh.+ */+ &.modal__body__manage_profile_height {+ height: calc(52vh - 1px);+ }}.modal__header {@@ -627,6 +638,27 @@ ul {}}}++ .manage-profile-tab-footer {+ height: 0;++ &.modal__footer_wrapper {+ border-top: 1px solid hsl(0deg 0% 87%);+ display: flex;+ justify-content: flex-end;+ align-items: center;+ height: 8vh;++ /* The default padding of the footer is 20px. However, since we have set */+ /* the height of the footer wrapper to be 8vh on different screen sizes, */+ /* the buttons might look odd. Instead of using padding top and bottom, we */+ /* just use the flex and properties to align them. */+ .modal__footer {+ padding-top: unset;+ padding-bottom: unset;+ }+ }+ }}@media (width < $md_min) {diff --git a/web/templates/user_profile_modal.hbs b/web/templates/user_profile_modal.hbsindex 67fd5976dba..f6a26464b69 100644--- a/web/templates/user_profile_modal.hbs+++ b/web/templates/user_profile_modal.hbs@@ -119,13 +119,15 @@<div class="tabcontent" id="manage-profile-tab"></div></div></main>- <footer class="modal__footer">- <button type="button" class="modal__btn dialog_exit_button" aria-label="{{t 'Close this dialog window' }}" data-micromodal-close>{{t "Cancel" }}</button>- <button type="button" class="modal__btn dialog_submit_button">- <span>{{t "Save changes"}}</span>- <div class="modal__spinner"></div>- </button>- </footer>+ <div class="manage-profile-tab-footer">+ <footer class="modal__footer">+ <button type="button" class="modal__btn dialog_exit_button" aria-label="{{t 'Close this dialog window' }}" data-micromodal-close>{{t "Cancel" }}</button>+ <button type="button" class="modal__btn dialog_submit_button">+ <span>{{t "Save changes"}}</span>+ <div class="modal__spinner"></div>+ </button>+ </footer>+ </div></div></div></div>