Skip to content

Commit

Permalink
Adding mana information in card list (#98)
Browse files Browse the repository at this point in the history
* Adding mana information in card list

* Removing unneeded console log

* Added missing mana cost column header in deck view
  • Loading branch information
Fightlapa authored Aug 11, 2022
1 parent cdf038b commit e117c11
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions webapp/src/views/Decks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@
<option value="darkness">Darkness</option>
</select>
</th>
<th>
<div class="sort-btn" @click="toggleSort('manaCost')">
Mana
<img
class="sort-ico"
width="25px"
:src="`/assets/images/${sortIcons.manaCost}.png`"
/>
</div>
</th>
<th>
<div class="sort-btn" @click="toggleSort('family')">
Race
Expand Down Expand Up @@ -133,6 +143,7 @@
<td>{{ card.name }}</td>
<td class="set">{{ card.set }}</td>
<td class="civilization">{{ card.civilization }}</td>
<td class="manaCost">{{ card.manaCost }}</td>
<td class="family">{{ card.family || "Spell" }}</td>
</tr>
</table>
Expand Down Expand Up @@ -209,6 +220,7 @@
<th>Card Name</th>
<th>Set</th>
<th>Civilization</th>
<th>Mana</th>
<th>Race</th>
</tr>
<template v-if="selectedDeck">
Expand All @@ -232,6 +244,7 @@
<td>{{ card.name }}</td>
<td class="set">{{ card.set }}</td>
<td class="civilization">{{ card.civilization }}</td>
<td class="manaCost">{{ card.manaCost }}</td>
<td class="civilization">{{ card.family }}</td>
</tr>
</template>
Expand Down Expand Up @@ -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;
Expand All @@ -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"
};
Expand Down

0 comments on commit e117c11

Please sign in to comment.