From 299aacd52c1b3c829c6bf54576520a67c9a6f8b3 Mon Sep 17 00:00:00 2001 From: Mark Nardi Date: Tue, 27 Feb 2024 14:59:39 +0100 Subject: [PATCH] get proposal name --- .../lib/core/activity/utils/getActivityTileAsset.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/shared/src/lib/core/activity/utils/getActivityTileAsset.ts b/packages/shared/src/lib/core/activity/utils/getActivityTileAsset.ts index d381304c19..6e05e972d4 100644 --- a/packages/shared/src/lib/core/activity/utils/getActivityTileAsset.ts +++ b/packages/shared/src/lib/core/activity/utils/getActivityTileAsset.ts @@ -1,7 +1,9 @@ -import { ActivityType } from '../enums' +import { ActivityType, GovernanceAction } from '../enums' import { Activity } from '../types' import { getNftByIdFromAllAccountNfts } from '@core/nfts/actions' import { getTokenFromActivity } from './getTokenFromActivity' +import { get } from 'svelte/store' +import { registeredProposalsForSelectedAccount } from '@contexts/governance' export function getActivityTileAsset(activity: Activity, accountIndex: number): string | undefined { if (activity.type === ActivityType.Basic || activity.type === ActivityType.Foundry) { @@ -19,6 +21,14 @@ export function getActivityTileAsset(activity: Activity, accountIndex: number): } else if (activity.type === ActivityType.Consolidation) { return '' } else if (activity.type === ActivityType.Governance) { + if ([GovernanceAction.StartVoting, GovernanceAction.StopVoting].includes(activity.governanceAction)) { + if (activity?.participation?.eventId) { + const proposal = get(registeredProposalsForSelectedAccount)?.[activity.participation.eventId] + return proposal.title + } else { + return activity.participation?.eventId + } + } return '' } else { return ''