UX: Show vertical topic timeline while composing (#8813)

Keeps topic timeline visible if space permits when composing, and adjusts its height dynamically.
This commit is contained in:
Penar Musaraj
2020-01-30 13:52:48 -05:00
committed by GitHub
parent 11a9f15fed
commit 999e2ff514
3 changed files with 50 additions and 16 deletions
@@ -10,9 +10,22 @@ import renderTopicFeaturedLink from "discourse/lib/render-topic-featured-link";
const SCROLLER_HEIGHT = 50;
const LAST_READ_HEIGHT = 20;
const MIN_SCROLLAREA_HEIGHT = 170;
const MAX_SCROLLAREA_HEIGHT = 300;
function scrollareaHeight() {
return $(window).height() < 425 ? 150 : 300;
const composerHeight =
document.getElementById("reply-control").offsetHeight || 0,
headerHeight = document.querySelectorAll(".d-header")[0].offsetHeight || 0;
// scrollarea takes up about half of the timeline's height
const availableHeight =
(window.innerHeight - composerHeight - headerHeight) / 2;
return Math.max(
MIN_SCROLLAREA_HEIGHT,
Math.min(availableHeight, MAX_SCROLLAREA_HEIGHT)
);
}
function scrollareaRemaining() {