aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/calendarBox/CalendarBox.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/calendarBox/CalendarBox.tsx')
-rw-r--r--src/client/views/nodes/calendarBox/CalendarBox.tsx58
1 files changed, 27 insertions, 31 deletions
diff --git a/src/client/views/nodes/calendarBox/CalendarBox.tsx b/src/client/views/nodes/calendarBox/CalendarBox.tsx
index 4ee2413be..84fa25dba 100644
--- a/src/client/views/nodes/calendarBox/CalendarBox.tsx
+++ b/src/client/views/nodes/calendarBox/CalendarBox.tsx
@@ -115,6 +115,7 @@ export class CalendarBox extends CollectionSubView() {
return 'red';
};
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
internalDocDrop = (e: Event, de: DragManager.DropEvent, docDragData: DragManager.DocumentDragData) => {
if (!super.onInternalDrop(e, de)) return false;
de.complete.docDragData?.droppedDocuments.forEach(doc => {
@@ -153,7 +154,6 @@ export class CalendarBox extends CollectionSubView() {
doc.startTime = new DateField(startDate);
doc.endTime = new DateField(endDate);
}
-
};
handleEventClick = (arg: EventClickArg) => {
@@ -201,40 +201,36 @@ export class CalendarBox extends CollectionSubView() {
eventDrop: this.handleEventDrop,
eventResize: this.handleEventDrop,
eventDidMount: arg => {
+ const doc = DocServer.GetCachedRefField(arg.event._def.groupId ?? '');
+ if (!doc) return;
- const doc = DocServer.GetCachedRefField(arg.event._def.groupId ?? '');
- if (!doc) return;
-
- if (doc.type === 'task') {
- const checkButton = document.createElement('button');
- checkButton.innerText = doc.completed ? '✅' : '⬜';
- checkButton.style.position = 'absolute';
- checkButton.style.right = '5px';
- checkButton.style.top = '50%';
- checkButton.style.transform = 'translateY(-50%)';
- checkButton.style.background = 'transparent';
- checkButton.style.border = 'none';
- checkButton.style.cursor = 'pointer';
- checkButton.style.fontSize = '18px';
- checkButton.style.zIndex = '1000';
- checkButton.style.padding = '0';
- checkButton.style.margin = '0';
-
- checkButton.onclick = ev => {
- ev.stopPropagation();
- doc.completed = !doc.completed;
- this._calendar?.refetchEvents();
- };
-
- // Make sure the parent box is positioned relative
- arg.el.style.position = 'relative';
- arg.el.appendChild(checkButton);
- }
-
- // (keep your other pointerup/contextmenu handlers here)
+ if (doc.type === 'task') {
+ const checkButton = document.createElement('button');
+ checkButton.innerText = doc.completed ? '✅' : '⬜';
+ checkButton.style.position = 'absolute';
+ checkButton.style.right = '5px';
+ checkButton.style.top = '50%';
+ checkButton.style.transform = 'translateY(-50%)';
+ checkButton.style.background = 'transparent';
+ checkButton.style.border = 'none';
+ checkButton.style.cursor = 'pointer';
+ checkButton.style.fontSize = '18px';
+ checkButton.style.zIndex = '1000';
+ checkButton.style.padding = '0';
+ checkButton.style.margin = '0';
+ checkButton.onclick = ev => {
+ ev.stopPropagation();
+ doc.completed = !doc.completed;
+ this._calendar?.refetchEvents();
+ };
+ // Make sure the parent box is positioned relative
+ arg.el.style.position = 'relative';
+ arg.el.appendChild(checkButton);
+ }
+ // (keep your other pointerup/contextmenu handlers here)
arg.el.addEventListener('pointerdown', ev => {
ev.button && ev.stopPropagation();