Skip to content

Commit

Permalink
chore: fix last comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nikaaru committed Dec 19, 2023
1 parent d53f73b commit da2b8f7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
19 changes: 13 additions & 6 deletions components/detail/SwapSteps/SwapStepChainAmount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,22 @@ import React from 'react';
import { SwapStepChainLogoProps } from './SwapSteps.type';

function SwapStepChainAmount(props: SwapStepChainLogoProps) {
const { token } = props;
const { token, firstStep } = props;
const { symbol, name, realAmount, expectedAmount } = token;
return (
<>
{isNaN(realAmount)
? `Est. ~${expectedAmount.toFixed(2)} ${symbol || name}`
: `${realAmount.toFixed(2)} ${symbol} (Est. ~${expectedAmount.toFixed(
2,
)} ${symbol || name})`}
{firstStep && `${realAmount.toFixed(2)} ${symbol}`}
{!firstStep && (
<>
{isNaN(realAmount)
? `Est. ~${expectedAmount.toFixed(2)} ${symbol || name}`
: `${realAmount.toFixed(
2,
)} ${symbol} (Est. ~${expectedAmount.toFixed(2)} ${
symbol || name
})`}
</>
)}
</>
);
}
Expand Down
4 changes: 2 additions & 2 deletions components/detail/SwapSteps/SwapStepItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function SwapStepItem(props: SwapStepItemProps) {
<div className="flex items-center">
<SwapStepChainLogo token={from} />
<span className="text-12 ml-5 text-neutral-400">
<SwapStepChainAmount token={from} />
<SwapStepChainAmount firstStep={firstStep} token={from} />
</span>
</div>
<div
Expand All @@ -51,7 +51,7 @@ function SwapStepItem(props: SwapStepItemProps) {
<div className="hidden md:flex items-center my-15">
<SwapStepChainLogo token={from} />
<span className="text-14 text-neutral-400">
<SwapStepChainAmount token={from} />
<SwapStepChainAmount firstStep={firstStep} token={from} />
</span>
<NextIcon className="mx-10 text-primary-500" />
<SwapStepChainLogo token={to} />
Expand Down
8 changes: 3 additions & 5 deletions components/detail/SwapSteps/SwapStepSwapper.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @next/next/no-img-element */
import React from 'react';
import { SwapStepItemProps } from './SwapSteps.type';
import { InternalPathType, SwapStatus } from 'types';
import { InternalPathType } from 'types';
import { BorderColor } from './SwapSteps.helper';

function SwapStepSwapper(props: SwapStepItemProps) {
Expand All @@ -19,9 +19,7 @@ function SwapStepSwapper(props: SwapStepItemProps) {
to: internalTo,
swapper: internalSwapper,
} = swapperItem;
const swapperStatus: SwapStatus =
index === swappers.length - 1 ? status : 'success';
const borderColor = BorderColor[swapperStatus];
const borderColor = BorderColor[status];

return (
<>
Expand All @@ -40,7 +38,7 @@ function SwapStepSwapper(props: SwapStepItemProps) {
<div className="text-12 md:text-18 text-primary-500">
{internalSwapper?.swapperType === 'DEX'
? `Swap on ${internalFrom?.blockchain} via ${internalSwapper?.swapperTitle}`
: `Swap from ${internalFrom?.blockchain} to ${internalTo?.blockchain} via ${internalSwapper?.swapperTitle}`}
: `Bridge from ${internalFrom?.blockchain} to ${internalTo?.blockchain} via ${internalSwapper?.swapperTitle}`}
</div>
</div>
</>
Expand Down
1 change: 1 addition & 0 deletions components/detail/SwapSteps/SwapSteps.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface SwapStepItemProps {

export interface SwapStepChainLogoProps {
token: AssetType;
firstStep?: boolean;
}

export interface SwapStepItemExpandedProps {
Expand Down

0 comments on commit da2b8f7

Please sign in to comment.