beginning to implement add custom radio stations, export favorites
This commit is contained in:
parent
8b7876c601
commit
c04e167bc2
@ -25,6 +25,8 @@ import Router from 'vue-router'
|
|||||||
import { generateUrl } from '@nextcloud/router'
|
import { generateUrl } from '@nextcloud/router'
|
||||||
|
|
||||||
import Main from './views/Main'
|
import Main from './views/Main'
|
||||||
|
import Categories from './views/Categories'
|
||||||
|
import Favorites from './views/Favorites'
|
||||||
import store from './store/main.js'
|
import store from './store/main.js'
|
||||||
|
|
||||||
Vue.use(Router)
|
Vue.use(Router)
|
||||||
@ -50,12 +52,12 @@ const router = new Router({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/favorites',
|
path: '/favorites',
|
||||||
component: Main,
|
component: Favorites,
|
||||||
name: 'FAVORITES',
|
name: 'FAVORITES',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/categories/:category?/:query?',
|
path: '/categories/:category?/:query?',
|
||||||
component: Main,
|
component: Categories,
|
||||||
name: 'CATEGORIES',
|
name: 'CATEGORIES',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -88,27 +88,21 @@ export default {
|
|||||||
'isFavorite',
|
'isFavorite',
|
||||||
]),
|
]),
|
||||||
stations() {
|
stations() {
|
||||||
if (this.$route.name === 'FAVORITES') {
|
if (this.$route.name === 'RECENT') {
|
||||||
return this.favorites
|
|
||||||
} else if (this.$route.name === 'RECENT') {
|
|
||||||
return this.recent
|
return this.recent
|
||||||
}
|
}
|
||||||
return this.tableData
|
return this.tableData
|
||||||
},
|
},
|
||||||
emptyContentMessage() {
|
emptyContentMessage() {
|
||||||
if (this.$route.name === 'FAVORITES') {
|
if (this.$route.name === 'RECENT') {
|
||||||
return t('radio', 'No favorites yet')
|
|
||||||
} else if (this.$route.name === 'RECENT') {
|
|
||||||
return t('radio', 'No recent stations yet')
|
return t('radio', 'No recent stations yet')
|
||||||
} else if (this.$route.name === 'SEARCH') {
|
} else if (this.$route.name === 'SEARCH') {
|
||||||
return t('radio', 'No search results')
|
return t('radio', 'No search results')
|
||||||
}
|
}
|
||||||
return 'No stations here'
|
return t('radio', 'No stations here')
|
||||||
},
|
},
|
||||||
emptyContentIcon() {
|
emptyContentIcon() {
|
||||||
if (this.$route.name === 'FAVORITES') {
|
if (this.$route.name === 'RECENT') {
|
||||||
return 'icon-star'
|
|
||||||
} else if (this.$route.name === 'RECENT') {
|
|
||||||
return 'icon-recent'
|
return 'icon-recent'
|
||||||
} else if (this.$route.name === 'SEARCH') {
|
} else if (this.$route.name === 'SEARCH') {
|
||||||
return 'icon-search'
|
return 'icon-search'
|
||||||
@ -116,9 +110,7 @@ export default {
|
|||||||
return 'icon-radio'
|
return 'icon-radio'
|
||||||
},
|
},
|
||||||
emptyContentDesc() {
|
emptyContentDesc() {
|
||||||
if (this.$route.name === 'FAVORITES') {
|
if (this.$route.name === 'RECENT') {
|
||||||
return t('radio', 'Stations you mark as favorite will show up here')
|
|
||||||
} else if (this.$route.name === 'RECENT') {
|
|
||||||
return t('radio', 'Stations you recently played will show up here')
|
return t('radio', 'Stations you recently played will show up here')
|
||||||
} else if (this.$route.name === 'SEARCH') {
|
} else if (this.$route.name === 'SEARCH') {
|
||||||
return t('radio', 'No stations were found matching your search term')
|
return t('radio', 'No stations were found matching your search term')
|
||||||
@ -195,13 +187,11 @@ export default {
|
|||||||
|
|
||||||
// Skip loading more stations on certain sites
|
// Skip loading more stations on certain sites
|
||||||
if (this.tableData.length > 0
|
if (this.tableData.length > 0
|
||||||
&& (this.$route.name === 'FAVORITES'
|
&& (this.$route.name === 'RECENT')) {
|
||||||
|| this.$route.name === 'RECENT'
|
|
||||||
|| this.$route.name === 'CATEGORIES')) {
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (menuState === 'FAVORITES' || menuState === 'RECENT') {
|
if (menuState === 'RECENT') {
|
||||||
this.pageLoading = false
|
this.pageLoading = false
|
||||||
} else if (menuState === 'SEARCH') {
|
} else if (menuState === 'SEARCH') {
|
||||||
const stations
|
const stations
|
||||||
@ -216,46 +206,6 @@ export default {
|
|||||||
this.pageLoading = false
|
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user