Skip to content

Commit

Permalink
fix: show correct step details label
Browse files Browse the repository at this point in the history
  • Loading branch information
chybisov committed Jul 15, 2022
1 parent 8d36f1c commit 931a67d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions packages/widget/src/components/StepActions/StepActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ export const StepActions: React.FC<StepActionsProps> = ({
{(step as LifiStep).includedSteps.map((step) => (
<MuiStep key={step.id} expanded>
<StepLabel StepIconComponent={StepIcon}>
<StepDetailsLabel step={step} />
{step.type === 'cross' || step.type === 'lifi' ? (
<CrossStepDetailsLabel step={step} />
) : (
<SwapStepDetailsLabel step={step} />
)}
</StepLabel>
<StepContent>
<StepDetailsContent step={step} />
Expand Down Expand Up @@ -102,7 +106,6 @@ export const StepDetailsContent: React.FC<{ step: Step }> = ({ step }) => {
export const CrossStepDetailsLabel: React.FC<{ step: Step }> = ({ step }) => {
const { t } = useTranslation();
const { getChainById } = useChains();

return (
<Typography fontSize={12} fontWeight="500" color="text.secondary">
{t('swap.crossStepDetails', {
Expand All @@ -116,10 +119,12 @@ export const CrossStepDetailsLabel: React.FC<{ step: Step }> = ({ step }) => {

export const SwapStepDetailsLabel: React.FC<{ step: Step }> = ({ step }) => {
const { t } = useTranslation();
const { getChainById } = useChains();
return (
<Typography fontSize={12} fontWeight="500" color="text.secondary">
{t('swap.swapStepDetails', {
value: step.toolDetails.name,
chain: getChainById(step.action.fromChainId)?.name,
tool: step.toolDetails.name,
})}
</Typography>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/widget/src/i18n/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"estimatedTime": "~{{value}} min.",
"networkIsBusy": "Network is busy...",
"crossStepDetails": "Bridge {{from}} to {{to}} via {{tool}}",
"swapStepDetails": "Swap on {{value}}",
"swapStepDetails": "Swap on {{chain}} via {{tool}}",
"tags": {
"recommended": "Recommended",
"fastest": "Fast",
Expand Down

0 comments on commit 931a67d

Please sign in to comment.