diff --git a/app/db/README.md b/app/db/README.md index 25926b4a..5526ddd7 100644 --- a/app/db/README.md +++ b/app/db/README.md @@ -33,7 +33,6 @@ To get more help on the Angular CLI use `ng help` or go check out the [Angular C - Options to merge references \*\* - Merge if overlap - Merge if contains -- Font Size - Page Admin \*\* - Delete Page - Show page and list of card titles @@ -47,7 +46,6 @@ To get more help on the Angular CLI use `ng help` or go check out the [Angular C - Note: Auto link passages using markdown link syntax - Passage - Show Note Cross References \*\* -- Login - Help Page - Settings for theme - Custom Colors for Light/Dark modes diff --git a/app/db/src/app/app.component.ts b/app/db/src/app/app.component.ts index 662023ba..f90fa13e 100644 --- a/app/db/src/app/app.component.ts +++ b/app/db/src/app/app.component.ts @@ -40,13 +40,12 @@ export class AppComponent extends SubscriberComponent implements AfterViewInit { this.storageService.initSavedPages(); this.storageService.initDisplaySettings(); + this.storageService.initNotes(); this.addSubscription( this.error$.subscribe((err) => { if (err) { - this.snackBar.open(`Oh no! ${err.msg}`, 'Error', { - duration: 4 * 1000, - }); + this.snackBar.open(`Oh no! ${err.msg}`, 'Dismiss Error'); } }) ); diff --git a/app/db/src/app/models/app-state.ts b/app/db/src/app/models/app-state.ts index 3a562a3d..e2026e89 100644 --- a/app/db/src/app/models/app-state.ts +++ b/app/db/src/app/models/app-state.ts @@ -3,6 +3,7 @@ import { IStorable } from './storable'; export interface AppState { readonly currentSavedPage: SavedPage; readonly savedPages: IStorable; + readonly notes: IStorable; readonly savedPagesLoaded: boolean; readonly mainPages: readonly Page[]; readonly cards: readonly CardItem[]; diff --git a/app/db/src/app/search/components/note/edit-modal/note-edit-modal.component.html b/app/db/src/app/search/components/note/edit-modal/note-edit-modal.component.html index 5c93ea76..aa24b8b2 100644 --- a/app/db/src/app/search/components/note/edit-modal/note-edit-modal.component.html +++ b/app/db/src/app/search/components/note/edit-modal/note-edit-modal.component.html @@ -10,6 +10,10 @@ Title + + References + + Content diff --git a/app/db/src/app/search/components/note/edit-modal/note-edit-modal.component.ts b/app/db/src/app/search/components/note/edit-modal/note-edit-modal.component.ts index ef252333..2f84e216 100644 --- a/app/db/src/app/search/components/note/edit-modal/note-edit-modal.component.ts +++ b/app/db/src/app/search/components/note/edit-modal/note-edit-modal.component.ts @@ -40,30 +40,12 @@ export class NoteEditModalComponent { } save() { - if (this.isNew) { - this.appService.createNote({ - qry: '', - dict: 'n/a', - type: 'Note', - data: { - ...this.data, - title: this.noteForm.get('title').value, - content: this.noteForm.get('content').value, - }, - }); - } else { - this.appService.editNote( - { - ...this.cardItem, - data: { - ...this.cardItem.data, - title: this.noteForm.get('title').value, - content: this.noteForm.get('content').value, - }, - }, - this.cardItem - ); - } + this.appService.saveNote({ + ...this.data, + title: this.noteForm.get('title').value, + xref: this.noteForm.get('xref').value, + content: this.noteForm.get('content').value, + }); this.dialogRef.close(); } diff --git a/app/db/src/app/search/components/note/note-card.component.html b/app/db/src/app/search/components/note/note-card.component.html index 29ce8af9..fe9b2ef5 100644 --- a/app/db/src/app/search/components/note/note-card.component.html +++ b/app/db/src/app/search/components/note/note-card.component.html @@ -16,6 +16,14 @@ {{ cardItem.data.content }} + + + + Cross References + + + {{ cardItem.data.xref }} +
diff --git a/app/db/src/app/search/components/note/note-card.component.ts b/app/db/src/app/search/components/note/note-card.component.ts index 18da52b0..44f6ca5c 100644 --- a/app/db/src/app/search/components/note/note-card.component.ts +++ b/app/db/src/app/search/components/note/note-card.component.ts @@ -3,6 +3,7 @@ import { MatDialog } from '@angular/material/dialog'; import { NoteEditModalComponent } from './edit-modal/note-edit-modal.component'; import { CardComponent } from '../../../common/components/card.component'; import { AppService } from '../../../services/app.service'; +import { NoteItem } from 'src/app/models/app-state'; @Component({ selector: 'app-note-card', @@ -12,11 +13,7 @@ import { AppService } from '../../../services/app.service'; export class NoteCardComponent extends CardComponent { @ViewChild('note') noteElement: ElementRef; - constructor( - protected elementRef: ElementRef, - private appService: AppService, - public dialog: MatDialog - ) { + constructor(protected elementRef: ElementRef, private appService: AppService, public dialog: MatDialog) { super(elementRef, dialog); this.icon$ = appService.select((state) => state.cardIcons.note); @@ -35,6 +32,6 @@ export class NoteCardComponent extends CardComponent { } delete() { - this.appService.deleteNote(this.cardItem); + this.appService.deleteNote(this.cardItem.data as NoteItem); } } diff --git a/app/db/src/app/search/components/search-page/search.page.html b/app/db/src/app/search/components/search-page/search.page.html index 2e8602f8..f3b9f9ee 100644 --- a/app/db/src/app/search/components/search-page/search.page.html +++ b/app/db/src/app/search/components/search-page/search.page.html @@ -1,5 +1,5 @@ -