Skip to content

Commit b2291a7

Browse files
authored
Merge pull request #334 from invariant-labs/staging
Update prod
2 parents ef435eb + 5e149ff commit b2291a7

File tree

13 files changed

+73
-30
lines changed

13 files changed

+73
-30
lines changed

src/components/NewPosition/PoolInit/PoolInit.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ export const PoolInit: React.FC<IPoolInit> = ({
407407
/>
408408
</Grid>
409409
) : (
410-
<Grid container className={classes.buttons}>
410+
<Grid container className={classes.buttons} justifyContent='center' alignItems='center'>
411411
<Button className={classes.button} onClick={resetRange}>
412412
Reset range
413413
</Button>

src/components/NewPosition/PoolInit/style.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ const useStyles = makeStyles()(theme => {
7777
}
7878
},
7979
buttons: {
80-
marginTop: 38,
80+
marginTop: 4,
8181
width: '100%',
82+
height: 70,
8283
flexDirection: 'row',
8384
gap: 16,
8485
alignItems: 'center'

src/components/Swap/ExchangeRate/ExchangeRate.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ const ExchangeRate: React.FC<iProps> = ({
2929
</Box>
3030
) : (
3131
<Typography className={classes.rateText}>
32-
1 {tokenFromSymbol} = {isNaN(amount) ? 0 : formatNumber(amount.toFixed(tokenToDecimals))}{' '}
32+
1 {tokenFromSymbol} ={' '}
33+
{isNaN(amount)
34+
? 0
35+
: formatNumber(amount.toFixed(tokenToDecimals)) === '0'
36+
? '~0'
37+
: formatNumber(amount.toFixed(tokenToDecimals))}{' '}
3338
{tokenToSymbol}
3439
</Typography>
3540
)

src/components/Swap/TransactionDetailsBox/TransactionDetailsBox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const TransactionDetailsBox: React.FC<IProps> = ({
3939
<Typography className={classes.value}>
4040
{exchangeRate.val === Infinity
4141
? '-'
42-
: `${formatNumber(exchangeRate.val.toFixed(exchangeRate.decimal))} ${exchangeRate.symbol}`}
42+
: `${formatNumber(exchangeRate.val.toFixed(exchangeRate.decimal)) === '0' ? '~0' : formatNumber(exchangeRate.val.toFixed(exchangeRate.decimal))} ${exchangeRate.symbol}`}
4343
</Typography>
4444
)}
4545
</Grid>

src/containers/NewPositionWrapper/NewPositionWrapper.tsx

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -255,14 +255,24 @@ export const NewPositionWrapper: React.FC<IProps> = ({
255255
}, [isWaitingForNewPool, tokenA, tokenB, feeIndex, poolKey, allPoolKeys, allPools.length])
256256

257257
useEffect(() => {
258-
if (poolKey !== '') {
259-
dispatch(
260-
positionsActions.getCurrentPlotTicks({
261-
poolKey: allPoolKeys[poolKey],
262-
isXtoY,
263-
fetchTicksAndTickmap: true
264-
})
265-
)
258+
if (poolKey !== '' && !isWaitingForNewPool) {
259+
const isCurrentTokenX = isXtoY
260+
? allPoolKeys[poolKey].tokenX === tokenA
261+
: allPoolKeys[poolKey].tokenX === tokenB
262+
263+
const isCurrentTokenY = isXtoY
264+
? allPoolKeys[poolKey].tokenY === tokenB
265+
: allPoolKeys[poolKey].tokenY === tokenA
266+
267+
if (isCurrentTokenX && isCurrentTokenY) {
268+
dispatch(
269+
positionsActions.getCurrentPlotTicks({
270+
poolKey: allPoolKeys[poolKey],
271+
isXtoY,
272+
fetchTicksAndTickmap: true
273+
})
274+
)
275+
}
266276
}
267277
}, [isWaitingForNewPool, tokenA, tokenB, poolKey, allPoolKeys])
268278

src/containers/SinglePositionWrapper/SinglePositionWrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ export const SinglePositionWrapper: React.FC<IProps> = ({ id }) => {
272272
}
273273

274274
useEffect(() => {
275-
dispatch(actions.getRemainingPositions())
275+
dispatch(actions.getRemainingPositions({ setLoaded: false }))
276276
const timer = setTimeout(() => {
277277
setIsFinishedDelayRender(true)
278278
}, 1000)

src/containers/WrappedPositionsList/WrappedPositionsList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ export const WrappedPositionsList: React.FC = () => {
187187
length={length}
188188
loadedPages={loadedPages}
189189
getRemainingPositions={() => {
190-
dispatch(actions.getRemainingPositions())
190+
dispatch(actions.getRemainingPositions({ setLoaded: true }))
191191
}}
192192
noInitialPositions={list.length === 0}
193193
/>

src/hideErrors.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ export const messagesToHide: string[] = [
66
'<path> attribute d: Expected moveto path command'
77
]
88

9+
if (process.env.NODE_ENV === 'production') console.log = () => {}
10+
911
export function filterConsoleMessages(hideMessages: string[]): void {
1012
if (typeof window === 'undefined') {
1113
return

src/store/reducers/pools.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export interface FetchTicksAndTickMaps {
7777
tokenFrom: string
7878
tokenTo: string
7979
allPools: PoolWithPoolKey[]
80+
poolKey?: PoolKey
8081
}
8182

8283
const network =

src/store/reducers/positions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ const positionsSlice = createSlice({
161161
state.positionsList.loading = true
162162
return state
163163
},
164-
getRemainingPositions(state, _action: PayloadAction<void>) {
164+
getRemainingPositions(state, _action: PayloadAction<{ setLoaded: boolean }>) {
165165
state.positionsList.loading = true
166166
return state
167167
},

0 commit comments

Comments
 (0)