Kasper Seweryn 2023-02-01 13:59:11 +01:00 committed by Georg krause
parent 385fc47158
commit 67f21c9861
4 changed files with 53 additions and 24 deletions

View File

@ -168,7 +168,16 @@ enum CoverType {
MILK_DROP MILK_DROP
} }
let isWebGLSupported = false
try {
const canvas = document.createElement('canvas')
isWebGLSupported = !!canvas.getContext('webgl2')
} catch (error) {}
const coverType = useStorage('queue:cover-type', CoverType.COVER_ART) const coverType = useStorage('queue:cover-type', CoverType.COVER_ART)
if (!isWebGLSupported) {
coverType.value = CoverType.COVER_ART
}
</script> </script>
<template> <template>
@ -212,24 +221,28 @@ const coverType = useStorage('queue:cover-type', CoverType.COVER_ART)
v-if="!fullscreen || !idle" v-if="!fullscreen || !idle"
class="cover-buttons" class="cover-buttons"
> >
<button <tooltip :content="!isWebGLSupported && $t('components.Queue.message.webglUnsupported')">
v-if="coverType === CoverType.COVER_ART" <button
class="ui secondary button" v-if="coverType === CoverType.COVER_ART"
:aria-label="labels.showVisualizer" class="ui secondary button"
:title="labels.showVisualizer" :aria-label="labels.showVisualizer"
@click="coverType = CoverType.MILK_DROP" :title="labels.showVisualizer"
> :disabled="!isWebGLSupported"
<i class="icon signal" /> @click="coverType = CoverType.MILK_DROP"
</button> >
<button <i class="icon signal" />
v-else-if="coverType === CoverType.MILK_DROP" </button>
class="ui secondary button" <button
:aria-label="labels.showCoverArt" v-else-if="coverType === CoverType.MILK_DROP"
:title="labels.showCoverArt" class="ui secondary button"
@click="coverType = CoverType.COVER_ART" :aria-label="labels.showCoverArt"
> :title="labels.showCoverArt"
<i class="icon image outline" /> :disabled="!isWebGLSupported"
</button> @click="coverType = CoverType.COVER_ART"
>
<i class="icon image outline" />
</button>
</tooltip>
<button <button
v-if="!fullscreen" v-if="!fullscreen"

View File

@ -1,15 +1,25 @@
<script setup lang="ts"> <script setup lang="ts">
interface Props { interface Props {
content: string content: string | false
tag?: string
} }
defineProps<Props>() withDefaults(defineProps<Props>(), {
tag: 'span'
})
</script> </script>
<template> <template>
<span <component
class="tooltip" :is="tag"
v-if="content"
:data-tooltip="content" :data-tooltip="content"
><i class="question circle icon" /></span> class="tooltip"
>
<slot>
<i class="question circle icon" />
</slot>
</component>
<slot v-else />
</template> </template>

View File

@ -178,7 +178,8 @@
}, },
"message": { "message": {
"automaticPlay": "The next track will play automatically in a few seconds…", "automaticPlay": "The next track will play automatically in a few seconds…",
"radio": "New tracks will be appended here automatically." "radio": "New tracks will be appended here automatically.",
"webglUnsupported": "Your browser does not support WebGL2 context"
}, },
"warning": { "warning": {
"connectivity": "You may have a connectivity issue." "connectivity": "You may have a connectivity issue."

View File

@ -364,6 +364,11 @@
opacity: 0; opacity: 0;
transform: translateY(0.5em); transform: translateY(0.5em);
} }
.tooltip {
z-index: 2;
pointer-events: all;
}
button { button {
z-index: 2; z-index: 2;