Skip to content

Commit

Permalink
fix: button text
Browse files Browse the repository at this point in the history
  • Loading branch information
siandreev committed Dec 13, 2024
1 parent 49173b9 commit 66704df
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion apps/web-swap-widget/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tonkeeper/web-swap-widget",
"version": "3.0.4",
"version": "3.0.5",
"author": "Ton APPS UK Limited <support@tonkeeper.com>",
"description": "Web swap widget for Tonkeeper",
"dependencies": {
Expand Down
7 changes: 2 additions & 5 deletions apps/web-swap-widget/src/components/SwapWidgetPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { SwapWidgetFooter } from './SwapWidgetFooter';
import { SwapWidgetTxSentNotification } from './SwapWidgetTxSent';
import { useDisclosure } from '@tonkeeper/uikit/dist/hooks/useDisclosure';
import { useToast } from '@tonkeeper/uikit/dist/hooks/useNotification';
import { toErrorMessage } from '@tonkeeper/uikit/dist/libs/common';

const MainFormWrapper = styled.div`
height: 100%;
Expand Down Expand Up @@ -103,11 +104,7 @@ export const SwapWidgetPage = () => {

onOpen();
} catch (e) {
if (e && typeof e === 'object' && 'message' in e && typeof e.message === 'string') {
notifyError(e.message);
} else if (e && typeof e === 'string') {
notifyError(e);
}
notifyError(toErrorMessage(e));
} finally {
setHasBeenSent(false);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/uikit/src/components/swap/SwapButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const SwapButton: FC<{ onClick: () => void; isEncodingProcess: boolean }>

return (
<Button size="medium" primary onClick={onClick} loading={isEncodingProcess}>
{t('continue')}
isEncodingProcess: {isEncodingProcess}
</Button>
);
};
11 changes: 11 additions & 0 deletions packages/uikit/src/libs/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,14 @@ export const getCountryName = (language: string, country: string) => {
return country;
}
};

export const toErrorMessage = (e: unknown) => {
if (e && typeof e === 'object' && 'message' in e && typeof e.message === 'string') {
return e.message;
} else if (e && typeof e === 'string') {
return e;
}

console.error(e);
return 'Unknown error';
};

0 comments on commit 66704df

Please sign in to comment.