From faf586899680d48be50af065b93933664ce9c61a Mon Sep 17 00:00:00 2001 From: Hunternif Date: Sun, 16 Feb 2025 21:01:47 +0000 Subject: [PATCH] client: add margin below post for symmetry --- client/js/views/post_main_view.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/client/js/views/post_main_view.js b/client/js/views/post_main_view.js index c6b312b66..3d35d19b5 100644 --- a/client/js/views/post_main_view.js +++ b/client/js/views/post_main_view.js @@ -1,6 +1,5 @@ "use strict"; -const iosCorrectedInnerHeight = require("ios-inner-height"); const router = require("../router.js"); const views = require("../util/views.js"); const uri = require("../util/uri.js"); @@ -21,21 +20,24 @@ class PostMainView { const sourceNode = template(ctx); const postContainerNode = sourceNode.querySelector(".post-container"); - const sidebarNode = sourceNode.querySelector(".sidebar"); views.replaceContent(this._hostNode, sourceNode); views.syncScrollPosition(); - const topNavigationNode = - document.body.querySelector("#top-navigation"); - this._postContentControl = new PostContentControl( postContainerNode, ctx.post, () => { + // Need add extra margin at the bottom for symmetry: + const postContainerRect = + postContainerNode.getBoundingClientRect(); + const margin = + postContainerRect.top - + this._hostNode.getBoundingClientRect().top; return [ - postContainerNode.getBoundingClientRect().width, - iosCorrectedInnerHeight() - - postContainerNode.getBoundingClientRect().top, + postContainerRect.width, + window.visualViewport.height - + postContainerRect.top - + margin, ]; } ); @@ -164,7 +166,7 @@ class PostMainView { } commentForm.hidden = true; // collapse by default addCommentButton.addEventListener("click", () => { - commentForm.hidden = !commentForm.hidden + commentForm.hidden = !commentForm.hidden; }); }