mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-25 16:29:49 -04:00
make the card icons part of the state, so you can allow the user to change them if they want to later.
This commit is contained in:
parent
d3c7287b14
commit
f95bf62cdb
@ -7,6 +7,7 @@ import {
|
|||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { CardItem, OpenData } from '../models/app-state';
|
import { CardItem, OpenData } from '../models/app-state';
|
||||||
import { BibleReference } from './bible-reference';
|
import { BibleReference } from './bible-reference';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
template: '',
|
template: '',
|
||||||
@ -21,6 +22,8 @@ export class CardComponent {
|
|||||||
@Input()
|
@Input()
|
||||||
cardItem: CardItem;
|
cardItem: CardItem;
|
||||||
|
|
||||||
|
icon$: Observable<string>;
|
||||||
|
|
||||||
constructor(protected elementRef: ElementRef) {}
|
constructor(protected elementRef: ElementRef) {}
|
||||||
|
|
||||||
protected copyToClip(text: string, html: string) {
|
protected copyToClip(text: string, html: string) {
|
||||||
|
@ -3,3 +3,15 @@ export const PageTitles = {
|
|||||||
Help: 'Help',
|
Help: 'Help',
|
||||||
Settings: 'Settings',
|
Settings: 'Settings',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const PageIcons = {
|
||||||
|
Search: 'search',
|
||||||
|
Help: 'help',
|
||||||
|
Settings: 'settings',
|
||||||
|
};
|
||||||
|
|
||||||
|
export const CardIcons = {
|
||||||
|
Words: 'font_download',
|
||||||
|
Passage: 'menu_book',
|
||||||
|
Strongs: 'article',
|
||||||
|
};
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { MatCardActions } from '@angular/material/card';
|
||||||
|
|
||||||
export interface AppState {
|
export interface AppState {
|
||||||
readonly savedPages: readonly SavedPage[];
|
readonly savedPages: readonly SavedPage[];
|
||||||
readonly mainPages: readonly Page[];
|
readonly mainPages: readonly Page[];
|
||||||
@ -6,6 +8,7 @@ export interface AppState {
|
|||||||
readonly error: Error;
|
readonly error: Error;
|
||||||
readonly paragraphs: HashTable<Paragraph>;
|
readonly paragraphs: HashTable<Paragraph>;
|
||||||
readonly displaySettings: DisplaySettings;
|
readonly displaySettings: DisplaySettings;
|
||||||
|
readonly cardIcons: CardIcons;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Error {
|
export interface Error {
|
||||||
@ -14,6 +17,12 @@ export interface Error {
|
|||||||
|
|
||||||
export type Data = BiblePassageResult | StrongsResult | WordLookupResult;
|
export type Data = BiblePassageResult | StrongsResult | WordLookupResult;
|
||||||
|
|
||||||
|
export interface CardIcons {
|
||||||
|
readonly words: string;
|
||||||
|
readonly passage: string;
|
||||||
|
readonly strongs: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface DisplaySettings {
|
export interface DisplaySettings {
|
||||||
readonly showStrongsAsModal: boolean;
|
readonly showStrongsAsModal: boolean;
|
||||||
readonly appendCardToBottom: boolean;
|
readonly appendCardToBottom: boolean;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<div class="card-title passage-title">
|
<div class="card-title passage-title">
|
||||||
<mat-icon aria-hidden="false" aria-label="Bible Passage Icon"
|
<mat-icon aria-hidden="false" aria-label="Bible Passage Icon">{{
|
||||||
>menu_book</mat-icon
|
icon$ | async
|
||||||
>
|
}}</mat-icon>
|
||||||
<span *ngIf="ref">{{ ref }}</span>
|
<span *ngIf="ref">{{ ref }}</span>
|
||||||
<button
|
<button
|
||||||
mat-icon-button
|
mat-icon-button
|
||||||
|
@ -35,6 +35,7 @@ export class PassageComponent extends CardComponent implements OnInit {
|
|||||||
private appService: AppService
|
private appService: AppService
|
||||||
) {
|
) {
|
||||||
super(elementRef);
|
super(elementRef);
|
||||||
|
this.icon$ = appService.select((state) => state.cardIcons.passage);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<div class="card-title strongs-title">
|
<div class="card-title strongs-title">
|
||||||
<mat-icon aria-hidden="false" aria-label="Strongs Entry Icon"
|
<mat-icon aria-hidden="false" aria-label="Strongs Entry Icon">{{
|
||||||
>article</mat-icon
|
icon$ | async
|
||||||
>
|
}}</mat-icon>
|
||||||
<span *ngIf="cardItem">{{ cardItem.qry }}</span>
|
<span *ngIf="cardItem">{{ cardItem.qry }}</span>
|
||||||
<button
|
<button
|
||||||
mat-icon-button
|
mat-icon-button
|
||||||
|
@ -16,6 +16,7 @@ export class StrongsComponent extends CardComponent {
|
|||||||
private appService: AppService
|
private appService: AppService
|
||||||
) {
|
) {
|
||||||
super(elementRef);
|
super(elementRef);
|
||||||
|
this.icon$ = appService.select((state) => state.cardIcons.strongs);
|
||||||
}
|
}
|
||||||
|
|
||||||
copy() {
|
copy() {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<div class="card-title words-title">
|
<div class="card-title words-title">
|
||||||
<mat-icon aria-hidden="false" aria-label="Word Search Entry Icon"
|
<mat-icon aria-hidden="false" aria-label="Word Search Entry Icon">{{
|
||||||
>font_download</mat-icon
|
icon$ | async
|
||||||
>
|
}}</mat-icon>
|
||||||
<span *ngIf="cardItem">{{ cardItem.qry }}</span>
|
<span *ngIf="cardItem">{{ cardItem.qry }}</span>
|
||||||
<button
|
<button
|
||||||
mat-icon-button
|
mat-icon-button
|
||||||
|
@ -17,7 +17,7 @@ export class WordsComponent extends CardComponent {
|
|||||||
private appService: AppService
|
private appService: AppService
|
||||||
) {
|
) {
|
||||||
super(elementRef);
|
super(elementRef);
|
||||||
console.log('rendering word search...');
|
this.icon$ = appService.select((state) => state.cardIcons.words);
|
||||||
}
|
}
|
||||||
|
|
||||||
copy() {
|
copy() {
|
||||||
|
@ -21,7 +21,7 @@ import {
|
|||||||
IndexResult,
|
IndexResult,
|
||||||
} from '../models/app-state';
|
} from '../models/app-state';
|
||||||
import { Section, BibleReference } from '../common/bible-reference';
|
import { Section, BibleReference } from '../common/bible-reference';
|
||||||
import { PageTitles } from '../constants';
|
import { PageTitles, PageIcons } from '../constants';
|
||||||
import { createStateService } from '../common/state-service';
|
import { createStateService } from '../common/state-service';
|
||||||
import * as math from 'mathjs';
|
import * as math from 'mathjs';
|
||||||
|
|
||||||
@ -30,9 +30,9 @@ const initialState: AppState = {
|
|||||||
autocomplete: [],
|
autocomplete: [],
|
||||||
savedPages: [],
|
savedPages: [],
|
||||||
mainPages: [
|
mainPages: [
|
||||||
{ title: PageTitles.Search, icon: 'search' },
|
{ title: PageTitles.Search, icon: PageIcons.Search },
|
||||||
{ title: PageTitles.Settings, icon: 'settings' },
|
{ title: PageTitles.Settings, icon: PageIcons.Settings },
|
||||||
{ title: PageTitles.Help, icon: 'help' },
|
{ title: PageTitles.Help, icon: PageIcons.Help },
|
||||||
],
|
],
|
||||||
error: null,
|
error: null,
|
||||||
paragraphs: null,
|
paragraphs: null,
|
||||||
@ -47,6 +47,11 @@ const initialState: AppState = {
|
|||||||
showParagraphs: true,
|
showParagraphs: true,
|
||||||
showParagraphHeadings: true,
|
showParagraphHeadings: true,
|
||||||
},
|
},
|
||||||
|
cardIcons: {
|
||||||
|
words: 'font_download',
|
||||||
|
passage: 'menu_book',
|
||||||
|
strongs: 'article',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
type AppAction =
|
type AppAction =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user