Skip to content

Fix meetings tab: correct week navigation, reader UX improvements#32

Open
Boudbois2271 wants to merge 2 commits into
MrCyjaneK:masterfrom
Boudbois2271:explore/meetings-tab
Open

Fix meetings tab: correct week navigation, reader UX improvements#32
Boudbois2271 wants to merge 2 commits into
MrCyjaneK:masterfrom
Boudbois2271:explore/meetings-tab

Conversation

@Boudbois2271
Copy link
Copy Markdown

The meetings tab had several bugs that made it mostly non-functional. This PR fixes them and adds a few small UX improvements to the reader.


meethelper.js

MWB month calculation was wrong (inverted condition + off-by-one)
The % 2 === 0 condition was inverted, causing the wrong bimonthly publication to be fetched every other month. Additionally, getMonth() (0-indexed) was used without +1, producing incorrect month codes half the year.

MWB link pointed to bare root
The MWB link went to /reader.html#/api/publications/mwb_YYYYMM/ with no chapter, showing a blank page. It now fetches the TOC first (same approach as the Watchtower).

Both links always opened to week 1 / the index page

  • MWB always opened to the first week of the publication regardless of the current date
  • Watchtower always opened to the Table of Contents (li[1])

Both now compute the current week/article from today's date:

  • getCurrentMWBWeek() — parses the first week's start date from the TOC title (e.g. "May 4-10"), computes the week offset from today
  • getCurrentWTArticle() — finds the first Sunday of the study month, computes the article offset

UX improvements

  • Links now show the week/article title (e.g. "Life and Ministry — May 18-24", "Watchtower — Show
    Insight and You Will Find Success")
  • Loading state shown while fetches
  • If a publication isn't cached yet links show a helpful message and
    redirect to /publications.html

meetings.html

  • Fixed missing </div> closing tag for #page-content-wrapper
    --- ### reader.html- Added hashchange listener so clile, Publications) while already onreader.html correctly reloads the ng the URL
  • Added a ← Back button in the nsers can navigate back after following a verse or footnote link

Boudbois2271 and others added 2 commits May 24, 2026 18:52
- Fix MWB month calculation (inverted condition + missing +1 for 1-indexed month)
- MWB and Watchtower now fetch TOC and open to current week/article instead of cover or index
- Add getCurrentMWBWeek(): parses first week start date, computes week offset from today
- Add getCurrentWTArticle(): finds first Sunday of study month, computes article offset
- Show week/article title in link text (e.g. 'Life and Ministry — May 18-24')
- Show loading state while fetches are in flight
- Show offline error with link to /publications.html if publication not cached
- Fix missing </div> closing tag in meetings.html
- Add hashchange listener in reader.html so sidebar links work while already on reader
- Add Back button in reader.html navbar (history.back())

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
getCurrentMWBWeek and getCurrentWTArticle both evaluated the fallback
value (items[1] / items[2]) on the line before the length guard, making
the guard unreachable in exactly the cases it was meant to protect
against. If the TOC had fewer entries than expected, both functions
threw TypeError instead of handling the error path.

Fix: move the guard above the fallback declaration in both functions.
Return null when the TOC is structurally invalid; callers now throw an
explicit Error so the existing .catch() handler shows the offline message
rather than silently swallowing an unrelated TypeError.

Also: unify week-offset rounding. getCurrentWTArticle used Math.round
while getCurrentMWBWeek used Math.floor. Week offsets must be floored —
a day-count that is 6.9 weeks should not round up to week 7.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant