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

109 lines
2.5 KiB
Vue
Raw Normal View History

2022-04-15 14:24:30 +00:00
<template>
2022-10-13 15:18:47 +00:00
<div class="extra-controls" data-testid="other-controls">
2022-11-02 19:25:22 +00:00
<div class="wrapper">
<button
v-koel-tooltip.top
2022-10-13 15:18:47 +00:00
class="visualizer-btn"
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
>
2023-11-10 13:16:06 +00:00
<Icon :icon="faBolt" />
</button>
2022-04-15 14:24:30 +00:00
<button
v-if="useEqualizer"
v-koel-tooltip.top
2022-04-15 14:24:30 +00:00
:class="{ active: showEqualizer }"
2022-10-13 15:18:47 +00:00
class="equalizer"
2022-11-02 19:25:22 +00:00
title="Show equalizer"
2022-04-20 15:57:53 +00:00
type="button"
2022-11-02 19:25:22 +00:00
@click.prevent="showEqualizer"
2022-04-15 14:24:30 +00:00
>
2023-11-10 13:16:06 +00:00
<Icon :icon="faSliders" />
2022-04-15 14:24:30 +00:00
</button>
<VolumeSlider />
2022-12-23 15:44:34 +00:00
<button
v-if="isFullscreenSupported()"
v-koel-tooltip.top
:title="fullscreenButtonTitle"
@click.prevent="toggleFullscreen"
>
2023-11-10 13:16:06 +00:00
<Icon :icon="isFullscreen ? faCompress : faExpand" />
2022-12-23 15:44:34 +00:00
</button>
2022-04-15 14:24:30 +00:00
</div>
</div>
</template>
2022-04-15 17:00:08 +00:00
<script lang="ts" setup>
2022-12-23 15:44:34 +00:00
import { faBolt, faCompress, faExpand, faSliders } from '@fortawesome/free-solid-svg-icons'
import { computed, onMounted, ref } from 'vue'
import { eventBus, isAudioContextSupported as useEqualizer, isFullscreenSupported } from '@/utils'
import { useRouter } from '@/composables'
2022-04-15 14:24:30 +00:00
import VolumeSlider from '@/components/ui/VolumeSlider.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>
<style lang="scss" scoped>
2022-10-13 15:18:47 +00:00
.extra-controls {
display: flex;
justify-content: flex-end;
2022-04-15 14:24:30 +00:00
position: relative;
2022-10-13 15:18:47 +00:00
width: 320px;
2022-04-15 14:24:30 +00:00
color: var(--color-text-secondary);
2022-10-13 15:18:47 +00:00
padding: 0 2rem;
2022-04-15 14:24:30 +00:00
:fullscreen & {
padding-right: 0;
}
2022-04-15 14:24:30 +00:00
.wrapper {
2022-10-13 15:18:47 +00:00
display: flex;
justify-content: flex-end;
align-items: center;
gap: 1.5rem;
2022-04-15 14:24:30 +00:00
}
2022-10-13 15:18:47 +00:00
button {
color: currentColor;
transition: color 0.2s ease-in-out;
2022-04-15 14:24:30 +00:00
2022-10-13 15:18:47 +00:00
&:hover {
color: var(--color-text-primary);
2022-04-15 14:24:30 +00:00
}
}
@media only screen and (max-width: 768px) {
2022-10-13 15:18:47 +00:00
width: auto;
2022-04-15 14:24:30 +00:00
2022-10-13 15:18:47 +00:00
.visualizer-btn {
2022-04-15 14:24:30 +00:00
display: none;
}
}
2022-12-23 15:44:34 +00:00
:fullscreen & {
.visualizer-btn {
display: none;
}
}
2022-04-15 14:24:30 +00:00
}
</style>