Skip to content
This repository has been archived by the owner on Mar 19, 2021. It is now read-only.

Commit

Permalink
Flash any icon, no data poe.ninja shows yellow icon, update flashes icon
Browse files Browse the repository at this point in the history
  • Loading branch information
klayveR committed Sep 25, 2018
1 parent e7a8b07 commit 86b64c4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
<div class="button" data-button="settings"><i class="fas fa-cog grey"></i></div>
<div class="button" data-button="update"><i class="fas fa-sync-alt grey"></i></div>
<div class="button" data-button="close-all"><i class="fas fa-times-circle grey"></i></div>
<div class="button" data-button="download" style="display: none"><i class="fas fa-download"></i></div>
<div class="button" data-button="status" style="display: none"><i class="fas fa-exclamation-circle red"></i></div>
</div>
<div class="middle"></div>
Expand Down
12 changes: 8 additions & 4 deletions src/modules/gui/gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,13 +335,16 @@ class GUI {

/**
* Flashes the error icon in the menu bar
*
* @param {string} icon Font awesome icon class
*/
static flashErrorIcon() {
static flashIcon(icon = "fas fa-exclamation-circle red") {
var statusButton = $(".menu").find("[data-button='status']");
var statusIcon = statusButton.find("i");

statusButton.stop(true, true);
statusIcon.removeClass();
statusIcon.addClass("fas fa-exclamation-circle red");
statusIcon.addClass(icon);
statusButton.show().delay(1000).fadeOut("slow");
}

Expand All @@ -355,9 +358,10 @@ class GUI {
updateEntry.setId("update-entry");
updateEntry.add();

GUI.flashIcon("fas fa-box blue");

$(".entry[data-id='" + updateEntry.getId() + "']").find("[data-entry-link='download']").click(function() {
ipcRenderer.send("download-update");
$(".menu").find("[data-button='download']").show();

updateEntry.setTitle("Downloading <span>v" + info.version + "</span>...");
updateEntry.setText("");
Expand All @@ -377,7 +381,7 @@ class GUI {
updateEntry.setText("XenonTrade <span>v" + info.version + "</span> has been downloaded. It will be automatically installed after closing XenonTrade.<br /><i class='fas fa-arrow-right'></i> <span data-entry-link='install'>Install now</span>");
updateEntry.setCloseable();

$(".menu").find("[data-button='download']").hide();
GUI.flashIcon("fas fa-download blue");

$(".entry[data-id='" + updateEntry.getId() + "']").find("[data-entry-link='install']").click(function() {
ipcRenderer.send("install-update");
Expand Down
4 changes: 2 additions & 2 deletions src/modules/pricecheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Pricecheck {
} else if(itemType !== "Magic" && !ninjaAPI.isUpdating()) {
Pricecheck._getNinjaPrice(parser);
} else {
GUI.flashErrorIcon();
GUI.flashIcon("fas fa-exclamation-circle red");
}
}
}
Expand All @@ -40,7 +40,7 @@ class Pricecheck {
return Pricecheck._handleNinjaPrice(parser, itemArray[0]);
})
.catch((error) => {
return GUI.flashErrorIcon();
return GUI.flashIcon("fas fa-exclamation-circle yellow");
});
} else {
new TextEntry("No data", "There's no data for " + config.get("league") + ". You should update before attempting to price check another item.", {icon: "fa-exclamation-triangle yellow", timeout: 10}).add();
Expand Down

0 comments on commit 86b64c4

Please sign in to comment.