Skip to content
Permalink
Browse files

Filter by set in home wildcards

  • Loading branch information...
Manuel-777 committed Apr 26, 2019
1 parent 8aa1264 commit 4f0eefe3f851ae98c3eeb4d90414c5916de7f792
Showing with 51 additions and 9 deletions.
  1. +2 −6 window_main/collection.js
  2. +39 −2 window_main/home.js
  3. +7 −0 window_main/index.css
  4. +3 −1 window_main/renderer.js
@@ -43,12 +43,8 @@ function openCollectionTab() {
}

orderedSets.sort((a, b) => {
if (setsList[a].release < setsList[b].release) {
return 1;
}
if (setsList[a].release > setsList[b].release) {
return -1;
}
if (a.release < b.release) return 1;
if (a.release > b.release) return -1;
return 0;
});

@@ -1,5 +1,6 @@
/*
global
filteredWildcardsSet,
timestamp,
$$,
userName,
@@ -14,6 +15,8 @@ global
authToken,
discordTag,
shell,
setsList,
showLoadingBars,
pop,
toHHMMSS,
createDivision
@@ -222,21 +225,55 @@ function open_home_tab(arg, opentab = true) {
let ti = $(this).attr("id");
if (ti == "create") {
createTournament();
}
else {
} else {
document.body.style.cursor = "progress";
ipc_send("tou_get", ti);
}
});
});

let orderedSets = [];
for (let set in setsList) {
if (set.collation !== false) {
orderedSets.push(set);
}
}

orderedSets.sort((a, b) => {
if (a.release < b.release) return 1;
if (a.release > b.release) return -1;
return 0;
});

if (topWildcards) {
d = createDivision(["list_fill"]);
mainDiv.appendChild(d);
title = createDivision(["card_tile_separator"], "Top Wildcards redeemed");
title.setAttribute("tooltip-content", "In the last 15 days.");
title.setAttribute("tooltip-bottom", "");
mainDiv.appendChild(title);

let setsContainer = createDivision(["top_wildcards_sets_cont"]);
orderedSets.forEach(set => {
let setbutton = createDivision(["set_filter"]);
if (filteredWildcardsSet !== set) {
setbutton.classList.add("set_filter_on");
}
setbutton.style.backgroundImage = `url(../images/sets/${
setsList[set].code
}.png)`;
setbutton.title = set;

setsContainer.appendChild(setbutton);
setbutton.addEventListener("click", () => {
setbutton.classList.remove("set_filter_on");
filteredWildcardsSet = set;
showLoadingBars();
ipc_send("request_home", filteredWildcardsSet);
});
});

mainDiv.appendChild(setsContainer);
cont = createDivision(["top_wildcards_cont"]);

let cell;
@@ -3088,6 +3088,13 @@ a:hover {
color: #fae5d2;
}

.top_wildcards_sets_cont {
justify-content: center;
width: 100%;
height: 64px;
display: flex;
}

.top_wildcards_set_icon {
background-repeat: no-repeat;
background-size: contain;
@@ -111,6 +111,8 @@ let rewards_daily_ends = new Date();
let rewards_weekly_ends = new Date();
let activeEvents = [];

let filteredWildcardsSet = "";

let deck_tags = {};
let tags_colors = {};
let authToken = null;
@@ -924,7 +926,7 @@ $(document).ready(function() {
open_home_tab(null, true);
} else {
document.body.style.cursor = "progress";
ipc_send("request_home", "");
ipc_send("request_home", filteredWildcardsSet);
}
}
}

0 comments on commit 4f0eefe

Please sign in to comment.
You can’t perform that action at this time.