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.

modals: Standardize the user profile modal footer structure.

Sayam Samal75c63de4c7af
diff --git a/web/src/user_profile.ts b/web/src/user_profile.ts
index a8fe717e1fe..9f3a3e01d5d 100644
--- a/web/src/user_profile.ts
+++ b/web/src/user_profile.ts
@@ -458,11 +458,7 @@ function render_user_group_list(groups: UserGroup[], user: User): void {
}
function render_manage_profile_content(user: User): void {
- // 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__content").addClass("modal__content__manage_profile_height");
- $("#user-profile-modal .manage-profile-tab-footer").addClass("modal__footer_wrapper");
+ $("#user-profile-modal .manage-profile-tab-footer").addClass("manage-profile-tab-active");
const $container = $("#manage-profile-tab");
$container.empty();
if (user.is_bot) {
@@ -774,12 +770,8 @@ export function show_user_profile(user: User, default_tab_key = "profile-tab"):
callback(_name: string | undefined, key: string) {
$(".tabcontent").hide();
$(`#${CSS.escape(key)}`).show();
- $("#user-profile-modal .modal__footer").hide();
- $("#user-profile-modal .modal__content").removeClass(
- "modal__content__manage_profile_height",
- );
$("#user-profile-modal .manage-profile-tab-footer").removeClass(
- "modal__footer_wrapper",
+ "manage-profile-tab-active",
);
switch (key) {
case "profile-tab":
@@ -797,7 +789,6 @@ export function show_user_profile(user: User, default_tab_key = "profile-tab"):
break;
}
case "manage-profile-tab":
- $("#user-profile-modal .modal__footer").show();
render_manage_profile_content(user);
break;
}
diff --git a/web/styles/app_variables.css b/web/styles/app_variables.css
index 7534fc33090..49ce7e443b2 100644
--- a/web/styles/app_variables.css
+++ b/web/styles/app_variables.css
@@ -639,7 +639,7 @@
See 1c6bed55e4e800b5bad7150f6bdd274cd7f6504e for more context. */
--width-dropdown-widget-button: 206px;
/* User profile modal */
- --user-profile-modal-body-height: 60vh;
+ --user-profile-modal-height: 75dvh;
--user-profile-modal-body-margin-bottom: 20px;
/* Height of the button for filter dropdown in stream settings UI.
diff --git a/web/styles/popovers.css b/web/styles/popovers.css
index 1d1ae24c112..30a9712f5cb 100644
--- a/web/styles/popovers.css
+++ b/web/styles/popovers.css
@@ -417,22 +417,8 @@ ul.popover-group-menu-member-list {
}
#user-profile-modal {
- .modal__content {
- box-sizing: border-box;
- height: var(--user-profile-modal-body-height);
- 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__content__manage_profile_height {
- height: calc(52vh - 1px);
- }
+ .modal__container {
+ height: var(--user-profile-modal-height);
}
#tab-toggle {
@@ -613,25 +599,8 @@ ul.popover-group-menu-member-list {
margin-bottom: 0.75em;
}
- .manage-profile-tab-footer {
- height: 0;
-
- &.modal__footer_wrapper {
- border-top: 1px solid var(--color-border-manage-profile-footer);
- 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;
- }
- }
+ .manage-profile-tab-footer:not(.manage-profile-tab-active) {
+ display: none;
}
}
diff --git a/web/templates/user_profile_modal.hbs b/web/templates/user_profile_modal.hbs
index 99f0c459ca0..2b2052ec904 100644
--- a/web/templates/user_profile_modal.hbs
+++ b/web/templates/user_profile_modal.hbs
@@ -186,16 +186,14 @@
<div class="tabcontent" id="manage-profile-tab"></div>
</div>
</main>
- <div class="manage-profile-tab-footer">
- <footer class="modal__footer">
- <div class="save-success"></div>
- <button type="button" class="modal__button dialog_exit_button" aria-label="{{t 'Close this dialog window' }}" data-micromodal-close>{{t "Cancel" }}</button>
- <button type="button" class="modal__button dialog_submit_button">
- <span class="submit-button-text">{{t "Save changes"}}</span>
- <span class="modal__spinner"></span>
- </button>
- </footer>
- </div>
+ <footer class="modal__footer manage-profile-tab-footer">
+ <div class="save-success"></div>
+ <button type="button" class="modal__button dialog_exit_button" aria-label="{{t 'Close this dialog window' }}" data-micromodal-close>{{t "Cancel" }}</button>
+ <button type="button" class="modal__button dialog_submit_button">
+ <span class="submit-button-text">{{t "Save changes"}}</span>
+ <span class="modal__spinner"></span>
+ </button>
+ </footer>
</div>
</div>
</div>