Skip to content

Commit

Permalink
get proposal name
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkNerdi committed Feb 27, 2024
1 parent 8e703e3 commit 299aacd
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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 ''
Expand Down

0 comments on commit 299aacd

Please sign in to comment.