Skip to content

Commit

Permalink
Gear dropdown filters set up to include current item if the item leve…
Browse files Browse the repository at this point in the history
…l of it is lower than the filters allow
  • Loading branch information
freyamade committed Jan 21, 2022
1 parent d9bb9c4 commit 7c4e747
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion frontend/src/components/gear_dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="select is-fullwidth" :class="{'is-danger': error !== undefined}">
<select ref="dropdown" :value="value" @input="handleInput">
<option value="-1">Select Gear</option>
<option v-for="gear in choices" :key="gear.id" :value="gear.id">{{ gear.name }} ({{ gear.item_level }})</option>
<option v-for="item in gear" :key="item.id" :value="item.id">{{ item.name }} ({{ item.item_level }})</option>
</select>
</div>
</div>
Expand All @@ -31,6 +31,12 @@ export default class GearDropdown extends Vue {
@Prop()
error!: string[] | undefined
@Prop()
maxIl!: number
@Prop()
minIl!: number
@Prop()
name!: string
Expand All @@ -41,6 +47,10 @@ export default class GearDropdown extends Vue {
return this.$refs.dropdown as HTMLSelectElement
}
get gear(): Gear[] {
return this.choices.filter((item: Gear) => item.id === this.value || (item.item_level <= this.maxIl && item.item_level >= this.minIl))
}
handleInput(): void {
this.$emit('input', this.dropdown.value)
}
Expand Down

0 comments on commit 7c4e747

Please sign in to comment.