mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-23 23:39:50 -04:00
add icons and color to page edit
This commit is contained in:
parent
8092d1fac4
commit
4d2faf0011
@ -11,7 +11,8 @@
|
|||||||
(cdkDropListDropped)="moveSavedPageCard($event)"
|
(cdkDropListDropped)="moveSavedPageCard($event)"
|
||||||
>
|
>
|
||||||
<div class="card-item" cdkDrag *ngFor="let q of savedPage.queries">
|
<div class="card-item" cdkDrag *ngFor="let q of savedPage.queries">
|
||||||
<span matLine>{{ format(q) }}</span>
|
|
||||||
|
<span matLine><mat-icon class="page_item_icon" [ngClass]="class(q)">{{ icons(q) }}</mat-icon>{{ format(q) }}</span>
|
||||||
<button mat-icon-button (click)="onRemoveCard(q)">
|
<button mat-icon-button (click)="onRemoveCard(q)">
|
||||||
<mat-icon>delete</mat-icon>
|
<mat-icon>delete</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
|
@ -2,10 +2,30 @@
|
|||||||
background-color: var(--page-color-primary);
|
background-color: var(--page-color-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.page_item_icon {
|
||||||
|
vertical-align: text-bottom;
|
||||||
|
margin-right: 3px;
|
||||||
|
}
|
||||||
.card-actions {
|
.card-actions {
|
||||||
color: var(--page-color-primary);
|
color: var(--page-color-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.strongs {
|
||||||
|
color: var(--strongs-color-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.passage {
|
||||||
|
color: var(--passage-color-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.words {
|
||||||
|
color: var(--words-color-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.note {
|
||||||
|
color: var(--note-color-primary);
|
||||||
|
}
|
||||||
|
|
||||||
.card-content {
|
.card-content {
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
max-height: 25rem;
|
max-height: 25rem;
|
||||||
|
@ -4,14 +4,14 @@ import { MatDialog } from '@angular/material/dialog';
|
|||||||
import { AppService } from '../../services/app.service';
|
import { AppService } from '../../services/app.service';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { SavedPage } from 'src/app/models/page-state';
|
import { SavedPage } from 'src/app/models/page-state';
|
||||||
import { CardItem, CardType, DataReference } from 'src/app/models/card-state';
|
import { CardIcons, CardItem, CardType, DataReference } from 'src/app/models/card-state';
|
||||||
import { NoteItem } from 'src/app/models/note-state';
|
|
||||||
import { OkCancelModalComponent, OkCancelResult } from '../ok-cancel-modal/ok-cancel-modal.component';
|
import { OkCancelModalComponent, OkCancelResult } from '../ok-cancel-modal/ok-cancel-modal.component';
|
||||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||||
import { PageEditModalComponent } from '../page-edit-modal/page-edit-modal.component';
|
import { PageEditModalComponent } from '../page-edit-modal/page-edit-modal.component';
|
||||||
import { HashTable } from 'src/app/common/hashtable';
|
import { HashTable } from 'src/app/common/hashtable';
|
||||||
import { SubscriberBase } from 'src/app/common/subscriber-base';
|
import { SubscriberBase } from 'src/app/common/subscriber-base';
|
||||||
import { getFromCardCache } from 'src/app/common/card-cache-operations';
|
import { getFromCardCache } from 'src/app/common/card-cache-operations';
|
||||||
|
import { NoteItem } from 'src/app/models/note-state';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-saved-page-card',
|
selector: 'app-saved-page-card',
|
||||||
@ -22,6 +22,7 @@ import { getFromCardCache } from 'src/app/common/card-cache-operations';
|
|||||||
export class SavedPageCardComponent extends SubscriberBase implements OnInit {
|
export class SavedPageCardComponent extends SubscriberBase implements OnInit {
|
||||||
icon$: Observable<string>;
|
icon$: Observable<string>;
|
||||||
cache: HashTable<CardItem>;
|
cache: HashTable<CardItem>;
|
||||||
|
cardIcons: CardIcons;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
savedPage: SavedPage;
|
savedPage: SavedPage;
|
||||||
@ -31,14 +32,26 @@ export class SavedPageCardComponent extends SubscriberBase implements OnInit {
|
|||||||
|
|
||||||
this.icon$ = appService.select((state) => state.settings.value.cardIcons.savedPage);
|
this.icon$ = appService.select((state) => state.settings.value.cardIcons.savedPage);
|
||||||
this.addSubscription(
|
this.addSubscription(
|
||||||
this.appService
|
this.appService.state$.subscribe((state) => {
|
||||||
.select((state) => state.cardCache)
|
this.cache = state.cardCache;
|
||||||
.subscribe((cache) => {
|
this.cardIcons = state.settings.value.cardIcons;
|
||||||
this.cache = cache;
|
})
|
||||||
})
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class(item: DataReference) {
|
||||||
|
if (item.type === CardType.Note) {
|
||||||
|
return 'note';
|
||||||
|
} else if (item.type === CardType.Passage) {
|
||||||
|
return 'passage';
|
||||||
|
} else if (item.type === CardType.Strongs) {
|
||||||
|
return 'strongs';
|
||||||
|
} else if (item.type === CardType.Word) {
|
||||||
|
return 'words';
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
format(item: DataReference) {
|
format(item: DataReference) {
|
||||||
if (item.type === CardType.Note) {
|
if (item.type === CardType.Note) {
|
||||||
return `Note: ${(getFromCardCache(item, this.cache).data as NoteItem).title}`;
|
return `Note: ${(getFromCardCache(item, this.cache).data as NoteItem).title}`;
|
||||||
@ -52,6 +65,23 @@ export class SavedPageCardComponent extends SubscriberBase implements OnInit {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
icons(item: DataReference) {
|
||||||
|
if (this.cardIcons === null || this.cardIcons === undefined) {
|
||||||
|
return 'page';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.type === CardType.Note) {
|
||||||
|
return this.cardIcons.note;
|
||||||
|
} else if (item.type === CardType.Passage) {
|
||||||
|
return this.cardIcons.passage;
|
||||||
|
} else if (item.type === CardType.Strongs) {
|
||||||
|
return this.cardIcons.strongs;
|
||||||
|
} else if (item.type === CardType.Word) {
|
||||||
|
return this.cardIcons.words;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
onRemoveCard(card: CardItem) {
|
onRemoveCard(card: CardItem) {
|
||||||
this.dialog
|
this.dialog
|
||||||
.open(OkCancelModalComponent, {
|
.open(OkCancelModalComponent, {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user