Skip to content

Commit

Permalink
v7.9.4
Browse files Browse the repository at this point in the history
v7.9.4
  • Loading branch information
platschi authored Sep 27, 2023
2 parents 8d165c1 + 5a16dab commit ed4fc68
Show file tree
Hide file tree
Showing 6 changed files with 194 additions and 157 deletions.
14 changes: 7 additions & 7 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,28 +86,28 @@
"@testing-library/react-hooks": "8.0.1",
"@testing-library/user-event": "14.4.3",
"@typechain/ethers-v5": "^10.2.1",
"@types/cors": "^2.8.13",
"@types/jest": "^29.5.3",
"@types/lodash": "4.14.196",
"@types/cors": "2.8.14",
"@types/jest": "29.5.5",
"@types/lodash": "4.14.198",
"@types/node": "14.0.13",
"@types/react": "18.2.18",
"@types/react": "18.2.22",
"@types/react-dom": "18.2.7",
"@types/react-responsive": "8.0.5",
"@types/react-select": "3.0.19",
"@types/react-slick": "0.23.10",
"@types/redux-logger": "^3.0.9",
"@types/styled-components": "^5.1.26",
"@types/styled-components": "5.1.27",
"@types/testing-library__jest-dom": "5.14.9",
"css-loader": "^6.8.1",
"eslint-config-turbo": "1.10.12",
"eslint-config-turbo": "1.10.14",
"html-to-image": "1.11.11",
"jest": "^29.6.2",
"jest-environment-jsdom": "^29.6.2",
"jest-preview": "^0.3.1",
"jest-transformer-svg": "^2.0.1",
"next-router-mock": "0.9.7",
"pinst": "3.0.0",
"postcss": "8.4.27",
"postcss": "8.4.30",
"prettier": "2.8.8",
"react-test-renderer": "17.0.1",
"storybook": "7.0.27",
Expand Down
40 changes: 36 additions & 4 deletions packages/app/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import dynamic from 'next/dynamic'
import Head from 'next/head'
import { FC } from 'react'
import { useRouter } from 'next/router'
import { FC, useCallback, useLayoutEffect } from 'react'
import { useTranslation } from 'react-i18next'
import styled from 'styled-components'

Expand All @@ -9,7 +10,13 @@ import Features from 'sections/homepage/Features'
import Hero from 'sections/homepage/Hero'
import ShortList from 'sections/homepage/ShortList'
import TradeNow from 'sections/homepage/TradeNow'
import BaseReferralModal from 'sections/referrals/ReferralModal/BaseReferralModal'
import HomeLayout from 'sections/shared/Layout/HomeLayout'
import { setOpenModal } from 'state/app/reducer'
import { selectShowModal } from 'state/app/selectors'
import { useAppDispatch, useAppSelector } from 'state/hooks'
import { fetchUnmintedBoostNftForCode } from 'state/referrals/action'
import { selectIsReferralCodeValid } from 'state/referrals/selectors'
import media from 'styles/media'

type AppLayoutProps = {
Expand All @@ -18,12 +25,34 @@ type AppLayoutProps = {

type HomePageComponent = FC & { layout?: FC<AppLayoutProps> }

const Assets = dynamic(() => import('../sections/homepage/Assets'), {
ssr: false,
})

const HomePage: HomePageComponent = () => {
const { t } = useTranslation()
const dispatch = useAppDispatch()
const router = useRouter()
const routerReferralCode = (router.query.ref as string)?.toLowerCase()
const isReferralCodeValid = useAppSelector(selectIsReferralCodeValid)
const openModal = useAppSelector(selectShowModal)

useLayoutEffect(() => {
if (router.isReady && routerReferralCode) {
dispatch(fetchUnmintedBoostNftForCode(routerReferralCode))
}
}, [dispatch, router.isReady, routerReferralCode])

useLayoutEffect(() => {
if (isReferralCodeValid) {
dispatch(setOpenModal('referrals_mint_boost_nft'))
}
}, [dispatch, isReferralCodeValid])

const onDismiss = useCallback(() => {
dispatch(setOpenModal(null))
}, [dispatch])

const Assets = dynamic(() => import('../sections/homepage/Assets'), {
ssr: false,
})
return (
<>
<Head>
Expand All @@ -39,6 +68,9 @@ const HomePage: HomePageComponent = () => {
<TradeNow />
</Container>
</HomeLayout>
{openModal === 'referrals_mint_boost_nft' && routerReferralCode && isReferralCodeValid && (
<BaseReferralModal onDismiss={onDismiss} referralCode={routerReferralCode} />
)}
</>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ export default function TradeConfirmationModal({
const ethBalanceExceeded = useAppSelector(selectKeeperDepositExceedsBal)
const hasSlTp = useAppSelector(selectNewTradeHasSlTp)
const sltpValidity = useAppSelector(selectTradePanelSLTPValidity)
const swapToken = useAppSelector(selectSelectedSwapDepositToken)

const [overridePriceProtection, setOverridePriceProtection] = useState(false)
const [acceptedSLRisk, setAcceptedSLRisk] = useState(false)
Expand Down Expand Up @@ -147,7 +146,7 @@ export default function TradeConfirmationModal({

const buttonText = allowanceValid
? t(`futures.market.trade.confirmation.modal.confirm-order.${leverageSide}`)
: t(`futures.market.trade.confirmation.modal.approve-order`, { asset: swapToken })
: t(`futures.market.trade.confirmation.modal.approve-order`, { asset: 'sUSD' })

return (
<StyledBaseModal
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { formatPercent } from '@kwenta/sdk/utils'
import { FC, memo } from 'react'
import { useRouter } from 'next/router'
import { FC, memo, useCallback } from 'react'
import { Trans, useTranslation } from 'react-i18next'
import styled from 'styled-components'

Expand All @@ -20,8 +21,14 @@ type Props = {

export const MintedNftModal: FC<Props> = memo(({ onDismiss, boostNftTier }) => {
const { t } = useTranslation()
const router = useRouter()
const { tier, boost } = REFFERAL_TIERS[boostNftTier]

const handleTradeNow = useCallback(() => {
router.push('/market')
onDismiss()
}, [onDismiss, router])

return (
<FlexDivColCentered>
<Spacer height={30} />
Expand Down Expand Up @@ -69,7 +76,7 @@ export const MintedNftModal: FC<Props> = memo(({ onDismiss, boostNftTier }) => {
loading={false}
textTransform="none"
fullWidth
onClick={onDismiss}
onClick={handleTradeNow}
>
<FlexDivRow columnGap="10px">
{t('referrals.affiliates.modal.referrer.trade-now-button')}
Expand Down
3 changes: 1 addition & 2 deletions packages/app/src/state/futures/smartMargin/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -606,8 +606,7 @@ export const selectSmartMarginAllowanceValid = createSelector(
selectSmartMarginBalanceInfo,
selectAvailableMarginInMarkets,
selectSmartMarginMarginDelta,
selectSwapDepositAllowance,
({ freeMargin }, idleInMarkets, marginDelta, allowance) => {
({ freeMargin, allowance }, idleInMarkets, marginDelta) => {
const totalIdleMargin = freeMargin.add(idleInMarkets)
const marginDeposit = marginDelta.sub(totalIdleMargin)
return totalIdleMargin.gte(marginDelta) || wei(allowance || 0).gte(marginDeposit)
Expand Down
Loading

1 comment on commit ed4fc68

@vercel
Copy link

@vercel vercel bot commented on ed4fc68 Sep 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

kwenta – ./packages/app

kwenta-git-main-kwenta.vercel.app
kwenta-kwenta.vercel.app
kwenta.io
www.kwenta.io

Please sign in to comment.