2018-08-11 01:47:10 -04:00
|
|
|
<template>
|
2023-06-23 16:23:32 -04:00
|
|
|
<section v-if="spotify_enabled" class="section">
|
2018-08-11 01:47:10 -04:00
|
|
|
<div class="container">
|
|
|
|
<div class="columns is-centered">
|
|
|
|
<div class="column is-four-fifths">
|
|
|
|
<div class="tabs is-centered is-small is-toggle is-toggle-rounded">
|
|
|
|
<ul>
|
2022-05-29 12:49:00 -04:00
|
|
|
<li
|
|
|
|
:class="{
|
|
|
|
'is-active': $store.state.search_path === '/search/library'
|
|
|
|
}"
|
|
|
|
>
|
2020-11-21 04:57:39 -05:00
|
|
|
<a @click="search_library">
|
2023-06-30 15:41:40 -04:00
|
|
|
<mdicon class="icon is-small" name="bookshelf" size="16" />
|
2022-06-04 07:57:08 -04:00
|
|
|
<span v-text="$t('page.search.tabs.library')" />
|
2018-08-11 01:47:10 -04:00
|
|
|
</a>
|
2020-11-21 04:57:39 -05:00
|
|
|
</li>
|
2022-05-29 12:49:00 -04:00
|
|
|
<li
|
|
|
|
:class="{
|
|
|
|
'is-active': $store.state.search_path === '/search/spotify'
|
|
|
|
}"
|
|
|
|
>
|
2020-11-21 04:57:39 -05:00
|
|
|
<a @click="search_spotify">
|
2023-06-30 15:41:40 -04:00
|
|
|
<mdicon class="icon is-small" name="spotify" size="16" />
|
2022-06-04 07:57:08 -04:00
|
|
|
<span v-text="$t('page.search.tabs.spotify')" />
|
2018-08-11 01:47:10 -04:00
|
|
|
</a>
|
2020-11-21 04:57:39 -05:00
|
|
|
</li>
|
2018-08-11 01:47:10 -04:00
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-03-13 16:16:32 -04:00
|
|
|
import * as types from '@/store/mutation_types'
|
|
|
|
|
2018-08-11 01:47:10 -04:00
|
|
|
export default {
|
|
|
|
name: 'TabsSearch',
|
|
|
|
|
2020-11-21 04:57:39 -05:00
|
|
|
props: ['query'],
|
|
|
|
|
2018-08-11 01:47:10 -04:00
|
|
|
computed: {
|
2022-02-19 00:39:14 -05:00
|
|
|
spotify_enabled() {
|
2018-08-11 01:47:10 -04:00
|
|
|
return this.$store.state.spotify.webapi_token_valid
|
2020-11-22 04:17:37 -05:00
|
|
|
},
|
|
|
|
|
2023-06-07 15:25:54 -04:00
|
|
|
route_query() {
|
2020-11-22 04:17:37 -05:00
|
|
|
if (!this.query) {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
type: 'track,artist,album,playlist,audiobook,podcast',
|
|
|
|
query: this.query,
|
|
|
|
limit: 3,
|
|
|
|
offset: 0
|
|
|
|
}
|
2018-08-11 01:47:10 -04:00
|
|
|
}
|
2020-11-21 04:57:39 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2023-06-07 15:25:54 -04:00
|
|
|
search_library() {
|
2022-03-13 16:16:32 -04:00
|
|
|
this.$store.commit(types.SEARCH_PATH, '/search/library')
|
2020-11-21 04:57:39 -05:00
|
|
|
this.$router.push({
|
2022-02-26 15:29:30 -05:00
|
|
|
path: this.$store.state.search_path,
|
2020-11-22 04:17:37 -05:00
|
|
|
query: this.route_query
|
2020-11-21 04:57:39 -05:00
|
|
|
})
|
|
|
|
},
|
|
|
|
|
2023-06-07 15:25:54 -04:00
|
|
|
search_spotify() {
|
2022-03-13 16:16:32 -04:00
|
|
|
this.$store.commit(types.SEARCH_PATH, '/search/spotify')
|
2020-11-21 04:57:39 -05:00
|
|
|
this.$router.push({
|
2022-02-26 15:29:30 -05:00
|
|
|
path: this.$store.state.search_path,
|
2020-11-22 04:17:37 -05:00
|
|
|
query: this.route_query
|
2020-11-21 04:57:39 -05:00
|
|
|
})
|
|
|
|
}
|
2018-08-11 01:47:10 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-02-19 00:39:14 -05:00
|
|
|
<style></style>
|