mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-22 01:57:44 +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:
committed by
GitHub
parent
aa6d3eba60
commit
cde2967ef6
@@ -19,19 +19,30 @@ export class NewsButton extends LitElement {
|
||||
try {
|
||||
const lastSeenVersion = localStorage.getItem("version");
|
||||
this.isActive = lastSeenVersion !== version;
|
||||
if (this.isActive) {
|
||||
setTimeout(() => {
|
||||
this.openNewsModel();
|
||||
}, 500);
|
||||
}
|
||||
} catch (error) {
|
||||
// Fallback to NOT showing notification if localStorage fails
|
||||
this.isActive = false;
|
||||
}
|
||||
localStorage.setItem("version", version);
|
||||
}
|
||||
|
||||
private handleClick() {
|
||||
localStorage.setItem("version", version);
|
||||
this.isActive = false;
|
||||
this.openNewsModel();
|
||||
}
|
||||
|
||||
private openNewsModel() {
|
||||
const newsModal = document.querySelector("news-modal") as NewsModal;
|
||||
if (newsModal) {
|
||||
newsModal.open();
|
||||
} else {
|
||||
console.log("no newsModal");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user