Skip to content

Commit

Permalink
minor issues (#2259)
Browse files Browse the repository at this point in the history
* fix: CR-617

* fix: hide num of active pos if its zero
  • Loading branch information
viet-nv authored Sep 21, 2023
1 parent abfc61e commit 23cc4de
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 63 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@
"@typescript-eslint/eslint-plugin": "^5.58.0",
"@typescript-eslint/parser": "^5.58.0",
"@vitejs/plugin-react": "^3.1.0",
"@welldone-software/why-did-you-render": "^7.0.1",
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-macros": "^3.1.0",
"env-cmd": "^10.1.0",
Expand Down
30 changes: 2 additions & 28 deletions src/components/YieldPools/FarmingPoolAPRCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const APRTooltipContent = ({
</Text>
</Flex>

{!!farmAPR && (
{!!maxFarmAPR && (
<Flex
sx={{
flexDirection: 'column',
Expand All @@ -91,33 +91,7 @@ export const APRTooltipContent = ({
<Text as="span" color={theme.warning}>
Farm APR:{' '}
<Text as="span" fontWeight={500}>
{formatDisplayNumber(farmAPR / 100, { style: 'percent', fractionDigits: 2 })}
</Text>
</Text>
<Text
as="span"
fontStyle="italic"
sx={{
whiteSpace: upToSmall ? 'wrap' : 'nowrap',
}}
>
<Trans>Estimated return from additional rewards if you also participate in the farm</Trans>
</Text>
</Flex>
)}

{!!farmV2APR && Number.isFinite(farmV2APR) && (
<Flex
sx={{
flexDirection: 'column',
fontSize: '12px',
lineHeight: '16px',
}}
>
<Text as="span" color={theme.warning}>
Farm APR:{' '}
<Text as="span" fontWeight={500}>
{formatDisplayNumber(farmV2APR / 100, { style: 'percent', fractionDigits: 2 })}
{formatDisplayNumber(maxFarmAPR / 100, { style: 'percent', fractionDigits: 2 })}
</Text>
</Text>
<Text
Expand Down
1 change: 0 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import '@/wdyr'
import * as Sentry from '@sentry/react'
import { BrowserTracing } from '@sentry/tracing'
import { Web3ReactHooks, Web3ReactProvider } from '@web3-react/core'
Expand Down
18 changes: 10 additions & 8 deletions src/pages/MyEarnings/Positions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,16 @@ function PositionStats({

return (
<Flex sx={{ gap: '1rem' }}>
<Flex sx={{ gap: '4px' }}>
<IconWrapper color={theme.primary}>
<Info size={10} />
</IconWrapper>
<Text fontSize={14} fontWeight="500">
<Trans>{numOfActivePositions} Active</Trans>
</Text>
</Flex>
{!!numOfActivePositions && (
<Flex sx={{ gap: '4px' }}>
<IconWrapper color={theme.primary}>
<Info size={10} />
</IconWrapper>
<Text fontSize={14} fontWeight="500">
<Trans>{numOfActivePositions} Active</Trans>
</Text>
</Flex>
)}

{numOfInactivePositions ? (
<Flex sx={{ gap: '4px' }}>
Expand Down
1 change: 1 addition & 0 deletions src/services/earning/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ const earningApi = createApi({
const positionData: GetElasticEarningResponse = (positionsRes?.data as any).data as GetElasticEarningResponse

const aggregateData = Object.keys(positionData).reduce((acc, chainName) => {
if (!positionData?.[chainName]) return acc
return {
...acc,
[chainName]: {
Expand Down
3 changes: 1 addition & 2 deletions src/state/farms/elasticv2/updater.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ export default function ElasticFarmV2Updater({ interval = true }: { interval?: b
const dispatch = useAppDispatch()
const { networkInfo, isEVM, chainId, account } = useActiveWeb3React()
const elasticFarm = useAppSelector(state => state.elasticFarmV2[chainId] || defaultChainData)
const { elasticClient } = useKyberSwapConfig()
const isEnableKNProtocol = true
const { elasticClient, isEnableKNProtocol } = useKyberSwapConfig()

const multicallContract = useMulticallContract()
const farmv2QuoterContract = useContract(
Expand Down
2 changes: 1 addition & 1 deletion src/utils/numbers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const parseNum = (value: FormatValue): Fraction => {
value instanceof Price
) {
const valueStr = (() => {
if (typeof value === 'string') return value
if (typeof value === 'string') return toFixed(+value)
if (typeof value === 'number') return toFixed(value)
if (value instanceof CurrencyAmount) return value.toFixed(value.currency.decimals)
if (value instanceof Price) return value.toFixed(18)
Expand Down
14 changes: 0 additions & 14 deletions src/wdyr.ts

This file was deleted.

9 changes: 1 addition & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5863,13 +5863,6 @@
motion "10.16.2"
qrcode "1.5.3"

"@welldone-software/why-did-you-render@^7.0.1":
version "7.0.1"
resolved "https://registry.yarnpkg.com/@welldone-software/why-did-you-render/-/why-did-you-render-7.0.1.tgz#09f487d84844bd8e66435843c2e0305702e61efb"
integrity sha512-Qe/8Xxa2G+LMdI6VoazescPzjjkHYduCDa8aHOJR50e9Bgs8ihkfMBY+ev7B4oc3N59Zm547Sgjf8h5y0FOyoA==
dependencies:
lodash "^4"

"@wojtekmaj/date-utils@^1.0.2", "@wojtekmaj/date-utils@^1.0.3":
version "1.0.3"
resolved "https://registry.yarnpkg.com/@wojtekmaj/date-utils/-/date-utils-1.0.3.tgz#2dcfd92881425c5923e429c2aec86fb3609032a1"
Expand Down Expand Up @@ -12507,7 +12500,7 @@ lodash.upperfirst@4.3.1:
resolved "https://registry.yarnpkg.com/lodash.upperfirst/-/lodash.upperfirst-4.3.1.tgz#1365edf431480481ef0d1c68957a5ed99d49f7ce"
integrity sha512-sReKOYJIJf74dhJONhU4e0/shzi1trVbSWDOhKYE5XV2O+H7Sb2Dihwuc7xWxVl+DgFPyTqIN3zMfT9cq5iWDg==

lodash@4.17.21, lodash@^4, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4:
lodash@4.17.21, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
Expand Down

0 comments on commit 23cc4de

Please sign in to comment.