Mise en place d'un composant permettant d'améliorer l'experience de mise à jour (via un rafraichissement de l'appli).
Modification de la partie web pour prendre la modification en compte
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<div
|
||||
class="update-banner"
|
||||
*ngIf="versionChecker.hasUpdate() && !dismissed"
|
||||
role="status"
|
||||
aria-live="polite"
|
||||
>
|
||||
<div class="banner-content">
|
||||
<lucide-icon [img]="RefreshCw" [size]="16"></lucide-icon>
|
||||
<span>
|
||||
Une nouvelle version de LoreMind est disponible
|
||||
(<strong>{{ versionChecker.remoteVersion() }}</strong>).
|
||||
Recharge pour profiter des dernieres ameliorations.
|
||||
</span>
|
||||
</div>
|
||||
<div class="banner-actions">
|
||||
<button type="button" class="btn-reload" (click)="reload()">
|
||||
Recharger
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-dismiss"
|
||||
(click)="dismiss()"
|
||||
title="Fermer (sera reaffiche au prochain demarrage)"
|
||||
aria-label="Fermer"
|
||||
>
|
||||
<lucide-icon [img]="X" [size]="16"></lucide-icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,68 @@
|
||||
.update-banner {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 9999;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
padding: 10px 20px;
|
||||
background: linear-gradient(90deg, #6d28d9, #7c3aed);
|
||||
color: #fff;
|
||||
font-size: 0.9rem;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
||||
|
||||
.banner-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.banner-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.btn-reload {
|
||||
background: #fff;
|
||||
color: #6d28d9;
|
||||
border: 0;
|
||||
padding: 6px 14px;
|
||||
border-radius: 4px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
font-size: 0.85rem;
|
||||
|
||||
&:hover {
|
||||
background: rgba(255, 255, 255, 0.92);
|
||||
}
|
||||
}
|
||||
|
||||
.btn-dismiss {
|
||||
background: transparent;
|
||||
border: 0;
|
||||
color: rgba(255, 255, 255, 0.85);
|
||||
cursor: pointer;
|
||||
padding: 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 4px;
|
||||
|
||||
&:hover {
|
||||
background: rgba(255, 255, 255, 0.15);
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Decale le contenu de l'app vers le bas quand le bandeau est present
|
||||
// (bandeau fixed, ne pousse pas naturellement le layout).
|
||||
:host:has(.update-banner) {
|
||||
display: block;
|
||||
}
|
||||
34
web/src/app/shared/update-banner/update-banner.component.ts
Normal file
34
web/src/app/shared/update-banner/update-banner.component.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { LucideAngularModule, RefreshCw, X } from 'lucide-angular';
|
||||
import { VersionCheckerService } from '../../services/version-checker.service';
|
||||
|
||||
/**
|
||||
* Bandeau global affiche en haut de l'app quand une nouvelle version de
|
||||
* LoreMind a ete deployee pendant que l'utilisateur avait deja l'onglet
|
||||
* ouvert. Propose un reload en un clic.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'app-update-banner',
|
||||
standalone: true,
|
||||
imports: [CommonModule, LucideAngularModule],
|
||||
templateUrl: './update-banner.component.html',
|
||||
styleUrls: ['./update-banner.component.scss']
|
||||
})
|
||||
export class UpdateBannerComponent {
|
||||
readonly RefreshCw = RefreshCw;
|
||||
readonly X = X;
|
||||
|
||||
/** L'utilisateur a explicitement ferme le bandeau pour cette session. */
|
||||
dismissed = false;
|
||||
|
||||
constructor(public versionChecker: VersionCheckerService) {}
|
||||
|
||||
reload(): void {
|
||||
this.versionChecker.reload();
|
||||
}
|
||||
|
||||
dismiss(): void {
|
||||
this.dismissed = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user