2022-12-17 23:29:16 +00:00
|
|
|
<script setup lang="ts">
|
2023-01-09 09:31:00 +00:00
|
|
|
import { useMediaQuery } from '@vueuse/core'
|
|
|
|
|
2022-12-17 23:29:16 +00:00
|
|
|
defineProps<{
|
2023-01-05 08:47:58 +00:00
|
|
|
closeableHeader?: boolean
|
2022-12-17 23:29:16 +00:00
|
|
|
busy?: boolean
|
|
|
|
animate?: boolean
|
|
|
|
}>()
|
|
|
|
|
|
|
|
defineEmits(['hide', 'subscribe'])
|
2023-01-01 19:24:22 +00:00
|
|
|
|
|
|
|
defineSlots<{
|
|
|
|
error: {}
|
|
|
|
}>()
|
|
|
|
|
2023-01-09 09:31:00 +00:00
|
|
|
const xl = useMediaQuery('(min-width: 1280px)')
|
|
|
|
|
2022-12-17 23:55:00 +00:00
|
|
|
const isLegacyAccount = computed(() => !currentUser.value?.vapidKey)
|
2022-12-17 23:29:16 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2023-01-05 08:47:58 +00:00
|
|
|
<div
|
|
|
|
flex="~ col"
|
|
|
|
gap-y-2
|
|
|
|
role="alert"
|
|
|
|
aria-labelledby="notifications-warning"
|
|
|
|
:class="closeableHeader ? 'border-b border-base' : 'px6 px4'"
|
|
|
|
>
|
|
|
|
<header flex items-center pb-2>
|
2022-12-17 23:29:16 +00:00
|
|
|
<h2 id="notifications-warning" text-md font-bold w-full>
|
2023-01-05 08:47:58 +00:00
|
|
|
{{ $t('settings.notifications.push_notifications.warning.enable_title') }}
|
2022-12-17 23:29:16 +00:00
|
|
|
</h2>
|
|
|
|
<button
|
2023-01-05 08:47:58 +00:00
|
|
|
v-if="closeableHeader"
|
2022-12-17 23:29:16 +00:00
|
|
|
flex rounded-4
|
|
|
|
type="button"
|
2023-01-05 08:47:58 +00:00
|
|
|
:title="$t('settings.notifications.push_notifications.warning.enable_close')"
|
2022-12-17 23:29:16 +00:00
|
|
|
hover:bg-active cursor-pointer transition-100
|
|
|
|
:disabled="busy"
|
|
|
|
@click="$emit('hide')"
|
|
|
|
>
|
2022-12-19 20:31:12 +00:00
|
|
|
<span aria-hidden="true" i-ri:close-line />
|
2022-12-17 23:29:16 +00:00
|
|
|
</button>
|
|
|
|
</header>
|
2023-01-09 09:31:00 +00:00
|
|
|
<template v-if="closeableHeader">
|
|
|
|
<p xl:hidden>
|
|
|
|
{{ $t('settings.notifications.push_notifications.warning.enable_description') }}
|
|
|
|
</p>
|
|
|
|
<p xl:hidden>
|
|
|
|
{{ $t('settings.notifications.push_notifications.warning.enable_description_mobile') }}
|
|
|
|
</p>
|
|
|
|
<p :class="xl ? null : 'hidden'">
|
|
|
|
{{ $t('settings.notifications.push_notifications.warning.enable_description_desktop') }}
|
|
|
|
</p>
|
|
|
|
</template>
|
|
|
|
<p v-else>
|
|
|
|
{{ $t('settings.notifications.push_notifications.warning.enable_description_settings') }}
|
2022-12-17 23:29:16 +00:00
|
|
|
</p>
|
2023-01-05 08:47:58 +00:00
|
|
|
<p v-if="isLegacyAccount">
|
|
|
|
{{ $t('settings.notifications.push_notifications.warning.re_auth') }}
|
2022-12-25 12:45:37 +00:00
|
|
|
</p>
|
2022-12-17 23:29:16 +00:00
|
|
|
<button
|
|
|
|
btn-outline rounded-full font-bold py4 flex="~ gap2 center" m5
|
|
|
|
type="button"
|
2022-12-26 09:13:59 +00:00
|
|
|
:class="busy || isLegacyAccount ? 'border-transparent' : null"
|
2022-12-17 23:55:00 +00:00
|
|
|
:disabled="busy || isLegacyAccount"
|
2022-12-17 23:29:16 +00:00
|
|
|
@click="$emit('subscribe')"
|
|
|
|
>
|
|
|
|
<span aria-hidden="true" :class="busy && animate ? 'i-ri:loader-2-fill animate-spin' : 'i-ri:check-line'" />
|
2023-01-09 09:31:00 +00:00
|
|
|
<span>{{ $t('settings.notifications.push_notifications.warning.enable_desktop') }}</span>
|
2022-12-17 23:29:16 +00:00
|
|
|
</button>
|
2023-01-05 08:47:58 +00:00
|
|
|
<slot name="error" />
|
2022-12-17 23:29:16 +00:00
|
|
|
</div>
|
|
|
|
</template>
|