From f5bb517ad0c9c5570f0080695d161f3d1229901b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bego=C3=B1a=20=C3=81lvarez=20de=20la=20Cruz?= Date: Tue, 12 Sep 2023 17:42:10 +0200 Subject: [PATCH] hotfix: do not display new staking event popup until there is a new one (#7417) --- .../routes/dashboard/staking/Staking.svelte | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/packages/shared/routes/dashboard/staking/Staking.svelte b/packages/shared/routes/dashboard/staking/Staking.svelte index 81fcd922157..a5cccf072e2 100644 --- a/packages/shared/routes/dashboard/staking/Staking.svelte +++ b/packages/shared/routes/dashboard/staking/Staking.svelte @@ -16,13 +16,26 @@ import { handleTransactionEventData, transferState } from 'shared/lib/wallet' import { onDestroy, onMount } from 'svelte' import { StakingAirdrop, StakingInfo, StakingSummary } from './views' + import { + ASSEMBLY_EVENT_ID, + ASSEMBLY_EVENT_START_DATE, + LAST_ASSEMBLY_STAKING_PERIOD, + CURRENT_ASSEMBLY_STAKING_PERIOD, + } from 'shared/lib/participation/constants' const handleNewStakingEvent = (): void => { - openPopup({ - type: 'newStakingPeriodNotification', - hideClose: true, - preventClose: false, - }) + if ( + ASSEMBLY_EVENT_ID && + ASSEMBLY_EVENT_START_DATE && + CURRENT_ASSEMBLY_STAKING_PERIOD > 0 && + LAST_ASSEMBLY_STAKING_PERIOD < CURRENT_ASSEMBLY_STAKING_PERIOD + ) { + openPopup({ + type: 'newStakingPeriodNotification', + hideClose: true, + preventClose: false, + }) + } updateProfile('hasVisitedStaking', true) }