Skip to content

Commit

Permalink
chore: only show balance if source asset input
Browse files Browse the repository at this point in the history
Signed-off-by: Griko Nibras <griko@nibras.co>
  • Loading branch information
grikomsn committed Jan 26, 2024
1 parent 2e97eaa commit c2b18e1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
8 changes: 3 additions & 5 deletions src/components/AssetInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ interface Props {
chain?: Chain;
onChainChange?: (chain: Chain) => void;
chains: Chain[];
showBalance?: boolean;
context: "source" | "destination";
isError?: string | boolean;
isLoading?: boolean;
Expand All @@ -44,7 +43,6 @@ function AssetInput({
chain,
chains,
onChainChange,
showBalance,
context,
isError,
isLoading,
Expand Down Expand Up @@ -103,7 +101,7 @@ function AssetInput({
/>
</div>
</div>
<div className="relative isolate mb-2">
<div className="relative isolate">
{isLoading && <SpinnerIcon className="absolute right-3 top-3 z-10 h-4 w-4 animate-spin text-neutral-300" />}
<input
data-testid="amount"
Expand Down Expand Up @@ -176,7 +174,7 @@ function AssetInput({
</p>
) : null}
<div className="flex-grow" />
{showBalance && account?.address && asset && (
{context === "source" && account?.address && asset && (
<div className="flex animate-slide-left-and-fade items-center text-sm text-neutral-400">
<span className="mr-1">Balance:</span>
<SimpleTooltip label={`${parseFloat(selectedAssetBalance).toString()} ${asset.recommendedSymbol}`}>
Expand Down Expand Up @@ -206,7 +204,7 @@ function AssetInput({
</div>
</div>
{typeof isError === "string" && (
<div className="animate-slide-up-and-fade text-balance text-center text-xs font-medium text-red-500">
<div className="mt-2 animate-slide-up-and-fade text-balance text-center text-xs font-medium text-red-500">
{isError}
</div>
)}
Expand Down
1 change: 0 additions & 1 deletion src/components/SwapWidget/SwapWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ export function SwapWidget() {
onAmountMax={onSourceAmountMax}
onAssetChange={onSourceAssetChange}
onChainChange={onSourceChainChange}
showBalance
context="source"
isLoading={direction === "swap-out" && routeLoading}
isError={isAmountError}
Expand Down

0 comments on commit c2b18e1

Please sign in to comment.