FEAT: refactor code
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
{{ track.title }}
|
{{ track.title }}
|
||||||
</span>
|
</span>
|
||||||
<span class="hidden lg:block">
|
<span class="hidden lg:block">
|
||||||
{{ store.getArtistById(track.artist).name }}
|
{{ getArtistName(track.artist) }}
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
</nav>
|
</nav>
|
||||||
@@ -35,9 +35,9 @@
|
|||||||
{{ currentTrack.title }}
|
{{ currentTrack.title }}
|
||||||
</h3>
|
</h3>
|
||||||
</a>
|
</a>
|
||||||
<a :href="store.getArtistById(currentTrack.artist).url" target="_blank" rel="noopener noreferrer">
|
<a v-if="currentArtist" :href="currentArtist.url" target="_blank" rel="noopener noreferrer">
|
||||||
<h2 class="font-bold text-6xl text-esyellow">
|
<h2 class="font-bold text-6xl text-esyellow">
|
||||||
{{ store.getArtistById(currentTrack.artist).name }}
|
{{ currentArtist.name }}
|
||||||
</h2>
|
</h2>
|
||||||
</a>
|
</a>
|
||||||
<h4 class="text-xl text-slate-200">
|
<h4 class="text-xl text-slate-200">
|
||||||
@@ -48,9 +48,9 @@
|
|||||||
|
|
||||||
<p class="block mt-10">
|
<p class="block mt-10">
|
||||||
see artist page:<br>
|
see artist page:<br>
|
||||||
<a target="_blank" class="underline text-orange-500 hover:text-orange-400"
|
<a v-if="currentArtist" target="_blank" class="underline text-orange-500 hover:text-orange-400"
|
||||||
:href="store.getArtistById(currentTrack.artist).url">
|
:href="currentArtist.url">
|
||||||
{{ store.getArtistById(currentTrack.artist).name }}
|
{{ currentArtist.name }}
|
||||||
</a><br>
|
</a><br>
|
||||||
purchase the track:<br>
|
purchase the track:<br>
|
||||||
<a target="_blank" class="underline text-orange-500 hover:text-orange-400" :href="currentTrack.url">
|
<a target="_blank" class="underline text-orange-500 hover:text-orange-400" :href="currentTrack.url">
|
||||||
@@ -71,19 +71,21 @@ const tracks = ref()
|
|||||||
const mixPlayer = ref()
|
const mixPlayer = ref()
|
||||||
const videoSD = ref()
|
const videoSD = ref()
|
||||||
const currentTrack = ref()
|
const currentTrack = ref()
|
||||||
|
|
||||||
const currentArtist = computed(() => {
|
|
||||||
currentTrack
|
|
||||||
})
|
|
||||||
|
|
||||||
const { isLoaded } = storeToRefs(store)
|
const { isLoaded } = storeToRefs(store)
|
||||||
|
const currentArtist = computed(() => {
|
||||||
|
return store.getArtistById(currentTrack.value.artist)
|
||||||
|
})
|
||||||
|
const getArtistName = (id: number) => {
|
||||||
|
return store.getArtistById(id)?.name
|
||||||
|
}
|
||||||
|
|
||||||
|
// LOAD DATAs
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
loadCompilation()
|
loadCompilation() // if user arrive directly on compilation page
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(isLoaded, () => {
|
watch(isLoaded, () => {
|
||||||
loadCompilation()
|
loadCompilation() // if the user came from another page
|
||||||
})
|
})
|
||||||
|
|
||||||
const watchPlayingTrack = () => {
|
const watchPlayingTrack = () => {
|
||||||
@@ -99,9 +101,9 @@ const watchPlayingTrack = () => {
|
|||||||
|
|
||||||
const loadCompilation = () => {
|
const loadCompilation = () => {
|
||||||
if (isLoaded.value) {
|
if (isLoaded.value) {
|
||||||
compilation.value = store.getCompilationById(route.params.id)
|
compilation.value = store.getCompilationById(route.params.id as string)
|
||||||
tracks.value = store.getTracksByCompilationId(route.params.id)
|
tracks.value = store.getTracksByCompilationId(route.params.id as string)
|
||||||
videoSD.value = 'https://files.erudi.fr/evilspins/' + compilation.value.id + '-HD.mp4'
|
videoSD.value = 'https://files.erudi.fr/evilspins/' + compilation.value.id + '-SD.mp4'
|
||||||
mixPlayer.value.load()
|
mixPlayer.value.load()
|
||||||
mixPlayer.value.play()
|
mixPlayer.value.play()
|
||||||
mixPlayer.value.focus()
|
mixPlayer.value.focus()
|
||||||
@@ -109,7 +111,7 @@ const loadCompilation = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const listenTo = (start) => {
|
const listenTo = (start: number) => {
|
||||||
mixPlayer.value.currentTime = start
|
mixPlayer.value.currentTime = start
|
||||||
mixPlayer.value.play()
|
mixPlayer.value.play()
|
||||||
}
|
}
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
<a href="/about">❓</a>
|
<a href="/about">❓</a>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
<section class="splash-screen flex items-center flex-col" @keydown.esc="closePlayer()">
|
<section class="splash-screen flex items-center flex-col">
|
||||||
<figure class="ui">
|
<figure class="ui">
|
||||||
<img class="logo" src="/logo.svg">
|
<img class="logo" src="/logo.svg">
|
||||||
<h1 class="text-white pt-6 text-sm md:text-md lg:text-lg text-center font-bold tracking-widest">Compilations
|
<h1 class="text-white pt-6 text-sm md:text-md lg:text-lg text-center font-bold tracking-widest">Compilations
|
||||||
|
@@ -3,12 +3,14 @@ export default eventHandler(() => {
|
|||||||
{
|
{
|
||||||
id: 'ES00A',
|
id: 'ES00A',
|
||||||
name: 'zero',
|
name: 'zero',
|
||||||
duration: 2794
|
duration: 2794,
|
||||||
|
description: '...',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'ES00B',
|
id: 'ES00B',
|
||||||
name: 'zero b-sides',
|
name: 'zero b-sides',
|
||||||
duration: 2470
|
duration: 2470,
|
||||||
|
description: '...',
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
@@ -4,6 +4,7 @@ export interface Compilation {
|
|||||||
name: string
|
name: string
|
||||||
duration: number
|
duration: number
|
||||||
tracks?: Track[]
|
tracks?: Track[]
|
||||||
|
description: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Artist {
|
export interface Artist {
|
||||||
|
Reference in New Issue
Block a user