mirror of
https://github.com/dralkh/spaceforge.git
synced 2026-07-22 06:45:03 +00:00
feat(review): combine due notes and today-only notes in default view
This commit is contained in:
parent
aa060b7ee6
commit
52efa857af
3 changed files with 38 additions and 13 deletions
|
|
@ -138,7 +138,27 @@ export class ReviewControllerCore implements IReviewController {
|
|||
// If currentReviewDateOverride is set, we are viewing a specific date from the calendar, so match exactly.
|
||||
// Otherwise (override is null), we are in the default "today" view, so get all notes due up to today.
|
||||
const matchExactDate = this.currentReviewDateOverride !== null;
|
||||
const newDueNotes = this.plugin.dataStorage.reviewScheduleService.getDueNotesWithCustomOrder(effectiveDate, true, matchExactDate);
|
||||
|
||||
let newDueNotes: ReviewSchedule[];
|
||||
|
||||
if (matchExactDate) {
|
||||
// Calendar view: Get notes for the specific date
|
||||
newDueNotes = this.plugin.dataStorage.reviewScheduleService.getDueNotesWithCustomOrder(effectiveDate, true, true);
|
||||
} else {
|
||||
// Default view: Get notes due up to today AND notes for today's date
|
||||
const dueNotes = this.plugin.dataStorage.reviewScheduleService.getDueNotesWithCustomOrder(effectiveDate, true, false);
|
||||
const todayOnlyNotes = this.plugin.dataStorage.reviewScheduleService.getDueNotesWithCustomOrder(effectiveDate, true, true);
|
||||
|
||||
const combinedNotes = [...dueNotes, ...todayOnlyNotes];
|
||||
const uniqueNotes = new Map<string, ReviewSchedule>();
|
||||
for (const note of combinedNotes) {
|
||||
if (!uniqueNotes.has(note.path)) {
|
||||
uniqueNotes.set(note.path, note);
|
||||
}
|
||||
}
|
||||
newDueNotes = Array.from(uniqueNotes.values());
|
||||
}
|
||||
|
||||
this.todayNotes = newDueNotes;
|
||||
|
||||
// The traversal order should directly reflect the order of todayNotes,
|
||||
|
|
|
|||
22
main.js
22
main.js
|
|
@ -1342,7 +1342,21 @@ var ReviewControllerCore = class {
|
|||
const originalPositions = new Map(this.traversalPositions);
|
||||
const effectiveDate = this.getEffectiveReviewDate();
|
||||
const matchExactDate = this.currentReviewDateOverride !== null;
|
||||
const newDueNotes = this.plugin.dataStorage.reviewScheduleService.getDueNotesWithCustomOrder(effectiveDate, true, matchExactDate);
|
||||
let newDueNotes;
|
||||
if (matchExactDate) {
|
||||
newDueNotes = this.plugin.dataStorage.reviewScheduleService.getDueNotesWithCustomOrder(effectiveDate, true, true);
|
||||
} else {
|
||||
const dueNotes = this.plugin.dataStorage.reviewScheduleService.getDueNotesWithCustomOrder(effectiveDate, true, false);
|
||||
const todayOnlyNotes = this.plugin.dataStorage.reviewScheduleService.getDueNotesWithCustomOrder(effectiveDate, true, true);
|
||||
const combinedNotes = [...dueNotes, ...todayOnlyNotes];
|
||||
const uniqueNotes = /* @__PURE__ */ new Map();
|
||||
for (const note of combinedNotes) {
|
||||
if (!uniqueNotes.has(note.path)) {
|
||||
uniqueNotes.set(note.path, note);
|
||||
}
|
||||
}
|
||||
newDueNotes = Array.from(uniqueNotes.values());
|
||||
}
|
||||
this.todayNotes = newDueNotes;
|
||||
this.traversalOrder = this.todayNotes.map((note) => note.path);
|
||||
this.traversalPositions = /* @__PURE__ */ new Map();
|
||||
|
|
@ -5942,11 +5956,7 @@ var CalendarView = class {
|
|||
const today = /* @__PURE__ */ new Date();
|
||||
const isClickedDateToday = DateUtils.isSameDay(currentDateObj, today);
|
||||
this.plugin.settings.sidebarViewType = "list";
|
||||
if (isClickedDateToday) {
|
||||
this.plugin.clickedDateFromCalendar = null;
|
||||
} else {
|
||||
this.plugin.clickedDateFromCalendar = currentDateObj;
|
||||
}
|
||||
this.plugin.clickedDateFromCalendar = currentDateObj;
|
||||
await this.plugin.savePluginData();
|
||||
const sidebarView = this.plugin.getSidebarView();
|
||||
if (sidebarView && typeof sidebarView.refresh === "function") {
|
||||
|
|
|
|||
|
|
@ -221,12 +221,7 @@ export class CalendarView {
|
|||
const isClickedDateToday = DateUtils.isSameDay(currentDateObj, today);
|
||||
|
||||
this.plugin.settings.sidebarViewType = 'list';
|
||||
|
||||
if (isClickedDateToday) {
|
||||
this.plugin.clickedDateFromCalendar = null;
|
||||
} else {
|
||||
this.plugin.clickedDateFromCalendar = currentDateObj;
|
||||
}
|
||||
this.plugin.clickedDateFromCalendar = currentDateObj;
|
||||
|
||||
await this.plugin.savePluginData();
|
||||
const sidebarView = this.plugin.getSidebarView();
|
||||
|
|
|
|||
Loading…
Reference in a new issue