2020-11-21 06:23:40 +00:00
|
|
|
<!-- TODO: return filteredPlatforms getter and return sort/filters -->
|
2020-08-22 18:59:58 +00:00
|
|
|
<template lang="html">
|
2020-11-23 23:15:43 +00:00
|
|
|
<b-list-group class="platforms mb-3">
|
|
|
|
<b-list-group-item
|
|
|
|
v-for="platform in filteredPlatforms"
|
|
|
|
:key="platform.id"
|
|
|
|
button
|
|
|
|
:active="value.includes(platform.id)"
|
|
|
|
@click="handleClick(platform.id)"
|
2020-10-14 23:57:10 +00:00
|
|
|
>
|
2020-11-23 23:15:43 +00:00
|
|
|
<b-img
|
|
|
|
:src="`/static/platform-logos/${platform.slug}.${platform.logoFormat}`"
|
|
|
|
:alt="platform.name"
|
2020-12-21 18:10:01 +00:00
|
|
|
width="60"
|
|
|
|
thumbnail
|
2020-11-23 23:15:43 +00:00
|
|
|
class="pr-2"
|
|
|
|
/>
|
2020-11-21 06:23:40 +00:00
|
|
|
|
2020-11-23 23:15:43 +00:00
|
|
|
{{ platform.name }}
|
|
|
|
</b-list-group-item>
|
|
|
|
</b-list-group>
|
2020-08-22 18:59:58 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-11-23 23:15:43 +00:00
|
|
|
import { mapState, mapGetters } from 'vuex';
|
2020-08-22 18:59:58 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
value: Array,
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
2020-12-09 23:30:52 +00:00
|
|
|
...mapState(['platforms', 'settings']),
|
2020-11-23 23:15:43 +00:00
|
|
|
...mapGetters(['filteredPlatforms']),
|
2020-10-14 23:20:25 +00:00
|
|
|
|
2020-11-21 06:23:40 +00:00
|
|
|
buttonLabel() {
|
2020-10-14 23:20:25 +00:00
|
|
|
return this.value.length
|
|
|
|
? this.$t('board.settings.platformLabel', { platformCount: this.value.length })
|
|
|
|
: this.$t('board.settings.platformPlaceholder');
|
|
|
|
},
|
2020-08-22 18:59:58 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
handleClick(platformId) {
|
|
|
|
if (this.value.includes(platformId)) {
|
|
|
|
this.removePlatform(platformId);
|
|
|
|
} else {
|
|
|
|
this.selectPlatform(platformId);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
selectPlatform(platformId) {
|
|
|
|
this.value.push(platformId);
|
|
|
|
},
|
|
|
|
|
|
|
|
removePlatform(platformId) {
|
|
|
|
const index = this.value.indexOf(platformId);
|
|
|
|
|
|
|
|
this.value.splice(index, 1);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|