Skip to content
Permalink
Browse files

archive matches

  • Loading branch information...
Manuel-777 committed May 8, 2019
1 parent 2098fbb commit 6c25fe82443082c435f10c3cc79e78bacee93d45
Showing with 15 additions and 25 deletions.
  1. +1 −0 shared/Aggregator.js
  2. +3 −13 window_background/background.js
  3. +11 −12 window_main/history.js
@@ -151,6 +151,7 @@ class Aggregator {

filterMatch(match) {
if (!match) return false;
if (match.archived && match.archived == true) return false;
const { eventId, oppColors, arch, date } = this.filters;

const passesEventFilter =
@@ -432,20 +432,10 @@ ipc.on("delete_deck", function(event, arg) {
});

//
ipc.on("delete_match", function(event, arg) {
ipc.on("archive_match", function(event, arg) {
ipc_send("show_loading");
var i = history.matches.indexOf(arg);
if (i > -1) {
history.matches.splice(i, 1);
store.set("matches_index", history.matches);
store.delete(arg);
}
i = drafts.matches.indexOf(arg);
if (i > -1) {
drafts.matches.splice(i, 1);
store.set("draft_index", drafts.matches);
store.delete(arg);
}
history[arg].archived = true;
store.set(arg, history[arg]);
ipc_send("hide_loading");
});

@@ -388,8 +388,9 @@ function open_history_tab(loadMore, _filters = {}) {
if (match.type == "draft") {
addShare(match);
}
deleteMatch(match);
addHover(match, tileGrpid);

archiveMatch(match, fldel, div);
}

$(this).off();
@@ -416,6 +417,15 @@ function open_history_tab(loadMore, _filters = {}) {
//loadHistory = actuallyLoaded;
}

function archiveMatch(match, fldel, div) {
fldel.addEventListener("click", e => {
e.stopPropagation();
ipc_send("archive_match", match.id);
div.style.height = "0px";
div.style.overflow = "hidden";
});
}

function formatPercent(percent, precision) {
// Utility function: converts a number to rounded percent
// converts number to percent
@@ -852,17 +862,6 @@ function draftShareLink() {
ipc_send("request_draft_link", obj);
}

function deleteMatch(_match) {
$("." + _match.id + "_del").on("click", function(e) {
let currentId = _match.id;
e.stopPropagation();
ipc_send("delete_match", currentId);
let deleteButton = $$("." + currentId)[0];
deleteButton.style.height = "0px";
deleteButton.style.overflow = "hidden";
});
}

function sort_history() {
matchesHistory.matches.sort(compare_matches);

0 comments on commit 6c25fe8

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