mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
Make first day of week settable through UI
This commit is contained in:
parent
aebaa04652
commit
806e52d6db
2 changed files with 10 additions and 11 deletions
|
@ -51,8 +51,9 @@
|
|||
targetYear,
|
||||
i18n,
|
||||
nightMode,
|
||||
revlogRange
|
||||
);
|
||||
revlogRange,
|
||||
calendarFirstDayOfWeek.set,
|
||||
)
|
||||
}
|
||||
|
||||
const title = i18n.tr(i18n.TR.STATISTICS_CALENDAR_TITLE);
|
||||
|
|
|
@ -85,7 +85,8 @@ export function renderCalendar(
|
|||
targetYear: number,
|
||||
i18n: I18n,
|
||||
nightMode: boolean,
|
||||
revlogRange: RevlogRange
|
||||
revlogRange: RevlogRange,
|
||||
setFirstDayOfWeek: (d: number) => void,
|
||||
): void {
|
||||
const svg = select(svgElem);
|
||||
const now = new Date();
|
||||
|
@ -181,7 +182,10 @@ export function renderCalendar(
|
|||
.attr("text-anchor", "end")
|
||||
.attr("font-size", "small")
|
||||
.attr("font-family", "monospace")
|
||||
.style("user-select", "none");
|
||||
.style("user-select", "none")
|
||||
.on("click", null)
|
||||
.filter((d: number) => [Weekday.SUNDAY, Weekday.MONDAY, Weekday.FRIDAY, Weekday.SATURDAY].includes(d))
|
||||
.on("click", setFirstDayOfWeek);
|
||||
|
||||
svg.select("g.days")
|
||||
.selectAll("rect")
|
||||
|
@ -199,11 +203,5 @@ export function renderCalendar(
|
|||
.on("mouseout", hideTooltip)
|
||||
.transition()
|
||||
.duration(800)
|
||||
.attr("fill", (d) => {
|
||||
if (d.count === 0) {
|
||||
return emptyColour;
|
||||
} else {
|
||||
return blues(d.count)!;
|
||||
}
|
||||
});
|
||||
.attr("fill", (d) => d.count === 0 ? emptyColour : blues(d.count)!);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue