beginning to implement sidebar

This commit is contained in:
Jonas Heinrich 2020-11-14 12:37:51 +01:00
parent 6f010e096e
commit 803a4d2301
2 changed files with 66 additions and 20 deletions

View File

@ -16,29 +16,52 @@
:station-data="tableData" :station-data="tableData"
:favorites="favorites" :favorites="favorites"
@doPlay="doPlay" @doPlay="doPlay"
@doFavor="doFavor" /> @doFavor="doFavor"
@toggleSidebar="toggleSidebar" />
<EmptyContent <EmptyContent
v-if="pageLoading" v-if="pageLoading"
icon="icon-loading" /> icon="icon-loading" />
<EmptyContent <template
v-if="tableData.length === 0 && !pageLoading" v-if="tableData.length === 0 && !pageLoading">
v-show="$route.name==='FAVORITES'" <EmptyContent
icon="icon-star"> v-show="$route.name==='FAVORITES'"
No favorites yet icon="icon-star">
<template #desc> No favorites yet
Stations you mark as favorite will show up here <template #desc>
</template> Stations you mark as favorite will show up here
</EmptyContent> </template>
<EmptyContent </EmptyContent>
v-if="tableData.length === 0 && !pageLoading" <EmptyContent
v-show="$route.name==='SEARCH'" v-if="tableData.length === 0 && !pageLoading"
icon="icon-search"> v-show="$route.name==='SEARCH'"
No search results icon="icon-search">
<template #desc> No search results
No stations were found matching your search term <template #desc>
</template> No stations were found matching your search term
</EmptyContent> </template>
</EmptyContent>
</template>
</AppContent> </AppContent>
<AppSidebar v-show="showSidebar"
:title="sidebarStation.name"
:subtitle="stationTags"
@close="showSidebar=false">
<div>
<h3><span class="icon-tag" /> {{ t('radio', 'Stream URL') }}</h3>
<Multiselect
class="sidebar__tags"
:value="tags"
:auto-limit="false"
:limit="7"
:options="allTags"
:multiple="true"
:taggable="true"
:placeholder="t('bookmarks', 'Select tags and create new ones')"
:disabled="!isEditable"
@input="onTagsChange"
@tag="onAddTag" />
</div>
</AppSidebar>
</Content> </Content>
</template> </template>
@ -48,6 +71,8 @@ import AppContent from '@nextcloud/vue/dist/Components/AppContent'
import Breadcrumbs from '@nextcloud/vue/dist/Components/Breadcrumbs' import Breadcrumbs from '@nextcloud/vue/dist/Components/Breadcrumbs'
import Breadcrumb from '@nextcloud/vue/dist/Components/Breadcrumb' import Breadcrumb from '@nextcloud/vue/dist/Components/Breadcrumb'
import EmptyContent from '@nextcloud/vue/dist/Components/EmptyContent' import EmptyContent from '@nextcloud/vue/dist/Components/EmptyContent'
import AppSidebar from '@nextcloud/vue/dist/Components/AppSidebar'
import AppSidebarTab from '@nextcloud/vue/dist/Components/AppSidebarTab'
import Navigation from './Navigation' import Navigation from './Navigation'
import Table from './Table' import Table from './Table'
import { Howl } from 'howler' import { Howl } from 'howler'
@ -68,17 +93,27 @@ export default {
Breadcrumb, Breadcrumb,
Table, Table,
EmptyContent, EmptyContent,
AppSidebar,
AppSidebarTab,
}, },
data: () => ({ data: () => ({
tableData: [], tableData: [],
pageLoading: false, pageLoading: false,
blurHashes: require('../assets/blurHashes.json'), blurHashes: require('../assets/blurHashes.json'),
favorites: null, favorites: null,
showSidebar: false,
sidebarStation: [],
}), }),
computed: { computed: {
player() { player() {
return this.$store.state.player return this.$store.state.player
}, },
stationTags() {
if (this.sidebarStation.tags) {
return this.sidebarStation.tags.replaceAll(',', ', ')
}
return ''
},
}, },
watch: { watch: {
$route: 'onRoute', $route: 'onRoute',
@ -331,6 +366,11 @@ export default {
vm.favorites = favorites vm.favorites = favorites
}) })
}, },
toggleSidebar(station) {
this.showSidebar = true
this.sidebarStation = station
},
}, },
} }
</script> </script>

View File

@ -44,7 +44,10 @@
@click="doFavor(idx, station)"> @click="doFavor(idx, station)">
{{ t('radio', 'Remove from favorites') }} {{ t('radio', 'Remove from favorites') }}
</ActionButton> </ActionButton>
<ActionButton icon="icon-info" :close-after-click="true"> <ActionButton
icon="icon-info"
:close-after-click="true"
@click="toggleSidebar(station)">
{{ t('radio', 'Details') }} {{ t('radio', 'Details') }}
</ActionButton> </ActionButton>
</Actions> </Actions>
@ -85,6 +88,9 @@ export default {
doFavor(idx, station) { doFavor(idx, station) {
this.$emit('doFavor', station) this.$emit('doFavor', station)
}, },
toggleSidebar(station) {
this.$emit('toggleSidebar', station)
},
}, },
} }
</script> </script>