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

fix some of console errors and warnings #33

Merged
merged 2 commits into from
Apr 16, 2024
Merged
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 index.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
dataLayer.push(arguments)
}
gtag('js', new Date())
gtag('config', 'G-TEFDYYTWP3')
gtag('config', 'G-TEFDYYTWP3', { cookie_flags: 'SameSite=None;Secure' })
</script> -->

<link rel="canonical" href="https://eclipse.invariant.app/" />
Expand Down
12 changes: 10 additions & 2 deletions src/components/FarmsList/StakeTile/StakeTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,31 @@ export const StakeTile: React.FC<IProps> = ({
const [progress, setProgress] = useState<ProgressState>('none')

useEffect(() => {
let timeout1: number
let timeout2: number

if (typeof stakeStatus === 'undefined') {
return
}

if (!stakeStatus.inProgress && progress === 'progress') {
setProgress(stakeStatus.success ? 'approvedWithSuccess' : 'approvedWithFail')

setTimeout(() => {
timeout1 = setTimeout(() => {
setProgress(stakeStatus.success ? 'success' : 'failed')
}, 1500)

setTimeout(() => {
timeout2 = setTimeout(() => {
setProgress('none')
}, 3000)
} else if (stakeStatus.inProgress && progress !== 'progress') {
setProgress('progress')
}

return () => {
if (timeout1) clearTimeout(timeout1)
if (timeout2) clearTimeout(timeout2)
}
}, [stakeStatus])

const data = xToY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export const DepositAmountInput: React.FC<IProps> = ({
tooltip: classes.tooltip
}}>
<Typography className={classes.noData}>
<div className={classes.noDataIcon}>?</div>No data
<span className={classes.noDataIcon}>?</span>No data
</Typography>
</Tooltip>
)
Expand Down
4 changes: 2 additions & 2 deletions src/components/Inputs/RangeInput/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ const useStyles = makeStyles((theme: Theme) => ({
borderRadius: 10,
flex: '1 1 0%',

'& $input': {
'& input': {
textAlign: 'center'
},

'& $input:disabled': {
'& input:disabled': {
color: colors.white.main
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ export const SelectTokenModal: React.FC<ISelectTokenModal> = ({
return (
<Grid
className={classes.tokenItem}
container
style={{
...style,
width: '90%',
Expand Down
8 changes: 6 additions & 2 deletions src/components/NewPosition/RangeSelector/RangeSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ import { MIN_TICK } from '@invariant-labs/sdk-eclipse'
import { MAX_TICK } from '@invariant-labs/sdk-eclipse/src'
import PlotTypeSwitch from '@components/PlotTypeSwitch/PlotTypeSwitch'
import ConcentrationSlider from '../ConcentrationSlider/ConcentrationSlider'
import { getConcentrationArray, getMaxTick, getMinTick } from '@invariant-labs/sdk-eclipse/lib/utils'
import {
getConcentrationArray,
getMaxTick,
getMinTick
} from '@invariant-labs/sdk-eclipse/lib/utils'
import loader from '@static/gif/loader.gif'
import useStyles from './style'
import activeLiquidity from '@static/svg/activeLiquidity.svg'
Expand Down Expand Up @@ -343,7 +347,7 @@ export const RangeSelector: React.FC<IRangeSelector> = ({
tooltip: classes.liquidityTooltip
}}>
<Typography className={classes.activeLiquidity}>
Active liquidity <div className={classes.activeLiquidityIcon}>i</div>
Active liquidity <span className={classes.activeLiquidityIcon}>i</span>
</Typography>
</Tooltip>
<Typography className={classes.currentPrice}>Current price</Typography>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ const SinglePositionPlot: React.FC<ISinglePositionPlot> = ({
tooltip: classes.liquidityTooltip
}}>
<Typography className={classes.activeLiquidity}>
Active liquidity <div className={classes.activeLiquidityIcon}>i</div>
Active liquidity <span className={classes.activeLiquidityIcon}>i</span>
</Typography>
</Tooltip>
<Typography className={classes.currentPrice}>Current price</Typography>
Expand Down
7 changes: 5 additions & 2 deletions src/components/PriceRangePlot/Brush/svgHandles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const MinText: React.FC<Pick<ISVGHandle, 'x' | 'textColor'>> = ({ x, text
</svg>
)

export const LeftHandle: React.FC<Pick<ISVGHandle, 'height' | 'fill'>> = ({ height, fill }) => (
export const LeftHandle: React.FC<Pick<ISVGHandle, 'height' | 'fill'>> = ({ height = 0, fill }) => (
<>
<path d={`M36 ${height}V0`} stroke={fill} strokeWidth='2' />
<path d='M0 4C0 1.79086 1.79086 0 4 0H37V20H4C1.79086 20 0 18.2091 0 16V4Z' fill={fill} />
Expand All @@ -51,7 +51,10 @@ export const LeftHandle: React.FC<Pick<ISVGHandle, 'height' | 'fill'>> = ({ heig
</>
)

export const RightHandle: React.FC<Pick<ISVGHandle, 'height' | 'fill'>> = ({ height, fill }) => (
export const RightHandle: React.FC<Pick<ISVGHandle, 'height' | 'fill'>> = ({
height = 0,
fill
}) => (
<>
<path d={`M1 ${height}V0`} stroke={fill} strokeWidth='2' />
<path d='M37 4C37 1.79086 35.2091 0 33 0H0V20H33C35.2091 20 37 18.2091 37 16V4Z' fill={fill} />
Expand Down
8 changes: 4 additions & 4 deletions src/components/PriceRangePlot/PriceRangePlot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,8 @@ export const PriceRangePlot: React.FC<IPriceRangePlot> = ({
<text
x='50%'
y='50%'
dominant-baseline='middle'
text-anchor='middle'
dominantBaseline='middle'
textAnchor='middle'
className={classes.loadingText}>
Loading liquidity data...
</text>
Expand Down Expand Up @@ -435,15 +435,15 @@ export const PriceRangePlot: React.FC<IPriceRangePlot> = ({
data={[
{
id: 'less than range',
data: currentLessThanRange
data: currentLessThanRange.length ? currentLessThanRange : [{ x: plotMin, y: 0 }]
},
{
id: 'range',
data: currentRange
},
{
id: 'greater than range',
data: currentGreaterThanRange
data: currentGreaterThanRange.length ? currentGreaterThanRange : [{ x: plotMax, y: 0 }]
}
]}
curve={isDiscrete ? (isXtoY ? 'stepAfter' : 'stepBefore') : 'basis'}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Stats/PoolListItem/PoolListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const PoolListItem: React.FC<IProps> = ({
classes={{
tooltip: classes.liquidityTooltip
}}>
<div className={classes.activeLiquidityIcon}>i</div>
<span className={classes.activeLiquidityIcon}>i</span>
</Tooltip>
</Typography>
) : null}
Expand Down
12 changes: 10 additions & 2 deletions src/components/Swap/Swap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,17 @@ export const Swap: React.FC<ISwap> = ({
setDetailsOpen(!detailsOpen)
}

React.useEffect(() => {
useEffect(() => {
let timeoutId: number

if (lockAnimation) {
setTimeout(() => setLockAnimation(false), 500)
timeoutId = setTimeout(() => setLockAnimation(false), 500)
}

return () => {
if (timeoutId) {
clearTimeout(timeoutId)
}
}
}, [lockAnimation])

Expand Down
12 changes: 10 additions & 2 deletions src/containers/NewPositionWrapper/NewPositionWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ export const NewPositionWrapper: React.FC<IProps> = ({
}, [poolIndex])

useEffect(() => {
let timeoutId1: number
let timeoutId2: number

if (!inProgress && progress === 'progress') {
setProgress(success ? 'approvedWithSuccess' : 'approvedWithFail')

Expand All @@ -99,14 +102,19 @@ export const NewPositionWrapper: React.FC<IProps> = ({
)
}

setTimeout(() => {
timeoutId1 = setTimeout(() => {
setProgress(success ? 'success' : 'failed')
}, 1500)

setTimeout(() => {
timeoutId2 = setTimeout(() => {
setProgress('none')
}, 3000)
}

return () => {
clearTimeout(timeoutId1)
clearTimeout(timeoutId2)
}
}, [success, inProgress])

const isXtoY = useMemo(() => {
Expand Down
14 changes: 11 additions & 3 deletions src/containers/WrappedSwap/WrappedSwap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,27 @@ export const WrappedSwap = () => {
const [progress, setProgress] = useState<ProgressState>('none')
const [tokenFrom, setTokenFrom] = useState<PublicKey | null>(null)
const [tokenTo, setTokenTo] = useState<PublicKey | null>(null)

useEffect(() => {
let timeoutId1: number
let timeoutId2: number

if (!inProgress && progress === 'progress') {
setProgress(success ? 'approvedWithSuccess' : 'approvedWithFail')

setTimeout(() => {
timeoutId1 = setTimeout(() => {
setProgress(success ? 'success' : 'failed')
}, 1500)

setTimeout(() => {
timeoutId2 = setTimeout(() => {
setProgress('none')
}, 3000)
}

// Cleanup function
return () => {
clearTimeout(timeoutId1)
clearTimeout(timeoutId2)
}
}, [success, inProgress])

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/web3/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const getCurrentSolanaConnection = (): Connection | null => {

export {
getSolanaConnection,
EclipseNetworks as EclipseNetworks,
EclipseNetworks,
getCurrentSolanaConnection,
// networkTypetoStakerNetwork,
networkTypetoProgramNetwork
Expand Down
Loading