Skip to content

Commit

Permalink
Merge pull request #822 from invariant-labs/staging
Browse files Browse the repository at this point in the history
Update prod env
  • Loading branch information
wojciech-cichocki authored Dec 19, 2024
2 parents 05adc3b + 541931c commit 266aa18
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 17 deletions.
3 changes: 2 additions & 1 deletion src/components/PopularPools/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export const useStyles = makeStyles()(() => ({
'& .slick-slide': {
display: 'flex',
justifyContent: 'center'
}
},
height: 344
},
dots: {
position: 'absolute',
Expand Down
31 changes: 16 additions & 15 deletions src/components/PriceRangePlot/PriceRangePlot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const PriceRangePlot: React.FC<IPriceRangePlot> = ({

const containerRef = useRef<HTMLDivElement>(null)

const maxVal = useMemo(() => Math.max(...data.map(element => element.y)), [data])
const maxVal = useMemo(() => Math.max(...data.map(element => element?.y)), [data])

const pointsOmitter = useCallback(
(data: Array<{ x: number; y: number }>) => {
Expand All @@ -99,7 +99,8 @@ export const PriceRangePlot: React.FC<IPriceRangePlot> = ({
(dataAfterOmit.length > 0 &&
((tick.x - dataAfterOmit[dataAfterOmit.length - 1].x) / (plotMax - plotMin) >=
minXDist ||
Math.abs(tick.y - dataAfterOmit[dataAfterOmit.length - 1].y) / maxVal >= minYChange))
Math.abs(tick?.y - dataAfterOmit[dataAfterOmit.length - 1]?.y) / maxVal >=
minYChange))
) {
dataAfterOmit.push(tick)
}
Expand Down Expand Up @@ -127,7 +128,7 @@ export const PriceRangePlot: React.FC<IPriceRangePlot> = ({
if (rangeData[rangeData.length - 1].x < leftRange.x) {
rangeData.push({
x: leftRange.x,
y: rangeData[rangeData.length - 1].y
y: rangeData[rangeData.length - 1]?.y
})
}

Expand All @@ -136,7 +137,7 @@ export const PriceRangePlot: React.FC<IPriceRangePlot> = ({
if (rangeData[0].x > Math.max(plotMin, data[0].x)) {
rangeData.unshift({
x: Math.max(plotMin, data[0].x),
y: outData.length > 0 ? outData[outData.length - 1].y : 0
y: outData.length > 0 ? outData[outData.length - 1]?.y : 0
})
}

Expand All @@ -159,14 +160,14 @@ export const PriceRangePlot: React.FC<IPriceRangePlot> = ({
if (!rangeData.length || rangeData[0].x > Math.max(plotMin, data[0].x)) {
rangeData.unshift({
x: Math.max(plotMin, data[0].x),
y: outMinData.length > 0 ? outMinData[outMinData.length - 1].y : 0
y: outMinData.length > 0 ? outMinData[outMinData.length - 1]?.y : 0
})
}

if (rangeData[rangeData.length - 1].x < Math.min(plotMax, data[data.length - 1].x)) {
rangeData.push({
x: Math.min(plotMax, data[data.length - 1].x),
y: rangeData[rangeData.length - 1].y
y: rangeData[rangeData.length - 1]?.y
})
}

Expand All @@ -185,25 +186,25 @@ export const PriceRangePlot: React.FC<IPriceRangePlot> = ({
if (!rangeData.length) {
rangeData.push({
x: Math.max(leftRange.x, plotMin),
y: data[lessThan - 1].y
y: data[lessThan - 1]?.y
})

rangeData.push({
x: Math.min(rightRange.x, plotMax),
y: data[lessThan - 1].y
y: data[lessThan - 1]?.y
})
} else {
if (rangeData[0].x > leftRange.x) {
rangeData.unshift({
x: leftRange.x,
y: rangeData[0].y
y: rangeData[0]?.y
})
}

if (rangeData[rangeData.length - 1].x < rightRange.x) {
rangeData.push({
x: rightRange.x,
y: rangeData[rangeData.length - 1].y
y: rangeData[rangeData.length - 1]?.y
})
}

Expand All @@ -221,7 +222,7 @@ export const PriceRangePlot: React.FC<IPriceRangePlot> = ({
if (!newRangeData.length || newRangeData[0].x > Math.max(plotMin, rangeData[0].x)) {
newRangeData.unshift({
x: Math.max(plotMin, rangeData[0].x),
y: outMinData.length > 0 ? outMinData[outMinData.length - 1].y : 0
y: outMinData.length > 0 ? outMinData[outMinData.length - 1]?.y : 0
})
}

Expand All @@ -231,7 +232,7 @@ export const PriceRangePlot: React.FC<IPriceRangePlot> = ({
) {
newRangeData.push({
x: Math.min(plotMax, rangeData[rangeData.length - 1].x),
y: newRangeData[newRangeData.length - 1].y
y: newRangeData[newRangeData.length - 1]?.y
})
}

Expand All @@ -258,7 +259,7 @@ export const PriceRangePlot: React.FC<IPriceRangePlot> = ({
if (rangeData[0].x > rightRange.x) {
rangeData.unshift({
x: rightRange.x,
y: rangeData[0].y
y: rangeData[0]?.y
})
}

Expand All @@ -267,7 +268,7 @@ export const PriceRangePlot: React.FC<IPriceRangePlot> = ({
if (rangeData[rangeData.length - 1].x < Math.min(plotMax, data[data.length - 1].x)) {
rangeData.push({
x: Math.min(plotMax, data[data.length - 1].x),
y: rangeData[rangeData.length - 1].y
y: rangeData[rangeData.length - 1]?.y
})
}

Expand Down Expand Up @@ -469,7 +470,7 @@ export const PriceRangePlot: React.FC<IPriceRangePlot> = ({
disabled
)

const isNoPositions = data.every(tick => !(tick.y > 0))
const isNoPositions = data.every(tick => !(tick?.y > 0))

return (
<Grid
Expand Down
25 changes: 24 additions & 1 deletion src/store/consts/static.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { MOCK_TOKENS } from '@invariant-labs/sdk'
import { FEE_TIERS } from '@invariant-labs/sdk/lib/utils'
import { BN } from '@project-serum/anchor'
import { ISnackbar } from '@store/reducers/snackbars'
import { PublicKey } from '@solana/web3.js'
import { Keypair, PublicKey } from '@solana/web3.js'
import { BestTier, Chain, PrefixConfig, Token, WalletType } from './types'
import Dog1 from '@static/svg/SolanaCreator/Dog1.svg'
import Dog2 from '@static/svg/SolanaCreator/Dog2.svg'
Expand Down Expand Up @@ -516,6 +516,29 @@ type Pool = {
fee: string
}

export const EMPTY_POOLS = [
{
tokenX: Keypair.generate().publicKey.toString(),
tokenY: Keypair.generate().publicKey.toString(),
fee: '0'
},
{
tokenX: Keypair.generate().publicKey.toString(),
tokenY: Keypair.generate().publicKey.toString(),
fee: '0'
},
{
tokenX: Keypair.generate().publicKey.toString(),
tokenY: Keypair.generate().publicKey.toString(),
fee: '0'
},
{
tokenX: Keypair.generate().publicKey.toString(),
tokenY: Keypair.generate().publicKey.toString(),
fee: '0'
}
]

export const getPopularPools = (network: NetworkType): Pool[] => {
switch (network) {
case NetworkType.Mainnet:
Expand Down

0 comments on commit 266aa18

Please sign in to comment.