From e117c114d7ead8af7061ff7d9eaf7c12c6bfa266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jab=C5=82o=C5=84ski?= Date: Thu, 11 Aug 2022 16:25:54 +0200 Subject: [PATCH] Adding mana information in card list (#98) * Adding mana information in card list * Removing unneeded console log * Added missing mana cost column header in deck view --- webapp/src/views/Decks.vue | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/webapp/src/views/Decks.vue b/webapp/src/views/Decks.vue index da27082d..dff8e0b4 100644 --- a/webapp/src/views/Decks.vue +++ b/webapp/src/views/Decks.vue @@ -99,6 +99,16 @@ + +
+ Mana + +
+
Race @@ -133,6 +143,7 @@ {{ card.name }} {{ card.set }} {{ card.civilization }} + {{ card.manaCost }} {{ card.family || "Spell" }} @@ -209,6 +220,7 @@ Card Name Set Civilization + Mana Race @@ -536,8 +549,9 @@ export default { cards.sort( (c1, c2) => - this.sort.directionNum * - c1[this.sort.by].localeCompare(c2[this.sort.by]) + (c1[this.sort.by] === parseInt(c1[this.sort.by], 10) && c2[this.sort.by] === parseInt(c2[this.sort.by], 10)) ? + this.sort.directionNum * (c1[this.sort.by] < c2[this.sort.by] ? -1 : c1[this.sort.by] > c2[this.sort.by] ? 1 : 0) : + this.sort.directionNum * c1[this.sort.by].localeCompare(c2[this.sort.by]) ); return cards; @@ -548,6 +562,7 @@ export default { name: "arrow_up_down", set: "arrow_up_down", civilization: "arrow_up_down", + manaCost: "arrow_up_down", family: "arrow_up_down" };