Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: xchain tx details use short names #29413

Merged
merged 6 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ui/hooks/useTransactionDisplayData.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import { selectBridgeHistoryForAccount } from '../ducks/bridge-status/selectors'
import { useBridgeTokenDisplayData } from '../pages/bridge/hooks/useBridgeTokenDisplayData';
import { formatAmount } from '../pages/confirmations/components/simulation-details/formatAmount';
import { getIntlLocale } from '../ducks/locale/locale';
import { NETWORK_TO_SHORT_NETWORK_NAME_MAP } from '../../shared/constants/bridge';
import { useI18nContext } from './useI18nContext';
import { useTokenFiatAmount } from './useTokenFiatAmount';
import { useUserPreferencedCurrency } from './useUserPreferencedCurrency';
Expand Down Expand Up @@ -122,7 +123,7 @@ export function useTransactionDisplayData(transactionGroup) {
bridgeHistoryItem,
srcTxMeta: transactionGroup.initialTransaction,
});
const destChainName = destNetwork?.name;
const destChainName = NETWORK_TO_SHORT_NETWORK_NAME_MAP[destNetwork?.chainId];

const { initialTransaction, primaryTransaction } = transactionGroup;
// initialTransaction contains the data we need to derive the primary purpose of this transaction group
Expand Down
13 changes: 11 additions & 2 deletions ui/pages/bridge/transaction-details/bridge-step-description.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ import {
TextColor,
} from '../../../helpers/constants/design-system';
import { useI18nContext } from '../../../hooks/useI18nContext';
import {
AllowedBridgeChainIds,
NETWORK_TO_SHORT_NETWORK_NAME_MAP,
} from '../../../../shared/constants/bridge';

type I18nFunction = (
key: string,
Expand Down Expand Up @@ -49,14 +53,19 @@ const getBridgeActionText = (
? networkConfigurationsByChainId[hexDestChainId]
: undefined;

const destChainName =
NETWORK_TO_SHORT_NETWORK_NAME_MAP[
destNetworkConfiguration?.chainId as AllowedBridgeChainIds
];

return stepStatus === StatusTypes.COMPLETE
? t('bridgeStepActionBridgeComplete', [
step.destAsset.symbol,
destNetworkConfiguration?.name,
destChainName,
])
: t('bridgeStepActionBridgePending', [
step.destAsset.symbol,
destNetworkConfiguration?.name,
destChainName,
]);
};

Expand Down
22 changes: 13 additions & 9 deletions ui/pages/bridge/transaction-details/transaction-detail-row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
AlignItems,
TextAlign,
TextVariant,
BlockSize,
} from '../../../helpers/constants/design-system';

type TransactionDetailRowProps = {
Expand All @@ -20,21 +21,24 @@ export default function TransactionDetailRow({
}: TransactionDetailRowProps) {
return (
<Box display={Display.Flex} justifyContent={JustifyContent.spaceBetween}>
<Box style={{ maxWidth: '40%' }} paddingRight={1}>
<Text variant={TextVariant.bodyMd}>{title}</Text>
</Box>
<Box
<Text
width={BlockSize.OneFourth}
paddingRight={1}
variant={TextVariant.bodyMd}
>
{title}
</Text>
<Text
display={Display.Flex}
width={BlockSize.ThreeFourths}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there going to be a follow-up to handle extra long network names? Some values don't overflow gracefully even when using the shortened network names
Screenshot 2025-01-06 at 5 01 06 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2025-01-07 at 3 39 14 PM

how's this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that it still looks the same for the OP to Arb as before

flexDirection={FlexDirection.Column}
alignItems={AlignItems.flexEnd}
textAlign={TextAlign.Right}
paddingLeft={1}
style={{
maxWidth: '60%',
}}
variant={TextVariant.bodyMd}
>
<Text variant={TextVariant.bodyMd}>{value}</Text>
</Box>
{value}
</Text>
</Box>
);
}
22 changes: 20 additions & 2 deletions ui/pages/bridge/transaction-details/transaction-details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ import {
AlignItems,
Display,
FlexDirection,
FlexWrap,
JustifyContent,
TextColor,
TextTransform,
} from '../../../helpers/constants/design-system';
Expand All @@ -57,6 +59,10 @@ import { formatAmount } from '../../confirmations/components/simulation-details/
import { getIntlLocale } from '../../../ducks/locale/locale';
import { TransactionGroup } from '../../../hooks/bridge/useBridgeTxHistoryData';
import TransactionActivityLog from '../../../components/app/transaction-activity-log';
import {
NETWORK_TO_SHORT_NETWORK_NAME_MAP,
AllowedBridgeChainIds,
} from '../../../../shared/constants/bridge';
import TransactionDetailRow from './transaction-detail-row';
import BridgeExplorerLinks from './bridge-explorer-links';
import BridgeStepList from './bridge-step-list';
Expand Down Expand Up @@ -207,8 +213,14 @@ const CrossChainSwapTxDetails = () => {
]
: undefined;

const srcNetworkName = srcNetwork?.name;
const destNetworkName = destNetwork?.name;
const srcNetworkName =
NETWORK_TO_SHORT_NETWORK_NAME_MAP[
srcNetwork?.chainId as AllowedBridgeChainIds
];
const destNetworkName =
NETWORK_TO_SHORT_NETWORK_NAME_MAP[
destNetwork?.chainId as AllowedBridgeChainIds
];

const data = srcChainTxMeta
? getTransactionBreakdownData({
Expand Down Expand Up @@ -354,6 +366,8 @@ const CrossChainSwapTxDetails = () => {
display={Display.Flex}
gap={1}
alignItems={AlignItems.center}
flexWrap={FlexWrap.Wrap}
justifyContent={JustifyContent.flexEnd}
>
{srcNetworkIconName}
<Icon name={IconName.Arrow2Right} size={IconSize.Sm} />
Expand Down Expand Up @@ -385,6 +399,8 @@ const CrossChainSwapTxDetails = () => {
display={Display.Flex}
gap={1}
alignItems={AlignItems.center}
flexWrap={FlexWrap.Wrap}
justifyContent={JustifyContent.flexEnd}
>
{t('bridgeTxDetailsTokenAmountOnChain', [
bridgeAmountSent,
Expand All @@ -401,6 +417,8 @@ const CrossChainSwapTxDetails = () => {
display={Display.Flex}
gap={1}
alignItems={AlignItems.center}
flexWrap={FlexWrap.Wrap}
justifyContent={JustifyContent.flexEnd}
>
{t('bridgeTxDetailsTokenAmountOnChain', [
bridgeAmountReceived,
Expand Down
Loading