Add basic deck builder #12
1 changed files with 14 additions and 0 deletions
|
@ -17,6 +17,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
<b-input
|
||||||
|
@input="ruleChanged"
|
||||||
|
v-model="ruleFilter"
|
||||||
|
placeholder="Search rule text"
|
||||||
|
></b-input>
|
||||||
<div class="setfilter" v-for="set in sets" :key="set">
|
<div class="setfilter" v-for="set in sets" :key="set">
|
||||||
<img
|
<img
|
||||||
@click="toggleSetFilter(set)"
|
@click="toggleSetFilter(set)"
|
||||||
|
@ -283,6 +288,7 @@ export default class DeckBuilder extends Vue {
|
||||||
|
|
||||||
// User Filters
|
// User Filters
|
||||||
private nameFilter!: string;
|
private nameFilter!: string;
|
||||||
|
private ruleFilter!: string;
|
||||||
private setFilters!: string[];
|
private setFilters!: string[];
|
||||||
private elementFilters!: string[];
|
private elementFilters!: string[];
|
||||||
|
|
||||||
|
@ -297,6 +303,7 @@ export default class DeckBuilder extends Vue {
|
||||||
rows: 2,
|
rows: 2,
|
||||||
columns: 5,
|
columns: 5,
|
||||||
nameFilter: "",
|
nameFilter: "",
|
||||||
|
ruleFilter: "",
|
||||||
setFilters: [],
|
setFilters: [],
|
||||||
elementFilters: [],
|
elementFilters: [],
|
||||||
colors: colorNames,
|
colors: colorNames,
|
||||||
|
@ -319,6 +326,9 @@ export default class DeckBuilder extends Vue {
|
||||||
if (this.nameFilter.length > 0) {
|
if (this.nameFilter.length > 0) {
|
||||||
filters.Name = this.nameFilter;
|
filters.Name = this.nameFilter;
|
||||||
}
|
}
|
||||||
|
if (this.ruleFilter.length > 0) {
|
||||||
|
filters.Rules = this.ruleFilter;
|
||||||
|
}
|
||||||
const filtered = await getCards(filters);
|
const filtered = await getCards(filters);
|
||||||
this.filtered = filtered.sort(sortByColor);
|
this.filtered = filtered.sort(sortByColor);
|
||||||
this.offset = 0;
|
this.offset = 0;
|
||||||
|
@ -382,6 +392,10 @@ export default class DeckBuilder extends Vue {
|
||||||
this.applyFilters();
|
this.applyFilters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ruleChanged() {
|
||||||
|
this.applyFilters();
|
||||||
|
}
|
||||||
|
|
||||||
private get canGoPrev(): boolean {
|
private get canGoPrev(): boolean {
|
||||||
return this.offset > 0;
|
return this.offset > 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue