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

[UN-1606] fix undefined ETH #134

Merged
merged 2 commits into from
Mar 13, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 15 additions & 10 deletions src/ui/internal/components/Amount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,16 @@ const Style = styled.div`
export interface IAmountProps {
amount: string;
tokenSymbol: string;
tokenAddress: string;
status?: string;
precision?: number;
}

export const Amount = ({
amount,
precision,
tokenSymbol,
tokenSymbol = "ETH",
tokenAddress,
status,
}: IAmountProps) => {
return (
Expand All @@ -54,15 +56,18 @@ export const Amount = ({
<strong>
{formatAmount(amount, precision || 18, tokenSymbol || "")}
</strong>
{tokenSymbol ? (
<span>{tokenSymbol}</span>
) : (
<Skeleton
style={{ display: "inline-block" }} // needed to not wrap the skeleton to a new line
width={85}
height={55}
/>
)}
{tokenSymbol && <span>{tokenSymbol}</span>}

{
// if tokenAddress is defined but tokenSymbol is not == we are loading the token info
tokenAddress && !tokenSymbol && (
<Skeleton
style={{ display: "inline-block" }} // needed to not wrap the skeleton to a new line
width={85}
height={55}
/>
)
}
</div>
{status && <Chip>{status}</Chip>}
</Style>
Expand Down
3 changes: 2 additions & 1 deletion src/ui/internal/modals/Pay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export function PayModal(props: IPaymentModalProps) {
tokenInfo?.decimals || 18,
tokenInfo?.symbol || "",
)}
tokenAddress={props.paymentProps.tokenAddress}
tokenSymbol={tokenInfo?.symbol}
status={paymentStatus}
/>
Expand Down Expand Up @@ -203,7 +204,7 @@ export function PayModal(props: IPaymentModalProps) {

if (!(error || success)) {
buttonChildren = `Pay ${props.paymentProps.amount} ${
tokenInfo ? tokenInfo.symbol : "-"
tokenInfo ? tokenInfo.symbol : "ETH"
}`;
buttonOnClick = onPayClick;
} else if (success) {
Expand Down