koel/resources/assets/js/components/meta/SupportKoel.vue

85 lines
1.8 KiB
Vue
Raw Normal View History

2022-04-15 14:24:30 +00:00
<template>
<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>
<button type="button" @click.prevent="close">Hide</button>
2022-12-02 16:17:37 +00:00
<span class="sep" />
<button type="button" @click.prevent="stopBugging">
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'
import { ref, watch } from 'vue'
import { preferenceStore } from '@/stores'
2022-04-15 14:24:30 +00:00
const delayUntilShow = 30 * 60 * 1000 // 30 minutes
2022-04-15 14:24:30 +00:00
2022-04-15 17:00:08 +00:00
const shown = ref(false)
2022-04-15 14:24:30 +00:00
const setUpShowBarTimeout = () => setTimeout(() => (shown.value = true), delayUntilShow)
const close = () => shown.value = false
2022-04-15 17:00:08 +00:00
const stopBugging = () => {
preferenceStore.set('supportBarNoBugging', true)
2022-04-15 17:00:08 +00:00
close()
}
watch(preferenceStore.initialized, initialized => {
if (!initialized) return
if (preferenceStore.state.supportBarNoBugging || isMobile.any) return
setUpShowBarTimeout()
}, { immediate: true })
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>