Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit 57f5280

Browse files
merge: last studio features and improvements
2 parents 427d98e + 3d30dec commit 57f5280

37 files changed

+717
-173
lines changed

studio/package-lock.json

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

studio/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"dependencies": {
1717
"@ionic/core": "4.1.1",
1818
"deckdeckgo": "file:../webcomponents/core",
19-
"deckdeckgo-inline-editor": "file:../webcomponents/inline-editor"
19+
"deckdeckgo-inline-editor": "file:../webcomponents/inline-editor",
20+
"rxjs": "^6.4.0"
2021
},
2122
"devDependencies": {
2223
"@stencil/core": "0.18.0",

studio/src/app/app-root.tsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,50 @@
11
import {Component, Prop} from '@stencil/core';
22

3+
import {Subscription} from 'rxjs';
4+
5+
import {ErrorService} from './services/error/error.service';
6+
37
@Component({
48
tag: 'app-root',
59
styleUrl: 'app-root.scss'
610
})
711
export class AppRoot {
812

913
@Prop({connect: 'ion-menu-controller'}) lazyMenuController!: HTMLIonMenuControllerElement;
14+
@Prop({connect: 'ion-toast-controller'}) toastController: HTMLIonToastControllerElement;
15+
16+
private subscription: Subscription;
17+
18+
private errorService: ErrorService;
19+
20+
constructor() {
21+
this.errorService = ErrorService.getInstance();
22+
}
23+
24+
async componentDidLoad() {
25+
this.subscription = this.errorService.watch().subscribe(async (error: string) => {
26+
await this.toastError(error);
27+
});
28+
}
29+
30+
async componentDidUnload() {
31+
if (this.subscription) {
32+
this.subscription.unsubscribe();
33+
}
34+
}
35+
36+
private async toastError(error: string) {
37+
const popover: HTMLIonToastElement = await this.toastController.create({
38+
message: error,
39+
showCloseButton: true,
40+
position: 'top',
41+
closeButtonText: 'Ok, sh*t happens',
42+
color: 'danger',
43+
duration: 6000
44+
});
45+
46+
await popover.present();
47+
}
1048

1149
render() {
1250
return ([

0 commit comments

Comments
 (0)