[Media UI] Don't display the torrent menu entry if no torrent plugin is enabled.

This commit is contained in:
Fabio Manganiello 2024-01-08 22:25:10 +01:00
parent 5ef7313bdc
commit deaedf2462
Signed by: blacklight
GPG key ID: D90FBA7F76362774
2 changed files with 19 additions and 3 deletions

View file

@ -8,7 +8,9 @@
@seek="seek" @search="search" @mute="toggleMute" @unmute="toggleMute">
<main>
<div class="nav-container from tablet" :style="navContainerStyle">
<Nav :selected-view="selectedView" @input="selectedView = $event"
<Nav :selected-view="selectedView"
:torrent-plugin="torrentPlugin"
@input="selectedView = $event"
@toggle="forceShowNav = !forceShowNav" />
</div>

View file

@ -4,7 +4,7 @@
<i class="fa fa-bars" />
</button>
<li v-for="(view, name) in views" :key="name" :title="view.displayName"
<li v-for="(view, name) in displayedViews" :key="name" :title="view.displayName"
:class="{selected: name === selectedView}" @click="$emit('input', name)">
<i :class="view.iconClass" />
</li>
@ -24,6 +24,10 @@ export default {
default: false,
},
torrentPlugin: {
type: String,
},
views: {
type: Object,
default: () => {
@ -46,6 +50,16 @@ export default {
}
},
},
computed: {
displayedViews() {
const views = {...this.views}
if (!this.torrentPlugin?.length)
delete views.torrents
return views
},
},
}
</script>