Skip to content

Commit 6314732

Browse files
committed
🔀 resolve conflit
2 parents b3007d3 + 6324b4c commit 6314732

File tree

2 files changed

+23
-30
lines changed

2 files changed

+23
-30
lines changed

src/app/core/components/app/app.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, OnDestroy, OnInit } from '@angular/core';
1+
import { Component, OnInit } from '@angular/core';
22

33
@Component({
44
selector: 'admin-root',

src/app/core/components/network-status/network-status.component.ts

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ import { fromEvent, Observable, Subscription } from 'rxjs';
1616
<div class="p-4">
1717
<div class="flex items-start">
1818
<div class="flex-shrink-0">
19-
<!-- Heroicon name: outline/check-circle -->
2019
<svg
2120
class="h-6 w-6"
22-
[ngClass]="{'text-green-400': networkStatus === 'online', 'text-red-400': networkStatus === 'offline'}"
21+
[ngClass]="{
22+
'text-green-400': networkStatus === 'online',
23+
'text-red-400': networkStatus === 'offline'
24+
}"
2325
xmlns="http://www.w3.org/2000/svg"
2426
fill="none"
2527
viewBox="0 0 24 24"
@@ -38,15 +40,9 @@ import { fromEvent, Observable, Subscription } from 'rxjs';
3840
stroke-linejoin="round" />
3941
</svg>
4042
</div>
41-
<div *ngIf="networkStatus === 'online'" class="ml-3 w-0 flex-1 pt-0.5">
42-
<p class="text-sm font-medium text-slate-900 capitalize">
43-
{{ networkStatus }}
44-
</p>
45-
<p class="mt-1 text-sm text-slate-500">
46-
{{ networkStatusMessage }}
47-
</p>
48-
</div>
49-
<div *ngIf="networkStatus === 'offline'" class="ml-3 w-0 flex-1 pt-0.5">
43+
<div
44+
*ngIf="networkStatus === 'online'"
45+
class="ml-3 w-0 flex-1 pt-0.5">
5046
<p class="text-sm font-medium text-slate-900 capitalize">
5147
{{ networkStatus }}
5248
</p>
@@ -63,53 +59,50 @@ import { fromEvent, Observable, Subscription } from 'rxjs';
6359
animations: [
6460
trigger('showHideNotification', [
6561
transition('void => *', [
66-
style({ transform: "translateX(0.5rem)", opacity: 0 }),
67-
animate(300, style({ transform: "translateX(0)", opacity: 1 }))
62+
style({ transform: 'translateX(0.5rem)', opacity: 0 }),
63+
animate(300, style({ transform: 'translateX(0)', opacity: 1 })),
6864
]),
69-
transition('* => void', [
70-
animate(100, style({ opacity: 0 }))
71-
])
65+
transition('* => void', [animate(100, style({ opacity: 0 }))]),
7266
]),
7367
],
7468
})
7569
export class NetworkStatusComponent implements OnInit {
7670
networkStatusMessage!: string;
7771
networkStatus!: string;
78-
79-
onlineEvent!: Observable<Event>;
80-
offlineEvent!: Observable<Event>;
8172
subscriptions: Subscription[] = [];
82-
8373
showNetworkStatus!: boolean;
8474

75+
onlineEvent$!: Observable<Event>;
76+
offlineEvent$!: Observable<Event>;
77+
8578
ngOnInit() {
8679
this.networkStatusChecker();
8780
}
8881

89-
showHideNetworkStatus() {
82+
toggleNetworkStatus(): void {
9083
this.showNetworkStatus = true;
9184
setTimeout(() => {
9285
this.showNetworkStatus = false;
93-
}, 3000);
86+
}, 5000);
9487
}
9588

9689
networkStatusChecker(): void {
97-
this.onlineEvent = fromEvent(window, 'online');
98-
this.offlineEvent = fromEvent(window, 'offline');
90+
this.onlineEvent$ = fromEvent(window, 'online');
91+
this.offlineEvent$ = fromEvent(window, 'offline');
9992

10093
this.subscriptions.push(
101-
this.onlineEvent.subscribe(() => {
94+
this.onlineEvent$.subscribe(() => {
10295
this.networkStatus = 'online';
10396
this.networkStatusMessage = $localize`Vous êtes de nouveau en ligne.`;
104-
this.showHideNetworkStatus();
97+
this.toggleNetworkStatus();
10598
})
10699
);
107100

108101
this.subscriptions.push(
109-
this.offlineEvent.subscribe(() => {
102+
this.offlineEvent$.subscribe(() => {
110103
this.networkStatus = 'offline';
111-
this.networkStatusMessage = $localize`Connexion perdue ! Vous n'êtes pas connecté à l'Internet`;
112-
this.showHideNetworkStatus();
104+
this.networkStatusMessage = $localize`Vous n'êtes pas connecté à l'Internet`;
105+
this.toggleNetworkStatus();
113106
})
114107
);
115108
}

0 commit comments

Comments
 (0)