Skip to content

fix(calendar): page the week grid with prev/next, not only the header - #56

Open
lucletoffe wants to merge 2 commits into
bulwarkmail:mainfrom
lucletoffe:fix/calendar-week-navigation
Open

lucletoffe wants to merge 2 commits into
bulwarkmail:mainfrom
lucletoffe:fix/calendar-week-navigation

Conversation

@lucletoffe

Copy link
Copy Markdown
Contributor

Summary

Week view stored the visible period (currentDate) separately from the highlighted day (selectedDate). The header title and event fetch followed currentDate; the grid followed selectedDate. Prev/next only moved currentDate, so the title jumped to the next week while the grid (and the selected-day highlight) stayed put.

  • Prev/next in week and agenda view now move both dates together.
  • WeekView takes a weekDate (the period to show) and keeps selectedDate for the highlight only.
  • Switching to week view anchors the period on the currently selected day, so the header and grid start on the same week.

Changes

  • src/lib/calendar-navigation.ts: applyCalendarNavigation / shiftViewDate
  • src/screens/CalendarScreen.tsx: wire prev/next and the week toggle through that helper
  • src/components/calendar/WeekView.tsx: render the week of weekDate
  • tests for the helper, including the drifted-dates case

Type of change

  • Bug fix (non-breaking change that fixes an issue)

Checklist

  • I have read the Contributing Guide
  • My code follows the project's code style and conventions
  • npm test (977 passed, 14 skipped) and tsc --noEmit are clean
  • I have added tests for the navigation helper

Week view kept two dates: currentDate drove the header range and event
fetch, selectedDate drove the grid. Prev/next only moved currentDate, so
the title jumped while the displayed week stayed put.
Prev/next already moved the grid; a horizontal swipe did nothing, so
paging weeks still felt broken. A right swipe goes to the previous
week, a left swipe to the next, without stealing the hour-grid scroll.
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