Skip to content

Commit

Permalink
fix: handle undefined errors in buy page when seller is logged in
Browse files Browse the repository at this point in the history
  • Loading branch information
r41ph committed Nov 8, 2024
1 parent cab90d3 commit 12d1e6a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ export function SupCurrencyAndAmount({
className = '',
}: {
price: number | string;
currencyCode: string;
currencyCode: string | undefined;
className?: string;
}) {
return currencyCode === USD_DENOM ? (
return currencyCode && currencyCode === USD_DENOM ? (
<span>
<span className="align-top text-[11px] leading-normal">$</span>
<span className={className}>{Number(price).toFixed(2)}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ export const AmountWithCurrency = ({
<span className={cn(classes?.amountContainer, 'mr-10')}>
<SupCurrencyAndAmount
price={amount}
currencyCode={currency.askDenom}
currencyCode={currency?.askDenom}
className={classes?.amount}
/>
</span>
<DenomIconWithCurrency
baseDenom={currency.askBaseDenom}
baseDenom={currency?.askBaseDenom}
displayDenom={displayDenom}
className={classes?.denom}
tooltipText={tooltipText}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ export function DenomIconWithCurrency({
className,
tooltipText,
}: {
baseDenom: string;
baseDenom: string | undefined;
displayDenom: string;
className?: string;
tooltipText?: string;
}) {
return (
return baseDenom ? (
<Body size="sm" className={cn('flex gap-5', className)}>
<DenomIcon
baseDenom={baseDenom}
Expand All @@ -30,5 +30,5 @@ export function DenomIconWithCurrency({
/>
)}
</Body>
);
) : null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,16 @@ export function OrderSummaryContent({
}: Props) {
const { _ } = useLingui();

const { projectName, currency, pricePerCredit, credits, currencyAmount } =
order;
const { projectName, currency, pricePerCredit, credits } = order;

const displayDenom = useMemo(
() =>
findDisplayDenom({
allowedDenoms,
bankDenom: currency.askDenom,
baseDenom: currency.askBaseDenom,
bankDenom: currency?.askDenom,
baseDenom: currency?.askBaseDenom,
}),
[allowedDenoms, currency.askBaseDenom, currency.askDenom],
[allowedDenoms, currency?.askBaseDenom, currency?.askDenom],
);

return (
Expand Down

0 comments on commit 12d1e6a

Please sign in to comment.