Skip to content

Commit

Permalink
Merge pull request #585 from madfish-solutions/v2.1.4
Browse files Browse the repository at this point in the history
V2.1.4
  • Loading branch information
herkoss authored Apr 6, 2022
2 parents 2dadb18 + 7692384 commit ba25be2
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 9 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ You can check out [the Next.js GitHub repository](https://github.com/vercel/next
## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
v2.1.4

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next-production-starter",
"version": "2.1.3",
"version": "2.1.4",
"private": true,
"scripts": {
"dev:mainnet": "cross-env NEXT_PUBLIC_NETWORK=mainnet DEFAULT_TOKENS_SLUGS=tez-KT193D4vozYnhGJQVtw7CoxxqphqUEEwK6Vb_0 NEXT_PUBLIC_MAINNET_BASE_URL=http://localhost:3000 NEXT_PUBLIC_HANGZHOUNET_BASE_URL=http://localhost:3002 next dev -p 3000",
Expand Down
4 changes: 3 additions & 1 deletion src/components/modals/PositionsModal/PositionTokenCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FC } from 'react';
import { Checkbox } from '@quipuswap/ui-kit';

import { TokenCell } from '@components/modals/Modal';
import { getTokenName, getTokenSymbol, prepareTokenLogo } from '@utils/helpers';
import { getTokenName, getTokenSymbol, isTezosToken, prepareTokenLogo } from '@utils/helpers';
import { Token } from '@utils/types';

interface PositionTokenCellProps {
Expand All @@ -17,6 +17,8 @@ export const PositionTokenCell: FC<PositionTokenCellProps> = ({ token, onClick,
tokenIcon={prepareTokenLogo(token.metadata?.thumbnailUri)}
tokenName={getTokenName(token)}
tokenSymbol={getTokenSymbol(token)}
tokenType={token.type}
isTezosToken={isTezosToken(token)}
tabIndex={0}
onClick={onClick}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
z-index: 99;
}

.modalPortal {
overflow: hidden;
}

.stakeIcon {
height: 36px;
width: 100%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ export const ConfirmationModal: FC = () => {

return (
<Modal
portalClassName={styles.modal}
className={styles.modal}
portalClassName={styles.modalPortal}
title={t('common|confirmation')}
contentClassName={compoundClassName}
isOpen={confirmationModalOpen}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

.button
max-width: 100%

.modalPortal
overflow: hidden

.column
display: flex
Expand Down
3 changes: 2 additions & 1 deletion src/components/modals/donation-modal/donation-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ export const DonationModal: FC = () => {

return (
<Modal
portalClassName={s.modal}
className={s.modal}
portalClassName={s.modalPortal}
title={t('common|Donate')}
contentClassName={compoundClassName}
isOpen={donationModalOpen}
Expand Down
7 changes: 5 additions & 2 deletions src/containers/swap-send/hooks/use-swap-formik.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import BigNumber from 'bignumber.js';
import { useFormik } from 'formik';
import { FormikHelpers, useFormik } from 'formik';

import { DEFAULT_DEADLINE_MINS, DEFAULT_SLIPPAGE_PERCENTAGE, TOKEN_TO_TOKEN_DEX } from '@app.config';
import { useDexGraph } from '@hooks/use-dex-graph';
Expand Down Expand Up @@ -35,7 +35,7 @@ export const useSwapFormik = (initialAction = SwapTabAction.SWAP) => {
[SwapField.DEADLINE]: new BigNumber(DEFAULT_DEADLINE_MINS)
};

const handleSubmit = async (formValues: Partial<SwapFormValues>) => {
const handleSubmit = async (formValues: Partial<SwapFormValues>, actions: FormikHelpers<Partial<SwapFormValues>>) => {
if (!tezos || !accountPkh) {
return;
}
Expand All @@ -45,6 +45,7 @@ export const useSwapFormik = (initialAction = SwapTabAction.SWAP) => {

const rawInputAmount = toDecimals(inputAmount, inputToken);
try {
actions.setSubmitting(true);
const walletOperation = await swap(tezos, accountPkh, {
deadlineTimespan: deadline.times(SECS_IN_MIN).integerValue(BigNumber.ROUND_HALF_UP).toNumber(),
inputAmount: rawInputAmount,
Expand All @@ -59,6 +60,7 @@ export const useSwapFormik = (initialAction = SwapTabAction.SWAP) => {
})!,
ttDexAddress: TOKEN_TO_TOKEN_DEX
});
actions.setSubmitting(false);

const inputTokenSymbol = getTokenSymbol(inputToken);
const outputTokenSymbol = getTokenSymbol(outputToken);
Expand All @@ -69,6 +71,7 @@ export const useSwapFormik = (initialAction = SwapTabAction.SWAP) => {
message: swapMessage
});
} catch (e) {
actions.setSubmitting(false);
showErrorToast(e as Error);
throw e;
}
Expand Down
13 changes: 10 additions & 3 deletions src/containers/swap-send/swap-send.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const PRICE_IMPACT_WARNING_THRESHOLD = 10;
const OrdinarySwapSend: FC<SwapSendProps & WithRouterProps> = ({ className, initialAction, router }) => {
const {
errors,
isSubmitting,
values: { deadline, inputToken, outputToken, inputAmount, outputAmount, action, recipient, slippage },
validateField,
setValues,
Expand Down Expand Up @@ -472,13 +473,19 @@ const OrdinarySwapSend: FC<SwapSendProps & WithRouterProps> = ({ className, init
/>
</div>
{!accountPkh && <ConnectWalletButton className={s.button} />}
{accountPkh && dataIsStale && (
{accountPkh && dataIsStale && !isSubmitting && (
<Button loading={dexPoolsLoading} onClick={refreshDexPools} className={s.button}>
{t('swap|Update Rates')}
</Button>
)}
{accountPkh && !dataIsStale && (
<Button disabled={submitDisabled} type="submit" onClick={handleSubmit} className={s.button}>
{accountPkh && (!dataIsStale || isSubmitting) && (
<Button
disabled={submitDisabled}
loading={isSubmitting}
type="submit"
onClick={handleSubmit}
className={s.button}
>
{currentTabLabel}
</Button>
)}
Expand Down

0 comments on commit ba25be2

Please sign in to comment.