Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v7.7.2 #2783

Merged
merged 5 commits into from
Sep 18, 2023
Merged

v7.7.2 #2783

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/jest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ jobs:
NEXT_PUBLIC_WALLETCONNECT_V2_ID: ${{ secrets.NEXT_PUBLIC_WALLETCONNECT_V2_ID }}

- name: Upload coverage to codecov.io
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Required:
- `NEXT_PUBLIC_SATSUMA_API_KEY` - API key for Satsuma subgraph queries
- `NEXT_PUBLIC_THEGRAPH_API_KEY` - API key for The Graph's decentralized service
- `NEXT_PUBLIC_DEFAULT_PRICE_SERVICE` - Specifies the default price server, options are `KWENTA` or `PYTH`
- `NEXT_PUBLIC_SERVICES_PROXY` - Specify Kwenta proxy server

### Run

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kwenta",
"version": "7.7.0",
"version": "7.7.2",
"description": "Kwenta",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kwenta/app",
"version": "7.7.0",
"version": "7.7.2",
"scripts": {
"dev": "next",
"build": "next build",
Expand Down
6 changes: 3 additions & 3 deletions packages/app/src/constants/announcement.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { MILLISECONDS_PER_DAY } from '@kwenta/sdk/constants'

// Shows or hides the home page banner entirely when set to true/false
export const BANNER_ENABLED = false
export const BANNER_ENABLED = true
// Sets the link destination for the banner component, or renders the banner as
// plain, un-clickable text if set to a falsey value (`false`, `null`, '', etc...)
export const BANNER_LINK_URL =
'https://mirror.xyz/kwenta.eth/xFomD0VE0H7o2sQ9zGeLyYPwCmtp8tLMXNTGtWy2UOQ'
'https://mirror.xyz/kwenta.eth/qJaLnoRFh8O_UhT3GZB15g8tJDG7KJmKdAEbd905BjM'
// Sets the text displayed on the home page banner
export const BANNER_TEXT = 'Important: Staking V2 Migration Coming Soon. Read More ↗'
export const BANNER_TEXT = 'Staking V2 Migration on September 21st. Read More ↗'
// Sets the height of the banner component on desktop
export const BANNER_HEIGHT_DESKTOP = 50
// Sets the height of the banner component on mobile
Expand Down
83 changes: 43 additions & 40 deletions packages/app/src/sections/dashboard/Stake/RewardsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ const RewardsTab: FC<TradingRewardProps> = ({ period = 0 }) => {
value: formatNumber(estimatedOpRewards, { minDecimals: 4 }),
},
],
disabled: opRewards.eq(0),
},
{
key: 'snx-rewards',
Expand Down Expand Up @@ -211,46 +212,48 @@ const RewardsTab: FC<TradingRewardProps> = ({ period = 0 }) => {
/>
</HeaderContainer>
<CardsContainer>
{rewardsInfo.map(({ key, title, copy, labels, info }) => (
<CardGrid key={key}>
<div>
<Body size="large" color="primary">
{title}
</Body>
<Body color="secondary">{copy}</Body>
</div>
<RewardsContainer>
<FlexDivRow justifyContent="flex-start" columnGap="15px">
{labels.map(({ label, value, labelIcon, valueIcon }) => (
<FlexDivCol rowGap="5px">
<IconContainer color="secondary">
{label}
{labelIcon}
</IconContainer>
<IconContainer size="large" color="preview">
{value}
{valueIcon}
</IconContainer>
</FlexDivCol>
))}
</FlexDivRow>
<FlexDivRow justifyContent="flex-start" columnGap="15px">
{info.map(({ label, labelIcon, value, valueIcon }) => (
<FlexDivCol rowGap="5px">
<IconContainer color="secondary">
{label}
{labelIcon}
</IconContainer>
<IconContainer size="large" color="primary">
{value}
{valueIcon}
</IconContainer>
</FlexDivCol>
))}
</FlexDivRow>
</RewardsContainer>
</CardGrid>
))}
{rewardsInfo
.filter((r) => !r.disabled)
.map(({ key, title, copy, labels, info }) => (
<CardGrid key={key}>
<div>
<Body size="large" color="primary">
{title}
</Body>
<Body color="secondary">{copy}</Body>
</div>
<RewardsContainer>
<FlexDivRow justifyContent="flex-start" columnGap="15px">
{labels.map(({ label, value, labelIcon, valueIcon }) => (
<FlexDivCol rowGap="5px">
<IconContainer color="secondary">
{label}
{labelIcon}
</IconContainer>
<IconContainer size="large" color="preview">
{value}
{valueIcon}
</IconContainer>
</FlexDivCol>
))}
</FlexDivRow>
<FlexDivRow justifyContent="flex-start" columnGap="15px">
{info.map(({ label, labelIcon, value, valueIcon }) => (
<FlexDivCol rowGap="5px">
<IconContainer color="secondary">
{label}
{labelIcon}
</IconContainer>
<IconContainer size="large" color="primary">
{value}
{valueIcon}
</IconContainer>
</FlexDivCol>
))}
</FlexDivRow>
</RewardsContainer>
</CardGrid>
))}
<ButtonContainer>
<Button
variant="yellow"
Expand Down
29 changes: 2 additions & 27 deletions packages/app/src/sections/dashboard/Stake/StakingHeading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import { useTranslation } from 'react-i18next'
import styled from 'styled-components'

import Button from 'components/Button'
import { FlexDivCentered, FlexDivCol, FlexDivRowCentered } from 'components/layout/flex'
import { Body, Heading } from 'components/Text'
import { BANNER_TEXT } from 'constants/announcement'
import { FlexDivCol, FlexDivRowCentered } from 'components/layout/flex'
import { Heading } from 'components/Text'
import { EXTERNAL_LINKS } from 'constants/links'

interface StakingHeadingProps {
Expand All @@ -17,13 +16,6 @@ export const StakingHeading: FC<StakingHeadingProps> = memo(({ title }) => {

return (
<FlexDivCol>
<BannerContainer
onClick={() =>
window.open(EXTERNAL_LINKS.Docs.StakingV2Migration, '_blank', 'noopener noreferrer')
}
>
<FuturesLink>{BANNER_TEXT}</FuturesLink>
</BannerContainer>
<TitleContainer>
<FlexDivCol rowGap="5px">
<StyledHeading variant="h4">{title}</StyledHeading>
Expand Down Expand Up @@ -53,20 +45,3 @@ const StyledButton = styled(Button)`
const StyledHeading = styled(Heading)`
font-weight: 400;
`

const FuturesLink = styled(Body)`
color: ${(props) => props.theme.colors.selectedTheme.newTheme.banner.yellow.text};
padding: 20px 0px;
`

const BannerContainer = styled(FlexDivCentered)`
width: 100%;
justify-content: center;
background: ${(props) => props.theme.colors.selectedTheme.newTheme.banner.yellow.background};
margin-bottom: 30px;
cursor: pointer;
border-radius: 8px;
white-space: pre-wrap;
text-align: center;
padding: 0px 5px;
`
1 change: 1 addition & 0 deletions packages/app/src/sections/dashboard/Stake/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ export type RewardsInfo = {
copy: string
labels: RewardsCard[]
info: RewardsCard[]
disabled?: boolean
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
rewards: opRewards,
onClick: handleClaimOp,
isDisabled: claimDisabledOp,
rewardsDisabled: opRewards.eq(0),
},
{
key: 'snx-rewards',
Expand Down Expand Up @@ -129,7 +130,7 @@
{open && (
<RewardsTabContainer ref={ref}>
<CardsContainer>
{REWARDS.map((reward) => (
{REWARDS.filter((r) => !r.rewardsDisabled).map((reward) => (

Check warning on line 133 in packages/app/src/sections/shared/Layout/AppLayout/Header/BalanceActions.tsx

View check run for this annotation

Codecov / codecov/patch

packages/app/src/sections/shared/Layout/AppLayout/Header/BalanceActions.tsx#L133

Added line #L133 was not covered by tests
<CardGrid key={reward.key}>
<Body size="medium" color="primary" weight="bold">
{reward.title}
Expand Down
17 changes: 11 additions & 6 deletions packages/app/src/sections/shared/Layout/HomeLayout/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
import {
BANNER_ENABLED,
BANNER_HEIGHT_DESKTOP,
BANNER_HEIGHT_MOBILE,
BANNER_LINK_URL,
BANNER_TEXT,
BANNER_WAITING_TIME,
} from 'constants/announcement'
import useWindowSize from 'hooks/useWindowSize'
import { MARKET_SELECTOR_HEIGHT_MOBILE } from 'sections/futures/Trade/MarketsDropdownSelector'
import CloseIconWithHover from 'sections/shared/components/CloseIconWithHover'
import { setShowBanner } from 'state/app/reducer'
Expand All @@ -29,15 +29,22 @@
const BannerView: React.FC<BannerViewProps> = ({ mode, onDismiss, onDetails }) => {
const router = useRouter()
const isMobile = mode === 'mobile'
const { lessThanWidth } = useWindowSize()

Check warning on line 32 in packages/app/src/sections/shared/Layout/HomeLayout/Banner.tsx

View check run for this annotation

Codecov / codecov/patch

packages/app/src/sections/shared/Layout/HomeLayout/Banner.tsx#L32

Added line #L32 was not covered by tests
const closeIconStyle = isMobile ? { flex: '0.08', marginTop: '5px' } : { flex: '0.1' }
const closeIconProps = isMobile ? { width: 12, height: 12 } : {}
const linkSize = isMobile ? 'small' : 'medium'
const marginTop =
router.pathname.includes('market') &&
lessThanWidth('md') &&
!router.pathname.includes('dashboard')
? `${MARKET_SELECTOR_HEIGHT_MOBILE}px`
: '0px'

Check warning on line 41 in packages/app/src/sections/shared/Layout/HomeLayout/Banner.tsx

View check run for this annotation

Codecov / codecov/patch

packages/app/src/sections/shared/Layout/HomeLayout/Banner.tsx#L38-L41

Added lines #L38 - L41 were not covered by tests

return (
<FuturesBannerContainer
onClick={onDetails}
$hasDetails={!!BANNER_LINK_URL}
$compact={!router.pathname.includes('market')}
$marginTop={marginTop}
>
<FuturesBannerLinkWrapper>
<FuturesLink size={linkSize}>
Expand Down Expand Up @@ -105,14 +112,15 @@
`};
`

const FuturesBannerContainer = styled.div<{ $hasDetails?: boolean; $compact?: boolean }>`
const FuturesBannerContainer = styled.div<{ $hasDetails?: boolean; $marginTop: string }>`
height: ${BANNER_HEIGHT_DESKTOP}px;
width: 100%;
display: flex;
align-items: center;
background: ${(props) => props.theme.colors.selectedTheme.newTheme.banner.yellow.background};
margin-bottom: 15px;
cursor: ${(props) => (props.$hasDetails ? 'pointer' : 'auto')};
margin-top: ${(props) => props.$marginTop || '0px'};

${media.lessThan('md')`
position: relative;
Expand All @@ -124,10 +132,7 @@
padding: 12px 10px;
border-radius: 0px;
gap: 5px;
height: ${BANNER_HEIGHT_MOBILE}px;
`}

margin-top: ${(props) => (props.$compact ? 0 : MARKET_SELECTOR_HEIGHT_MOBILE)}px;
`

const FuturesBannerLinkWrapper = styled.div`
Expand Down
3 changes: 1 addition & 2 deletions packages/app/src/state/referrals/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { ThunkConfig } from 'state/types'
import { selectWallet } from 'state/wallet/selectors'
import logError from 'utils/logError'

import { setMintedBoostNft, setStartOnboarding } from './reducer'
import { setMintedBoostNft } from './reducer'

export const mintBoostNft = createAsyncThunk<void, string, ThunkConfig>(
'referrals/mintBoostNft',
Expand All @@ -44,7 +44,6 @@ export const mintBoostNft = createAsyncThunk<void, string, ThunkConfig>(
await monitorAndAwaitTransaction(dispatch, tx)
dispatch(fetchBoostNftForAccount())
dispatch(setMintedBoostNft(true))
dispatch(setStartOnboarding(false))
} catch (err) {
logError(err)
dispatch(handleTransactionError(err.message))
Expand Down
Loading