Skip to content

Commit

Permalink
feat(NotificationsManagementSubscriptionDialog): remove obsoulete fea…
Browse files Browse the repository at this point in the history
…tures

- remove `group_offline` and `reatime_mode` from dialog
- remove redundant translation

See: BEDS-607
  • Loading branch information
benji-bitfly committed Oct 18, 2024
1 parent d43767c commit 2992d29
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 60 deletions.
1 change: 1 addition & 0 deletions frontend/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"NotificationsManagmentMachines",
"NotificationsNetworkTable",
"NotificationsOverview",
"SubscriptionDialog",
"a11y",
"checkout",
"ci",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ const { t: $t } = useTranslation()
const {
secondsPerEpoch,
} = useNetworkStore()
const { user } = useUserStore()
const hasPremiumPerkGroupOffline = computed(
() => user.value?.premium_perks.notifications_validator_dashboard_group_offline,
)
const hasPremiumPerkRealTimeMode = computed(
() => user.value?.premium_perks.notifications_validator_dashboard_real_time_mode,
)
function closeDialog(): void {
dialogRef?.value.close()
Expand All @@ -24,31 +17,32 @@ function closeDialog(): void {
const checkboxes = ref({
is_attestations_missed_subscribed: props.value?.is_attestations_missed_subscribed ?? false,
is_block_proposal_subscribed: props.value?.is_block_proposal_subscribed ?? false,
is_group_offline_subscribed: props.value?.is_group_offline_subscribed ?? false,
is_max_collateral_subscribed: props.value?.is_max_collateral_subscribed ?? false,
is_min_collateral_subscribed: props.value?.is_min_collateral_subscribed ?? false,
is_real_time_mode_enabled: props.value?.is_real_time_mode_enabled ?? false,
is_slashed_subscribed: props.value?.is_slashed_subscribed ?? false,
is_sync_subscribed: props.value?.is_sync_subscribed ?? false,
is_upcoming_block_proposal_subscribed: props.value?.is_upcoming_block_proposal_subscribed ?? false,
is_validator_offline_subscribed: props.value?.is_validator_offline_subscribed ?? false,
is_withdrawal_processed_subscribed: props.value?.is_withdrawal_processed_subscribed ?? false,
})
const thresholds = ref({
group_offline_threshold: formatFraction(props.value?.group_offline_threshold ?? 0),
max_collateral_threshold: formatFraction(props.value?.max_collateral_threshold ?? 0),
min_collateral_threshold: formatFraction(props.value?.min_collateral_threshold ?? 0),
})
const emit = defineEmits<{
(e: 'change-settings', settings: Omit<NotificationSettingsValidatorDashboard, 'is_webhook_discord_enabled' | 'webhook_url'>): void,
(e: 'change-settings', settings: Omit<NotificationSettingsValidatorDashboard,
'group_offline_threshold'
| 'is_group_offline_subscribed'
| 'is_real_time_mode_enabled'
| 'is_webhook_discord_enabled'
| 'webhook_url'>): void,
}>()
watchDebounced([
checkboxes,
thresholds,
], () => {
emit('change-settings', {
...checkboxes.value,
group_offline_threshold: Number(formatToFraction(thresholds.value.group_offline_threshold)),
max_collateral_threshold: Number(formatToFraction(thresholds.value.max_collateral_threshold)),
min_collateral_threshold: Number(formatToFraction(thresholds.value.min_collateral_threshold)),
})
Expand Down Expand Up @@ -97,33 +91,6 @@ watch(hasAllEvents, () => {
/>
</template>
</BcSettingsRow>
<BcSettingsRow
v-model:checkbox="checkboxes.is_group_offline_subscribed"
v-model:input="thresholds.group_offline_threshold"
:label="$t('notifications.subscriptions.validators.group_is_offline.label')"
has-unit
:has-premium-gem="!hasPremiumPerkGroupOffline"
>
<template #info>
<BcTranslation
keypath="notifications.subscriptions.validators.group_is_offline.info.template"
listpath="notifications.subscriptions.validators.group_is_offline.info._list"
>
<template #_list="{ listpath }">
<ul v-if="listpath">
<li v-for="(item, index) in $t(listpath).split('\n')" :key="item">
{{ item }}
<template v-if="index ===3 ">
<br>
<span class="bold">{{ $t('notifications.subscriptions.validators.group_is_offline.info.note_bold') }}</span>
<span>{{ $t('notifications.subscriptions.validators.group_is_offline.info.note') }}</span>
</template>
</li>
</ul>
</template>
</BcTranslation>
</template>
</BcSettingsRow>
<BcSettingsRow
v-model:checkbox="checkboxes.is_attestations_missed_subscribed"
:label="$t('notifications.subscriptions.validators.attestation_missed.label')"
Expand Down Expand Up @@ -162,13 +129,6 @@ watch(hasAllEvents, () => {
has-unit
:label="$t('notifications.subscriptions.validators.max_collateral_reached.label')"
/>

<BcSettingsRow
v-model:checkbox="checkboxes.is_real_time_mode_enabled"
:label="$t('notifications.subscriptions.validators.real_time_mode.label')"
:info="$t('notifications.subscriptions.validators.real_time_mode.info')"
:has-premium-gem="!hasPremiumPerkRealTimeMode"
/>
<BcSettingsRow
v-model:checkbox="hasAllEvents"
:label="$t('notifications.subscriptions.validators.all_events.label')"
Expand Down
15 changes: 1 addition & 14 deletions frontend/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -844,25 +844,12 @@
"label": "Block proposal (missed & success)"
},
"explanation": "All notifications are sent after network finality (~20min).",
"group_is_offline": {
"info": {
"_list": "Once 10% of your group is offline\nOnce you have been offline for 3 epochs\nEvery 32 Epochs (~3 hours) during your downtime\nOnce you are back online again",
"note": "Notification resets if you do not meet the threshold of 10%",
"note_bold": "Note: ",
"template": "We will trigger a notification: {_list}"
},
"label": "Group is offline"
},
"max_collateral_reached": {
"label": "Max collateral reached"
},
"min_collateral_reached": {
"label": "Min collateral reached"
},
"real_time_mode": {
"info": "Sends notifications after the first epoch and does not wait for finality to send notifications, which might cause false positive notifications.",
"label": "Realtime mode"
},
"sync_committee": {
"label": "Sync committee"
},
Expand All @@ -875,7 +862,7 @@
},
"validator_is_offline": {
"info": {
"_list": "Once the validator has been offline for 3 epochs\nEvery 32 Epochs (~3 hours) during your downtime\nOnce you are back online again",
"_list": "Once the validator has been offline for 3 epochs\nOnce you are back online again",
"template": "We will trigger a notification: {_list}"
},
"label": "Validator is offline"
Expand Down

0 comments on commit 2992d29

Please sign in to comment.