fix bugs with calendar page, highlight next event
This commit is contained in:
Vendored
+288
-239
@@ -538,7 +538,9 @@
|
||||
searchEventsHeadline: "Search Events",
|
||||
///
|
||||
events: "Events",
|
||||
noEvents: "No events"
|
||||
noEvents: "No events",
|
||||
//
|
||||
eventNext: "Up next"
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -770,7 +772,8 @@
|
||||
monthInputPlaceholder: "01",
|
||||
searchEventsHeadline: "Ereignisse suchen",
|
||||
events: "Ereignisse",
|
||||
noEvents: "Keine Ereignisse"
|
||||
noEvents: "Keine Ereignisse",
|
||||
eventNext: "Als n\xE4chstes"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -1000,7 +1003,8 @@
|
||||
monthInputPlaceholder: "01",
|
||||
searchEventsHeadline: "Buscar Eventos",
|
||||
events: "Eventos",
|
||||
noEvents: "No hay eventos"
|
||||
noEvents: "No hay eventos",
|
||||
eventNext: "A continuaci\xF3n"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1055,6 +1059,13 @@
|
||||
function createTimestamp() {
|
||||
return (/* @__PURE__ */ new Date()).toISOString();
|
||||
}
|
||||
function formatISO(date) {
|
||||
return date.toISOString().split("T")[0];
|
||||
}
|
||||
function formatTime(date) {
|
||||
const time = [date.getHours(), date.getMinutes()];
|
||||
return time.join(":");
|
||||
}
|
||||
function checkDoesObjectMatchSearch(query, getStringsOfObject, object) {
|
||||
if (query == "") return true;
|
||||
const stringsInObject = getStringsOfObject(object);
|
||||
@@ -1364,7 +1375,6 @@
|
||||
if (!(e instanceof KeyboardEvent))
|
||||
return console.trace("NOT A KEY EVENT");
|
||||
if (_CoreViewModel.checkIsKeystroke(e) == false) return;
|
||||
console.log(e.key);
|
||||
e.preventDefault();
|
||||
const contexts = this.contexts;
|
||||
while (contexts.length > 0) {
|
||||
@@ -1377,14 +1387,16 @@
|
||||
// CHRON
|
||||
this.chronHandlerManager = new HandlerManager();
|
||||
this.todayDate = new State(/* @__PURE__ */ new Date());
|
||||
this.time = new State("99:99");
|
||||
this.startChron = () => {
|
||||
setInterval(this.chronHandlerManager.trigger, 2e3);
|
||||
setInterval(this.chronHandlerManager.trigger, 1e3);
|
||||
};
|
||||
this.handleChron = () => {
|
||||
const newDate = /* @__PURE__ */ new Date();
|
||||
if (this.unwrappedTodayDate.toDateString() == newDate.toDateString())
|
||||
return;
|
||||
if (this.unwrappedTodayDate.toDateString() != newDate.toDateString())
|
||||
this.todayDate.value = /* @__PURE__ */ new Date();
|
||||
if (formatTime(newDate) != this.time.value)
|
||||
this.time.value = formatTime(newDate);
|
||||
};
|
||||
// DRAG & DROP
|
||||
this.draggedObject = new State(void 0);
|
||||
@@ -1430,9 +1442,6 @@
|
||||
};
|
||||
this.configureServiceWorker();
|
||||
this.checkUpdates();
|
||||
this.noUpdateAvailable.subscribe(() => {
|
||||
console.log(this.noUpdateAvailable.value, this.latestVersion.value, this.version.value);
|
||||
});
|
||||
this.startChron();
|
||||
this.chronHandlerManager.setHandler(
|
||||
"core-view-model",
|
||||
@@ -1804,7 +1813,6 @@
|
||||
this.calculateUsage = () => {
|
||||
this.occupiedSpaceMB.value = this.coreViewModel.storageModel.calculateUsage();
|
||||
this.maximumSpaceMB.value = this.coreViewModel.storageModel.determineCapacity();
|
||||
console.log(this.occupiedSpaceMB.value, this.maximumSpaceMB.value);
|
||||
};
|
||||
// view
|
||||
this.showStorageModal = () => {
|
||||
@@ -2206,7 +2214,7 @@
|
||||
};
|
||||
this.downloadFile = async () => {
|
||||
if (this.cannotExport.value == true) return;
|
||||
const date = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
||||
const date = formatISO(/* @__PURE__ */ new Date());
|
||||
const backup = await this.coreViewModel.fileTransferModel.generateBackup(
|
||||
this.selectedPaths.value.values(),
|
||||
this.exportKey.value
|
||||
@@ -2945,6 +2953,255 @@
|
||||
boardId: ""
|
||||
};
|
||||
|
||||
// src/ViewModel/Pages/taskContainingPageViewModel.ts
|
||||
var TaskContainingPageViewModel = class extends Context {
|
||||
// init
|
||||
constructor(coreViewModel2, chatViewModel, boardsAndTasksModel, contextDebugDescription) {
|
||||
super(contextDebugDescription);
|
||||
this.coreViewModel = coreViewModel2;
|
||||
this.chatViewModel = chatViewModel;
|
||||
this.boardsAndTasksModel = boardsAndTasksModel;
|
||||
// state
|
||||
this.taskIndexManager = new IndexManager(
|
||||
(taskViewModel) => taskViewModel.sortingString
|
||||
);
|
||||
this.selectedTaskViewModel = new State(void 0);
|
||||
this.taskViewModels = new MapState();
|
||||
this.taskCategorySuggestions = new ListState();
|
||||
this.taskStatusSuggestions = new ListState();
|
||||
// methods
|
||||
this.createTaskFromBoardId = (boardId) => {
|
||||
const taskFileContent = this.boardsAndTasksModel.createTask(boardId);
|
||||
const taskViewModel = new TaskViewModel(
|
||||
this.coreViewModel,
|
||||
this.chatViewModel,
|
||||
this.boardsAndTasksModel,
|
||||
this,
|
||||
taskFileContent
|
||||
);
|
||||
taskViewModel.open();
|
||||
this.updateTaskIndices();
|
||||
};
|
||||
// view
|
||||
this.showTask = (taskFileContent) => {
|
||||
};
|
||||
this.removeTaskFromView = (taskFileContent) => {
|
||||
};
|
||||
this.selectTask = (selectedTask) => {
|
||||
this.selectedTaskViewModel.value = selectedTask;
|
||||
};
|
||||
this.closeTask = () => {
|
||||
this.selectedTaskViewModel.value = void 0;
|
||||
};
|
||||
this.updateTaskIndices = () => {
|
||||
this.taskIndexManager.update([...this.taskViewModels.value.values()]);
|
||||
for (const taskViewModel of this.taskViewModels.value.values()) {
|
||||
taskViewModel.updateIndex();
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
// src/ViewModel/Pages/calendarPageViewModel.ts
|
||||
var CALENDAR_EVENT_BOARD_ID = "events";
|
||||
var CalendarPageViewModel = class extends TaskContainingPageViewModel {
|
||||
// init
|
||||
constructor(coreViewModel2, chatViewModel, calendarModel, boardsAndTasksModel) {
|
||||
super(coreViewModel2, chatViewModel, boardsAndTasksModel, "calendar");
|
||||
this.coreViewModel = coreViewModel2;
|
||||
this.chatViewModel = chatViewModel;
|
||||
this.calendarModel = calendarModel;
|
||||
this.boardsAndTasksModel = boardsAndTasksModel;
|
||||
// paths
|
||||
this.getBasePath = () => {
|
||||
return [...this.calendarModel.getViewPath()];
|
||||
};
|
||||
// state
|
||||
this.currentTodayDate = void 0;
|
||||
this.selectedYear = new State(0);
|
||||
this.selectedMonth = new State(0);
|
||||
this.selectedDate = new State(0);
|
||||
this.monthGrid = new State(void 0);
|
||||
this.nextTask = new State(void 0);
|
||||
// methods
|
||||
this.createEvent = () => {
|
||||
const taskFileContent = this.boardsAndTasksModel.createTask(CALENDAR_EVENT_BOARD_ID);
|
||||
taskFileContent.date = CalendarModel.getISODateString(
|
||||
this.selectedYear.value.toString(),
|
||||
this.selectedMonth.value.toString(),
|
||||
this.selectedDate.value.toString()
|
||||
);
|
||||
const taskViewModel = new TaskViewModel(
|
||||
this.coreViewModel,
|
||||
this.chatViewModel,
|
||||
this.boardsAndTasksModel,
|
||||
this,
|
||||
taskFileContent
|
||||
);
|
||||
taskViewModel.open();
|
||||
this.updateTaskIndices();
|
||||
};
|
||||
this.getEventsForDate = () => {
|
||||
const paddedDate = CalendarModel.padDateOrMonth(
|
||||
this.selectedDate.toString()
|
||||
);
|
||||
if (this.monthGrid.value == void 0) {
|
||||
return void 0;
|
||||
}
|
||||
return this.monthGrid.value.days[paddedDate];
|
||||
};
|
||||
// view
|
||||
this.getTaskMapState = (taskFileContent) => {
|
||||
if (this.monthGrid.value == null) return null;
|
||||
const date = CalendarModel.isoToDateString(
|
||||
taskFileContent.date ?? ""
|
||||
);
|
||||
return this.monthGrid.value.days[date];
|
||||
};
|
||||
this.showTask = (taskFileContent) => {
|
||||
const monthString = CalendarModel.isoToMonthString(
|
||||
taskFileContent.date ?? ""
|
||||
);
|
||||
if (monthString == void 0 || monthString != this.monthString) {
|
||||
this.removeTaskFromView(taskFileContent);
|
||||
this.calendarModel.deleteTaskReference(
|
||||
this.monthString,
|
||||
taskFileContent.fileId
|
||||
);
|
||||
return;
|
||||
}
|
||||
const taskViewModel = new TaskViewModel(
|
||||
this.coreViewModel,
|
||||
this.chatViewModel,
|
||||
this.boardsAndTasksModel,
|
||||
this,
|
||||
taskFileContent
|
||||
);
|
||||
const mapState = this.getTaskMapState(taskFileContent);
|
||||
this.taskViewModels.handleRemoval(taskViewModel, () => {
|
||||
mapState?.remove(taskFileContent.fileId);
|
||||
});
|
||||
this.taskViewModels.remove(taskFileContent.fileId);
|
||||
this.taskViewModels.set(taskFileContent.fileId, taskViewModel);
|
||||
mapState?.set(taskFileContent.fileId, taskViewModel);
|
||||
this.updateTaskIndices();
|
||||
};
|
||||
this.removeTaskFromView = (taskFileContent) => {
|
||||
this.taskViewModels.remove(taskFileContent.fileId);
|
||||
};
|
||||
this.showToday = () => {
|
||||
const today = this.coreViewModel.todayDate.value;
|
||||
this.selectedYear.value = today.getFullYear();
|
||||
this.selectedMonth.value = today.getMonth() + 1;
|
||||
this.selectedDate.value = today.getDate();
|
||||
};
|
||||
this.showPreviousMonth = () => {
|
||||
this.selectedMonth.value -= 1;
|
||||
if (this.selectedMonth.value <= 0) {
|
||||
this.selectedYear.value -= 1;
|
||||
this.selectedMonth.value = 12;
|
||||
}
|
||||
};
|
||||
this.showNextMonth = () => {
|
||||
this.selectedMonth.value += 1;
|
||||
if (this.selectedMonth.value >= 13) {
|
||||
this.selectedYear.value += 1;
|
||||
this.selectedMonth.value = 1;
|
||||
}
|
||||
};
|
||||
this.handleDrop = (year, month, date) => {
|
||||
const ISOString = CalendarModel.getISODateString(
|
||||
year,
|
||||
month,
|
||||
date
|
||||
);
|
||||
const draggedObject = this.coreViewModel.draggedObject.value;
|
||||
if (draggedObject instanceof TaskViewModel == false) return;
|
||||
draggedObject.setDate(ISOString);
|
||||
};
|
||||
this.handleChron = () => {
|
||||
this.updateMonthGrid();
|
||||
this.updateNextTask();
|
||||
};
|
||||
this.updateMonthGrid = () => {
|
||||
const today = formatISO(this.coreViewModel.todayDate.value);
|
||||
if (this.currentTodayDate == today)
|
||||
return;
|
||||
this.loadMonthTasks();
|
||||
this.currentTodayDate = today;
|
||||
this.selectedDate.callSubscriptions();
|
||||
};
|
||||
this.updateNextTask = () => {
|
||||
if (this.selectedDateString != this.currentTodayDate) {
|
||||
this.nextTask.value = void 0;
|
||||
return;
|
||||
}
|
||||
const tasks = this.getEventsForDate();
|
||||
if (tasks == void 0) return;
|
||||
for (const task of [...tasks.value.values()]) {
|
||||
if (task.time.value <= this.coreViewModel.time.value) continue;
|
||||
this.nextTask.value = task;
|
||||
break;
|
||||
}
|
||||
;
|
||||
};
|
||||
// load
|
||||
this.loadMonthTasks = () => {
|
||||
this.monthGrid.value = this.calendarModel.generateMonthGrid(
|
||||
this.coreViewModel,
|
||||
this.selectedYear.value,
|
||||
this.selectedMonth.value,
|
||||
() => new MapState()
|
||||
);
|
||||
const taskIds = this.calendarModel.listTaskIds(
|
||||
this.monthString
|
||||
);
|
||||
for (const taskId of taskIds) {
|
||||
const taskFileContent = this.boardsAndTasksModel.getLatestTaskFileContent(taskId);
|
||||
if (taskFileContent == null) continue;
|
||||
this.showTask(taskFileContent);
|
||||
}
|
||||
};
|
||||
this.loadData = () => {
|
||||
};
|
||||
this.calendarModel = calendarModel;
|
||||
this.boardsAndTasksModel = boardsAndTasksModel;
|
||||
this.chatViewModel = chatViewModel;
|
||||
bulkSubscribe([this.selectedYear, this.selectedMonth], () => {
|
||||
this.loadMonthTasks();
|
||||
});
|
||||
this.selectedDate.subscribeSilent(() => {
|
||||
this.updateNextTask();
|
||||
});
|
||||
boardsAndTasksModel.taskHandlerManager.setHandler(
|
||||
"calendar" + this.chatViewModel.chatModel.id,
|
||||
(taskFileContent) => {
|
||||
this.showTask(taskFileContent);
|
||||
}
|
||||
);
|
||||
this.coreViewModel.chronHandlerManager.setHandler(
|
||||
`calendar-${this.chatViewModel.chatModel.id}`,
|
||||
this.handleChron
|
||||
);
|
||||
this.showToday();
|
||||
this.registerKeyStroke("-" /* Reset */, this.showToday);
|
||||
this.registerKeyStroke("k", this.showPreviousMonth);
|
||||
this.registerKeyStroke("l", this.showNextMonth);
|
||||
this.registerKeyStroke("a" /* Create */, this.createEvent);
|
||||
this.chatViewModel.registerContext("calendar" /* Calendar */, this);
|
||||
}
|
||||
// data
|
||||
get monthString() {
|
||||
return CalendarModel.getMonthString(
|
||||
this.selectedYear.value.toString(),
|
||||
this.selectedMonth.value.toString()
|
||||
);
|
||||
}
|
||||
get selectedDateString() {
|
||||
return [this.selectedYear.value, this.selectedMonth.value, this.selectedDate.value].map((x, i) => i == 0 ? x : CalendarModel.padDateOrMonth(x.toString())).join("-");
|
||||
}
|
||||
};
|
||||
|
||||
// src/ViewModel/Pages/taskViewModel.ts
|
||||
var TaskViewModel = class extends Context {
|
||||
// init
|
||||
@@ -2969,6 +3226,7 @@
|
||||
this.priority = new State("");
|
||||
this.date = new State("");
|
||||
this.time = new State("");
|
||||
this.isNotNext = new State(true);
|
||||
this.selectedVersionId = new State("");
|
||||
this.versionIds = new ListState();
|
||||
this.isPresentingFullScreenDescription = new State(
|
||||
@@ -3077,6 +3335,11 @@
|
||||
this.loadAllData = () => {
|
||||
this.loadTaskData();
|
||||
this.loadVersionIds();
|
||||
if (this.containingViewModel instanceof CalendarPageViewModel) {
|
||||
this.containingViewModel.nextTask.subscribe((nextTask) => {
|
||||
this.isNotNext.value = nextTask != this;
|
||||
});
|
||||
}
|
||||
};
|
||||
this.loadTaskData = () => {
|
||||
this.boardId.value = this.task.boardId;
|
||||
@@ -3131,55 +3394,6 @@
|
||||
}
|
||||
};
|
||||
|
||||
// src/ViewModel/Pages/taskContainingPageViewModel.ts
|
||||
var TaskContainingPageViewModel = class extends Context {
|
||||
// init
|
||||
constructor(coreViewModel2, chatViewModel, boardsAndTasksModel, contextDebugDescription) {
|
||||
super(contextDebugDescription);
|
||||
this.coreViewModel = coreViewModel2;
|
||||
this.chatViewModel = chatViewModel;
|
||||
this.boardsAndTasksModel = boardsAndTasksModel;
|
||||
// state
|
||||
this.taskIndexManager = new IndexManager(
|
||||
(taskViewModel) => taskViewModel.sortingString
|
||||
);
|
||||
this.selectedTaskViewModel = new State(void 0);
|
||||
this.taskViewModels = new MapState();
|
||||
this.taskCategorySuggestions = new ListState();
|
||||
this.taskStatusSuggestions = new ListState();
|
||||
// methods
|
||||
this.createTaskFromBoardId = (boardId) => {
|
||||
const taskFileContent = this.boardsAndTasksModel.createTask(boardId);
|
||||
const taskViewModel = new TaskViewModel(
|
||||
this.coreViewModel,
|
||||
this.chatViewModel,
|
||||
this.boardsAndTasksModel,
|
||||
this,
|
||||
taskFileContent
|
||||
);
|
||||
taskViewModel.open();
|
||||
this.updateTaskIndices();
|
||||
};
|
||||
// view
|
||||
this.showTask = (taskFileContent) => {
|
||||
};
|
||||
this.removeTaskFromView = (taskFileContent) => {
|
||||
};
|
||||
this.selectTask = (selectedTask) => {
|
||||
this.selectedTaskViewModel.value = selectedTask;
|
||||
};
|
||||
this.closeTask = () => {
|
||||
this.selectedTaskViewModel.value = void 0;
|
||||
};
|
||||
this.updateTaskIndices = () => {
|
||||
this.taskIndexManager.update([...this.taskViewModels.value.values()]);
|
||||
for (const taskViewModel of this.taskViewModels.value.values()) {
|
||||
taskViewModel.updateIndex();
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
// src/ViewModel/Utility/searchViewModel.ts
|
||||
var SearchViewModel = class {
|
||||
// init
|
||||
@@ -3365,7 +3579,6 @@
|
||||
this,
|
||||
taskFileContent
|
||||
);
|
||||
console.log("STILL HERE", taskFileContent.fileId);
|
||||
this.taskViewModels.set(taskFileContent.fileId, taskViewModel);
|
||||
};
|
||||
this.removeTaskFromView = (taskFileContent) => {
|
||||
@@ -4525,180 +4738,6 @@
|
||||
}
|
||||
};
|
||||
|
||||
// src/ViewModel/Pages/calendarPageViewModel.ts
|
||||
var CALENDAR_EVENT_BOARD_ID = "events";
|
||||
var CalendarPageViewModel = class extends TaskContainingPageViewModel {
|
||||
// init
|
||||
constructor(coreViewModel2, chatViewModel, calendarModel, boardsAndTasksModel) {
|
||||
super(coreViewModel2, chatViewModel, boardsAndTasksModel, "calendar");
|
||||
this.coreViewModel = coreViewModel2;
|
||||
this.chatViewModel = chatViewModel;
|
||||
this.calendarModel = calendarModel;
|
||||
this.boardsAndTasksModel = boardsAndTasksModel;
|
||||
// paths
|
||||
this.getBasePath = () => {
|
||||
return [...this.calendarModel.getViewPath()];
|
||||
};
|
||||
// state
|
||||
this.currentTodayDate = void 0;
|
||||
this.selectedYear = new State(0);
|
||||
this.selectedMonth = new State(0);
|
||||
this.selectedDate = new State(0);
|
||||
this.monthGrid = new State(void 0);
|
||||
// methods
|
||||
this.createEvent = () => {
|
||||
const taskFileContent = this.boardsAndTasksModel.createTask(CALENDAR_EVENT_BOARD_ID);
|
||||
taskFileContent.date = CalendarModel.getISODateString(
|
||||
this.selectedYear.value.toString(),
|
||||
this.selectedMonth.value.toString(),
|
||||
this.selectedDate.value.toString()
|
||||
);
|
||||
const taskViewModel = new TaskViewModel(
|
||||
this.coreViewModel,
|
||||
this.chatViewModel,
|
||||
this.boardsAndTasksModel,
|
||||
this,
|
||||
taskFileContent
|
||||
);
|
||||
taskViewModel.open();
|
||||
this.updateTaskIndices();
|
||||
};
|
||||
this.getEventsForDate = () => {
|
||||
const paddedDate = CalendarModel.padDateOrMonth(
|
||||
this.selectedDate.toString()
|
||||
);
|
||||
if (this.monthGrid.value == void 0) {
|
||||
return void 0;
|
||||
}
|
||||
return this.monthGrid.value.days[paddedDate];
|
||||
};
|
||||
// view
|
||||
this.getTaskMapState = (taskFileContent) => {
|
||||
if (this.monthGrid.value == null) return null;
|
||||
const date = CalendarModel.isoToDateString(
|
||||
taskFileContent.date ?? ""
|
||||
);
|
||||
return this.monthGrid.value.days[date];
|
||||
};
|
||||
this.showTask = (taskFileContent) => {
|
||||
const monthString = CalendarModel.isoToMonthString(
|
||||
taskFileContent.date ?? ""
|
||||
);
|
||||
if (monthString == void 0 || monthString != this.monthString) {
|
||||
this.removeTaskFromView(taskFileContent);
|
||||
this.calendarModel.deleteTaskReference(
|
||||
this.monthString,
|
||||
taskFileContent.fileId
|
||||
);
|
||||
return;
|
||||
}
|
||||
const taskViewModel = new TaskViewModel(
|
||||
this.coreViewModel,
|
||||
this.chatViewModel,
|
||||
this.boardsAndTasksModel,
|
||||
this,
|
||||
taskFileContent
|
||||
);
|
||||
const mapState = this.getTaskMapState(taskFileContent);
|
||||
this.taskViewModels.handleRemoval(taskViewModel, () => {
|
||||
mapState?.remove(taskFileContent.fileId);
|
||||
});
|
||||
this.taskViewModels.remove(taskFileContent.fileId);
|
||||
this.taskViewModels.set(taskFileContent.fileId, taskViewModel);
|
||||
mapState?.set(taskFileContent.fileId, taskViewModel);
|
||||
this.updateTaskIndices();
|
||||
};
|
||||
this.removeTaskFromView = (taskFileContent) => {
|
||||
this.taskViewModels.remove(taskFileContent.fileId);
|
||||
};
|
||||
this.showToday = () => {
|
||||
const today = this.coreViewModel.todayDate.value;
|
||||
this.selectedYear.value = today.getFullYear();
|
||||
this.selectedMonth.value = today.getMonth() + 1;
|
||||
this.selectedDate.value = today.getDate();
|
||||
};
|
||||
this.showPreviousMonth = () => {
|
||||
this.selectedMonth.value -= 1;
|
||||
if (this.selectedMonth.value <= 0) {
|
||||
this.selectedYear.value -= 1;
|
||||
this.selectedMonth.value = 12;
|
||||
}
|
||||
};
|
||||
this.showNextMonth = () => {
|
||||
this.selectedMonth.value += 1;
|
||||
if (this.selectedMonth.value >= 13) {
|
||||
this.selectedYear.value += 1;
|
||||
this.selectedMonth.value = 1;
|
||||
}
|
||||
};
|
||||
this.handleDrop = (year, month, date) => {
|
||||
const ISOString = CalendarModel.getISODateString(
|
||||
year,
|
||||
month,
|
||||
date
|
||||
);
|
||||
const draggedObject = this.coreViewModel.draggedObject.value;
|
||||
if (draggedObject instanceof TaskViewModel == false) return;
|
||||
draggedObject.setDate(ISOString);
|
||||
};
|
||||
this.updateMonthGrid = () => {
|
||||
if (this.currentTodayDate == this.coreViewModel.todayDate.value.toISOString())
|
||||
return;
|
||||
this.loadMonthTasks();
|
||||
this.currentTodayDate = this.coreViewModel.todayDate.value.toISOString();
|
||||
};
|
||||
// load
|
||||
this.loadMonthTasks = () => {
|
||||
this.monthGrid.value = this.calendarModel.generateMonthGrid(
|
||||
this.coreViewModel,
|
||||
this.selectedYear.value,
|
||||
this.selectedMonth.value,
|
||||
() => new MapState()
|
||||
);
|
||||
const taskIds = this.calendarModel.listTaskIds(
|
||||
this.monthString
|
||||
);
|
||||
for (const taskId of taskIds) {
|
||||
const taskFileContent = this.boardsAndTasksModel.getLatestTaskFileContent(taskId);
|
||||
if (taskFileContent == null) continue;
|
||||
this.showTask(taskFileContent);
|
||||
}
|
||||
};
|
||||
this.loadData = () => {
|
||||
this.loadMonthTasks();
|
||||
};
|
||||
this.calendarModel = calendarModel;
|
||||
this.boardsAndTasksModel = boardsAndTasksModel;
|
||||
this.chatViewModel = chatViewModel;
|
||||
bulkSubscribe([this.selectedYear, this.selectedMonth], () => {
|
||||
this.loadMonthTasks();
|
||||
});
|
||||
boardsAndTasksModel.taskHandlerManager.setHandler(
|
||||
"calendar" + this.chatViewModel.chatModel.id,
|
||||
(taskFileContent) => {
|
||||
this.showTask(taskFileContent);
|
||||
}
|
||||
);
|
||||
this.coreViewModel.chronHandlerManager.setHandler(
|
||||
`calendar-${this.chatViewModel.chatModel.id}`,
|
||||
this.updateMonthGrid
|
||||
);
|
||||
this.showToday();
|
||||
this.registerKeyStroke("-" /* Reset */, this.showToday);
|
||||
this.registerKeyStroke("k", this.showPreviousMonth);
|
||||
this.registerKeyStroke("l", this.showNextMonth);
|
||||
this.registerKeyStroke("a" /* Create */, this.createEvent);
|
||||
this.chatViewModel.registerContext("calendar" /* Calendar */, this);
|
||||
}
|
||||
// data
|
||||
get monthString() {
|
||||
return CalendarModel.getMonthString(
|
||||
this.selectedYear.value.toString(),
|
||||
this.selectedMonth.value.toString()
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
// src/ViewModel/Chat/chatViewModel.ts
|
||||
var ChatViewModel6 = class extends ContextHost {
|
||||
// init
|
||||
@@ -4881,7 +4920,6 @@
|
||||
};
|
||||
this.openNotification = () => {
|
||||
const notification = this.marquee.value;
|
||||
console.log(notification);
|
||||
if (notification == void 0) return;
|
||||
const chat = [
|
||||
...this.chatListViewModel.chatViewModels.value.values()
|
||||
@@ -5238,16 +5276,28 @@
|
||||
calendar_month: taskViewModel.date.value || "---",
|
||||
schedule: taskViewModel.time.value || "---"
|
||||
};
|
||||
const className = createProxyState(
|
||||
[taskViewModel.isNotNext],
|
||||
() => `${taskViewModel.isNotNext.value ? "standard" : "primary"} tile flex-no`
|
||||
);
|
||||
const view = /* @__PURE__ */ createElement(
|
||||
"button",
|
||||
{
|
||||
draggable: "true",
|
||||
class: "tile flex-no",
|
||||
"set:class": className,
|
||||
style: "user-select: none; -webkit-user-select: none",
|
||||
"on:click": taskViewModel.open,
|
||||
"on:dragstart": taskViewModel.dragStart
|
||||
},
|
||||
/* @__PURE__ */ createElement("div", null, /* @__PURE__ */ createElement(
|
||||
"span",
|
||||
{
|
||||
class: "secondary",
|
||||
"toggle:hidden": taskViewModel.isNotNext
|
||||
},
|
||||
taskViewModel.coreViewModel.translations.chatPage.calendar.eventNext,
|
||||
/* @__PURE__ */ createElement("hr", null)
|
||||
), /* @__PURE__ */ createElement(
|
||||
"b",
|
||||
{
|
||||
class: "ellipsis",
|
||||
@@ -6867,7 +6917,6 @@
|
||||
calendarPageViewModel.selectedDate
|
||||
],
|
||||
() => {
|
||||
console.log(calendarPageViewModel.selectedDate.value);
|
||||
const listState = calendarPageViewModel.getEventsForDate();
|
||||
if (listState == void 0) {
|
||||
return /* @__PURE__ */ createElement("div", null);
|
||||
|
||||
Vendored
+14
-1
@@ -151,7 +151,7 @@ a {
|
||||
}
|
||||
|
||||
.background-primary {
|
||||
background: var(--primary);
|
||||
background: var(--primary) !important;
|
||||
}
|
||||
|
||||
/* text */
|
||||
@@ -641,6 +641,19 @@ input[type="radio"] {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.padding-top-0 {
|
||||
padding-top: 0 !important;
|
||||
}
|
||||
.padding-left-0 {
|
||||
padding-left: 0 !important;
|
||||
}
|
||||
.padding-right-0 {
|
||||
padding-right: 0 !important;
|
||||
}
|
||||
.padding-bottom-0 {
|
||||
padding-bottom: 0 !important;
|
||||
}
|
||||
|
||||
.padding-0 {
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
const VERSION = "2610 Beta 5.4"
|
||||
const VERSION = "2610 Beta 6"
|
||||
|
||||
function processUrl(event) {
|
||||
const url = event.request.url;
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
2610 Beta 5.4
|
||||
2610 Beta 6
|
||||
|
||||
@@ -18,6 +18,10 @@ export function createTimestamp(): string {
|
||||
return new Date().toISOString();
|
||||
}
|
||||
|
||||
export function formatISO(date: Date): string {
|
||||
return date.toISOString().split("T")[0];
|
||||
}
|
||||
|
||||
export function formatTime(date: Date): string {
|
||||
const time = [date.getHours(), date.getMinutes()];
|
||||
return time.join(":");
|
||||
|
||||
@@ -47,7 +47,6 @@ export function CalendarPage(
|
||||
calendarPageViewModel.selectedDate,
|
||||
],
|
||||
() => {
|
||||
console.log(calendarPageViewModel.selectedDate.value);
|
||||
const listState = calendarPageViewModel.getEventsForDate();
|
||||
|
||||
if (listState == undefined) {
|
||||
|
||||
@@ -11,15 +11,26 @@ export function TaskEntry(taskViewModel: TaskViewModel) {
|
||||
schedule: taskViewModel.time.value || "---",
|
||||
};
|
||||
|
||||
const className = React.createProxyState([taskViewModel.isNotNext], ()=>
|
||||
`${taskViewModel.isNotNext.value ? "standard" : "primary"} tile flex-no`
|
||||
)
|
||||
|
||||
const view = (
|
||||
<button
|
||||
draggable="true"
|
||||
class="tile flex-no"
|
||||
set:class={className}
|
||||
style="user-select: none; -webkit-user-select: none"
|
||||
on:click={taskViewModel.open}
|
||||
on:dragstart={taskViewModel.dragStart}
|
||||
>
|
||||
<div>
|
||||
<span
|
||||
class="secondary"
|
||||
toggle:hidden={taskViewModel.isNotNext}
|
||||
>
|
||||
{taskViewModel.coreViewModel.translations.chatPage.calendar.eventNext}
|
||||
<hr></hr>
|
||||
</span>
|
||||
<b
|
||||
class="ellipsis"
|
||||
subscribe:innerText={taskViewModel.name}
|
||||
|
||||
@@ -338,6 +338,10 @@ const englishTranslations = {
|
||||
|
||||
events: "Events",
|
||||
noEvents: "No events",
|
||||
|
||||
//
|
||||
|
||||
eventNext: "Up next",
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -657,6 +661,8 @@ export const allTranslations: {
|
||||
|
||||
events: "Ereignisse",
|
||||
noEvents: "Keine Ereignisse",
|
||||
|
||||
eventNext: "Als nächstes",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -971,6 +977,8 @@ export const allTranslations: {
|
||||
|
||||
events: "Eventos",
|
||||
noEvents: "No hay eventos",
|
||||
|
||||
eventNext: "A continuación",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -59,7 +59,6 @@ export default class CoreViewModel {
|
||||
if (!(e instanceof KeyboardEvent))
|
||||
return console.trace("NOT A KEY EVENT");
|
||||
if (CoreViewModel.checkIsKeystroke(e) == false) return;
|
||||
console.log(e.key);
|
||||
e.preventDefault();
|
||||
const contexts: Context[] = this.contexts;
|
||||
while (contexts.length > 0) {
|
||||
@@ -73,24 +72,21 @@ export default class CoreViewModel {
|
||||
// CHRON
|
||||
chronHandlerManager = new HandlerManager<void>();
|
||||
todayDate = new React.State<Date>(new Date());
|
||||
time = new React.State<[number, number]>([0, 0]);
|
||||
time = new React.State<string>("99:99");
|
||||
get unwrappedTodayDate(): Date {
|
||||
return new Date(this.todayDate.value);
|
||||
}
|
||||
get timeString(): string {
|
||||
return this.time.value.join(":");
|
||||
}
|
||||
|
||||
startChron = (): void => {
|
||||
setInterval(this.chronHandlerManager.trigger, 2000);
|
||||
setInterval(this.chronHandlerManager.trigger, 1000);
|
||||
};
|
||||
|
||||
handleChron = (): void => {
|
||||
const newDate = new Date();
|
||||
if (this.unwrappedTodayDate.toDateString() != newDate.toDateString())
|
||||
this.todayDate.value = new Date();
|
||||
if (formatTime(newDate) != this.timeString)
|
||||
this.time.value = [newDate.getHours(), newDate.getMinutes()];
|
||||
if (formatTime(newDate) != this.time.value)
|
||||
this.time.value = formatTime(newDate);
|
||||
};
|
||||
|
||||
// DRAG & DROP
|
||||
@@ -154,9 +150,6 @@ export default class CoreViewModel {
|
||||
|
||||
this.configureServiceWorker();
|
||||
this.checkUpdates();
|
||||
this.noUpdateAvailable.subscribe(() => {
|
||||
console.log(this.noUpdateAvailable.value, this.latestVersion.value, this.version.value);
|
||||
})
|
||||
|
||||
this.startChron();
|
||||
this.chronHandlerManager.setHandler(
|
||||
|
||||
@@ -7,6 +7,7 @@ import StorageModel, {
|
||||
} from "../../Model/Global/storageModel";
|
||||
import { TransferData } from "../../Model/Global/fileTransferModel";
|
||||
import ChatModel from "../../Model/Chat/chatModel";
|
||||
import {formatISO} from "../../Model/Utility/utility";
|
||||
|
||||
export default class FileTransferViewModel extends Context {
|
||||
// state
|
||||
@@ -142,7 +143,7 @@ export default class FileTransferViewModel extends Context {
|
||||
|
||||
downloadFile = async (): Promise<void> => {
|
||||
if (this.cannotExport.value == true) return;
|
||||
const date = new Date().toISOString().split("T")[0];
|
||||
const date = formatISO(new Date());
|
||||
|
||||
const backup: Blob =
|
||||
await this.coreViewModel.fileTransferModel.generateBackup(
|
||||
|
||||
@@ -35,7 +35,6 @@ export default class NotificationViewModel {
|
||||
|
||||
openNotification = () => {
|
||||
const notification: Notification | undefined = this.marquee.value;
|
||||
console.log(notification);
|
||||
if (notification == undefined) return;
|
||||
|
||||
const chat = [
|
||||
|
||||
@@ -52,7 +52,6 @@ export default class StorageViewModel extends Context {
|
||||
calculateUsage = (): void => {
|
||||
this.occupiedSpaceMB.value = this.coreViewModel.storageModel.calculateUsage();
|
||||
this.maximumSpaceMB.value = this.coreViewModel.storageModel.determineCapacity();
|
||||
console.log(this.occupiedSpaceMB.value, this.maximumSpaceMB.value);
|
||||
}
|
||||
|
||||
// view
|
||||
|
||||
@@ -153,7 +153,6 @@ export default class BoardViewModel extends TaskContainingPageViewModel {
|
||||
this,
|
||||
taskFileContent,
|
||||
);
|
||||
console.log("STILL HERE", taskFileContent.fileId);
|
||||
this.taskViewModels.set(taskFileContent.fileId, taskViewModel);
|
||||
};
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import CalendarModel, { MonthGrid } from "../../Model/Files/calendarModel";
|
||||
import BoardsAndTasksModel, {
|
||||
TaskFileContent,
|
||||
} from "../../Model/Files/boardsAndTasksModel";
|
||||
import {formatISO, formatTime} from "../../Model/Utility/utility";
|
||||
|
||||
export const CALENDAR_EVENT_BOARD_ID = "events";
|
||||
|
||||
@@ -20,6 +21,12 @@ export default class CalendarPageViewModel extends TaskContainingPageViewModel {
|
||||
);
|
||||
}
|
||||
|
||||
get selectedDateString(): string {
|
||||
return [this.selectedYear.value, this.selectedMonth.value, this.selectedDate.value]
|
||||
.map((x, i) => i == 0 ? x : CalendarModel.padDateOrMonth(x.toString()))
|
||||
.join("-");
|
||||
}
|
||||
|
||||
// paths
|
||||
getBasePath = (): string[] => {
|
||||
return [...this.calendarModel.getViewPath()];
|
||||
@@ -35,6 +42,8 @@ export default class CalendarPageViewModel extends TaskContainingPageViewModel {
|
||||
MonthGrid<React.MapState<TaskViewModel>> | undefined
|
||||
> = new React.State<any>(undefined);
|
||||
|
||||
nextTask: React.State<TaskViewModel|undefined> = new React.State(undefined);
|
||||
|
||||
// methods
|
||||
createEvent = (): void => {
|
||||
const taskFileContent: TaskFileContent =
|
||||
@@ -157,17 +166,37 @@ export default class CalendarPageViewModel extends TaskContainingPageViewModel {
|
||||
draggedObject.setDate(ISOString);
|
||||
};
|
||||
|
||||
handleChron = (): void => {
|
||||
this.updateMonthGrid();
|
||||
this.updateNextTask();
|
||||
}
|
||||
|
||||
updateMonthGrid = (): void => {
|
||||
const today = formatISO(this.coreViewModel.todayDate.value)
|
||||
if (
|
||||
this.currentTodayDate ==
|
||||
this.coreViewModel.todayDate.value.toISOString()
|
||||
this.currentTodayDate == today
|
||||
)
|
||||
return;
|
||||
this.loadMonthTasks();
|
||||
this.currentTodayDate =
|
||||
this.coreViewModel.todayDate.value.toISOString();
|
||||
this.currentTodayDate = today;
|
||||
this.selectedDate.callSubscriptions();
|
||||
};
|
||||
|
||||
updateNextTask = (): void => {
|
||||
if (this.selectedDateString != this.currentTodayDate) {
|
||||
this.nextTask.value = undefined;
|
||||
return;
|
||||
}
|
||||
|
||||
const tasks = this.getEventsForDate();
|
||||
if (tasks == undefined) return;
|
||||
for (const task of [...tasks.value.values()]) {
|
||||
if (task.time.value <= this.coreViewModel.time.value) continue;
|
||||
this.nextTask.value = task;
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
// load
|
||||
loadMonthTasks = (): void => {
|
||||
this.monthGrid.value = this.calendarModel.generateMonthGrid(
|
||||
@@ -189,7 +218,6 @@ export default class CalendarPageViewModel extends TaskContainingPageViewModel {
|
||||
};
|
||||
|
||||
loadData = (): void => {
|
||||
this.loadMonthTasks();
|
||||
};
|
||||
|
||||
// init
|
||||
@@ -209,6 +237,9 @@ export default class CalendarPageViewModel extends TaskContainingPageViewModel {
|
||||
React.bulkSubscribe([this.selectedYear, this.selectedMonth], () => {
|
||||
this.loadMonthTasks();
|
||||
});
|
||||
this.selectedDate.subscribeSilent(()=>{
|
||||
this.updateNextTask();
|
||||
})
|
||||
|
||||
// handlers
|
||||
boardsAndTasksModel.taskHandlerManager.setHandler(
|
||||
@@ -219,7 +250,7 @@ export default class CalendarPageViewModel extends TaskContainingPageViewModel {
|
||||
);
|
||||
this.coreViewModel.chronHandlerManager.setHandler(
|
||||
`calendar-${this.chatViewModel.chatModel.id}`,
|
||||
this.updateMonthGrid,
|
||||
this.handleChron,
|
||||
);
|
||||
|
||||
// initiate
|
||||
|
||||
@@ -8,6 +8,7 @@ import { localeCompare, padZero } from "../../Model/Utility/utility";
|
||||
import BoardsAndTasksModel, {
|
||||
TaskFileContent,
|
||||
} from "../../Model/Files/boardsAndTasksModel";
|
||||
import CalendarPageViewModel from "./calendarPageViewModel";
|
||||
|
||||
export default class TaskViewModel extends Context {
|
||||
// util
|
||||
@@ -55,6 +56,8 @@ export default class TaskViewModel extends Context {
|
||||
date: React.State<string> = new React.State("");
|
||||
time: React.State<string> = new React.State("");
|
||||
|
||||
isNotNext: React.State<boolean> = new React.State(true);
|
||||
|
||||
selectedVersionId: React.State<string> = new React.State("");
|
||||
versionIds: React.ListState<string> = new React.ListState();
|
||||
|
||||
@@ -196,6 +199,12 @@ export default class TaskViewModel extends Context {
|
||||
loadAllData = (): void => {
|
||||
this.loadTaskData();
|
||||
this.loadVersionIds();
|
||||
|
||||
if (this.containingViewModel instanceof CalendarPageViewModel) {
|
||||
this.containingViewModel.nextTask.subscribe((nextTask)=>{
|
||||
this.isNotNext.value = nextTask != this;
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
loadTaskData = (): void => {
|
||||
|
||||
Reference in New Issue
Block a user