aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/formattedText/DailyJournal.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/formattedText/DailyJournal.tsx')
-rw-r--r--src/client/views/nodes/formattedText/DailyJournal.tsx62
1 files changed, 1 insertions, 61 deletions
diff --git a/src/client/views/nodes/formattedText/DailyJournal.tsx b/src/client/views/nodes/formattedText/DailyJournal.tsx
index dfd19ae97..51e9d9ec1 100644
--- a/src/client/views/nodes/formattedText/DailyJournal.tsx
+++ b/src/client/views/nodes/formattedText/DailyJournal.tsx
@@ -1,6 +1,5 @@
-import { action, makeObservable, observable } from 'mobx';
+import { makeObservable } from 'mobx';
import * as React from 'react';
-import { RichTextField } from '../../../../fields/RichTextField';
import { Docs } from '../../../documents/Documents';
import { DocumentType } from '../../../documents/DocumentTypes';
import { ViewBoxAnnotatableComponent } from '../../DocComponent';
@@ -8,8 +7,6 @@ import { FieldView, FieldViewProps } from '../FieldView';
import { FormattedTextBox, FormattedTextBoxProps } from './FormattedTextBox';
export class DailyJournal extends ViewBoxAnnotatableComponent<FieldViewProps>() {
- @observable journalDate: string;
-
public static LayoutString(fieldStr: string) {
return FieldView.LayoutString(DailyJournal, fieldStr);
}
@@ -17,63 +14,6 @@ export class DailyJournal extends ViewBoxAnnotatableComponent<FieldViewProps>()
constructor(props: FormattedTextBoxProps) {
super(props);
makeObservable(this);
- this.journalDate = this.getFormattedDate();
-
- console.log('Constructor: Setting initial title and text...');
- this.setDailyTitle();
- this.setDailyText();
- }
-
- getFormattedDate(): string {
- const date = new Date().toLocaleDateString(undefined, {
- weekday: 'long',
- year: 'numeric',
- month: 'long',
- day: 'numeric',
- });
- console.log('getFormattedDate():', date);
- return date;
- }
-
- @action
- setDailyTitle() {
- console.log('setDailyTitle() called...');
- console.log('Current title before update:', this.dataDoc.title);
-
- if (!this.dataDoc.title || this.dataDoc.title !== this.journalDate) {
- console.log('Updating title to:', this.journalDate);
- this.dataDoc.title = this.journalDate;
- }
-
- console.log('New title after update:', this.dataDoc.title);
- }
-
- @action
- setDailyText() {
- const placeholderText = 'Start writing here...';
- const dateText = `${this.journalDate}\n`;
-
- console.log('Checking if dataDoc has text field...');
-
- this.dataDoc[this.fieldKey] = RichTextField.textToRtfFormat(
- [
- { text: 'Journal Entry:', styles: { bold: true, color: 'black', fontSize: 20 } },
- { text: dateText, styles: { italic: true, color: 'gray', fontSize: 15 } },
- { text: placeholderText, styles: { fontSize: 14, color: 'gray' } },
- ],
- undefined,
- placeholderText.length
- );
-
- console.log('Current text field:', this.dataDoc[this.fieldKey]);
- }
-
- componentDidMount(): void {
- console.log('componentDidMount() triggered...');
- // bcz: This should be moved into Docs.Create.DailyJournalDocument()
- // otherwise, it will override all the text whenever the note is reloaded
- this.setDailyTitle();
- this.setDailyText();
}
render() {