Skip to content

Commit

Permalink
Fix Highlighted Day on Desktop view
Browse files Browse the repository at this point in the history
When navigating through the months in the SidebarDaySelector
It doesn't highlight the day if It isn't the current selected date.

Co-authored-by: André Dias <and@tutao.de>
  • Loading branch information
2 people authored and domesticated-raptor committed Nov 5, 2024
1 parent 61ddbf8 commit 8d021b2
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import m, { Children, Component, Vnode } from "mithril"
import { formatMonthWithFullYear } from "../../../../common/misc/Formatter.js"
import { incrementMonth } from "@tutao/tutanota-utils"
import { incrementMonth, isSameDay } from "@tutao/tutanota-utils"
import { DaySelector } from "./DaySelector.js"
import { DaysToEvents } from "../../../../common/calendar/date/CalendarEventsRepository.js"
import renderSwitchMonthArrowIcon from "../../../../common/gui/base/buttons/ArrowButton.js"

export interface DaySelectorSidebarAttrs {
Expand Down Expand Up @@ -30,6 +29,8 @@ export class DaySelectorSidebar implements Component<DaySelectorSidebarAttrs> {
this.openDate = vnode.attrs.selectedDate
}

const disableHighlight = !isSameDay(vnode.attrs.selectedDate, this.currentDate)

return m(
".plr-m.mt-form",
m(".elevated-bg.pt-s.pb-m.border-radius.flex.flex-column", [
Expand All @@ -45,9 +46,9 @@ export class DaySelectorSidebar implements Component<DaySelectorSidebarAttrs> {
this.onMonthChange(isNext)
m.redraw()
},
showDaySelection: vnode.attrs.showDaySelection,
showDaySelection: vnode.attrs.showDaySelection && !disableHighlight,
highlightToday: vnode.attrs.highlightToday,
highlightSelectedWeek: vnode.attrs.highlightSelectedWeek,
highlightSelectedWeek: vnode.attrs.highlightSelectedWeek && !disableHighlight,
useNarrowWeekName: true,
hasEventOn: vnode.attrs.hasEventsOn,
}),
Expand Down

0 comments on commit 8d021b2

Please sign in to comment.