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

View file

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