Skip to content

Commit dba7f87

Browse files
committed
Merge branch 'miscs'
2 parents 63d4ac7 + 3d99bfb commit dba7f87

File tree

5 files changed

+36
-5
lines changed

5 files changed

+36
-5
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
- Show reading list title and reading list actions when scrolling up.
6+
57
## 25.04.1
68

79
- Remove async functions to simplify the code.

docs/adrs/0009-remove-asnyc-for-now.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,6 @@ It will impact many files, but it should be relatively straightforward.
3131
- Use `gunicorn` to run the application in production:
3232
- It’s kind of a default choice for this, and I’ve used it in the past with great success.
3333
- Create an incoming HTTP request timeout. Set it to 60s to allow for slow search.
34-
- Use 4 workers: from my experience, it’s a good number.
34+
- Use 4 workers: from my experience, it’s a good number. It will increase memory usage.
35+
- After deploy, I see a 100MB increase for the 4 workers. Acceptable for me.
3536
- We may need to allow for incoming request timeout and number of workers to be configured.

legadilo/static/js/list_of_articles.js

+26
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,36 @@
173173
window.addEventListener("scrollend", runRefresh);
174174
};
175175

176+
const setupMobileScroll = () => {
177+
const headerHeight = getComputedStyle(document.body).getPropertyValue(
178+
"--content-header-height",
179+
);
180+
const readingListTitleContainer = document.getElementById("reading-list-title-container");
181+
readingListTitleContainer.style.top = headerHeight;
182+
const titleHeight = readingListTitleContainer.getBoundingClientRect().height;
183+
const readingListActionsContainer = document.getElementById("reading-list-actions-container");
184+
readingListActionsContainer.style.top = `calc(${headerHeight} + ${titleHeight}px)`;
185+
186+
let currentOffset = window.scrollY;
187+
188+
window.addEventListener("scroll", () => {
189+
if (currentOffset > window.scrollY) {
190+
readingListTitleContainer.classList.add("sticky-top");
191+
readingListActionsContainer.classList.add("sticky-top");
192+
} else {
193+
readingListTitleContainer.classList.remove("sticky-top");
194+
readingListActionsContainer.classList.remove("sticky-top");
195+
}
196+
197+
currentOffset = window.scrollY;
198+
});
199+
};
200+
176201
window.addEventListener("load", () => {
177202
jsCfg = JSON.parse(document.head.querySelector("#js-cfg").textContent);
178203
setupReadAction();
179204
setupReadOnScroll();
180205
setupRefresh();
206+
setupMobileScroll();
181207
});
182208
})();

legadilo/templates/reading/list_of_articles.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@
5353
</div>
5454
{% endblock center_navbar %}
5555
{% block content %}
56-
<div class="container-fluid px-md-3">
56+
<div id="reading-list-title-container"
57+
class="container-fluid px-md-3 bg-body z-1">
5758
<div class="row">
5859
<div class="col col-md-3 d-none d-md-block"></div>
5960
<div class="col col-12 col-md-7 col-md-8 px-1 px-md-3">
@@ -70,7 +71,7 @@ <h1>{{ page_title }}</h1>
7071
</nav>
7172
</div>
7273
<div class="col col-12 col-md-8 px-1 px-md-3 mx-0">
73-
<div class="row px-0 mx-0">
74+
<div id="reading-list-actions-container" class="row px-0 mx-0 bg-body z-1">
7475
{% if count_articles_of_current_reading_list > 0 %}
7576
<h2 class="fs-6 col-6 col-md-2 align-middle d-flex align-items-center px-0 mx-0">
7677
<span id="articles-in-total">

legadilo/users/tests/snapshots/test_registration/test_registration_success/page_response.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,8 @@ <h1 class="modal-title fs-5"></h1>
343343
</div>
344344

345345

346-
<div class="container-fluid px-md-3">
346+
<div id="reading-list-title-container"
347+
class="container-fluid px-md-3 bg-body z-1">
347348
<div class="row">
348349
<div class="col col-md-3 d-none d-md-block"></div>
349350
<div class="col col-12 col-md-7 col-md-8 px-1 px-md-3">
@@ -404,7 +405,7 @@ <h1>Unread</h1>
404405
</nav>
405406
</div>
406407
<div class="col col-12 col-md-8 px-1 px-md-3 mx-0">
407-
<div class="row px-0 mx-0">
408+
<div id="reading-list-actions-container" class="row px-0 mx-0 bg-body z-1">
408409

409410

410411

0 commit comments

Comments
 (0)