From acd99318b3d8eddaaa2a9b100ef55968e0f6bb80 Mon Sep 17 00:00:00 2001 From: Victor Thomas <10986371+vthomas13@users.noreply.github.com> Date: Tue, 13 Jun 2023 17:49:53 -0400 Subject: [PATCH] Icon changes, add badgewrapped icons to smart tx --- .../app/transaction-icon/transaction-icon.js | 75 +++++++++++------- .../app/transaction-list-item/index.scss | 5 -- .../smart-transaction-list-item.component.js | 46 +++++++++-- .../transaction-list-item.component.js | 77 +++++++++++++------ .../activity-list-item/activity-list-item.js | 5 +- 5 files changed, 146 insertions(+), 62 deletions(-) diff --git a/ui/components/app/transaction-icon/transaction-icon.js b/ui/components/app/transaction-icon/transaction-icon.js index bb42a71b9589..820c4969dd12 100644 --- a/ui/components/app/transaction-icon/transaction-icon.js +++ b/ui/components/app/transaction-icon/transaction-icon.js @@ -1,47 +1,56 @@ import React from 'react'; import { useDispatch } from 'react-redux'; import PropTypes from 'prop-types'; -import Approve from '../../ui/icon/approve-icon.component'; -import Interaction from '../../ui/icon/interaction-icon.component'; -import Receive from '../../ui/icon/receive-icon.component'; -import Send from '../../ui/icon/send-icon.component'; -import Sign from '../../ui/icon/sign-icon.component'; -import Swap from '../../ui/icon/swap-icon-for-list.component'; import { TransactionGroupCategory, TransactionGroupStatus, TransactionStatus, } from '../../../../shared/constants/transaction'; import { captureSingleException } from '../../../store/actions'; +import { AvatarIcon, IconName } from '../../component-library'; +import { + BackgroundColor, + IconColor, + Size, +} from '../../../helpers/constants/design-system'; const ICON_MAP = { - [TransactionGroupCategory.approval]: Approve, - [TransactionGroupCategory.interaction]: Interaction, - [TransactionGroupCategory.receive]: Receive, - [TransactionGroupCategory.send]: Send, - [TransactionGroupCategory.signatureRequest]: Sign, - [TransactionGroupCategory.swap]: Swap, + [TransactionGroupCategory.approval]: IconName.Check, + [TransactionGroupCategory.interaction]: IconName.ProgrammingArrows, + [TransactionGroupCategory.receive]: IconName.Received, + [TransactionGroupCategory.send]: IconName.Arrow2UpRight, + [TransactionGroupCategory.signatureRequest]: IconName.SecurityTick, + [TransactionGroupCategory.swap]: IconName.SwapHorizontal, }; -const FAIL_COLOR = 'var(--color-error-default)'; -const PENDING_COLOR = 'var(--color-icon-default)'; -const OK_COLOR = 'var(--color-primary-default)'; - const COLOR_MAP = { - [TransactionGroupStatus.pending]: PENDING_COLOR, - [TransactionGroupStatus.cancelled]: FAIL_COLOR, - [TransactionStatus.approved]: PENDING_COLOR, - [TransactionStatus.dropped]: FAIL_COLOR, - [TransactionStatus.failed]: FAIL_COLOR, - [TransactionStatus.rejected]: FAIL_COLOR, - [TransactionStatus.submitted]: PENDING_COLOR, - [TransactionStatus.unapproved]: PENDING_COLOR, + [TransactionGroupStatus.pending]: IconColor.primaryDefault, + [TransactionGroupStatus.cancelled]: IconColor.errorDefault, + [TransactionStatus.approved]: IconColor.primaryDefault, + [TransactionStatus.dropped]: IconColor.errorDefault, + [TransactionStatus.failed]: IconColor.errorDefault, + [TransactionStatus.rejected]: IconColor.errorDefault, + [TransactionStatus.submitted]: IconColor.primaryDefault, + [TransactionStatus.unapproved]: IconColor.primaryDefault, +}; + +const BACKGROUND_COLOR_MAP = { + [TransactionGroupStatus.pending]: BackgroundColor.primaryMuted, + [TransactionGroupStatus.cancelled]: BackgroundColor.errorMuted, + [TransactionStatus.approved]: BackgroundColor.primaryMuted, + [TransactionStatus.dropped]: BackgroundColor.errorMuted, + [TransactionStatus.failed]: BackgroundColor.errorMuted, + [TransactionStatus.rejected]: BackgroundColor.errorMuted, + [TransactionStatus.submitted]: BackgroundColor.primaryMuted, + [TransactionStatus.unapproved]: BackgroundColor.primaryMuted, }; export default function TransactionIcon({ status, category }) { const dispatch = useDispatch(); - const color = COLOR_MAP[status] || OK_COLOR; + const color = COLOR_MAP[status] || IconColor.primaryDefault; + const backgroundColor = + BACKGROUND_COLOR_MAP[status] || BackgroundColor.primaryMuted; const Icon = ICON_MAP[category]; if (!Icon) { @@ -50,10 +59,22 @@ export default function TransactionIcon({ status, category }) { `The category prop passed to TransactionIcon is not supported. The prop is: ${category}`, ), ); - return
; + return ( +