wip notification settings

This commit is contained in:
negue
2022-09-10 16:00:56 +02:00
parent 56f956be5a
commit 7b5568ed23

View File

@@ -1,67 +1,70 @@
<template> <template>
<div class="row standard-page"> <div class="row standard-page">
<div class="col-12"> <div class="col-12">
<h1>{{ $t('notifications') }}</h1> <h1 class="page-header">{{ $t('notifications') }}</h1>
</div> </div>
<div class="col-12"> <div class="col-12">
<div class="checkbox"> <h2>All Notifications</h2>
<label>
<input <table class="table">
v-model="user.preferences.pushNotifications.unsubscribeFromAll" <tr>
type="checkbox" <td>{{ $t('unsubscribeAllPush') }}</td>
class="mr-2" <td>
@change="set('pushNotifications', 'unsubscribeFromAll')" <toggle-switch :checked="user.preferences.pushNotifications.unsubscribeFromAll"
> @toggle="set('pushNotifications', 'unsubscribeFromAll')"
<span>{{ $t('unsubscribeAllPush') }}</span> />
</label>
</div> </td>
<br> </tr>
<div class="checkbox"> <tr>
<label> <td>
<input {{ $t('unsubscribeAllEmails') }} <br>
v-model="user.preferences.emailNotifications.unsubscribeFromAll" <small>{{ $t('unsubscribeAllEmailsText') }}</small>
type="checkbox" </td>
class="mr-2" <td>
@change="set('emailNotifications', 'unsubscribeFromAll')" <toggle-switch :checked="user.preferences.emailNotifications.unsubscribeFromAll"
> @toggle="set('emailNotifications', 'unsubscribeFromAll')"
<span>{{ $t('unsubscribeAllEmails') }}</span> />
</label> </td>
</div> </tr>
<small>{{ $t('unsubscribeAllEmailsText') }}</small> <tr>
<td></td>
<td></td>
</tr>
</table>
</div> </div>
<div class="col-8"> <div class="col-12">
<h2>Email & Push</h2>
<table class="table"> <table class="table">
<tr> <tr>
<td></td> <td></td>
<th> <th class="email_push_col">
<span>{{ $t('email') }}</span> <span>{{ $t('email') }}</span>
</th> </th>
<th> <th class="email_push_col">
<span>{{ $t('push') }}</span> <span>{{ $t('push') }}</span>
</th> </th>
</tr> </tr>
<tr <tr
v-for="notification in notificationsIds" v-for="notification in notificationsIds"
:key="notification" :key="notification"
> >
<td> <td>
<span>{{ $t(notification) }}</span> <span>{{ $t(notification) }}</span>
</td> </td>
<td> <td class="email_push_col">
<input <toggle-switch :checked="user.preferences.emailNotifications[notification]"
v-model="user.preferences.emailNotifications[notification]" @toggle="set('emailNotifications', notification)"
type="checkbox" class="toggle-switch-width"
@change="set('emailNotifications', notification)" />
>
</td> </td>
<td v-if="onlyEmailsIds.indexOf(notification) === -1"> <td class="email_push_col">
<input <toggle-switch :checked="user.preferences.pushNotifications[notification]"
v-model="user.preferences.pushNotifications[notification]" @toggle="set('pushNotifications', notification)"
type="checkbox" v-if="!onlyEmailsIds.includes(notification)"
@change="set('pushNotifications', notification)" class="toggle-switch-width"
> />
</td><td v-else>
&nbsp;
</td> </td>
</tr> </tr>
</table> </table>
@@ -69,28 +72,45 @@
</div> </div>
</template> </template>
<style type="text/scss">
.toggle-switch-width {
::v-deep {
.toggle-switch {
margin-left: 0;
}
}
}
.email_push_col {
width: 50px;
padding-left: 0 !important;
padding-right: 0 !important;
}
</style>
<script> <script>
import { mapState } from '@/libs/store'; import { mapState } from '@/libs/store';
import notificationsMixin from '@/mixins/notifications'; import notificationsMixin from '@/mixins/notifications';
import ToggleSwitch from '@/components/ui/toggleSwitch';
export default { export default {
components: { ToggleSwitch },
mixins: [notificationsMixin], mixins: [notificationsMixin],
data () { data () {
return { return {
notificationsIds: Object.freeze([ notificationsIds: Object.freeze([
'majorUpdates', 'majorUpdates',
'onboarding',
'newPM', 'newPM',
'wonChallenge',
'giftedGems', 'giftedGems',
'giftedSubscription', 'giftedSubscription',
'invitedParty', 'invitedParty',
'invitedGuild', 'invitedGuild',
'kickedGroup',
'questStarted',
'invitedQuest', 'invitedQuest',
'wonChallenge',
'questStarted',
// 'weeklyRecaps',
'kickedGroup',
'onboarding',
'importantAnnouncements', 'importantAnnouncements',
'weeklyRecaps',
'subscriptionReminders', 'subscriptionReminders',
]), ]),
// list of email-only notifications // list of email-only notifications