+
Note References
- note link, note link, note link...
+
+
+
diff --git a/app/db/src/app/search/components/passage/passage-card.component.scss b/app/db/src/app/search/components/passage/passage-card.component.scss
index fefe09fe..c8c7a4ef 100644
--- a/app/db/src/app/search/components/passage/passage-card.component.scss
+++ b/app/db/src/app/search/components/passage/passage-card.component.scss
@@ -18,3 +18,8 @@
font-family: var(--card-heading-font-family);
font-weight: 600;
}
+
+.reference {
+ width: 100%;
+ margin: 3px;
+}
diff --git a/app/db/src/app/search/components/passage/passage-card.component.ts b/app/db/src/app/search/components/passage/passage-card.component.ts
index b2cde46a..72d15e9b 100644
--- a/app/db/src/app/search/components/passage/passage-card.component.ts
+++ b/app/db/src/app/search/components/passage/passage-card.component.ts
@@ -1,10 +1,11 @@
import { Component, OnInit, ElementRef, ViewChild } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
-import { BibleReference } from '../../../common/bible-reference';
+import { BibleReference, Overlap } from '../../../common/bible-reference';
import { AppService } from '../../../services/app.service';
import { CardComponent } from '../../../common/components/card.component';
import { Paragraph } from '../../../models/passage-state';
import { StrongsModalComponent } from '../strongs/modal/strongs-modal.component';
+import { NoteItem } from 'src/app/models/note-state';
@Component({
selector: 'app-passage-card',
@@ -24,6 +25,13 @@ export class PassageCardComponent extends CardComponent implements OnInit {
displaySettings$ = this.appService.select((state) => state.displaySettings.value);
+ // whenever the notes changes, look for any notes that reference this passage.
+ notes$ = this.appService.select((state) =>
+ state.notes.value.filter((o) => {
+ const refs = o.xref.split(';').map((r) => new BibleReference(r));
+ return refs.filter((r) => BibleReference.overlap(this.ref, r) !== Overlap.None).length > 0;
+ })
+ );
hasNotes = false;
@ViewChild('passage') passageElement: ElementRef;
@@ -115,6 +123,10 @@ export class PassageCardComponent extends CardComponent implements OnInit {
this.appService.updatePassage(this.cardItem, this.ref);
}
+ openNote(note: NoteItem) {
+ this.appService.getNote(note.id, this.cardItem);
+ }
+
async openStrongs(q: string, asModal = false) {
const dict = this.cardItem.dict === 'H' ? 'heb' : 'grk';
const numbers = q.split(' ');
diff --git a/app/db/src/app/search/components/search-page/search.page.ts b/app/db/src/app/search/components/search-page/search.page.ts
index 7a3da221..277ebe38 100644
--- a/app/db/src/app/search/components/search-page/search.page.ts
+++ b/app/db/src/app/search/components/search-page/search.page.ts
@@ -119,7 +119,7 @@ export class SearchPage extends SubscriberComponent implements OnInit {
const q = term.trim();
if (q !== '') {
if (q.startsWith('note:')) {
- await this.appService.getNote(q.replace('note:', ''));
+ await this.appService.findNotes(q.replace('note:', ''));
} else if (q.search(/[0-9]/i) === -1) {
// // its a search term.
await this.appService.getWords(q);
diff --git a/app/db/src/app/services/app.service.ts b/app/db/src/app/services/app.service.ts
index 4584331d..2a6cf7e7 100644
--- a/app/db/src/app/services/app.service.ts
+++ b/app/db/src/app/services/app.service.ts
@@ -147,6 +147,11 @@ type AppAction =
qry: string;
nextToItem: CardItem;
}
+ | {
+ type: 'GET_NOTE';
+ noteId: string;
+ nextToItem: CardItem;
+ }
| {
type: 'UPDATE_NOTES';
notes: IStorable;
@@ -416,6 +421,21 @@ function reducer(state: AppState, action: AppAction): AppState {
cards,
};
}
+ case 'GET_NOTE': {
+ const note = state.notes.value.find((o) => o.id === action.noteId);
+ const card = {
+ qry: note.id,
+ dict: 'n/a',
+ type: 'Note',
+ data: note,
+ };
+
+ return reducer(state, {
+ type: 'ADD_CARD',
+ card,
+ nextToItem: action.nextToItem,
+ });
+ }
case 'UPDATE_NOTES': {
return {
...state,
@@ -445,7 +465,7 @@ function reducer(state: AppState, action: AppAction): AppState {
];
const notes = new Storable([
- ...state.notes.value.filter((o) => o.id === action.note.id),
+ ...state.notes.value.filter((o) => o.id !== action.note.id),
action.note,
]);
@@ -466,12 +486,13 @@ function reducer(state: AppState, action: AppAction): AppState {
};
}),
]);
- return {
+ const newState = {
...state,
cards,
notes,
savedPages,
};
+ return newState;
}
case 'DELETE_NOTE': {
// the note may be in any of the following:
@@ -636,19 +657,10 @@ export class AppService extends createStateService(reducer, initialState) {
});
}
- async getNote(id: string, nextToItem: CardItem = null) {
- const note = (await this.localStorageService.get('notes/' + id).toPromise()) as NoteItem;
-
- const card = {
- qry: id,
- dict: 'n/a',
- type: 'Note',
- data: note,
- };
-
+ async getNote(noteId: string, nextToItem: CardItem = null) {
this.dispatch({
- type: 'ADD_CARD',
- card,
+ type: 'GET_NOTE',
+ noteId,
nextToItem,
});
}
diff --git a/app/db/src/styles/app.scss b/app/db/src/styles/app.scss
index 4830e786..c0371ea6 100644
--- a/app/db/src/styles/app.scss
+++ b/app/db/src/styles/app.scss
@@ -137,3 +137,8 @@ a {
font-size: var(--card-font-size) !important;
line-height: calc(var(--card-font-size) * 1.1) !important;
}
+
+.mat-expansion-panel:not([class*="mat-elevation-z"]) {
+ box-shadow: none !important;
+ border: 1px solid #eee;
+}