2022-12-18 02:29:16 +03:00
|
|
|
<script setup lang="ts">
|
2023-01-09 12:31:00 +03:00
|
|
|
import { useMediaQuery } from '@vueuse/core'
|
|
|
|
|
2022-12-18 02:29:16 +03:00
|
|
|
defineProps<{
|
2023-01-05 11:47:58 +03:00
|
|
|
closeableHeader?: boolean
|
2022-12-18 02:29:16 +03:00
|
|
|
busy?: boolean
|
|
|
|
animate?: boolean
|
|
|
|
}>()
|
|
|
|
|
|
|
|
defineEmits(['hide', 'subscribe'])
|
2023-01-01 22:24:22 +03:00
|
|
|
|
|
|
|
defineSlots<{
|
|
|
|
error: {}
|
|
|
|
}>()
|
|
|
|
|
2023-01-09 12:31:00 +03:00
|
|
|
const xl = useMediaQuery('(min-width: 1280px)')
|
|
|
|
|
2022-12-18 02:55:00 +03:00
|
|
|
const isLegacyAccount = computed(() => !currentUser.value?.vapidKey)
|
2022-12-18 02:29:16 +03:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2023-01-05 11:47:58 +03: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-18 02:29:16 +03:00
|
|
|
<h2 id="notifications-warning" text-md font-bold w-full>
|
2023-01-05 11:47:58 +03:00
|
|
|
{{ $t('settings.notifications.push_notifications.warning.enable_title') }}
|
2022-12-18 02:29:16 +03:00
|
|
|
</h2>
|
|
|
|
<button
|
2023-01-05 11:47:58 +03:00
|
|
|
v-if="closeableHeader"
|
2022-12-18 02:29:16 +03:00
|
|
|
flex rounded-4
|
|
|
|
type="button"
|
2023-01-05 11:47:58 +03:00
|
|
|
:title="$t('settings.notifications.push_notifications.warning.enable_close')"
|
2022-12-18 02:29:16 +03:00
|
|
|
hover:bg-active cursor-pointer transition-100
|
|
|
|
:disabled="busy"
|
|
|
|
@click="$emit('hide')"
|
|
|
|
>
|
2022-12-19 23:31:12 +03:00
|
|
|
<span aria-hidden="true" i-ri:close-line />
|
2022-12-18 02:29:16 +03:00
|
|
|
</button>
|
|
|
|
</header>
|
2023-01-09 12:31:00 +03: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-18 02:29:16 +03:00
|
|
|
</p>
|
2023-01-05 11:47:58 +03:00
|
|
|
<p v-if="isLegacyAccount">
|
|
|
|
{{ $t('settings.notifications.push_notifications.warning.re_auth') }}
|
2022-12-25 15:45:37 +03:00
|
|
|
</p>
|
2022-12-18 02:29:16 +03:00
|
|
|
<button
|
|
|
|
btn-outline rounded-full font-bold py4 flex="~ gap2 center" m5
|
|
|
|
type="button"
|
2022-12-26 12:13:59 +03:00
|
|
|
:class="busy || isLegacyAccount ? 'border-transparent' : null"
|
2022-12-18 02:55:00 +03:00
|
|
|
:disabled="busy || isLegacyAccount"
|
2022-12-18 02:29:16 +03: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 12:31:00 +03:00
|
|
|
<span>{{ $t('settings.notifications.push_notifications.warning.enable_desktop') }}</span>
|
2022-12-18 02:29:16 +03:00
|
|
|
</button>
|
2023-01-05 11:47:58 +03:00
|
|
|
<slot name="error" />
|
2022-12-18 02:29:16 +03:00
|
|
|
</div>
|
|
|
|
</template>
|