adds requests state for Request component
This commit is contained in:
@@ -1,21 +1,40 @@
|
||||
<template>
|
||||
<button class="button is-primary" disabled>
|
||||
<div>
|
||||
<button class="button is-primary is-fullwidth"
|
||||
@click="putRequest"
|
||||
:disabled="isRequested">
|
||||
<span class="icon">
|
||||
<i class="fas fa-praying-hands"></i>
|
||||
</span>
|
||||
<small>Request pending...</small>
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
<script>
|
||||
import { store } from '../App.vue'
|
||||
export default {
|
||||
props: ["item"],
|
||||
data () {
|
||||
return {
|
||||
state: store.state,
|
||||
_requested: false, // Dummy state
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
||||
}
|
||||
// Check if item is requested by active player
|
||||
isRequested () {
|
||||
const reqs = this.state.requests[this.state.player_id];
|
||||
return reqs.includes(this.item);
|
||||
},
|
||||
// Check if item is requested by multiple players including active one
|
||||
isInConflict () {
|
||||
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
putRequest () {
|
||||
store.putRequest(this.item)
|
||||
},
|
||||
},
|
||||
}
|
||||
</style>
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user