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

74 lines
2.2 KiB
Vue
Raw Normal View History

2022-04-15 14:24:30 +00:00
<template>
2024-05-19 05:49:42 +00:00
<div class="extra-controls flex justify-end relative md:w-[420px] px-6 md:px-8 py-0">
2024-04-04 22:20:42 +00:00
<div class="flex justify-end items-center gap-6">
2024-05-19 05:49:42 +00:00
<FooterQueueIcon />
2024-04-04 22:20:42 +00:00
<FooterBtn
class="visualizer-btn hidden md:!block"
2022-04-15 14:24:30 +00:00
data-testid="toggle-visualizer-btn"
title="Toggle visualizer"
@click.prevent="toggleVisualizer"
2022-04-15 14:24:30 +00:00
>
2024-05-19 05:49:42 +00:00
<Icon :icon="faBolt" fixed-width />
2024-04-04 22:20:42 +00:00
</FooterBtn>
2022-04-15 14:24:30 +00:00
2024-04-04 22:20:42 +00:00
<FooterBtn
2022-04-15 14:24:30 +00:00
v-if="useEqualizer"
:class="{ active: showEqualizer }"
2022-10-13 15:18:47 +00:00
class="equalizer"
2022-11-02 19:25:22 +00:00
title="Show equalizer"
@click.prevent="showEqualizer"
2022-04-15 14:24:30 +00:00
>
2024-10-14 08:25:23 +00:00
<AudioLinesIcon size="16" />
2024-04-04 22:20:42 +00:00
</FooterBtn>
2022-04-15 14:24:30 +00:00
<VolumeSlider />
2022-12-23 15:44:34 +00:00
2024-04-04 22:20:42 +00:00
<FooterBtn v-if="isFullscreenSupported()" :title="fullscreenButtonTitle" @click.prevent="toggleFullscreen">
2024-05-19 05:49:42 +00:00
<Icon :icon="isFullscreen ? faCompress : faExpand" fixed-width />
2024-04-04 22:20:42 +00:00
</FooterBtn>
2022-04-15 14:24:30 +00:00
</div>
</div>
</template>
2022-04-15 17:00:08 +00:00
<script lang="ts" setup>
2024-10-14 08:25:23 +00:00
import { faBolt, faCompress, faExpand } from '@fortawesome/free-solid-svg-icons'
import { AudioLinesIcon } from 'lucide-vue-next'
2022-12-23 15:44:34 +00:00
import { computed, onMounted, ref } from 'vue'
import { eventBus, isFullscreenSupported, isAudioContextSupported as useEqualizer } from '@/utils'
import { useRouter } from '@/composables'
2022-04-15 14:24:30 +00:00
import VolumeSlider from '@/components/ui/VolumeSlider.vue'
2024-04-04 22:20:42 +00:00
import FooterBtn from '@/components/layout/app-footer/FooterButton.vue'
2024-05-19 05:49:42 +00:00
import FooterQueueIcon from '@/components/layout/app-footer/FooterQueueButton.vue'
2022-04-15 17:00:08 +00:00
2022-12-23 15:44:34 +00:00
const isFullscreen = ref(false)
const fullscreenButtonTitle = computed(() => (isFullscreen.value ? 'Exit fullscreen mode' : 'Enter fullscreen mode'))
2022-04-15 17:00:08 +00:00
const { go, isCurrentScreen } = useRouter()
2022-11-02 19:25:22 +00:00
const showEqualizer = () => eventBus.emit('MODAL_SHOW_EQUALIZER')
2022-12-23 15:44:34 +00:00
const toggleFullscreen = () => eventBus.emit('FULLSCREEN_TOGGLE')
const toggleVisualizer = () => go(isCurrentScreen('Visualizer') ? -1 : 'visualizer')
2022-12-23 15:44:34 +00:00
onMounted(() => {
document.addEventListener('fullscreenchange', () => {
isFullscreen.value = Boolean(document.fullscreenElement)
})
})
2022-04-15 14:24:30 +00:00
</script>
2024-04-04 20:13:35 +00:00
<style lang="postcss" scoped>
2022-10-13 15:18:47 +00:00
.extra-controls {
:fullscreen & {
2024-04-04 22:20:42 +00:00
@apply pr-0;
2022-04-15 14:24:30 +00:00
}
2022-12-23 15:44:34 +00:00
:fullscreen & {
.visualizer-btn {
2024-04-04 22:20:42 +00:00
@apply hidden;
2022-12-23 15:44:34 +00:00
}
}
2022-04-15 14:24:30 +00:00
}
</style>