toast errors and some styling

This commit is contained in:
Matt Hill
2021-07-13 23:43:39 -06:00
committed by Aiden McClelland
parent c2313b4eb3
commit 6bbe19aed7
43 changed files with 463 additions and 403 deletions

View File

@@ -11,11 +11,8 @@
<ion-content>
<text-spinner *ngIf="loading; else loaded" [text]="'Loading ' + title | titlecase"></text-spinner>
<ng-template #loaded>
<ion-item *ngIf="error" style="margin-bottom: 16px;">
<ion-text class="ion-text-wrap" color="danger">{{ error }}</ion-text>
</ion-item>
<ng-template #loaded>
<div *ngIf="content" class="content-padding" [innerHTML]="content | markdown"></div>
</ng-template>
</ion-content>

View File

@@ -1,6 +1,7 @@
import { Component, Input } from '@angular/core'
import { ModalController } from '@ionic/angular'
import { ApiService } from 'src/app/services/api/api.service'
import { ErrorToastService } from 'src/app/services/error-toast.service'
@Component({
selector: 'markdown',
@@ -12,10 +13,10 @@ export class MarkdownPage {
@Input() title: string
content: string
loading = true
error = ''
constructor (
private readonly modalCtrl: ModalController,
private readonly errToast: ErrorToastService,
private readonly apiService: ApiService,
) { }
@@ -23,7 +24,8 @@ export class MarkdownPage {
try {
this.content = await this.apiService.getStatic(this.contentUrl)
} catch (e) {
this.error = e.message
console.error(e.message)
this.errToast.present(e.message)
} finally {
this.loading = false
}

View File

@@ -18,7 +18,8 @@ export class OSWelcomePage {
) { }
async dismiss () {
this.apiService.setDbValue({ pointer: '/welcome-ack', value: this.config.version }).catch(console.error)
this.apiService.setDbValue({ pointer: '/welcome-ack', value: this.config.version })
.catch(console.error)
// return false to skip subsequent alert modals (e.g. check for updates modals)
// return true to show subsequent alert modals