Skip to content

Highlight current day in overview and yearly view#231

Draft
domi4484 wants to merge 3 commits into
developeregrem:masterfrom
domi4484:highlight-current-day
Draft

Highlight current day in overview and yearly view#231
domi4484 wants to merge 3 commits into
developeregrem:masterfrom
domi4484:highlight-current-day

Conversation

@domi4484
Copy link
Copy Markdown
Contributor

Sometimes it would be practical to see today date at first glance on the calendar views.

I marked the PR as draft because of two points in the table view. If this feature is desirable I'll try to improve.

  • I am just not super happy that the highlight is not rendered under the reservations.
  • Maybe the day number should be highlighted as well. But there is already holidays and weekends color there.

Table view:
image

Yearly with no reservations:
image

Yearly with partial reservations:
image

Yearly with full reservations:
image

@developeregrem
Copy link
Copy Markdown
Owner

Hi @domi4484 again, a small but great improvement 😊
The thing with the colour behind a reservation is something i failed in the past as well. There were always some edgecases which does not work as intended 🤨
One visual thing I noticed: In the table view the cell is not highlighted while selecting cells using the mouse as shown below. This is working well in the yearly view. Maybe you can check if this will work here as well?
image

Furthermore some general aspects regarding the architecture:
The change works visually, but in reservation_table.html.twig it is not fully aligned with the newer table architecture. The regular reservation table is already built as a grid in ReservationTableService, so Twig should mostly render prepared DayColumn / TableCell data. The new today-highlight logic currently recalculates cell date ranges in Twig from cell.span, cell.date, and startsAtDayBoundary, which leaks the service’s half-day slot model back into the template.

A cleaner follow-up would be to move this state into the grid model, for example by adding isToday to DayColumn, or a render flag such as containsToday / isToday to TableCell, computed inside ReservationTableService. Antoher advantage is that you can write dedicated Unit tests if rendering works as intended for your use-case.

For reservation_table_month.html.twig, the change is more consistent with the current code because that yearly/month view still builds much of its table directly in Twig and does not use ReservationTableService yet.

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.

2 participants