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

feat: markets page recommended tab and Portals assets #7736

Merged
merged 47 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
d275640
wip: markets page recommended tab
gomesalexandre Sep 11, 2024
0f891e6
feat: descynchronise chain selection
gomesalexandre Sep 12, 2024
2a1d75e
feat: dry
gomesalexandre Sep 12, 2024
0bb9f15
feat: progression
gomesalexandre Sep 12, 2024
544d218
feat: more progression
gomesalexandre Sep 12, 2024
505ca2d
feat: visual progression
gomesalexandre Sep 12, 2024
3ced439
feat: more unify
gomesalexandre Sep 12, 2024
53b628c
fix: chainIds over chainId
gomesalexandre Sep 12, 2024
51d0a04
feat: yeah right I'm definitely becoming a shepherd I guess
gomesalexandre Sep 12, 2024
a5a59ac
fix: unbork color-map script
gomesalexandre Sep 12, 2024
4443f22
feat: portals initial wire-up
gomesalexandre Sep 12, 2024
a288998
feat: onClick
gomesalexandre Sep 12, 2024
78ae09b
feat: cleanup
gomesalexandre Sep 12, 2024
402721e
feat: progression
gomesalexandre Sep 12, 2024
bf85534
feat: fetch market data
gomesalexandre Sep 12, 2024
7005494
Merge remote-tracking branch 'origin/develop' into feat_recommended_1
gomesalexandre Sep 12, 2024
79b4bcb
feat: cleanup log
gomesalexandre Sep 12, 2024
cbce36f
feat: todos
gomesalexandre Sep 12, 2024
67aa746
feat: more cleanup
gomesalexandre Sep 12, 2024
a489cd3
fix: beard oil but not by beard, maybe neo oil? but I dont have any b…
NeOMakinG Sep 13, 2024
3bb3b37
Merge remote-tracking branch 'origin/develop' into feat_recommended_1
gomesalexandre Sep 16, 2024
7c567af
Merge remote-tracking branch 'origin/develop' into feat_recommended_1
gomesalexandre Sep 16, 2024
4b59a86
fix: merge
gomesalexandre Sep 16, 2024
278f724
feat: leverage portalsPlatforms query
gomesalexandre Sep 16, 2024
534b527
feat: regen all
gomesalexandre Sep 16, 2024
5b489df
feat: cleaner apy
gomesalexandre Sep 16, 2024
ae2fadb
fix: market-data things
gomesalexandre Sep 16, 2024
aff1ad4
Merge branch 'develop' into feat_recommended_1
gomesalexandre Sep 17, 2024
20e59ae
Merge branch 'develop' into feat_recommended_1
gomesalexandre Sep 18, 2024
4d4230f
feat: :%s/`/'/g
gomesalexandre Sep 18, 2024
59d8d65
fix: missing occurences
gomesalexandre Sep 18, 2024
f64fb8e
feat: referential stability
gomesalexandre Sep 18, 2024
5fa241b
feat: parameterize percentage jump
gomesalexandre Sep 18, 2024
f2edf5e
Merge remote-tracking branch 'origin/develop' into feat_recommended_1
gomesalexandre Sep 18, 2024
366bdea
feat: add generate:all script and regen
gomesalexandre Sep 18, 2024
0d06530
feat: checkout origin/develop generatedAssetData
gomesalexandre Sep 18, 2024
d78dc6d
fix: limit
gomesalexandre Sep 18, 2024
5146448
feat: regen
gomesalexandre Sep 18, 2024
e357114
feat: regen
gomesalexandre Sep 18, 2024
9b09751
Merge branch 'develop' into feat_recommended_1
gomesalexandre Sep 19, 2024
7dfee08
feat: use assets icon
gomesalexandre Sep 19, 2024
78d258f
feat: decouple per-chain
gomesalexandre Sep 19, 2024
8f83532
feat: filter out nova
gomesalexandre Sep 19, 2024
81f9492
feat: proper query narrowing
gomesalexandre Sep 19, 2024
9d45348
feat: remove useless process.env short circuit
gomesalexandre Sep 19, 2024
16b42c9
feat: regen:all
gomesalexandre Sep 19, 2024
c4cb191
Merge remote-tracking branch 'origin/develop' into feat_recommended_1
gomesalexandre Sep 19, 2024
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
6 changes: 0 additions & 6 deletions src/lib/market-service/portals/portals.ts
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { ChainId } from '@shapeshiftoss/caip'
import { ASSET_NAMESPACE, bscChainId, fromAssetId, toAssetId } from '@shapeshiftoss/caip'
import type {
AssetsByIdPartial,
FindAllMarketArgs,
HistoryData,
MarketCapResult,
Expand All @@ -22,7 +21,6 @@ import { CHAIN_ID_TO_PORTALS_NETWORK } from 'lib/portals/constants'
import type { GetTokensResponse, HistoryResponse } from 'lib/portals/types'
import { assertUnreachable, getTimeFrameBounds, isToken } from 'lib/utils'

import generatedAssetData from '../../asset-service/service/generatedAssetData.json'
import type { MarketService } from '../api'
import { DEFAULT_CACHE_TTL_MS } from '../config'
import { isValidDate } from '../utils/isValidDate'
Expand Down Expand Up @@ -115,11 +113,7 @@ export class PortalsMarketService implements MarketService {
}
}
async findByAssetId({ assetId }: MarketDataArgs): Promise<MarketData | null> {
const assets = generatedAssetData as unknown as AssetsByIdPartial

try {
const asset = assets[assetId]
if (!asset) return null
gomesalexandre marked this conversation as resolved.
Show resolved Hide resolved
const { chainId, assetReference } = fromAssetId(assetId)

const network = CHAIN_ID_TO_PORTALS_NETWORK[chainId]
Expand Down
17 changes: 2 additions & 15 deletions src/pages/Markets/Recommended.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { Box, Flex, Grid, GridItem, Heading, Text } from '@chakra-ui/react'
import { type AssetId, type ChainId, fromAssetId } from '@shapeshiftoss/caip'
import { KnownChainIds } from '@shapeshiftoss/types'
import { useCallback, useEffect, useMemo, useState } from 'react'
import { useCallback, useMemo, useState } from 'react'
import { useTranslate } from 'react-polyglot'
import { useHistory } from 'react-router'
import { ChainDropdown } from 'components/ChainDropdown/ChainDropdown'
import { Main } from 'components/Layout/Main'
import { SEO } from 'components/Layout/Seo'
import { marketApi } from 'state/slices/marketDataSlice/marketDataSlice'
import { selectAssetIds } from 'state/slices/selectors'
import { useAppDispatch, useAppSelector } from 'state/store'
import { useAppSelector } from 'state/store'

import { AssetCard } from './components/AssetCard'
import { CardWithSparkline } from './components/CardWithSparkline'
Expand Down Expand Up @@ -40,7 +39,6 @@ const AssetsGrid: React.FC<{
selectedChainId?: ChainId
isLoading: boolean
}> = ({ assetIds, selectedChainId, isLoading }) => {
const dispatch = useAppDispatch()
const history = useHistory()
const filteredAssetIds = useMemo(
() =>
Expand All @@ -53,12 +51,6 @@ const AssetsGrid: React.FC<{
[assetIds, selectedChainId],
)

useEffect(() => {
filteredAssetIds.forEach(assetId =>
dispatch(marketApi.endpoints.findByAssetId.initiate(assetId)),
)
}, [assetIds, dispatch, filteredAssetIds])

const handleCardClick = useCallback(
(assetId: AssetId) => {
return history.push(`/assets/${assetId}`)
Expand Down Expand Up @@ -98,7 +90,6 @@ const LpGrid: React.FC<{ assetIds: AssetId[]; selectedChainId?: ChainId; isLoadi
selectedChainId,
isLoading,
}) => {
const dispatch = useAppDispatch()
const history = useHistory()
const handleCardClick = useCallback(
(assetId: AssetId) => {
Expand All @@ -119,10 +110,6 @@ const LpGrid: React.FC<{ assetIds: AssetId[]; selectedChainId?: ChainId; isLoadi
[assetIds, selectedChainId],
)

useEffect(() => {
filteredAssetIds.map(assetId => dispatch(marketApi.endpoints.findByAssetId.initiate(assetId)))
}, [assetIds, dispatch, filteredAssetIds])

return (
<Grid templateRows={gridTemplateRowsSx} gridTemplateColumns={gridTemplateColumnSx} gap={4}>
{filteredAssetIds.map((assetId, index) => {
Expand Down
4 changes: 4 additions & 0 deletions src/pages/Markets/hooks/usePortalsAssetsQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { PORTALS_NETWORK_TO_CHAIN_ID } from 'lib/portals/constants'
import type { TokenInfo } from 'lib/portals/types'
import { fetchPortalsPlatforms, fetchPortalsTokens, portalTokenToAsset } from 'lib/portals/utils'
import { assets as assetsSlice } from 'state/slices/assetsSlice/assetsSlice'
import { marketApi } from 'state/slices/marketDataSlice/marketDataSlice'
import { selectAssets, selectFeeAssetById } from 'state/slices/selectors'
import { store, useAppDispatch, useAppSelector } from 'state/store'

Expand Down Expand Up @@ -66,6 +67,9 @@ export const usePortalsAssetsQuery = () => {
byId: { [assetId]: asset },
}),
)

// and its market-data since it may or may not be missing
dispatch(marketApi.endpoints.findByAssetId.initiate(assetId))
}

acc.byId[assetId] = token
Expand Down
Loading