mirror of
https://github.com/koel/koel
synced 2024-09-20 06:11:53 +00:00
feat(plus): suggests to show public songs if song list is empty
This commit is contained in:
parent
1f9f053c0d
commit
024db0b988
2 changed files with 21 additions and 12 deletions
|
@ -42,6 +42,14 @@
|
||||||
<Icon :icon="faVolumeOff" />
|
<Icon :icon="faVolumeOff" />
|
||||||
</template>
|
</template>
|
||||||
Your library is empty.
|
Your library is empty.
|
||||||
|
<a
|
||||||
|
role="button"
|
||||||
|
class="d-block secondary"
|
||||||
|
v-if="isPlus && ownSongsOnly"
|
||||||
|
@click.prevent="showSongsFromOthers"
|
||||||
|
>
|
||||||
|
Show public songs from other users?
|
||||||
|
</a>
|
||||||
</ScreenEmptyState>
|
</ScreenEmptyState>
|
||||||
</template>
|
</template>
|
||||||
</section>
|
</section>
|
||||||
|
@ -112,6 +120,11 @@ const sort = async (field: SongListSortField, order: SortOrder) => {
|
||||||
await fetchSongs()
|
await fetchSongs()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const showSongsFromOthers = async () => {
|
||||||
|
ownSongsOnly.value = false
|
||||||
|
await fetchSongs()
|
||||||
|
}
|
||||||
|
|
||||||
const fetchSongs = async () => {
|
const fetchSongs = async () => {
|
||||||
if (!moreSongsAvailable.value || loading.value) return
|
if (!moreSongsAvailable.value || loading.value) return
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,20 @@
|
||||||
<template>
|
<template>
|
||||||
<span :class="checked && 'checked'">
|
<span :class="value && 'checked'">
|
||||||
<input :checked="checked" type="checkbox" v-bind="$attrs" @input="onInput">
|
<input :checked="value" type="checkbox" v-bind="$attrs" v-model="value">
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from 'vue'
|
import { computed } from 'vue'
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{ modelValue?: any }>(), {
|
const props = withDefaults(defineProps<{ modelValue?: any }>(), { modelValue: false })
|
||||||
modelValue: false
|
|
||||||
})
|
|
||||||
|
|
||||||
const checked = ref(props.modelValue)
|
|
||||||
|
|
||||||
const emit = defineEmits<{ (e: 'update:modelValue', value: boolean): void }>()
|
const emit = defineEmits<{ (e: 'update:modelValue', value: boolean): void }>()
|
||||||
|
|
||||||
const onInput = (event: Event) => {
|
const value = computed({
|
||||||
checked.value = (event.target as HTMLInputElement).checked
|
get: () => props.modelValue,
|
||||||
emit('update:modelValue', checked.value)
|
set: value => emit('update:modelValue', value)
|
||||||
}
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
Loading…
Reference in a new issue