Skip to content

Commit

Permalink
Add functionality to go to WEEK view clicking at the week number at M…
Browse files Browse the repository at this point in the history
…ONTH view
  • Loading branch information
andrehgdias authored and wrdhub committed Jul 24, 2024
1 parent d0b1dce commit adba4ce
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/calendar-app/calendar/view/CalendarMonthView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,18 @@ export class CalendarMonthView implements Component<CalendarMonthAttrs>, ClassCo
this.renderDayHeader(day, attrs.onDateSelected), // According to ISO 8601, weeks always start on Monday. Week numbering systems for
// weeks that do not start on Monday are not strictly defined, so we only display
// a week number if the user's client is configured to start weeks on Monday
weekDayNumber === 0 && attrs.startOfTheWeek === WeekStart.MONDAY ? m(".calendar-month-week-number.abs", getWeekNumber(day.date)) : null,
weekDayNumber === 0 && attrs.startOfTheWeek === WeekStart.MONDAY
? m(
".calendar-month-week-number.abs.z3",
{
onclick: (e: MouseEvent) => {
e.stopPropagation()
attrs.onDateSelected(new Date(day.date), CalendarViewType.WEEK)
},
},
getWeekNumber(day.date),
)
: null,
],
)
}
Expand Down
11 changes: 11 additions & 0 deletions src/common/gui/main-styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2247,6 +2247,17 @@ styles.registerStyle("main", () => {
top: "8px",
left: "6px",
},
".calendar-month-week-number:after": {
// Used to expand the clickable area
content: "''",
width: "100%",
height: "100%",
position: "absolute",
top: "0",
left: "0",
padding: "35%",
margin: "-35% -35%",
},
".color-picker": {
height: px(30),
width: px(100),
Expand Down

0 comments on commit adba4ce

Please sign in to comment.