fix bug with next task highlight

This commit is contained in:
marlon-erler
2026-09-25 20:11:33 +02:00
parent bdbd5fa123
commit c202acbde6
7 changed files with 720 additions and 710 deletions
+700 -697
View File
File diff suppressed because it is too large Load Diff
Vendored
+1 -1
View File
@@ -1,4 +1,4 @@
const VERSION = "2610 Beta 6" const VERSION = "2610 Beta 6.6"
function processUrl(event) { function processUrl(event) {
const url = event.request.url; const url = event.request.url;
+1 -1
View File
@@ -1 +1 @@
2610 Beta 6 2610 Beta 6.6
+5 -5
View File
@@ -102,7 +102,7 @@ export default class CalendarModel {
}; };
for (let i = 0; i < daysInMonth; i++) { for (let i = 0; i < daysInMonth; i++) {
const paddedDate: string = CalendarModel.padDateOrMonth( const paddedDate: string = CalendarModel.padZero(
(i + 1).toString(), (i + 1).toString(),
); );
grid.days[paddedDate] = defaultValueCreator(); grid.days[paddedDate] = defaultValueCreator();
@@ -130,13 +130,13 @@ export default class CalendarModel {
static isoToDateString = (dateISOString: string): string => { static isoToDateString = (dateISOString: string): string => {
const [year, month, date, _] = dateISOString.split("-"); const [year, month, date, _] = dateISOString.split("-");
const paddedDate = CalendarModel.padDateOrMonth(date ?? ""); const paddedDate = CalendarModel.padZero(date ?? "");
return paddedDate; return paddedDate;
}; };
static getMonthString = (year: string = "", month: string = ""): string => { static getMonthString = (year: string = "", month: string = ""): string => {
const paddedYear: string = year.padStart(4, "0"); const paddedYear: string = year.padStart(4, "0");
const paddedMonth: string = CalendarModel.padDateOrMonth(month); const paddedMonth: string = CalendarModel.padZero(month);
return `${paddedYear}-${paddedMonth}`; return `${paddedYear}-${paddedMonth}`;
}; };
@@ -146,11 +146,11 @@ export default class CalendarModel {
date: string, date: string,
): string => { ): string => {
const monthString: string = CalendarModel.getMonthString(year, month); const monthString: string = CalendarModel.getMonthString(year, month);
const paddedDate: string = CalendarModel.padDateOrMonth(date); const paddedDate: string = CalendarModel.padZero(date);
return `${monthString}-${paddedDate}`; return `${monthString}-${paddedDate}`;
}; };
static padDateOrMonth = (input: string): string => { static padZero = (input: string): string => {
return input.padStart(2, "0"); return input.padStart(2, "0");
}; };
} }
+5 -2
View File
@@ -1,5 +1,7 @@
import { checkIsValidObject, checkMatchesObjectStructure } from "./typeSafety"; import { checkIsValidObject, checkMatchesObjectStructure } from "./typeSafety";
import * as React from "../../react"; import * as React from "../../react";
import {CalendarPage} from "../../View/ChatPages/calendarPage";
import CalendarModel from "../Files/calendarModel";
export interface Stringifiable { export interface Stringifiable {
toString(): string; toString(): string;
@@ -23,8 +25,9 @@ export function formatISO(date: Date): string {
} }
export function formatTime(date: Date): string { export function formatTime(date: Date): string {
const time = [date.getHours(), date.getMinutes()]; return [date.getHours(), date.getMinutes()]
return time.join(":"); .map(x => CalendarModel.padZero(x.toString()))
.join(":");
} }
// filters // filters
+2
View File
@@ -123,7 +123,9 @@ export default class CoreViewModel {
update = async (): Promise<void> => { update = async (): Promise<void> => {
if (!this.swRegistration) return; if (!this.swRegistration) return;
await this.swRegistration.update(); await this.swRegistration.update();
setTimeout(()=>{
window.location.reload(); window.location.reload();
}, 500);
} }
// init // init
+5 -3
View File
@@ -23,7 +23,7 @@ export default class CalendarPageViewModel extends TaskContainingPageViewModel {
get selectedDateString(): string { get selectedDateString(): string {
return [this.selectedYear.value, this.selectedMonth.value, this.selectedDate.value] return [this.selectedYear.value, this.selectedMonth.value, this.selectedDate.value]
.map((x, i) => i == 0 ? x : CalendarModel.padDateOrMonth(x.toString())) .map((x, i) => i == 0 ? x : CalendarModel.padZero(x.toString()))
.join("-"); .join("-");
} }
@@ -67,7 +67,7 @@ export default class CalendarPageViewModel extends TaskContainingPageViewModel {
}; };
getEventsForDate = (): React.MapState<TaskViewModel> | undefined => { getEventsForDate = (): React.MapState<TaskViewModel> | undefined => {
const paddedDate: string = CalendarModel.padDateOrMonth( const paddedDate: string = CalendarModel.padZero(
this.selectedDate.toString(), this.selectedDate.toString(),
); );
@@ -190,7 +190,9 @@ export default class CalendarPageViewModel extends TaskContainingPageViewModel {
const tasks = this.getEventsForDate(); const tasks = this.getEventsForDate();
if (tasks == undefined) return; if (tasks == undefined) return;
for (const task of [...tasks.value.values()]) { const taskArray =[...tasks.value.values()];
const sorted = taskArray.sort((a, b) => a.index.value - b.index.value);
for (const task of sorted) {
if (task.time.value <= this.coreViewModel.time.value) continue; if (task.time.value <= this.coreViewModel.time.value) continue;
this.nextTask.value = task; this.nextTask.value = task;
break; break;