Skip to content

Commit fa14d77

Browse files
committed
feat: add spinner
1 parent ad21f90 commit fa14d77

File tree

8 files changed

+130
-7
lines changed

8 files changed

+130
-7
lines changed

.vscode/launch.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "jdk",
9+
"request": "launch",
10+
"name": "Launch Java App"
11+
},
12+
{
13+
"name": "Launch Java: Continuous Mode",
14+
"type": "jdk",
15+
"request": "launch",
16+
"launchConfiguration": "Continuous Mode"
17+
}
18+
]
19+
}

payment-frontend/src/angular/src/app/booking/booking.component.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@
1414
height: calc(100vh - 130px);
1515
width: 100%;
1616
border: none;
17-
}
17+
}
18+

payment-frontend/src/angular/src/app/booking/booking.component.ts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,46 @@
1010
See the License for the specific language governing permissions and
1111
limitations under the License.
1212
*/
13-
import { Component } from '@angular/core';
13+
import { AfterViewInit, Component } from '@angular/core';
1414
import {MatButtonModule} from '@angular/material/button';
1515
import { Router } from '@angular/router';
1616
import {DomSanitizer} from '@angular/platform-browser';
17+
import {MatDialog, MatDialogModule} from '@angular/material/dialog';
18+
import { SpinnerComponent } from '../spinner/spinner.component';
1719

1820
@Component({
1921
selector: 'app-booking',
20-
imports: [MatButtonModule],
22+
imports: [MatButtonModule,MatDialogModule],
2123
templateUrl: './booking.component.html',
2224
styleUrl: './booking.component.scss'
2325
})
24-
export class BookingComponent {
26+
export class BookingComponent implements AfterViewInit {
2527
protected iframeUrl = this.domSanitizer.bypassSecurityTrustResourceUrl('http://localhost:3000/');
2628

27-
constructor(private router: Router, private domSanitizer: DomSanitizer) { }
29+
constructor(private router: Router, private domSanitizer: DomSanitizer, private dialog: MatDialog) { }
30+
31+
ngAfterViewInit(): void {
32+
this.showDialog();
33+
}
2834

2935
protected showFlights(): void {
3036
this.iframeUrl = this.domSanitizer.bypassSecurityTrustResourceUrl('http://localhost:3000/');
37+
this.showDialog();
3138
}
3239

3340
protected showHotels(): void {
3441
this.iframeUrl = this.domSanitizer.bypassSecurityTrustResourceUrl('http://localhost:8088/');
42+
this.showDialog();
3543
}
3644

3745
protected showPayment(): void {
38-
this.router.navigate(['/payment']);
46+
this.router.navigate(['/payment']);
47+
this.showDialog();
48+
}
49+
50+
private showDialog(): void {
51+
const myDialog = this.dialog.open(SpinnerComponent, {width: '350px', height: '350px', disableClose: true, enterAnimationDuration: '500ms', exitAnimationDuration: '500ms',
52+
backdropClass: 'dialog-backdrop', hasBackdrop: true});
53+
setTimeout(() => myDialog.close(), 2000);
3954
}
4055
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div class="container">
2+
<mat-spinner diameter="200"></mat-spinner>
3+
</div>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* Copyright 2023 Sven Loesekann
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
.container {
14+
display: flex;
15+
align-items: center;
16+
justify-content: center;
17+
height: 100%;
18+
width: 100%;
19+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/**
2+
* Copyright 2023 Sven Loesekann
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
import { ComponentFixture, TestBed } from '@angular/core/testing';
14+
15+
import { SpinnerComponent } from './spinner.component';
16+
/*
17+
describe('SpinnerComponent', () => {
18+
let component: SpinnerComponent;
19+
let fixture: ComponentFixture<SpinnerComponent>;
20+
21+
beforeEach(async () => {
22+
await TestBed.configureTestingModule({
23+
imports: [SpinnerComponent]
24+
})
25+
.compileComponents();
26+
27+
fixture = TestBed.createComponent(SpinnerComponent);
28+
component = fixture.componentInstance;
29+
fixture.detectChanges();
30+
});
31+
32+
it('should create', () => {
33+
expect(component).toBeTruthy();
34+
});
35+
});
36+
*/
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* Copyright 2023 Sven Loesekann
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
import { Component } from '@angular/core';
14+
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner';
15+
16+
@Component({
17+
selector: 'app-spinner',
18+
imports: [MatProgressSpinnerModule],
19+
templateUrl: './spinner.component.html',
20+
styleUrl: './spinner.component.scss'
21+
})
22+
export class SpinnerComponent {
23+
24+
}

payment-frontend/src/angular/src/styles.scss

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,10 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1010
See the License for the specific language governing permissions and
1111
limitations under the License.
1212
*/
13-
@use "material-icons/iconfont/material-icons.scss";
13+
@use "material-icons/iconfont/material-icons.scss";
14+
15+
.dialog-backdrop {
16+
backdrop-filter: blur(5px);
17+
opacity: 1;
18+
background: rgba(0,0,0,0.5);
19+
}

0 commit comments

Comments
 (0)