mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-25 08:19:50 -04:00
configure card font
This commit is contained in:
parent
d70cc9ca3b
commit
7d3ca25a8d
@ -33,7 +33,7 @@ To get more help on the Angular CLI use `ng help` or go check out the [Angular C
|
|||||||
- Options to merge references \*\*
|
- Options to merge references \*\*
|
||||||
- Merge if overlap
|
- Merge if overlap
|
||||||
- Merge if contains
|
- Merge if contains
|
||||||
- Font Size / Font settings
|
- Font Size
|
||||||
- Page Admin \*\*
|
- Page Admin \*\*
|
||||||
- Delete Page
|
- Delete Page
|
||||||
- Show page and list of card titles
|
- Show page and list of card titles
|
||||||
@ -52,7 +52,6 @@ To get more help on the Angular CLI use `ng help` or go check out the [Angular C
|
|||||||
- Settings for theme
|
- Settings for theme
|
||||||
- Custom Colors for Light/Dark modes
|
- Custom Colors for Light/Dark modes
|
||||||
- Dark / Light / NightLight Mode
|
- Dark / Light / NightLight Mode
|
||||||
- Sync Card across Devices
|
|
||||||
- Merge saved pages lists when unlogged in -> login
|
- Merge saved pages lists when unlogged in -> login
|
||||||
- Incorporate Jacob's Geo Work
|
- Incorporate Jacob's Geo Work
|
||||||
- Android and IOS mobile apps with Ionic Capactor
|
- Android and IOS mobile apps with Ionic Capactor
|
||||||
|
@ -21,9 +21,7 @@ export class AppComponent extends SubscriberComponent implements AfterViewInit {
|
|||||||
fontSize$ = this.appService.select(
|
fontSize$ = this.appService.select(
|
||||||
(state) => state.displaySettings.fontSize + 'pt'
|
(state) => state.displaySettings.fontSize + 'pt'
|
||||||
);
|
);
|
||||||
fontFamily$ = this.appService.select(
|
cardFont$ = this.appService.select((state) => state.displaySettings.cardFont);
|
||||||
(state) => state.displaySettings.fontFamily
|
|
||||||
);
|
|
||||||
|
|
||||||
isHandset$: Observable<boolean> = this.breakpointObserver
|
isHandset$: Observable<boolean> = this.breakpointObserver
|
||||||
.observe(Breakpoints.Handset)
|
.observe(Breakpoints.Handset)
|
||||||
@ -46,12 +44,20 @@ export class AppComponent extends SubscriberComponent implements AfterViewInit {
|
|||||||
this.appService.initSavedPages();
|
this.appService.initSavedPages();
|
||||||
this.appService.initDisplaySettings();
|
this.appService.initDisplaySettings();
|
||||||
|
|
||||||
this.fontSize$.subscribe((size) => {
|
this.addSubscription(
|
||||||
document.documentElement.style.setProperty('--font-size', size);
|
this.fontSize$.subscribe((size) => {
|
||||||
});
|
if (size) {
|
||||||
this.fontFamily$.subscribe((family) => {
|
document.documentElement.style.setProperty('--font-size', size);
|
||||||
document.documentElement.style.setProperty('--font-family', family);
|
}
|
||||||
});
|
})
|
||||||
|
);
|
||||||
|
this.addSubscription(
|
||||||
|
this.cardFont$.subscribe((family) => {
|
||||||
|
if (family) {
|
||||||
|
document.documentElement.style.setProperty('--font-family', family);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit(): void {
|
ngAfterViewInit(): void {
|
||||||
|
@ -28,6 +28,13 @@
|
|||||||
>Insert Result Next to Card</mat-slide-toggle
|
>Insert Result Next to Card</mat-slide-toggle
|
||||||
>
|
>
|
||||||
</mat-list-item>
|
</mat-list-item>
|
||||||
|
<mat-list-item>
|
||||||
|
<mat-slide-toggle
|
||||||
|
[checked]="this.displaySettings.syncCardsAcrossDevices"
|
||||||
|
(change)="toggleSyncCardsAcrossDevices($event)"
|
||||||
|
>Sync Cards Across Devices</mat-slide-toggle
|
||||||
|
>
|
||||||
|
</mat-list-item>
|
||||||
</mat-nav-list>
|
</mat-nav-list>
|
||||||
|
|
||||||
<mat-toolbar>Display Settings</mat-toolbar>
|
<mat-toolbar>Display Settings</mat-toolbar>
|
||||||
@ -61,3 +68,18 @@
|
|||||||
>
|
>
|
||||||
</mat-list-item>
|
</mat-list-item>
|
||||||
</mat-nav-list>
|
</mat-nav-list>
|
||||||
|
|
||||||
|
<mat-toolbar>Style Settings</mat-toolbar>
|
||||||
|
<mat-nav-list>
|
||||||
|
<mat-form-field appearance="fill" class="card-fonts">
|
||||||
|
<mat-label>Card Fonts</mat-label>
|
||||||
|
<mat-select
|
||||||
|
[(value)]="cardFont"
|
||||||
|
(selectionChange)="cardFontSelected($event)"
|
||||||
|
>
|
||||||
|
<mat-option *ngFor="let font of fonts" [value]="font">
|
||||||
|
{{ font }}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
</mat-nav-list>
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
.card-fonts {
|
||||||
|
width: 100%;
|
||||||
|
}
|
@ -3,6 +3,8 @@ import { AppService } from 'src/app/services/app.service';
|
|||||||
import { MatSlideToggleChange } from '@angular/material/slide-toggle';
|
import { MatSlideToggleChange } from '@angular/material/slide-toggle';
|
||||||
import { SubscriberComponent } from '../subscriber.component';
|
import { SubscriberComponent } from '../subscriber.component';
|
||||||
import { DisplaySettings } from 'src/app/models/app-state';
|
import { DisplaySettings } from 'src/app/models/app-state';
|
||||||
|
import { CardFonts } from 'src/app/constants';
|
||||||
|
import { MatSelectChange } from '@angular/material/select';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-settings',
|
selector: 'app-settings',
|
||||||
@ -11,16 +13,24 @@ import { DisplaySettings } from 'src/app/models/app-state';
|
|||||||
})
|
})
|
||||||
export class SettingsComponent extends SubscriberComponent {
|
export class SettingsComponent extends SubscriberComponent {
|
||||||
displaySettings: DisplaySettings;
|
displaySettings: DisplaySettings;
|
||||||
|
fonts: string[];
|
||||||
|
cardFont = '';
|
||||||
|
|
||||||
constructor(private appService: AppService) {
|
constructor(public appService: AppService) {
|
||||||
super();
|
super();
|
||||||
|
this.fonts = CardFonts;
|
||||||
this.addSubscription(
|
this.addSubscription(
|
||||||
this.appService.state$.subscribe((state) => {
|
this.appService.state$.subscribe((state) => {
|
||||||
this.displaySettings = state.displaySettings;
|
this.displaySettings = state.displaySettings;
|
||||||
|
this.cardFont = state.displaySettings.cardFont;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cardFontSelected(evt: MatSelectChange) {
|
||||||
|
this.appService.changeFont(evt.value);
|
||||||
|
}
|
||||||
|
|
||||||
//#region Search Settings
|
//#region Search Settings
|
||||||
|
|
||||||
toggleStrongsAsModal(toggle: MatSlideToggleChange) {
|
toggleStrongsAsModal(toggle: MatSlideToggleChange) {
|
||||||
@ -50,6 +60,12 @@ export class SettingsComponent extends SubscriberComponent {
|
|||||||
clearSearchAfterQuery: toggle.checked,
|
clearSearchAfterQuery: toggle.checked,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
toggleSyncCardsAcrossDevices(toggle: MatSlideToggleChange) {
|
||||||
|
this.appService.updateDisplaySettings({
|
||||||
|
...this.displaySettings,
|
||||||
|
syncCardsAcrossDevices: toggle.checked,
|
||||||
|
});
|
||||||
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
//#region Passage Settings
|
//#region Passage Settings
|
||||||
|
@ -13,3 +13,13 @@ export const CardIcons = {
|
|||||||
Passage: 'menu_book',
|
Passage: 'menu_book',
|
||||||
Strongs: 'article',
|
Strongs: 'article',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const CardFonts = [
|
||||||
|
'Merriweather',
|
||||||
|
'PT Sans',
|
||||||
|
'PT Serif',
|
||||||
|
'Open Sans',
|
||||||
|
'Roboto',
|
||||||
|
'Roboto Condensed',
|
||||||
|
'Inconsolata',
|
||||||
|
];
|
||||||
|
@ -34,12 +34,14 @@ export interface DisplaySettings {
|
|||||||
readonly clearSearchAfterQuery: boolean;
|
readonly clearSearchAfterQuery: boolean;
|
||||||
|
|
||||||
readonly fontSize: number;
|
readonly fontSize: number;
|
||||||
readonly fontFamily: string;
|
readonly cardFont: string;
|
||||||
|
|
||||||
readonly showVersesOnNewLine: boolean;
|
readonly showVersesOnNewLine: boolean;
|
||||||
readonly showVerseNumbers: boolean;
|
readonly showVerseNumbers: boolean;
|
||||||
readonly showParagraphs: boolean;
|
readonly showParagraphs: boolean;
|
||||||
readonly showParagraphHeadings: boolean;
|
readonly showParagraphHeadings: boolean;
|
||||||
|
|
||||||
|
readonly syncCardsAcrossDevices: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type OpenData = {
|
export type OpenData = {
|
||||||
|
@ -57,11 +57,12 @@ const initialState: AppState = {
|
|||||||
insertCardNextToItem: true,
|
insertCardNextToItem: true,
|
||||||
clearSearchAfterQuery: true,
|
clearSearchAfterQuery: true,
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
fontFamily: 'PT Serif',
|
cardFont: 'PT Serif',
|
||||||
showVersesOnNewLine: false,
|
showVersesOnNewLine: false,
|
||||||
showVerseNumbers: false,
|
showVerseNumbers: false,
|
||||||
showParagraphs: true,
|
showParagraphs: true,
|
||||||
showParagraphHeadings: true,
|
showParagraphHeadings: true,
|
||||||
|
syncCardsAcrossDevices: false,
|
||||||
},
|
},
|
||||||
cardIcons: {
|
cardIcons: {
|
||||||
words: 'font_download',
|
words: 'font_download',
|
||||||
@ -109,7 +110,7 @@ type AppAction =
|
|||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
type: 'UPDATE_FONT_FAMILY';
|
type: 'UPDATE_FONT_FAMILY';
|
||||||
family: string;
|
cardFont: string;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
type: 'UPDATE_AUTOCOMPLETE';
|
type: 'UPDATE_AUTOCOMPLETE';
|
||||||
@ -241,7 +242,7 @@ function reducer(state: AppState, action: AppAction): AppState {
|
|||||||
...state,
|
...state,
|
||||||
displaySettings: {
|
displaySettings: {
|
||||||
...state.displaySettings,
|
...state.displaySettings,
|
||||||
fontFamily: action.family,
|
cardFont: action.cardFont,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -285,6 +286,13 @@ export class AppService extends createStateService(reducer, initialState) {
|
|||||||
console.log(msg);
|
console.log(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
changeFont(cardFont: string) {
|
||||||
|
this.dispatch({
|
||||||
|
type: 'UPDATE_FONT_FAMILY',
|
||||||
|
cardFont,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//#region Saved Pages
|
//#region Saved Pages
|
||||||
|
|
||||||
async initSavedPages() {
|
async initSavedPages() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user