aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2025-06-02 18:58:18 -0400
committerbobzel <zzzman@gmail.com>2025-06-02 18:58:18 -0400
commit57e1862e58e89a505547d817123c04079854814f (patch)
treebb964f7c03d8911f69c6823eac443d7159a12309
parenta7afce10c47724156510a8665e7e1841566082e8 (diff)
changed field names for tasks to start with task_. changed calendar date and range to start with _calendar
-rw-r--r--src/client/documents/Documents.ts18
-rw-r--r--src/client/util/CalendarManager.tsx2
-rw-r--r--src/client/views/nodes/TaskBox.tsx197
-rw-r--r--src/client/views/nodes/calendarBox/CalendarBox.tsx41
-rw-r--r--src/client/views/nodes/formattedText/DailyJournal.tsx70
5 files changed, 124 insertions, 204 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index 0b6385466..4ad9c9bd8 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -11,7 +11,7 @@ import { List } from '../../fields/List';
import { RichTextField } from '../../fields/RichTextField';
import { SchemaHeaderField } from '../../fields/SchemaHeaderField';
import { ComputedField, ScriptField } from '../../fields/ScriptField';
-import { DocCast, ScriptCast, StrCast } from '../../fields/Types';
+import { ScriptCast, StrCast } from '../../fields/Types';
import { AudioField, CsvField, ImageField, PdfField, VideoField, WebField } from '../../fields/URLField';
import { SharingPermissions } from '../../fields/util';
import { PointData } from '../../pen-gestures/GestureTypes';
@@ -182,8 +182,6 @@ export class DocumentOptions {
identifier?: STRt = new StrInfo('documentIcon displayed for each doc as "d[x]"', false);
_rotation?: NUMt = new NumInfo('Amount of rotation on a document in degrees', false);
- date_range?: STRt = new StrInfo('date range for calendar', false);
-
chat?: STRt = new StrInfo('fields related to chatBox', false);
chat_history?: STRt = new StrInfo('chat history for chatbox', false);
chat_thread_id?: STRt = new StrInfo('thread id for chatbox', false);
@@ -525,10 +523,14 @@ export class DocumentOptions {
ai_generatedDocs?: List<Doc>; // list of documents generated by GAI engine
// TASK MANAGER
- $startTime?: DateInfo | DateField = new DateInfo('start date and time', /*filterable*/ false);
- $endTime?: DateInfo | DateField = new DateInfo('end date and time', /*filterable*/ false);
- $allDay?: BoolInfo | boolean = new BoolInfo('whether task is all-day or not', /*filterable*/ false);
- $completed?: BoolInfo | boolean = new BoolInfo('whether the task is completed', /*filterable*/ false);
+ $task_dateRange?: STRt = new StrInfo('date range for calendar', false);
+ $task_startTime?: DateInfo | DateField = new DateInfo('start date and time', /*filterable*/ false);
+ $task_endTime?: DateInfo | DateField = new DateInfo('end date and time', /*filterable*/ false);
+ $task_allDay?: BoolInfo | boolean = new BoolInfo('whether task is all-day or not', /*filterable*/ false);
+ $task_completed?: BoolInfo | boolean = new BoolInfo('whether the task is completed', /*filterable*/ false);
+
+ _calendar_date?: DateInfo | DateField = new DateInfo('current selected date of a calendar', /*filterable*/ false);
+ _calendar_dateRange?: STRt = new StrInfo('date range shown on a calendar', false);
/**
* JSON‐stringified slot configuration for ScrapbookBox
@@ -978,6 +980,7 @@ export namespace Docs {
);
}
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
export function TaskDocument(text = '', options: DocumentOptions = {}, fieldKey = 'text') {
return InstanceFromProto(
Prototypes.get(DocumentType.TASK),
@@ -1070,6 +1073,7 @@ export namespace Docs {
_layout_nativeDimEditable: true,
_layout_reflowHorizontal: true,
_layout_reflowVertical: true,
+ calendar: '',
...options,
_type_collection: CollectionViewType.Calendar,
});
diff --git a/src/client/util/CalendarManager.tsx b/src/client/util/CalendarManager.tsx
index b50e39c02..a8460ed4b 100644
--- a/src/client/util/CalendarManager.tsx
+++ b/src/client/util/CalendarManager.tsx
@@ -156,7 +156,7 @@ export class CalendarManager extends ObservableReactComponent<object> {
const subDocEmbedding = Doc.MakeEmbedding(targetDoc); // embedding
console.log('subdoc embedding', subDocEmbedding);
subDocEmbedding.embedContainer = calendar; // set embed container
- subDocEmbedding.date_range = `${startDateStr}|${endDateStr}`; // set subDoc date range
+ subDocEmbedding.task_dateRange = `${startDateStr}|${endDateStr}`; // set subDoc date range
Doc.AddDocToList(calendar, 'data', subDocEmbedding); // add embedded subDoc to calendar
diff --git a/src/client/views/nodes/TaskBox.tsx b/src/client/views/nodes/TaskBox.tsx
index ff1c70b90..9d59746f8 100644
--- a/src/client/views/nodes/TaskBox.tsx
+++ b/src/client/views/nodes/TaskBox.tsx
@@ -1,4 +1,4 @@
-import { action, observable, makeObservable, IReactionDisposer, reaction } from 'mobx';
+import { action, makeObservable, IReactionDisposer, reaction } from 'mobx';
import { observer } from 'mobx-react';
import * as React from 'react';
import { Docs } from '../../documents/Documents';
@@ -22,11 +22,10 @@ interface TaskBoxProps {
*/
@observer
export class TaskBox extends React.Component<TaskBoxProps> {
-
/**
- * Method to reuturn the
- * @param fieldStr
- * @returns
+ * Method to reuturn the
+ * @param fieldStr
+ * @returns
*/
public static LayoutString(fieldStr: string) {
return FieldView.LayoutString(TaskBox, fieldStr);
@@ -57,11 +56,11 @@ export class TaskBox extends React.Component<TaskBoxProps> {
*/
@action
updateAllDay = (e: React.ChangeEvent<HTMLInputElement>) => {
- this.props.Document.$allDay = e.target.checked;
+ this.props.Document.$task_allDay = e.target.checked;
if (e.target.checked) {
- delete this.props.Document.$startTime;
- delete this.props.Document.$endTime;
+ delete this.props.Document.$task_startTime;
+ delete this.props.Document.$task_endTime;
}
this.setTaskDateRange();
@@ -75,16 +74,16 @@ export class TaskBox extends React.Component<TaskBoxProps> {
updateStart = (e: React.ChangeEvent<HTMLInputElement>) => {
const newStart = new Date(e.target.value);
- this.props.Document.$startTime = new DateField(newStart);
+ this.props.Document.$task_startTime = new DateField(newStart);
- const endDate = this.props.Document.$endTime instanceof DateField ? this.props.Document.$endTime.date : undefined;
+ const endDate = this.props.Document.$task_endTime instanceof DateField ? this.props.Document.$task_endTime.date : undefined;
if (endDate && newStart > endDate) {
// Alert user
alert('Start time cannot be after end time. End time has been adjusted.');
-
+
// Fix end time
const adjustedEnd = new Date(newStart.getTime() + 60 * 60 * 1000);
- this.props.Document.$endTime = new DateField(adjustedEnd);
+ this.props.Document.$task_endTime = new DateField(adjustedEnd);
}
this.setTaskDateRange();
@@ -98,16 +97,16 @@ export class TaskBox extends React.Component<TaskBoxProps> {
updateEnd = (e: React.ChangeEvent<HTMLInputElement>) => {
const newEnd = new Date(e.target.value);
- this.props.Document.$endTime = new DateField(newEnd);
+ this.props.Document.$task_endTime = new DateField(newEnd);
- const startDate = this.props.Document.$startTime instanceof DateField ? this.props.Document.$startTime.date : undefined;
+ const startDate = this.props.Document.$task_startTime instanceof DateField ? this.props.Document.$task_startTime.date : undefined;
if (startDate && newEnd < startDate) {
// Alert user
alert('End time cannot be before start time. Start time has been adjusted.');
-
+
// Fix start time
const adjustedStart = new Date(newEnd.getTime() - 60 * 60 * 1000);
- this.props.Document.$startTime = new DateField(adjustedStart);
+ this.props.Document.$task_startTime = new DateField(adjustedStart);
}
this.setTaskDateRange();
@@ -120,21 +119,21 @@ export class TaskBox extends React.Component<TaskBoxProps> {
setTaskDateRange() {
const doc = this.props.Document;
- if (doc.$allDay) {
- const range = typeof doc.date_range === 'string' ? doc.date_range.split('|') : [];
+ if (doc.$task_allDay) {
+ const range = typeof doc.$task_dateRange === 'string' ? doc.$task_dateRange.split('|') : [];
const dateStr = range[0] ?? new Date().toISOString().split('T')[0]; // default to today
- doc.date_range = `${dateStr}|${dateStr}`;
- doc.$allDay = true;
+ doc.$task_dateRange = `${dateStr}|${dateStr}`;
+ doc.$task_allDay = true;
} else {
- const startField = doc.$startTime;
- const endField = doc.$endTime;
+ const startField = doc.$task_startTime;
+ const endField = doc.$task_endTime;
const startDate = startField instanceof DateField ? startField.date : null;
const endDate = endField instanceof DateField ? endField.date : null;
if (startDate && endDate && !isNaN(startDate.getTime()) && !isNaN(endDate.getTime())) {
- doc.date_range = `${startDate.toISOString()}|${endDate.toISOString()}`;
- doc.$allDay = false;
+ doc.$task_dateRange = `${startDate.toISOString()}|${endDate.toISOString()}`;
+ doc.$task_allDay = false;
}
}
}
@@ -146,12 +145,12 @@ export class TaskBox extends React.Component<TaskBoxProps> {
@action
toggleComplete = (e: React.ChangeEvent<HTMLInputElement>) => {
- this.props.Document.$completed = e.target.checked;
+ this.props.Document.$task_completed = e.target.checked;
};
/**
* Constructor for the task box
- * @param props - props containing the document reference
+ * @param props - props containing the document reference
*/
constructor(props: TaskBoxProps) {
@@ -193,134 +192,81 @@ export class TaskBox extends React.Component<TaskBoxProps> {
}
/**
- * Method to render the task box
+ * Method to render the task box
* @returns - HTML with taskbox components
*/
render() {
-
function toLocalDateTimeString(date: Date): string {
const pad = (n: number) => n.toString().padStart(2, '0');
- return (
- date.getFullYear() +
- '-' +
- pad(date.getMonth() + 1) +
- '-' +
- pad(date.getDate()) +
- 'T' +
- pad(date.getHours()) +
- ':' +
- pad(date.getMinutes())
- );
+ return date.getFullYear() + '-' + pad(date.getMonth() + 1) + '-' + pad(date.getDate()) + 'T' + pad(date.getHours()) + ':' + pad(date.getMinutes());
}
-
+
const doc = this.props.Document;
const taskDesc = typeof doc.text === 'string' ? doc.text : '';
const taskTitle = typeof doc.title === 'string' ? doc.title : '';
- const allDay = !!doc.$allDay;
- const isCompleted = !!this.props.Document.$completed;
-
- const startTime = doc.$startTime instanceof DateField && doc.$startTime.date instanceof Date
- ? toLocalDateTimeString(doc.$startTime.date)
- : '';
-
- const endTime = doc.$endTime instanceof DateField && doc.$endTime.date instanceof Date
- ? toLocalDateTimeString(doc.$endTime.date)
- : '';
+ const allDay = !!doc.$task_allDay;
+ const isCompleted = !!this.props.Document.$task_completed;
+ const startTime = doc.$task_startTime instanceof DateField && doc.$task_startTime.date instanceof Date ? toLocalDateTimeString(doc.$task_startTime.date) : '';
+ const endTime = doc.$task_endTime instanceof DateField && doc.$task_endTime.date instanceof Date ? toLocalDateTimeString(doc.$task_endTime.date) : '';
return (
<div className="task-manager-container">
- <input
- className="task-manager-title"
- type="text"
- placeholder="Task Title"
- value={taskTitle}
- onChange={this.updateTitle}
- disabled={isCompleted}
- style={{opacity: isCompleted ? 0.7 : 1,}}
- />
-
- <textarea
- className="task-manager-description"
- placeholder="What’s your task?"
- value={taskDesc}
- onChange={this.updateText}
- disabled={isCompleted}
- style={{opacity: isCompleted ? 0.7 : 1,}}
- />
+ <input className="task-manager-title" type="text" placeholder="Task Title" value={taskTitle} onChange={this.updateTitle} disabled={isCompleted} style={{ opacity: isCompleted ? 0.7 : 1 }} />
- <div className="task-manager-checkboxes">
+ <textarea className="task-manager-description" placeholder="What’s your task?" value={taskDesc} onChange={this.updateText} disabled={isCompleted} style={{ opacity: isCompleted ? 0.7 : 1 }} />
- <label className="task-manager-allday" style={{opacity: isCompleted ? 0.7 : 1,}}>
- <input
- type="checkbox"
- checked={allDay}
- onChange={this.updateAllDay}
- disabled={isCompleted}
- />
+ <div className="task-manager-checkboxes">
+ <label className="task-manager-allday" style={{ opacity: isCompleted ? 0.7 : 1 }}>
+ <input type="checkbox" checked={allDay} onChange={this.updateAllDay} disabled={isCompleted} />
All day
-
{allDay && (
- <input
- type="date"
- value={(() => {
- const rawRange = doc.date_range;
- if (typeof rawRange !== 'string') return '';
- const datePart = rawRange.split('|')[0];
- if (!datePart) return '';
- const d = new Date(datePart);
- return !isNaN(d.getTime()) ? d.toISOString().split('T')[0] : '';
- })()}
- onChange={e => {
- const newDate = new Date(e.target.value);
- if (!isNaN(newDate.getTime())) {
- const dateStr = e.target.value;
- if (dateStr) {
- doc.date_range = `${dateStr}T00:00:00|${dateStr}T00:00:00`;
+ <input
+ type="date"
+ value={(() => {
+ const rawRange = doc.$task_dateRange;
+ if (typeof rawRange !== 'string') return '';
+ const datePart = rawRange.split('|')[0];
+ if (!datePart) return '';
+ const d = new Date(datePart);
+ return !isNaN(d.getTime()) ? d.toISOString().split('T')[0] : '';
+ })()}
+ onChange={e => {
+ const newDate = new Date(e.target.value);
+ if (!isNaN(newDate.getTime())) {
+ const dateStr = e.target.value;
+ if (dateStr) {
+ doc.$task_dateRange = `${dateStr}T00:00:00|${dateStr}T00:00:00`;
+ }
}
- }
- }}
- disabled={isCompleted}
- style={{ marginLeft: '8px' }}
- />
- )}
+ }}
+ disabled={isCompleted}
+ style={{ marginLeft: '8px' }}
+ />
+ )}
</label>
<label className="task-manager-complete">
<input type="checkbox" checked={isCompleted} onChange={this.toggleComplete} />
Complete
</label>
-
</div>
{!allDay && (
- <div
- className="task-manager-times"
- style={{ opacity: isCompleted ? 0.7 : 1 }}
- >
- <label>
- Start:
- <input
- type="datetime-local"
- value={startTime}
- onChange={this.updateStart}
- disabled={isCompleted}
- />
- </label>
- <label>
- End:
- <input
- type="datetime-local"
- value={endTime}
- onChange={this.updateEnd}
- disabled={isCompleted}
- />
- </label>
- </div>
- )}
+ <div className="task-manager-times" style={{ opacity: isCompleted ? 0.7 : 1 }}>
+ <label>
+ Start:
+ <input type="datetime-local" value={startTime} onChange={this.updateStart} disabled={isCompleted} />
+ </label>
+ <label>
+ End:
+ <input type="datetime-local" value={endTime} onChange={this.updateEnd} disabled={isCompleted} />
+ </label>
+ </div>
+ )}
</div>
);
}
@@ -337,9 +283,10 @@ Docs.Prototypes.TemplateMap.set(DocumentType.TASK, {
_layout_nativeDimEditable: true,
_layout_reflowVertical: true,
_layout_reflowHorizontal: true,
+ task: '',
defaultDoubleClick: 'ignore',
systemIcon: 'BsCheckSquare',
height_min: 300,
- width_min: 300
+ width_min: 300,
},
});
diff --git a/src/client/views/nodes/calendarBox/CalendarBox.tsx b/src/client/views/nodes/calendarBox/CalendarBox.tsx
index f21eec604..835d58337 100644
--- a/src/client/views/nodes/calendarBox/CalendarBox.tsx
+++ b/src/client/views/nodes/calendarBox/CalendarBox.tsx
@@ -46,6 +46,7 @@ export class CalendarBox extends CollectionSubView() {
}
componentDidMount(): void {
+ this.Document.$calendar = ''; // needed only to make the keyvalue view look nice.
this._props.setContentViewBox?.(this);
this._eventsDisposer = reaction(
() => ({ events: this.calendarEvents }),
@@ -73,8 +74,8 @@ export class CalendarBox extends CollectionSubView() {
@computed get calendarEvents(): EventSourceInput | undefined {
return this.childDocs.map(doc => {
- const { start, end } = dateRangeStrToDates(StrCast(doc.date_range));
- const isCompleted = BoolCast(doc.$completed); // AARAV ADD
+ const { start, end } = dateRangeStrToDates(StrCast(doc.$task_dateRange));
+ const isCompleted = BoolCast(doc.$task_completed); // AARAV ADD
return {
title: StrCast(doc.title),
start,
@@ -82,7 +83,7 @@ export class CalendarBox extends CollectionSubView() {
groupId: doc[Id],
startEditable: true,
endEditable: true,
- allDay: BoolCast(doc.$allDay),
+ allDay: BoolCast(doc.$task_allDay),
classNames: ['mother', isCompleted ? 'completed-task' : ''], // will determine the style
editable: true, // subject to change in the future
backgroundColor: this.eventToColor(doc),
@@ -96,10 +97,10 @@ export class CalendarBox extends CollectionSubView() {
}
@computed get dateRangeStrDates() {
- return dateRangeStrToDates(StrCast(this.Document.date_range));
+ return dateRangeStrToDates(StrCast(this.Document._calendar_dateRange));
}
get dateSelect() {
- return dateRangeStrToDates(StrCast(this.Document.date));
+ return dateRangeStrToDates(StrCast(this.Document._calendar_date));
}
// Choose a calendar view based on the date range
@@ -124,7 +125,7 @@ export class CalendarBox extends CollectionSubView() {
if (!super.onInternalDrop(e, de)) return false;
de.complete.docDragData?.droppedDocuments.forEach(doc => {
const today = new Date().toISOString();
- if (!doc.date_range) doc.$date_range = `${today}|${today}`;
+ if (!doc.$task_dateRange) doc.$task_dateRange = `${today}|${today}`;
});
return true;
};
@@ -136,7 +137,7 @@ export class CalendarBox extends CollectionSubView() {
handleEventDrop = undoable((arg: EventDropArg | EventResizeDoneArg) => {
const doc = DocServer.GetCachedRefField(arg.event._def.groupId ?? '');
- // doc && arg.event.start && (doc.date_range = arg.event.start?.toString() + '|' + (arg.event.end ?? arg.event.start).toString());
+ // doc && arg.event.start && (doc.$task_dateRange = arg.event.start?.toString() + '|' + (arg.event.end ?? arg.event.start).toString());
if (!doc || !arg.event.start) return;
// get the new start and end dates
@@ -144,19 +145,19 @@ export class CalendarBox extends CollectionSubView() {
const endDate = new Date(arg.event.end ?? arg.event.start);
// update date range, time range, and all day status
- doc.date_range = `${startDate.toISOString()}|${endDate.toISOString()}`;
+ doc.$task_dateRange = `${startDate.toISOString()}|${endDate.toISOString()}`;
const allDayStatus = arg.event.allDay ?? false;
- if (doc.$allDay !== allDayStatus) {
- doc.$allDay = allDayStatus;
+ if (doc.$task_allDay !== allDayStatus) {
+ doc.$task_allDay = allDayStatus;
}
- if (doc.$allDay) {
- delete doc.$startTime;
- delete doc.$endTime;
+ if (doc.$task_allDay) {
+ delete doc.$task_startTime;
+ delete doc.$task_endTime;
} else {
- doc.$startTime = new DateField(startDate);
- doc.$endTime = new DateField(endDate);
+ doc.$task_startTime = new DateField(startDate);
+ doc.task_endTime = new DateField(endDate);
}
}, 'change event date');
@@ -220,7 +221,7 @@ export class CalendarBox extends CollectionSubView() {
displayEventEnd={false}
plugins={[multiMonthPlugin, dayGridPlugin, timeGrid, interactionPlugin]}
aspectRatio={this._props.PanelWidth() / this._props.PanelHeight()}
- weekends={false}
+ weekends={true}
events={this.calendarEvents}
eventClick={this.handleEventClick}
eventDrop={this.handleEventDrop}
@@ -229,7 +230,7 @@ export class CalendarBox extends CollectionSubView() {
select={(info: DateSelectArg) => {
const start = dateRangeStrToDates(info.startStr).start.toISOString();
const end = info.allDay ? start : dateRangeStrToDates(info.endStr).start.toISOString();
- this.dataDoc.date = start + '|' + end;
+ this.Document._calendar_date = start + '|' + end;
}}
// eventContent={() => {
// return null;
@@ -238,9 +239,9 @@ export class CalendarBox extends CollectionSubView() {
const doc = DocServer.GetCachedRefField(arg.event._def.groupId ?? '');
if (!doc) return;
- if (doc.type === 'task') {
+ if (doc.type === DocumentType.TASK) {
const checkButton = document.createElement('button');
- checkButton.innerText = doc.$completed ? '✅' : '⬜';
+ checkButton.innerText = doc.$task_completed ? '✅' : '⬜';
checkButton.style.position = 'absolute';
checkButton.style.right = '5px';
checkButton.style.top = '50%';
@@ -255,7 +256,7 @@ export class CalendarBox extends CollectionSubView() {
checkButton.onclick = ev => {
ev.stopPropagation();
- doc.$completed = !doc.$completed;
+ doc.$task_completed = !doc.$task_completed;
this._calendar?.refetchEvents();
};
diff --git a/src/client/views/nodes/formattedText/DailyJournal.tsx b/src/client/views/nodes/formattedText/DailyJournal.tsx
index ae5582ef7..564609494 100644
--- a/src/client/views/nodes/formattedText/DailyJournal.tsx
+++ b/src/client/views/nodes/formattedText/DailyJournal.tsx
@@ -12,7 +12,6 @@ import { RTFCast } from '../../../../fields/Types';
import { Mark } from 'prosemirror-model';
import { observer } from 'mobx-react';
-
export class DailyJournal extends ViewBoxAnnotatableComponent<FieldViewProps>() {
@observable journalDate: string;
@observable typingTimeout: NodeJS.Timeout | null = null; // track typing delay
@@ -22,8 +21,6 @@ export class DailyJournal extends ViewBoxAnnotatableComponent<FieldViewProps>()
@observable inlinePromptsEnabled = true;
@observable askPromptsEnabled = true;
-
-
_ref = React.createRef<FormattedTextBox>(); // reference to the formatted textbox
predictiveTextRange: { from: number; to: number } | null = null; // where predictive text starts and ends
private predictiveText: string | null = ' ... why?';
@@ -114,7 +111,7 @@ export class DailyJournal extends ViewBoxAnnotatableComponent<FieldViewProps>()
@action.bound toggleAskPrompts() {
this.askPromptsEnabled = !this.askPromptsEnabled;
}
-
+
/**
* Method to handle click on document (to close prompt menu)
* @param e - a click on the document
@@ -123,33 +120,27 @@ export class DailyJournal extends ViewBoxAnnotatableComponent<FieldViewProps>()
handleDocumentClick(e: MouseEvent) {
const menu = document.getElementById('prompts-menu');
const button = document.getElementById('prompts-button');
- if (
- this.showPromptMenu &&
- menu &&
- !menu.contains(e.target as Node) &&
- button &&
- !button.contains(e.target as Node)
- ) {
+ if (this.showPromptMenu && menu && !menu.contains(e.target as Node) && button && !button.contains(e.target as Node)) {
this.showPromptMenu = false;
}
}
-
/**
* Method to set initial date of document in the calendar view
*/
@action setInitialDateRange() {
- if (!this.dataDoc.date_range && this.journalDate) {
+ if (!this.dataDoc.$task_dateRange && this.journalDate) {
const parsedDate = new Date(this.journalDate);
if (!isNaN(parsedDate.getTime())) {
const localStart = new Date(parsedDate.getFullYear(), parsedDate.getMonth(), parsedDate.getDate());
const localEnd = new Date(localStart); // same day
- this.dataDoc.date_range = `${localStart.toISOString()}|${localEnd.toISOString()}`;
- this.dataDoc.allDay = true;
+ this.dataDoc.$task_dateRange = `${localStart.toISOString()}|${localEnd.toISOString()}`;
+ this.dataDoc.$task_allDay = true;
+ this.dataDoc.$task = ''; // needed only to make the keyvalue view look good.
- // console.log('Set date_range and allDay on journal (from local date):', this.dataDoc.date_range);
+ // console.log('Set task_dateRange and task_allDay on journal (from local date):', this.dataDoc.$task_dateRange);
} else {
// console.log('Could not parse journalDate:', this.journalDate);
}
@@ -187,7 +178,6 @@ export class DailyJournal extends ViewBoxAnnotatableComponent<FieldViewProps>()
if (this.inlinePromptsEnabled) {
this.insertPredictiveQuestion();
}
-
}, 3500);
};
@@ -196,7 +186,6 @@ export class DailyJournal extends ViewBoxAnnotatableComponent<FieldViewProps>()
*/
@action insertPredictiveQuestion = async () => {
-
const editorView = this._ref.current?.EditorView;
if (!editorView) return;
@@ -347,7 +336,7 @@ export class DailyJournal extends ViewBoxAnnotatableComponent<FieldViewProps>()
*/
@action handleGeneratePrompts = async () => {
if (this.isLoadingPrompts) {
- return
+ return;
}
this.isLoadingPrompts = true;
@@ -391,8 +380,6 @@ export class DailyJournal extends ViewBoxAnnotatableComponent<FieldViewProps>()
// Insert formatted text
const transaction = state.tr.insert(state.selection.from, headerText).insert(state.selection.from + headerText.nodeSize, responseText);
dispatch(transaction);
- (this._props as any)?.updateLayout?.();
-
}
} catch (err) {
console.error('Error calling GPT:', err);
@@ -402,7 +389,7 @@ export class DailyJournal extends ViewBoxAnnotatableComponent<FieldViewProps>()
};
/**
- * Method to render the styled DailyJournal
+ * Method to render the styled DailyJournal
* @returns - the HTML component for the journal
*/
render() {
@@ -438,8 +425,7 @@ export class DailyJournal extends ViewBoxAnnotatableComponent<FieldViewProps>()
cursor: 'pointer',
zIndex: 10,
}}
- onClick={this.togglePromptMenu}
- >
+ onClick={this.togglePromptMenu}>
Prompts
</button>
{this.showPromptMenu && (
@@ -458,16 +444,14 @@ export class DailyJournal extends ViewBoxAnnotatableComponent<FieldViewProps>()
minWidth: '170px',
maxWidth: 'fit-content',
overflow: 'auto',
- }}
- >
+ }}>
<div
style={{
display: 'flex',
justifyContent: 'flex-end',
alignItems: 'center',
marginBottom: '10px',
- }}
- >
+ }}>
<label
style={{
display: 'flex',
@@ -476,26 +460,19 @@ export class DailyJournal extends ViewBoxAnnotatableComponent<FieldViewProps>()
fontSize: '14px',
justifyContent: 'flex-end',
width: '100%',
- }}
- >
+ }}>
/ask
- <input
- type="checkbox"
- checked={this.askPromptsEnabled}
- onChange={this.toggleAskPrompts}
- style={{ margin: 0 }}
- />
+ <input type="checkbox" checked={this.askPromptsEnabled} onChange={this.toggleAskPrompts} style={{ margin: 0 }} />
</label>
</div>
-
+
<div
style={{
display: 'flex',
justifyContent: 'flex-end',
alignItems: 'center',
marginBottom: '10px',
- }}
- >
+ }}>
<label
style={{
display: 'flex',
@@ -504,15 +481,9 @@ export class DailyJournal extends ViewBoxAnnotatableComponent<FieldViewProps>()
fontSize: '14px',
justifyContent: 'flex-end',
width: '100%',
- }}
- >
+ }}>
Inline Prompting
- <input
- type="checkbox"
- checked={this.inlinePromptsEnabled}
- onChange={this.toggleInlinePrompts}
- style={{ margin: 0 }}
- />
+ <input type="checkbox" checked={this.inlinePromptsEnabled} onChange={this.toggleInlinePrompts} style={{ margin: 0 }} />
</label>
</div>
@@ -531,15 +502,12 @@ export class DailyJournal extends ViewBoxAnnotatableComponent<FieldViewProps>()
opacity: this.isLoadingPrompts ? 0.6 : 1,
padding: '5px 10px',
float: 'right',
- }}
- >
+ }}>
Generate Prompts
</button>
</div>
)}
-
-
<FormattedTextBox ref={this._ref} {...this._props} fieldKey={'text'} Document={this.Document} TemplateDataDocument={undefined} />
</div>
);