UX: Fix topic progress placement in iOS app

Fixes placement issues introduced in #45a55a3

Fixes topic progress placement when composer is collapsed with a draft
This commit is contained in:
Penar Musaraj 2019-10-06 16:10:08 -04:00
parent bfe0bc0cbd
commit d45866eb5c

View File

@ -161,7 +161,7 @@ export default Ember.Component.extend({
: $("#topic-progress").outerHeight(); : $("#topic-progress").outerHeight();
const maximumOffset = $("#topic-bottom").offset().top + progressHeight; const maximumOffset = $("#topic-bottom").offset().top + progressHeight;
const windowHeight = $(window).height(); const windowHeight = $(window).height();
const composerHeight = $("#reply-control").height() || 0; let composerHeight = $("#reply-control").height() || 0;
const isDocked = offset >= maximumOffset - windowHeight + composerHeight; const isDocked = offset >= maximumOffset - windowHeight + composerHeight;
let bottom = $("body").height() - maximumOffset; let bottom = $("body").height() - maximumOffset;
@ -170,8 +170,15 @@ export default Ember.Component.extend({
bottom += $iPadFooterNav.outerHeight(); bottom += $iPadFooterNav.outerHeight();
} }
const wrapperDir = $html.hasClass("rtl") ? "left" : "right"; const wrapperDir = $html.hasClass("rtl") ? "left" : "right";
const draftComposerHeight = 40;
if (composerHeight > 0) { if (composerHeight > 0) {
const $iPhoneFooterNav = $(".footer-nav-visible .footer-nav");
const $replyDraft = $("#reply-control.draft");
if ($iPhoneFooterNav.outerHeight() && $replyDraft.outerHeight()) {
composerHeight =
$replyDraft.outerHeight() + $iPhoneFooterNav.outerHeight();
}
$wrapper.css("bottom", isDocked ? bottom : composerHeight); $wrapper.css("bottom", isDocked ? bottom : composerHeight);
} else { } else {
$wrapper.css("bottom", isDocked ? bottom : ""); $wrapper.css("bottom", isDocked ? bottom : "");
@ -186,9 +193,10 @@ export default Ember.Component.extend({
$wrapper.css(wrapperDir, "1em"); $wrapper.css(wrapperDir, "1em");
} }
if (!isDocked) { $wrapper.css(
$wrapper.css("margin-bottom", "0px"); "margin-bottom",
} !isDocked && composerHeight > draftComposerHeight ? "0px" : ""
);
}, },
click(e) { click(e) {