Skip to content

Commit

Permalink
Fix: Add default badge and cta props for crypto to fiat page
Browse files Browse the repository at this point in the history
Fix: Add default badge and cta props for crypto to fiat page
  • Loading branch information
mmioana committed Nov 27, 2024
1 parent af8d7b8 commit 6e5c0f0
Showing 1 changed file with 23 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@ export const displayName =
export const getBadgeProps = (
status?: string | null,
): CryptoToFiatBadgeProps => {
const defaultBadgeProps: CryptoToFiatBadgeProps = {
text: formatText({
id: `${displayName}.pillCopy`,
defaultMessage: 'Not started',
}),
icon: WarningCircle,
theme: 'red',
};

switch (status) {
case KycStatus.NotStarted: {
return {
text: formatText({
id: `${displayName}.pillCopy`,
defaultMessage: 'Not started',
}),
icon: WarningCircle,
theme: 'red',
};
}
case KycStatus.Incomplete: {
return {
text: formatText({
Expand Down Expand Up @@ -68,11 +67,9 @@ export const getBadgeProps = (
theme: 'red',
};
}
case KycStatus.NotStarted:
default: {
return {
text: '',
theme: 'gray',
};
return defaultBadgeProps;
}
}
};
Expand All @@ -83,8 +80,18 @@ export const getCTAProps = (
ctaTitle?: MessageDescriptor;
ctaDisabled?: boolean;
} => {
const defaultCTAProps = {
ctaTitle: {
id: `${displayName}.headingTitle`,
defaultMessage: 'Start KYC',
},
};

if (!status) {
return { ctaDisabled: true };
return {
...defaultCTAProps,
ctaDisabled: true,
};
}

switch (status) {
Expand Down Expand Up @@ -124,12 +131,7 @@ export const getCTAProps = (
};
}
default: {
return {
ctaTitle: {
id: `${displayName}.headingTitle`,
defaultMessage: 'Start KYC',
},
};
return defaultCTAProps;
}
}
};
Expand Down

0 comments on commit 6e5c0f0

Please sign in to comment.