2018-08-22 15:54:22 +09:00
|
|
|
<template>
|
|
|
|
<button
|
|
|
|
class="mk-mute-button"
|
|
|
|
:class="{ active: user.isMuted }"
|
|
|
|
@click="onClick">
|
|
|
|
<span v-if="!user.isMuted">%fa:eye-slash% %i18n:@mute%</span>
|
|
|
|
<span v-else>%fa:eye% %i18n:@unmute%</span>
|
|
|
|
</button>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue'
|
|
|
|
export default Vue.extend({
|
|
|
|
props: {
|
|
|
|
user: {
|
|
|
|
type: Object,
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onClick() {
|
|
|
|
if (!this.user.isMuted) {
|
|
|
|
this.mute();
|
|
|
|
} else {
|
|
|
|
this.unmute();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mute() {
|
|
|
|
(this as any).api('mute/create', { userId: this.user.id})
|
|
|
|
.then(() => { this.user.isMuted = true })
|
|
|
|
.catch(() => { alert('error')})
|
|
|
|
},
|
|
|
|
unmute() {
|
|
|
|
(this as any).api('mute/delete', { userId: this.user.id })
|
|
|
|
.then(() => { this.user.isMuted = false })
|
|
|
|
.catch(() => { alert('error') })
|
|
|
|
}
|
|
|
|
},
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
2018-09-26 20:19:35 +09:00
|
|
|
|
2018-08-22 15:54:22 +09:00
|
|
|
|
|
|
|
.mk-mute-button
|
|
|
|
display block
|
2018-09-26 20:19:35 +09:00
|
|
|
user-select none
|
2018-08-22 15:54:22 +09:00
|
|
|
cursor pointer
|
|
|
|
padding 0 16px
|
|
|
|
margin 0
|
|
|
|
min-width 100px
|
|
|
|
line-height 36px
|
|
|
|
font-size 14px
|
|
|
|
font-weight bold
|
2018-09-26 20:19:35 +09:00
|
|
|
color var(--primary)
|
2018-08-22 15:54:22 +09:00
|
|
|
background transparent
|
|
|
|
outline none
|
2018-09-26 20:19:35 +09:00
|
|
|
border solid 1px var(--primary)
|
2018-08-22 15:54:22 +09:00
|
|
|
border-radius 36px
|
|
|
|
|
|
|
|
&:hover
|
2018-09-26 20:19:35 +09:00
|
|
|
background var(--primaryAlpha01)
|
2018-08-22 15:54:22 +09:00
|
|
|
|
|
|
|
&:active
|
2018-09-26 20:19:35 +09:00
|
|
|
background var(--primaryAlpha02)
|
2018-08-22 15:54:22 +09:00
|
|
|
|
|
|
|
&.active
|
2018-09-26 20:19:35 +09:00
|
|
|
color var(--primaryForeground)
|
|
|
|
background var(--primary)
|
2018-08-22 15:54:22 +09:00
|
|
|
|
|
|
|
&:hover
|
2018-09-26 20:19:35 +09:00
|
|
|
background var(--primaryLighten10)
|
|
|
|
border-color var(--primaryLighten10)
|
2018-08-22 15:54:22 +09:00
|
|
|
&:active
|
2018-09-26 20:19:35 +09:00
|
|
|
background var(--primaryDarken10)
|
|
|
|
border-color var(--primaryDarken10)
|
2018-08-22 15:54:22 +09:00
|
|
|
|
|
|
|
</style>
|