[Media UI] Added media view to URL fragment.

This commit is contained in:
Fabio Manganiello 2024-07-15 22:34:32 +02:00
parent e180c9c76f
commit a746273f73
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774
2 changed files with 23 additions and 5 deletions

View file

@ -19,7 +19,7 @@
<Nav :selected-view="selectedView"
:torrent-plugin="torrentPlugin"
:download-icon-class="downloadIconClass"
@input="onNavInput"
@input="setView"
@toggle="forceShowNav = !forceShowNav"
/>
</div>
@ -544,13 +544,20 @@ export default {
}, {})
},
onNavInput(event) {
this.selectedView = event
if (event === 'search') {
setView(title) {
this.selectedView = title
if (title === 'search') {
this.selectedResult = null
}
},
updateView() {
const args = this.getUrlArgs()
if (args.view) {
this.selectedView = args.view
}
},
onDownloadStarted(event) {
this.downloads[event.path] = event
this.notify({
@ -679,6 +686,7 @@ export default {
this.sources.jellyfin = true
await this.refreshDownloads()
this.updateView()
},
destroy() {

View file

@ -5,14 +5,17 @@
</button>
<li v-for="(view, name) in displayedViews" :key="name" :title="view.displayName"
:class="{selected: name === selectedView, ...customClasses[name]}" @click="$emit('input', name)">
:class="{selected: name === selectedView, ...customClasses[name]}" @click="input(name)">
<i :class="view.iconClass" />
</li>
</nav>
</template>
<script>
import Utils from '@/Utils';
export default {
mixins: [Utils],
emits: ['input', 'toggle'],
props: {
selectedView: {
@ -78,6 +81,13 @@ export default {
}
},
},
methods: {
input(view) {
this.$emit('input', view)
this.setUrlArgs({view: view})
},
},
}
</script>