koel/resources/assets/js/components/layout/app-footer/index.vue

74 lines
1.9 KiB
Vue
Raw Normal View History

2022-04-15 14:24:30 +00:00
<template>
2022-04-20 15:57:53 +00:00
<footer id="mainFooter" @contextmenu.stop.prevent="requestContextMenu">
2022-04-15 17:00:08 +00:00
<PlayerControls :song="song"/>
2022-04-15 14:24:30 +00:00
<div class="media-info-wrap">
2022-04-15 17:00:08 +00:00
<MiddlePane :song="song"/>
2022-04-20 15:57:53 +00:00
<ExtraControls :song="song"/>
2022-04-15 14:24:30 +00:00
</div>
</footer>
</template>
2022-04-15 17:00:08 +00:00
<script lang="ts" setup>
import { ref } from 'vue'
2022-04-15 14:24:30 +00:00
import { eventBus } from '@/utils'
2022-04-15 17:00:08 +00:00
2022-04-20 15:57:53 +00:00
import ExtraControls from '@/components/layout/app-footer/FooterExtraControls.vue'
import MiddlePane from '@/components/layout/app-footer/FooterMiddlePane.vue'
import PlayerControls from '@/components/layout/app-footer/FooterPlayerControls.vue'
2022-04-15 14:24:30 +00:00
2022-04-15 17:00:08 +00:00
const song = ref<Song | null>(null)
const viewingQueue = ref(false)
2022-04-15 14:24:30 +00:00
2022-04-15 17:00:08 +00:00
const requestContextMenu = (event: MouseEvent) => {
song.value?.id && eventBus.emit('SONG_CONTEXT_MENU_REQUESTED', event, song.value)
}
2022-04-15 14:24:30 +00:00
2022-04-15 17:00:08 +00:00
eventBus.on({
/**
* Listen to song:played event to set the current playing song.
*/
'SONG_STARTED': (newSong: Song) => (song.value = newSong),
2022-04-15 14:24:30 +00:00
2022-04-15 17:00:08 +00:00
/**
* Listen to main-content-view:load event and highlight the Queue icon if
* the Queue screen is being loaded.
*/
'LOAD_MAIN_CONTENT': (view: MainViewName) => (viewingQueue.value = view === 'Queue')
2022-04-15 14:24:30 +00:00
})
</script>
<style lang="scss" scoped>
footer {
background: var(--color-bg-secondary);
height: var(--footer-height);
display: flex;
position: relative;
z-index: 9;
.media-info-wrap {
flex: 1;
display: flex;
}
// Add a reverse gradient here to eliminate the "hard cut" feel.
&::before {
content: " ";
position: absolute;
width: 100%;
height: calc(2 * var(--footer-height) / 3);
bottom: var(--footer-height);
left: 0;
// Safari 8 won't recognize rgba(255, 255, 255, 0) and treat it as black.
// rgba(#000, 0) is a workaround.
background-image: linear-gradient(to bottom, rgba(#000, 0) 0%, rgba(#000, .1) 100%);
pointer-events: none; // click-through
}
@media only screen and (max-width: 768px) {
height: var(--footer-height-mobile);
}
}
</style>