2022-04-15 14:24:30 +00:00
|
|
|
<template>
|
2022-05-07 10:14:35 +00:00
|
|
|
<div v-if="shown" class="support-bar" data-testid="support-bar">
|
2022-04-15 14:24:30 +00:00
|
|
|
<p>
|
|
|
|
Loving Koel? Please consider supporting its development via
|
2022-04-24 08:29:14 +00:00
|
|
|
<a href="https://github.com/users/phanan/sponsorship" rel="noopener" target="_blank">GitHub Sponsors</a>
|
2022-04-15 14:24:30 +00:00
|
|
|
and/or
|
2022-04-24 08:29:14 +00:00
|
|
|
<a href="https://opencollective.com/koel" rel="noopener" target="_blank">OpenCollective</a>.
|
2022-04-15 14:24:30 +00:00
|
|
|
</p>
|
2022-07-07 18:05:46 +00:00
|
|
|
<button data-testid="hide-support-koel" type="button" @click.prevent="close">Hide</button>
|
2022-04-15 14:24:30 +00:00
|
|
|
<span class="sep"></span>
|
2022-10-13 15:18:47 +00:00
|
|
|
<button data-testid="stop-support-koel-bugging" type="button" @click.prevent="stopBugging">
|
2022-07-07 18:05:46 +00:00
|
|
|
Don't bug me again
|
|
|
|
</button>
|
2022-04-15 14:24:30 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2022-04-15 17:00:08 +00:00
|
|
|
<script lang="ts" setup>
|
2022-04-15 14:24:30 +00:00
|
|
|
import isMobile from 'ismobilejs'
|
2022-05-07 10:14:35 +00:00
|
|
|
import { computed, ref, toRef } from 'vue'
|
2022-04-15 14:24:30 +00:00
|
|
|
import { eventBus } from '@/utils'
|
2022-05-07 10:14:35 +00:00
|
|
|
import { preferenceStore } from '@/stores'
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-05-07 10:14:35 +00:00
|
|
|
const delayUntilShow = 30 * 60 * 1000
|
|
|
|
let timeoutHandle = 0
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-04-15 17:00:08 +00:00
|
|
|
const shown = ref(false)
|
2022-05-07 10:14:35 +00:00
|
|
|
const noBugging = toRef(preferenceStore.state, 'supportBarNoBugging')
|
2022-04-15 14:24:30 +00:00
|
|
|
|
2022-05-07 10:14:35 +00:00
|
|
|
const canNag = computed(() => !isMobile.any && !noBugging.value)
|
2022-04-15 17:00:08 +00:00
|
|
|
|
2022-05-07 10:14:35 +00:00
|
|
|
const setUpShowBarTimeout = () => (timeoutHandle = window.setTimeout(() => (shown.value = true), delayUntilShow))
|
2022-04-15 17:00:08 +00:00
|
|
|
|
|
|
|
const close = () => {
|
|
|
|
shown.value = false
|
2022-05-07 10:14:35 +00:00
|
|
|
window.clearTimeout(timeoutHandle)
|
2022-04-15 17:00:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const stopBugging = () => {
|
2022-05-07 10:14:35 +00:00
|
|
|
preferenceStore.set('supportBarNoBugging', true)
|
2022-04-15 17:00:08 +00:00
|
|
|
close()
|
|
|
|
}
|
|
|
|
|
|
|
|
eventBus.on('KOEL_READY', () => canNag.value && setUpShowBarTimeout())
|
2022-04-15 14:24:30 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.support-bar {
|
|
|
|
background: var(--color-bg-primary);
|
|
|
|
font-size: .9rem;
|
|
|
|
padding: .75rem 1rem;
|
|
|
|
display: flex;
|
|
|
|
color: rgba(255, 255, 255, .6);
|
|
|
|
z-index: 9;
|
|
|
|
|
|
|
|
> * + * {
|
|
|
|
margin-left: 1rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
p {
|
|
|
|
flex: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
a {
|
|
|
|
color: var(--color-text-primary);
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
color: var(--color-highlight);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.sep {
|
|
|
|
display: block;
|
|
|
|
|
|
|
|
&::after {
|
|
|
|
content: '•';
|
|
|
|
display: block;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
button {
|
|
|
|
color: var(--color-text-primary);
|
|
|
|
font-size: .9rem;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
color: var(--color-highlight);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|