started adding routes to the whole app (the app is currently broken)

This commit is contained in:
Roberto Tonino 2020-07-28 22:09:13 +02:00
parent 20460ef9ce
commit 2e05ef3f0a
13 changed files with 194 additions and 76 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
<template> <template>
<div id="about_tab" class="main_tabcontent"> <div id="about_tab" class="main_tabcontent" ref="root">
<h2 class="page_heading">{{ $t('sidebar.about') }}</h2> <h2 class="page_heading">{{ $t('sidebar.about') }}</h2>
<ul> <ul>
<li v-html="$t('about.usesLibrary')"></li> <li v-html="$t('about.usesLibrary')"></li>
@ -208,6 +208,14 @@ export default {
paypal, paypal,
ethereum, ethereum,
bitcoin bitcoin
}) }),
mounted() {
console.log('about mounted')
this.$refs.root.style.display = 'block'
},
beforeDestroy() {
console.log('about bef dest')
this.$refs.root.style.display = 'none'
}
} }
</script> </script>

View File

@ -1,5 +1,5 @@
<template> <template>
<div id="charts_tab" class="main_tabcontent"> <div id="charts_tab" class="main_tabcontent" ref="root">
<h2 class="page_heading">{{ $t('charts.title') }}</h2> <h2 class="page_heading">{{ $t('charts.title') }}</h2>
<div v-if="country === ''" id="charts_selection"> <div v-if="country === ''" id="charts_selection">
<div class="release_grid charts_grid"> <div class="release_grid charts_grid">
@ -72,9 +72,7 @@
<td class="table__cell--large breakline"> <td class="table__cell--large breakline">
{{ {{
track.title + track.title +
(track.title_version && track.title.indexOf(track.title_version) == -1 (track.title_version && track.title.indexOf(track.title_version) == -1 ? ' ' + track.title_version : '')
? ' ' + track.title_version
: '')
}} }}
</td> </td>
<td <td
@ -194,8 +192,14 @@ export default {
} }
}, },
mounted() { mounted() {
console.log('charts mounted')
this.$refs.root.style.display = 'block'
socket.on('init_charts', this.initCharts) socket.on('init_charts', this.initCharts)
socket.on('setChartTracks', this.setTracklist) socket.on('setChartTracks', this.setTracklist)
},
beforeDestroy() {
console.log('charts bef dest')
this.$refs.root.style.display = 'none'
} }
} }
</script> </script>

View File

@ -6,12 +6,12 @@
<!-- <ArtistTab /> --> <!-- <ArtistTab /> -->
<!-- <TracklistTab /> --> <!-- <TracklistTab /> -->
<!-- <TheHomeTab /> --> <!-- <TheHomeTab /> -->
<TheChartsTab /> <!-- <TheChartsTab />
<TheFavoritesTab /> <TheFavoritesTab />
<TheErrorsTab /> <TheErrorsTab />
<TheLinkAnalyzerTab /> <TheLinkAnalyzerTab />
<TheAboutTab /> <TheAboutTab />
<TheSettingsTab /> <TheSettingsTab /> -->
<TheMainSearch :scrolled-search-type="newScrolled" /> <TheMainSearch :scrolled-search-type="newScrolled" />
</div> </div>
</section> </section>
@ -21,13 +21,13 @@
// import ArtistTab from '@components/ArtistTab.vue' // import ArtistTab from '@components/ArtistTab.vue'
// import TracklistTab from '@components/TracklistTab.vue' // import TracklistTab from '@components/TracklistTab.vue'
import TheChartsTab from '@components/TheChartsTab.vue' // import TheChartsTab from '@components/TheChartsTab.vue'
import TheFavoritesTab from '@components/TheFavoritesTab.vue' // import TheFavoritesTab from '@components/TheFavoritesTab.vue'
import TheErrorsTab from '@components/TheErrorsTab.vue' // import TheErrorsTab from '@components/TheErrorsTab.vue'
// import TheHomeTab from '@components/TheHomeTab.vue' // import TheHomeTab from '@components/TheHomeTab.vue'
import TheLinkAnalyzerTab from '@components/TheLinkAnalyzerTab.vue' // import TheLinkAnalyzerTab from '@components/TheLinkAnalyzerTab.vue'
import TheAboutTab from '@components/TheAboutTab.vue' // import TheAboutTab from '@components/TheAboutTab.vue'
import TheSettingsTab from '@components/TheSettingsTab.vue' // import TheSettingsTab from '@components/TheSettingsTab.vue'
import TheMainSearch from '@components/TheMainSearch.vue' import TheMainSearch from '@components/TheMainSearch.vue'
import { debounce } from '@/utils/utils' import { debounce } from '@/utils/utils'
@ -37,13 +37,13 @@ export default {
components: { components: {
// ArtistTab, // ArtistTab,
// TracklistTab // TracklistTab
TheChartsTab, // TheChartsTab,
TheFavoritesTab, // TheFavoritesTab,
TheErrorsTab, // TheErrorsTab,
// TheHomeTab, // TheHomeTab,
TheLinkAnalyzerTab, // TheLinkAnalyzerTab,
TheAboutTab, // TheAboutTab,
TheSettingsTab, // TheSettingsTab,
TheMainSearch TheMainSearch
}, },
data: () => ({ data: () => ({

View File

@ -1,5 +1,5 @@
<template> <template>
<div id="errors_tab" class="main_tabcontent"> <div id="errors_tab" class="main_tabcontent" ref="root">
<h1>{{ $t('errors.title', [title]) }}</h1> <h1>{{ $t('errors.title', [title]) }}</h1>
<table class="table table--tracklist"> <table class="table table--tracklist">
<tr> <tr>
@ -42,8 +42,14 @@ export default {
} }
}, },
mounted() { mounted() {
console.log('errors mounted')
this.$refs.root.style.display = 'block'
EventBus.$on('showTabErrors', this.showErrors) EventBus.$on('showTabErrors', this.showErrors)
this.$root.$on('showTabErrors', this.showErrors) this.$root.$on('showTabErrors', this.showErrors)
},
beforeDestroy() {
console.log('errors bef dest')
this.$refs.root.style.display = 'none'
} }
} }
</script> </script>

View File

@ -1,5 +1,5 @@
<template> <template>
<div id="favorites_tab" class="main_tabcontent" @click="handleFavoritesTabClick"> <div id="favorites_tab" class="main_tabcontent" @click="handleFavoritesTabClick" ref="root">
<h2 class="page_heading"> <h2 class="page_heading">
{{ $t('favorites.title') }} {{ $t('favorites.title') }}
<div <div
@ -48,9 +48,7 @@
</div> </div>
<p class="primary-text">{{ release.title }}</p> <p class="primary-text">{{ release.title }}</p>
<p class="secondary-text"> <p class="secondary-text">
{{ {{ `${$t('globals.by', [release.creator.name])} - ${$tc('globals.listTabs.trackN', release.nb_tracks)}` }}
`${$t('globals.by', [release.creator.name])} - ${$tc('globals.listTabs.trackN', release.nb_tracks)}`
}}
</p> </p>
</div> </div>
<div <div
@ -74,12 +72,7 @@
</div> </div>
<p class="primary-text">{{ release.title }}</p> <p class="primary-text">{{ release.title }}</p>
<p class="secondary-text"> <p class="secondary-text">
{{ {{ `${$t('globals.by', [release.creator.name])} - ${$tc('globals.listTabs.trackN', release.nb_tracks)}` }}
`${$t('globals.by', [release.creator.name])} - ${$tc(
'globals.listTabs.trackN',
release.nb_tracks
)}`
}}
</p> </p>
</div> </div>
</div> </div>
@ -315,6 +308,8 @@ export default {
} }
}, },
mounted() { mounted() {
console.log('favorites mounted')
this.$refs.root.style.display = 'block'
socket.on('init_favorites', this.initFavorites) socket.on('init_favorites', this.initFavorites)
socket.on('updated_userFavorites', this.updated_userFavorites) socket.on('updated_userFavorites', this.updated_userFavorites)
socket.on('updated_userSpotifyPlaylists', this.updated_userSpotifyPlaylists) socket.on('updated_userSpotifyPlaylists', this.updated_userSpotifyPlaylists)
@ -322,6 +317,10 @@ export default {
socket.on('updated_userAlbums', this.updated_userAlbums) socket.on('updated_userAlbums', this.updated_userAlbums)
socket.on('updated_userArtist', this.updated_userArtist) socket.on('updated_userArtist', this.updated_userArtist)
socket.on('updated_userTracks', this.updated_userTracks) socket.on('updated_userTracks', this.updated_userTracks)
},
beforeDestroy() {
console.log('favorites bef dest')
this.$refs.root.style.display = 'none'
} }
} }
</script> </script>

View File

@ -1,5 +1,5 @@
<template> <template>
<div id="analyzer_tab" class="main_tabcontent image_header"> <div id="analyzer_tab" class="main_tabcontent image_header" ref="root">
<h2 class="page_heading page_heading--capitalize">{{ $t('sidebar.linkAnalyzer') }}</h2> <h2 class="page_heading page_heading--capitalize">{{ $t('sidebar.linkAnalyzer') }}</h2>
<div v-if="link == ''"> <div v-if="link == ''">
<p> <p>
@ -25,16 +25,22 @@
<h1>{{ title }}</h1> <h1>{{ title }}</h1>
<h2 v-if="type == 'track'"> <h2 v-if="type == 'track'">
<i18n path="globals.by" tag="span"> <i18n path="globals.by" tag="span">
<span place="0" class="clickable" @click="artistView" :data-id="data.artist.id">{{ data.artist.name }}</span> <span place="0" class="clickable" @click="artistView" :data-id="data.artist.id">{{
data.artist.name
}}</span>
</i18n> </i18n>
<i18n path="globals.in" tag="span"> <i18n path="globals.in" tag="span">
<span place="0" class="clickable" @click="albumView" :data-id="data.album.id">{{ data.album.title }}</span> <span place="0" class="clickable" @click="albumView" :data-id="data.album.id">{{
data.album.title
}}</span>
</i18n> </i18n>
</h2> </h2>
<h2 v-else-if="type == 'album'"> <h2 v-else-if="type == 'album'">
<i18n path="globals.by" tag="span"> <i18n path="globals.by" tag="span">
<span place="0" class="clickable" @click="artistView" :data-id="data.artist.id">{{ data.artist.name }}</span> <span place="0" class="clickable" @click="artistView" :data-id="data.artist.id">{{
data.artist.name
}}</span>
</i18n> </i18n>
{{ `${$tc('globals.listTabs.trackN', data.nb_tracks)}` }} {{ `${$tc('globals.listTabs.trackN', data.nb_tracks)}` }}
</h2> </h2>
@ -181,11 +187,17 @@ export default {
} }
}, },
mounted() { mounted() {
console.log('link analyzer mounted')
this.$refs.root.style.display = 'block'
EventBus.$on('linkAnalyzerTab:reset', this.reset) EventBus.$on('linkAnalyzerTab:reset', this.reset)
socket.on('analyze_track', this.showTrack) socket.on('analyze_track', this.showTrack)
socket.on('analyze_album', this.showAlbum) socket.on('analyze_album', this.showAlbum)
socket.on('analyze_notSupported', this.notSupported) socket.on('analyze_notSupported', this.notSupported)
},
beforeDestroy() {
console.log('link analyzer bef dest')
this.$refs.root.style.display = 'none'
} }
} }
</script> </script>

View File

@ -1,5 +1,5 @@
<template> <template>
<div id="search_tab" class="main_tabcontent" @click="handleSearchTabClick"> <div id="search_tab" class="main_tabcontent" @click="handleSearchTabClick" ref="root">
<div :class="{ hide: results.query != '' }"> <div :class="{ hide: results.query != '' }">
<h2>{{ $t('search.startSearching') }}</h2> <h2>{{ $t('search.startSearching') }}</h2>
<p>{{ $t('search.description') }}</p> <p>{{ $t('search.description') }}</p>
@ -9,8 +9,12 @@
<li class="section-tabs__tab search_tablinks" id="search_all_tab">{{ $t('globals.listTabs.all') }}</li> <li class="section-tabs__tab search_tablinks" id="search_all_tab">{{ $t('globals.listTabs.all') }}</li>
<li class="section-tabs__tab search_tablinks" id="search_track_tab">{{ $tc('globals.listTabs.track', 2) }}</li> <li class="section-tabs__tab search_tablinks" id="search_track_tab">{{ $tc('globals.listTabs.track', 2) }}</li>
<li class="section-tabs__tab search_tablinks" id="search_album_tab">{{ $tc('globals.listTabs.album', 2) }}</li> <li class="section-tabs__tab search_tablinks" id="search_album_tab">{{ $tc('globals.listTabs.album', 2) }}</li>
<li class="section-tabs__tab search_tablinks" id="search_artist_tab">{{ $tc('globals.listTabs.artist', 2) }}</li> <li class="section-tabs__tab search_tablinks" id="search_artist_tab">
<li class="section-tabs__tab search_tablinks" id="search_playlist_tab">{{ $tc('globals.listTabs.playlist', 2) }}</li> {{ $tc('globals.listTabs.artist', 2) }}
</li>
<li class="section-tabs__tab search_tablinks" id="search_playlist_tab">
{{ $tc('globals.listTabs.playlist', 2) }}
</li>
</ul> </ul>
<div id="search_tab_content"> <div id="search_tab_content">
<!-- ### Main Search Tab ### --> <!-- ### Main Search Tab ### -->
@ -65,9 +69,7 @@
$tc('globals.listTabs.trackN', results.allTab.TOP_RESULT[0].nb_song) $tc('globals.listTabs.trackN', results.allTab.TOP_RESULT[0].nb_song)
}} }}
</p> </p>
<span class="tag">{{ <span class="tag">{{ $tc(`globals.listTabs.${results.allTab.TOP_RESULT[0].type}`, 1) }}</span>
$tc(`globals.listTabs.${results.allTab.TOP_RESULT[0].type}`, 1)
}}</span>
</div> </div>
</div> </div>
<div v-else-if="section == 'TRACK'"> <div v-else-if="section == 'TRACK'">
@ -195,7 +197,9 @@
> >
{{ release.ALB_TITLE }} {{ release.ALB_TITLE }}
</p> </p>
<p class="secondary-text">{{ release.ART_NAME + ' - ' + $tc('globals.listTabs.trackN', release.NUMBER_TRACK) }}</p> <p class="secondary-text">
{{ release.ART_NAME + ' - ' + $tc('globals.listTabs.trackN', release.NUMBER_TRACK) }}
</p>
</div> </div>
</div> </div>
<div v-else-if="section == 'PLAYLIST'" class="release_grid firstrow_only"> <div v-else-if="section == 'PLAYLIST'" class="release_grid firstrow_only">
@ -361,7 +365,11 @@
<i v-if="release.explicit_lyrics" class="material-icons explicit_icon">explicit</i> <i v-if="release.explicit_lyrics" class="material-icons explicit_icon">explicit</i>
{{ release.title }} {{ release.title }}
</p> </p>
<p class="secondary-text">{{ $t('globals.by', [release.artist.name]) + ' - ' + $tc('globals.listTabs.trackN', release.nb_tracks) }}</p> <p class="secondary-text">
{{
$t('globals.by', [release.artist.name]) + ' - ' + $tc('globals.listTabs.trackN', release.nb_tracks)
}}
</p>
</div> </div>
</div> </div>
</div> </div>
@ -424,9 +432,7 @@
</div> </div>
<p class="primary-text">{{ release.title }}</p> <p class="primary-text">{{ release.title }}</p>
<p class="secondary-text"> <p class="secondary-text">
{{ {{ `${$t('globals.by', [release.user.name])} - ${$tc('globals.listTabs.trackN', release.nb_tracks)}` }}
`${$t('globals.by', [release.user.name])} - ${$tc('globals.listTabs.trackN', release.nb_tracks)}`
}}
</p> </p>
</div> </div>
</div> </div>
@ -497,12 +503,18 @@ export default {
} }
}, },
mounted() { mounted() {
// console.log('main search mounted')
// this.$refs.root.style.display = 'block'
EventBus.$on('mainSearch:checkLoadMoreContent', this.checkLoadMoreContent) EventBus.$on('mainSearch:checkLoadMoreContent', this.checkLoadMoreContent)
this.$root.$on('mainSearch:showNewResults', this.showNewResults) this.$root.$on('mainSearch:showNewResults', this.showNewResults)
socket.on('mainSearch', this.handleMainSearch) socket.on('mainSearch', this.handleMainSearch)
socket.on('search', this.handleSearch) socket.on('search', this.handleSearch)
}, },
beforeDestroy() {
// console.log('main search bef dest')
// this.$refs.root.style.display = 'none'
},
methods: { methods: {
artistView: showView.bind(null, 'artist'), artistView: showView.bind(null, 'artist'),
albumView: showView.bind(null, 'album'), albumView: showView.bind(null, 'album'),

View File

@ -1,5 +1,5 @@
<template> <template>
<div id="settings_tab" class="main_tabcontent fixed_footer"> <div id="settings_tab" class="main_tabcontent fixed_footer" ref="root">
<h2 class="page_heading">{{ $t('settings.title') }}</h2> <h2 class="page_heading">{{ $t('settings.title') }}</h2>
<div id="logged_in_info" ref="loggedInInfo"> <div id="logged_in_info" ref="loggedInInfo">
@ -611,7 +611,13 @@ export default {
accountNum: 0, accountNum: 0,
accounts: [] accounts: []
}), }),
beforeDestroy() {
console.log('settings bef dest')
this.$refs.root.style.display = 'none'
},
mounted() { mounted() {
console.log('settings mounted')
this.$refs.root.style.display = 'block'
this.locales = this.$i18n.availableLocales this.locales = this.$i18n.availableLocales
EventBus.$on('settingsTab:revertSettings', this.revertSettings) EventBus.$on('settingsTab:revertSettings', this.revertSettings)

View File

@ -142,24 +142,45 @@ export default {
switch (targetID) { switch (targetID) {
case 'main_search_tablink': case 'main_search_tablink':
selectedTab = 'search_tab' selectedTab = 'search_tab'
this.$router.push({
name: 'Search'
})
break break
case 'main_home_tablink': case 'main_home_tablink':
selectedTab = 'home_tab' selectedTab = 'home_tab'
this.$router.push({
name: 'Home'
})
break break
case 'main_charts_tablink': case 'main_charts_tablink':
selectedTab = 'charts_tab' selectedTab = 'charts_tab'
this.$router.push({
name: 'Charts'
})
break break
case 'main_favorites_tablink': case 'main_favorites_tablink':
selectedTab = 'favorites_tab' selectedTab = 'favorites_tab'
this.$router.push({
name: 'Favorites'
})
break break
case 'main_analyzer_tablink': case 'main_analyzer_tablink':
selectedTab = 'analyzer_tab' selectedTab = 'analyzer_tab'
this.$router.push({
name: 'Link Analyzer'
})
break break
case 'main_settings_tablink': case 'main_settings_tablink':
selectedTab = 'settings_tab' selectedTab = 'settings_tab'
this.$router.push({
name: 'Settings'
})
break break
case 'main_about_tablink': case 'main_about_tablink':
selectedTab = 'about_tab' selectedTab = 'about_tab'
this.$router.push({
name: 'About'
})
break break
default: default:

View File

@ -244,6 +244,7 @@ export default {
}, },
showPlaylist(data) { showPlaylist(data) {
this.reset() this.reset()
console.log(data)
const { const {
id: playlistID, id: playlistID,

View File

@ -25,6 +25,8 @@ export function changeTab(sidebarEl, section, tabName) {
const tabContent = document.getElementsByClassName(`${section}_tabcontent`) const tabContent = document.getElementsByClassName(`${section}_tabcontent`)
for (let i = 0; i < tabContent.length; i++) { for (let i = 0; i < tabContent.length; i++) {
if (!tabContent[i]) continue
tabContent[i].style.display = 'none' tabContent[i].style.display = 'none'
} }
@ -40,17 +42,21 @@ export function changeTab(sidebarEl, section, tabName) {
EventBus.$emit('settingsTab:revertCredentials') EventBus.$emit('settingsTab:revertCredentials')
} }
// * The tab we want to show
if (document.getElementById(tabName)) {
document.getElementById(tabName).style.display = 'block' document.getElementById(tabName).style.display = 'block'
}
if (section === 'main') { if (section === 'main') {
window.main_selected = tabName window.main_selected = tabName
} else if ('search' === section) { } else if (section === 'search') {
window.search_selected = tabName window.search_selected = tabName
} }
sidebarEl.classList.add('active') sidebarEl.classList.add('active')
// Check if you need to load more content in the search tab // * Check if you need to load more content in the search tab
// * Happens when the user changes the tab in the main search
if ( if (
window.main_selected === 'search_tab' && window.main_selected === 'search_tab' &&
['track_search', 'album_search', 'artist_search', 'playlist_search'].indexOf(window.search_selected) !== -1 ['track_search', 'album_search', 'artist_search', 'playlist_search'].indexOf(window.search_selected) !== -1

View File

@ -3,9 +3,17 @@ import VueRouter from 'vue-router'
import { socket } from '@/utils/socket' import { socket } from '@/utils/socket'
import EventBus from '@/utils/EventBus' import EventBus from '@/utils/EventBus'
import TheHomeTab from '@components/TheHomeTab.vue'
import TracklistTab from '@components/TracklistTab.vue'
import ArtistTab from '@components/ArtistTab.vue' import ArtistTab from '@components/ArtistTab.vue'
import TracklistTab from '@components/TracklistTab.vue'
import TheHomeTab from '@components/TheHomeTab.vue'
import TheChartsTab from '@components/TheChartsTab.vue'
import TheFavoritesTab from '@components/TheFavoritesTab.vue'
import TheErrorsTab from '@components/TheErrorsTab.vue'
import TheLinkAnalyzerTab from '@components/TheLinkAnalyzerTab.vue'
import TheAboutTab from '@components/TheAboutTab.vue'
import TheSettingsTab from '@components/TheSettingsTab.vue'
import TheMainSearch from '@components/TheMainSearch.vue'
Vue.use(VueRouter) Vue.use(VueRouter)
@ -24,6 +32,41 @@ const routes = [
name: 'Artist', name: 'Artist',
component: ArtistTab component: ArtistTab
}, },
{
path: '/charts',
name: 'Charts',
component: TheChartsTab
},
{
path: '/favorites',
name: 'Favorites',
component: TheFavoritesTab
},
{
path: '/errors',
name: 'Errors',
component: TheErrorsTab
},
{
path: '/link-analyzer',
name: 'Link Analyzer',
component: TheLinkAnalyzerTab
},
{
path: '/about',
name: 'About',
component: TheAboutTab
},
{
path: '/settings',
name: 'Settings',
component: TheSettingsTab
},
// {
// path: '/search',
// name: 'Search',
// component: TheMainSearch
// },
// 404 client side // 404 client side
{ {
path: '*', path: '*',