Skip to content

Commit 4d8d5ae

Browse files
committed
#837: create banner with information about update
1 parent 8acfd18 commit 4d8d5ae

7 files changed

+93
-0
lines changed

package-lock.json

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/components/components.module.ts

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { HintBoxComponent } from './hint-box/hint-box.component';
2222
import { LectureListComponent } from './lecture-list/lecture-list.component';
2323
import { MensaMealComponent } from './mensa-meal/mensa-meal.component';
2424
import { ModulesGridComponent } from './modules-grid/modules-grid.component';
25+
import { InfoBannerComponent } from './info-banner/info-banner.component';
2526

2627
@NgModule({
2728
declarations: [
@@ -40,6 +41,7 @@ import { ModulesGridComponent } from './modules-grid/modules-grid.component';
4041
CampusReorderModalPage,
4142
DatePickerComponent,
4243
ModulesGridComponent,
44+
InfoBannerComponent,
4345
],
4446
imports: [
4547
IonicModule,
@@ -70,6 +72,7 @@ import { ModulesGridComponent } from './modules-grid/modules-grid.component';
7072
CourseDataComponent,
7173
DatePickerComponent,
7274
ModulesGridComponent,
75+
InfoBannerComponent,
7376
],
7477
})
7578
export class ComponentsModule {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<div id="info-banner-card" class="card">
2+
<ion-card>
3+
<ion-card-header>
4+
<ion-card-title>Neue Informationen</ion-card-title>
5+
<ion-card-subtitle>Zu PULS Login & Mensaapp</ion-card-subtitle>
6+
</ion-card-header>
7+
<ion-card-content>
8+
Der PULS-Login ist derzeit leider nicht möglich. <br />
9+
Den aktueller Speiseplan finden Sie unter: https://swp.webspeiseplan.de.
10+
<br />
11+
Wir arbeiten an einer Lösung und bitten Sie um Geduld.
12+
</ion-card-content>
13+
<div style="display: block; margin: auto; width: fit-content">
14+
<ion-button fill="clear" (click)="closeCard()"
15+
>Hinweis schließen</ion-button
16+
>
17+
</div>
18+
</ion-card>
19+
</div>

src/app/components/info-banner/info-banner.component.scss

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
2+
import { IonicModule } from '@ionic/angular';
3+
4+
import { InfoBannerComponent } from './info-banner.component';
5+
6+
describe('InfoBannerComponent', () => {
7+
let component: InfoBannerComponent;
8+
let fixture: ComponentFixture<InfoBannerComponent>;
9+
10+
beforeEach(waitForAsync(() => {
11+
TestBed.configureTestingModule({
12+
declarations: [InfoBannerComponent],
13+
imports: [IonicModule.forRoot()],
14+
}).compileComponents();
15+
16+
fixture = TestBed.createComponent(InfoBannerComponent);
17+
component = fixture.componentInstance;
18+
fixture.detectChanges();
19+
}));
20+
21+
it('should create', () => {
22+
expect(component).toBeTruthy();
23+
});
24+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { Component, OnInit } from '@angular/core';
2+
import { Preferences } from '@capacitor/preferences';
3+
4+
const prefKey = 'MobileUP_DontShowBanner';
5+
6+
@Component({
7+
selector: 'app-info-banner',
8+
templateUrl: './info-banner.component.html',
9+
styleUrls: ['./info-banner.component.scss'],
10+
})
11+
export class InfoBannerComponent implements OnInit {
12+
constructor() {}
13+
14+
ngOnInit() {
15+
this.checkPref().then((prefValue) => {
16+
console.log('render info banner: ' + prefValue);
17+
if (prefValue === true) {
18+
this.closeCard();
19+
}
20+
});
21+
}
22+
23+
closeCard(): void {
24+
document.querySelector('#info-banner-card').innerHTML = '';
25+
this.setPref(true);
26+
}
27+
28+
setPref = async (v: boolean) => {
29+
await Preferences.set({
30+
key: prefKey,
31+
value: String(v),
32+
});
33+
};
34+
35+
checkPref = async (): Promise<boolean> => {
36+
const { value } = await Preferences.get({ key: prefKey });
37+
console.log(`Pref is ${value}!`);
38+
return value === 'true';
39+
};
40+
41+
removePref = async () => {
42+
await Preferences.remove({ key: prefKey });
43+
};
44+
}

src/app/pages/home/home.page.html

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
</div>
3535
</ng-template>
3636

37+
<app-info-banner> </app-info-banner>
38+
3739
<app-hint-box
3840
*ngIf="displaySystemStatusWarning"
3941
[hintTypeAsString]="systemStatusWarning.title"

0 commit comments

Comments
 (0)