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