beginning to implement add custom radio stations, export favorites

This commit is contained in:
Jonas Heinrich 2021-03-08 13:29:45 +01:00
parent 8b7876c601
commit c04e167bc2
2 changed files with 11 additions and 59 deletions

View File

@ -25,6 +25,8 @@ import Router from 'vue-router'
import { generateUrl } from '@nextcloud/router'
import Main from './views/Main'
import Categories from './views/Categories'
import Favorites from './views/Favorites'
import store from './store/main.js'
Vue.use(Router)
@ -50,12 +52,12 @@ const router = new Router({
},
{
path: '/favorites',
component: Main,
component: Favorites,
name: 'FAVORITES',
},
{
path: '/categories/:category?/:query?',
component: Main,
component: Categories,
name: 'CATEGORIES',
},
{

View File

@ -88,27 +88,21 @@ export default {
'isFavorite',
]),
stations() {
if (this.$route.name === 'FAVORITES') {
return this.favorites
} else if (this.$route.name === 'RECENT') {
if (this.$route.name === 'RECENT') {
return this.recent
}
return this.tableData
},
emptyContentMessage() {
if (this.$route.name === 'FAVORITES') {
return t('radio', 'No favorites yet')
} else if (this.$route.name === 'RECENT') {
if (this.$route.name === 'RECENT') {
return t('radio', 'No recent stations yet')
} else if (this.$route.name === 'SEARCH') {
return t('radio', 'No search results')
}
return 'No stations here'
return t('radio', 'No stations here')
},
emptyContentIcon() {
if (this.$route.name === 'FAVORITES') {
return 'icon-star'
} else if (this.$route.name === 'RECENT') {
if (this.$route.name === 'RECENT') {
return 'icon-recent'
} else if (this.$route.name === 'SEARCH') {
return 'icon-search'
@ -116,9 +110,7 @@ export default {
return 'icon-radio'
},
emptyContentDesc() {
if (this.$route.name === 'FAVORITES') {
return t('radio', 'Stations you mark as favorite will show up here')
} else if (this.$route.name === 'RECENT') {
if (this.$route.name === 'RECENT') {
return t('radio', 'Stations you recently played will show up here')
} else if (this.$route.name === 'SEARCH') {
return t('radio', 'No stations were found matching your search term')
@ -195,13 +187,11 @@ export default {
// Skip loading more stations on certain sites
if (this.tableData.length > 0
&& (this.$route.name === 'FAVORITES'
|| this.$route.name === 'RECENT'
|| this.$route.name === 'CATEGORIES')) {
&& (this.$route.name === 'RECENT')) {
return true
}
if (menuState === 'FAVORITES' || menuState === 'RECENT') {
if (menuState === 'RECENT') {
this.pageLoading = false
} else if (menuState === 'SEARCH') {
const stations
@ -216,46 +206,6 @@ export default {
this.pageLoading = false
}
if (this.$route.name === 'CATEGORIES') {
if (this.$route.path === '/categories') {
this.tableData = [
{
name: t('radio', 'Countries'),
type: 'folder',
path: '/categories/countries',
},
{
name: t('radio', 'States'),
type: 'folder',
path: '/categories/states',
},
{
name: t('radio', 'Languages'),
type: 'folder',
path: '/categories/languages',
},
{
name: t('radio', 'Tags'),
type: 'folder',
path: '/categories/tags',
},
]
this.pageLoading = false
return true
} else if (this.$route.params.category && !this.$route.params.query) {
const stations
= await apiClient.queryCategory(this.$route.params.category)
this.tableData = this.tableData.concat(stations)
this.pageLoading = false
} else if (this.$route.params.category && this.$route.params.query) {
const stations
= await apiClient.queryByCategory(this.$route.params.category,
this.$route.params.query)
this.tableData = this.tableData.concat(stations)
this.pageLoading = false
}
}
},
/**