diff --git a/packages/desktop/views/dashboard/wallet/tab-section/activity/components/row-sections/ActivityAmountSection.svelte b/packages/desktop/views/dashboard/wallet/tab-section/activity/components/row-sections/ActivityAmountSection.svelte index 8c4384ed9e..29f767853e 100644 --- a/packages/desktop/views/dashboard/wallet/tab-section/activity/components/row-sections/ActivityAmountSection.svelte +++ b/packages/desktop/views/dashboard/wallet/tab-section/activity/components/row-sections/ActivityAmountSection.svelte @@ -35,7 +35,7 @@ } function getFormattedMarketPrice(_activity: Activity): string | undefined { - if ((_activity.type === ActivityType.Basic || _activity.type === ActivityType.Foundry) && token) { + if ([ActivityType.Basic, ActivityType.Governance, ActivityType.Foundry].includes(_activity.type) && token) { const amount = _activity.tokenTransfer?.rawAmount ?? _activity.baseTokenTransfer.rawAmount const marketPrice = getFiatValueFromTokenAmount(amount, token) diff --git a/packages/desktop/views/dashboard/wallet/tab-section/activity/components/row-sections/ActivityAssetSection.svelte b/packages/desktop/views/dashboard/wallet/tab-section/activity/components/row-sections/ActivityAssetSection.svelte index da454b52a8..ff05f4a23a 100644 --- a/packages/desktop/views/dashboard/wallet/tab-section/activity/components/row-sections/ActivityAssetSection.svelte +++ b/packages/desktop/views/dashboard/wallet/tab-section/activity/components/row-sections/ActivityAssetSection.svelte @@ -1,9 +1,16 @@
- {#if token} + {#if activity.type === ActivityType.Governance} + + {:else if token} {:else if activity.type === ActivityType.Nft} @@ -47,21 +56,21 @@ {:else if activity.type === ActivityType.Alias} {/if}
- {localize(getActivityTileAction(activity))} + {localize(getActivityTileAction(activity))} {getActivityTileAsset(activity, $selectedAccountIndex)}
diff --git a/packages/desktop/views/dashboard/wallet/tab-section/activity/components/row-sections/getActivityActionPill.ts b/packages/desktop/views/dashboard/wallet/tab-section/activity/components/row-sections/getActivityActionPill.ts deleted file mode 100644 index 30b635eecb..0000000000 --- a/packages/desktop/views/dashboard/wallet/tab-section/activity/components/row-sections/getActivityActionPill.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Activity, ActivityAsyncStatus, ActivityDirection } from '@core/activity' -import { getTimeDifference } from '@core/utils/time' - -export function getActivityActionPill( - activity: Activity, - currentDate: Date -): { type: 'timelock' | 'unclaimed' | 'expired'; timeDiff?: string } | undefined { - if (!activity?.asyncData?.asyncStatus) { - return undefined - } - - const { asyncStatus, expirationDate, timelockDate } = activity.asyncData - - switch (asyncStatus) { - case ActivityAsyncStatus.Claimed: { - return undefined - } - case ActivityAsyncStatus.Timelocked: { - if (activity.direction === ActivityDirection.Outgoing) { - if (expirationDate) { - const timeDiff = getTimeDifference(expirationDate, currentDate) - return { type: 'unclaimed', timeDiff } - } else { - return undefined - } - } else { - const timeDiff = getTimeDifference(timelockDate, currentDate) - return { type: 'timelock', timeDiff } - } - } - case ActivityAsyncStatus.Unclaimed: { - const timeDiff = expirationDate ? getTimeDifference(expirationDate, currentDate) : undefined - return { type: 'unclaimed', timeDiff } - } - case ActivityAsyncStatus.Expired: { - return { type: 'expired' } - } - default: { - return undefined - } - } -} diff --git a/packages/shared/package.json b/packages/shared/package.json index 5c275dc3cc..d23d2d135b 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -5,7 +5,7 @@ "author": "Bloom Labs Ltd ", "license": "Apache-2.0", "dependencies": { - "@bloomwalletio/ui": "0.20.6", + "@bloomwalletio/ui": "0.20.8", "@ethereumjs/rlp": "4.0.1", "@ethereumjs/tx": "5.2.1", "@ethereumjs/util": "9.0.2", diff --git a/packages/shared/src/components/avatars/GovernanceAvatar.svelte b/packages/shared/src/components/avatars/GovernanceAvatar.svelte new file mode 100644 index 0000000000..984c05b829 --- /dev/null +++ b/packages/shared/src/components/avatars/GovernanceAvatar.svelte @@ -0,0 +1,24 @@ + + + diff --git a/packages/shared/src/components/avatars/index.ts b/packages/shared/src/components/avatars/index.ts index 9022cceba8..a3ded1d46f 100644 --- a/packages/shared/src/components/avatars/index.ts +++ b/packages/shared/src/components/avatars/index.ts @@ -1,4 +1,5 @@ export { default as ContactAvatar } from './ContactAvatar.svelte' +export { default as GovernanceAvatar } from './GovernanceAvatar.svelte' export { default as NftAvatar } from './NftAvatar.svelte' export { default as NetworkAvatar } from './NetworkAvatar.svelte' export { default as ProfileAvatar } from './ProfileAvatar.svelte' diff --git a/packages/shared/src/lib/core/activity/utils/getActivityActionColor.ts b/packages/shared/src/lib/core/activity/utils/getActivityActionColor.ts deleted file mode 100644 index 61449349d4..0000000000 --- a/packages/shared/src/lib/core/activity/utils/getActivityActionColor.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Activity, ActivityAction, ActivityDirection, ActivityType } from '@core/activity' - -export function getActivityActionColor(activity: Activity, darkMode: boolean): string { - const { type, direction, action } = activity - const neutralColor = darkMode ? 'neutral-1' : 'neutral-7' - - if (type === ActivityType.Basic && activity.isShimmerClaiming) { - return 'info' - } - if (type === ActivityType.Governance) { - return neutralColor - } else if (type === ActivityType.Consolidation) { - return neutralColor - } else if (type === ActivityType.SmartContract) { - return neutralColor - } else if (action === ActivityAction.Mint) { - return 'success' - } else if (action === ActivityAction.Burn) { - return 'danger' - } else if (action === ActivityAction.InitialBalance) { - return neutralColor - } else if (action === ActivityAction.Send || action === ActivityAction.BalanceChange) { - const isReceived = [ - ActivityDirection.Incoming, - ActivityDirection.SelfTransaction, - ActivityDirection.Genesis, - ].includes(direction) - - if (direction === ActivityDirection.Outgoing) { - return 'brand' - } else if (isReceived) { - return 'info' - } else { - return neutralColor - } - } else { - return neutralColor - } -} diff --git a/packages/desktop/views/dashboard/wallet/tab-section/activity/components/row-sections/getActivityActionColor.ts b/packages/shared/src/lib/core/activity/utils/getActivityActionTextColor.ts similarity index 68% rename from packages/desktop/views/dashboard/wallet/tab-section/activity/components/row-sections/getActivityActionColor.ts rename to packages/shared/src/lib/core/activity/utils/getActivityActionTextColor.ts index e976b14bc7..f9861983a1 100644 --- a/packages/desktop/views/dashboard/wallet/tab-section/activity/components/row-sections/getActivityActionColor.ts +++ b/packages/shared/src/lib/core/activity/utils/getActivityActionTextColor.ts @@ -1,23 +1,27 @@ -import { Activity, ActivityAction, ActivityDirection, ActivityType } from '@core/activity' +import { TextColor } from '@bloomwalletio/ui' +import { Activity, ActivityAction, ActivityDirection, ActivityType, GovernanceAction } from '@core/activity' -export function getActivityActionColor(activity: Activity, darkMode: boolean): string { +export function getActivityActionTextColor(activity: Activity): TextColor { const { type, direction, action } = activity if (type === ActivityType.Basic && activity.isShimmerClaiming) { return 'info' } if (type === ActivityType.Governance) { - return darkMode ? 'neutral-1' : 'neutral-7' + if ([GovernanceAction.StartVoting, GovernanceAction.StopVoting].includes(activity.governanceAction)) { + return 'secondary' + } + return 'primary' } else if (type === ActivityType.Consolidation) { - return darkMode ? 'neutral-1' : 'neutral-7' + return 'primary' } else if (type === ActivityType.SmartContract) { - return 'brand' + return 'primary' } else if (action === ActivityAction.Mint) { return 'success' } else if (action === ActivityAction.Burn) { return 'danger' } else if (action === ActivityAction.InitialBalance) { - return darkMode ? 'neutral-1' : 'neutral-7' + return 'primary' } else if (action === ActivityAction.Send || action === ActivityAction.BalanceChange) { const isReceived = [ ActivityDirection.Incoming, @@ -30,9 +34,9 @@ export function getActivityActionColor(activity: Activity, darkMode: boolean): s } else if (isReceived) { return 'info' } else { - return darkMode ? 'neutral-1' : 'neutral-7' + return 'primary' } } else { - return darkMode ? 'neutral-1' : 'neutral-7' + return 'primary' } } diff --git a/packages/shared/src/lib/core/activity/utils/getActivityTileAction.ts b/packages/shared/src/lib/core/activity/utils/getActivityTileAction.ts index 26468ff2c3..0c6de07927 100644 --- a/packages/shared/src/lib/core/activity/utils/getActivityTileAction.ts +++ b/packages/shared/src/lib/core/activity/utils/getActivityTileAction.ts @@ -17,7 +17,7 @@ export function getActivityTileAction(activity: Activity): string | undefined { } else if (activity.governanceAction === GovernanceAction.DecreaseVotingPower) { return isConfirmed ? 'general.decreased' : 'general.decreasing' } else if (activity.governanceAction === GovernanceAction.StartVoting) { - return isConfirmed ? 'general.voted' : 'general.voting' + return isConfirmed ? 'general.voteStarted' : 'general.voteStarting' } else if (activity.governanceAction === GovernanceAction.StopVoting) { return isConfirmed ? 'general.unvoted' : 'general.unvoting' } else if (activity.governanceAction === GovernanceAction.ChangedVote) { 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 '' diff --git a/packages/shared/src/lib/core/activity/utils/index.ts b/packages/shared/src/lib/core/activity/utils/index.ts index 7d8ec3f0d4..f0c50eb7c9 100644 --- a/packages/shared/src/lib/core/activity/utils/index.ts +++ b/packages/shared/src/lib/core/activity/utils/index.ts @@ -14,7 +14,7 @@ export * from './generateSingleFoundryActivity' export * from './generateSingleGovernanceActivity' export * from './generateSingleNftActivity' export * from './getActivityDetailsTitle' -export * from './getActivityActionColor' +export * from './getActivityActionTextColor' export * from './getActivityActionPill' export * from './getActivityTileAction' export * from './getActivityTileAsset' diff --git a/packages/shared/src/locales/en.json b/packages/shared/src/locales/en.json index d92055e4b2..ec696f6156 100644 --- a/packages/shared/src/locales/en.json +++ b/packages/shared/src/locales/en.json @@ -1396,18 +1396,18 @@ "receiving": "Receiving", "newVotingPower": "New voting power", "votingPower": "Voting power", - "increased": "Voting power increased", - "increasing": "Increasing voting power", - "decreased": "Voting power decreased", - "decreasing": "Decreasing voting power", + "increased": "Voting increased", + "increasing": "Increasing voting", + "decreased": "Voting decreased", + "decreasing": "Decreasing voting", "voted": "Voted", "voting": "Voting", "changedVote": "Changed vote", "changingVote": "Changing vote", "revoted": "Revoted", "revoting": "Revoting", - "unvoted": "Unvoted", - "unvoting": "Unvoting", + "unvoted": "Stopped voting", + "unvoting": "Stopping voting", "transferred": "Transferred", "transferring": "Transferring", "shimmerClaimed": "Claimed", diff --git a/yarn.lock b/yarn.lock index 78e86cfe65..bcd8b0ea03 100644 --- a/yarn.lock +++ b/yarn.lock @@ -343,10 +343,10 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@bloomwalletio/ui@0.20.6": - version "0.20.6" - resolved "https://npm.pkg.github.com/download/@bloomwalletio/ui/0.20.6/566636d21ecf9553142868a95d7bf2c64e2a3007#566636d21ecf9553142868a95d7bf2c64e2a3007" - integrity sha512-MqU+umZ5IaODS0/Zi4zJdzbeVta2wbBmBz9hbSK7JEKCqFiZ9ocgmZXw5IZmb5nbWLUQUzdVUT8/C6m4pY+pCg== +"@bloomwalletio/ui@0.20.8": + version "0.20.8" + resolved "https://npm.pkg.github.com/download/@bloomwalletio/ui/0.20.8/c315895a962b23263da7fe5e91ddff0eb61fb9db#c315895a962b23263da7fe5e91ddff0eb61fb9db" + integrity sha512-jwailq9C48f4R+ID3wnzzC+A7KKSMI6TUM/HAX7St/qwhruK583wof05ci6JAkEnJKkj4Y6pGE5i4eHB+s48aQ== dependencies: "@floating-ui/dom" "1.4.3" "@popperjs/core" "2.11.8"