Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Highlighted Day on Desktop view #7849

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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