Skip to content

Commit

Permalink
fix: confirm button
Browse files Browse the repository at this point in the history
  • Loading branch information
siandreev committed Dec 13, 2024
1 parent 7920f3b commit 2a6888f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
7 changes: 1 addition & 6 deletions apps/web-swap-widget/src/components/SwapWidgetPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { styled } from 'styled-components';
import { useEncodeSwapToTonConnectParams } from '@tonkeeper/uikit/dist/state/swap/useEncodeSwap';
import { useState } from 'react';
import {
useSelectedSwap,
useSwapFromAmount,
Expand Down Expand Up @@ -60,7 +59,6 @@ export const SwapWidgetPage = () => {
const { isLoading, mutateAsync: encode } = useEncodeSwapToTonConnectParams({
forceCalculateBattery: true
});
const [hasBeenSent, setHasBeenSent] = useState<boolean>(false);
const [selectedSwap] = useSelectedSwap();
const [fromAsset, setFromAsset] = useSwapFromAsset();
const [toAsset, setToAsset] = useSwapToAsset();
Expand All @@ -73,7 +71,6 @@ export const SwapWidgetPage = () => {

const ctx = getTonkeeperInjectionContext()!;

setHasBeenSent(true);
try {
const result = await ctx.sendTransaction({
source: ctx.address,
Expand Down Expand Up @@ -105,8 +102,6 @@ export const SwapWidgetPage = () => {
onOpen();
} catch (e) {
notifyError(toErrorMessage(e));
} finally {
setHasBeenSent(false);
}
};

Expand All @@ -127,7 +122,7 @@ export const SwapWidgetPage = () => {
</ChangeIconStyled>
</SwapFromField>
<SwapToField separateInfo />
<SwapButton onClick={onConfirm} isEncodingProcess={isLoading || hasBeenSent} />
<SwapButton onClick={onConfirm} isEncodingProcess={isLoading} />
<Spacer />
<SwapWidgetFooter />
<SwapTokensListNotification />
Expand Down
4 changes: 2 additions & 2 deletions packages/uikit/src/components/swap/SwapButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ export const SwapButton: FC<{ onClick: () => void; isEncodingProcess: boolean }>
}

return (
<Button size="medium" primary onClick={onClick}>
isEncodingProcess: {isEncodingProcess}
<Button size="medium" primary onClick={onClick} loading={isEncodingProcess}>
{t('continue')}
</Button>
);
};
4 changes: 4 additions & 0 deletions packages/uikit/src/components/swap/SwapToField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ const FiledContainerStyled = styled.div`
border-radius: ${p =>
p.theme.displayType === 'full-width' ? p.theme.corner2xSmall : p.theme.cornerSmall};
padding: 6px 12px;
&:empty {
display: none;
}
`;

const FiledHeader = styled.div`
Expand Down

0 comments on commit 2a6888f

Please sign in to comment.