mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-08-07 11:09:34 +00:00
feat: display changelog modal on new version to improve awareness (#2403)
## Description: Following discussion on discord, some people (including me) thought it would be nice to show the changelog whenever there is a new version, as people seemed not to be aware of the gameplay change https://github.com/user-attachments/assets/00b9531d-ea7a-4e69-8a01-64ef3b39536b ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: sorikairo
This commit is contained in:
@@ -19,19 +19,30 @@ export class NewsButton extends LitElement {
|
|||||||
try {
|
try {
|
||||||
const lastSeenVersion = localStorage.getItem("version");
|
const lastSeenVersion = localStorage.getItem("version");
|
||||||
this.isActive = lastSeenVersion !== version;
|
this.isActive = lastSeenVersion !== version;
|
||||||
|
if (this.isActive) {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.openNewsModel();
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Fallback to NOT showing notification if localStorage fails
|
// Fallback to NOT showing notification if localStorage fails
|
||||||
this.isActive = false;
|
this.isActive = false;
|
||||||
}
|
}
|
||||||
|
localStorage.setItem("version", version);
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleClick() {
|
private handleClick() {
|
||||||
localStorage.setItem("version", version);
|
localStorage.setItem("version", version);
|
||||||
this.isActive = false;
|
this.isActive = false;
|
||||||
|
this.openNewsModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
private openNewsModel() {
|
||||||
const newsModal = document.querySelector("news-modal") as NewsModal;
|
const newsModal = document.querySelector("news-modal") as NewsModal;
|
||||||
if (newsModal) {
|
if (newsModal) {
|
||||||
newsModal.open();
|
newsModal.open();
|
||||||
|
} else {
|
||||||
|
console.log("no newsModal");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user