feat: add coloured calendar system indicators
Add a selectable single-dot or per-system indicator mode. Date systems now carry configurable colours; results are cached per displayed month and invalidated when paths/settings change. Refine calendar hierarchy, spacing, hover, and today states.
This commit is contained in:
@@ -181,6 +181,14 @@ export class WaypointView extends ItemView {
|
||||
this.plugin.settings.calendar.firstDayOfWeek,
|
||||
);
|
||||
|
||||
const systemIndicators = this.plugin.settings.calendar.showNoteIndicators
|
||||
&& this.plugin.settings.calendar.indicatorMode === 'systems'
|
||||
? this.plugin.getDateSystemIndicators(weeks.reduce<moment.Moment[]>(
|
||||
(dates, week) => dates.concat(week.days.map(day => day.date)),
|
||||
[],
|
||||
))
|
||||
: null;
|
||||
|
||||
for (const week of weeks) {
|
||||
const row = tbody.createEl('tr');
|
||||
|
||||
@@ -211,8 +219,20 @@ export class WaypointView extends ItemView {
|
||||
|
||||
if (this.plugin.settings.calendar.showNoteIndicators) {
|
||||
const dateStr = day.date.format('YYYY-MM-DD');
|
||||
if (this.plugin.hasNoteForDate(dateStr)) {
|
||||
cell.addClass('has-note');
|
||||
if (this.plugin.settings.calendar.indicatorMode === 'any') {
|
||||
if (this.plugin.hasNoteForDate(dateStr)) {
|
||||
cell.addClass('has-note');
|
||||
}
|
||||
} else {
|
||||
const indicators = systemIndicators?.get(dateStr) || [];
|
||||
if (indicators.length > 0) {
|
||||
const dots = cell.createDiv({ cls: 'waypoint-day-indicators' });
|
||||
for (const indicator of indicators) {
|
||||
const dot = dots.createSpan({ cls: 'waypoint-day-indicator' });
|
||||
dot.style.setProperty('--waypoint-indicator-color', indicator.color);
|
||||
setTooltip(dot, indicator.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user