Skip to content
Snippets Groups Projects
Select Git revision
  • develop default protected
  • add-favorite-albums
  • 896-add-electron-support
  • dark-theme
  • webdav
  • live-streaming
  • 0.19.0
  • 0.19.0-rc2
  • 0.19.0-rc1
  • 0.18.3
  • 0.18.2
  • 0.18.1
  • 0.18
  • 0.17
  • 0.16.3
  • 0.16.2
  • 0.16.1
  • 0.16
  • 0.15
  • 0.14.2
  • 0.14.1
  • 0.14
  • 0.13
  • 0.12
  • 0.11
  • 0.10
26 results

Button.vue

Blame
  • Forked from funkwhale / funkwhale
    7599 commits behind the upstream repository.
    Button.vue 1.10 KiB
    <template>
      <button @click="toggleRadio" :class="['ui', 'blue', {'inverted': running}, 'button']">
        <i class="ui feed icon"></i>
        <template v-if="running">Stop</template>
        <template v-else>Start</template>
        radio
      </button>
    </template>
    
    <script>
    
    export default {
      props: {
        customRadioId: {required: false},
        type: {type: String, required: false},
        objectId: {type: Number, default: null}
      },
      methods: {
        toggleRadio () {
          if (this.running) {
            this.$store.dispatch('radios/stop')
          } else {
            this.$store.dispatch('radios/start', {type: this.type, objectId: this.objectId, customRadioId: this.customRadioId})
          }
        }
      },
      computed: {
        running () {
          let state = this.$store.state.radios
          let current = state.current
          if (!state.running) {
            return false
          } else {
            return current.type === this.type && current.objectId === this.objectId && current.customRadioId === this.customRadioId
          }
        }
      }
    }
    </script>
    
    <!-- Add "scoped" attribute to limit CSS to this component only -->
    <style scoped>
    i {
      cursor: pointer;
    }
    </style>