-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TW-1125: [epic] Assets rework (#1006)
* TW-683: Tokens rework. Account's tokens -> Redux * TW-683: Assets rework. Tokens. + Whitelist * TW-683: Assets rework. Tokens. 'Add Asset' page * TW-683: Assets rework. Collectibles. Redux * TW-683: Assets rework. Tokens. Manage page. Fix: listing other account tokens too * TW-683: Assets rework. Tokens. Refactor * TW-683: Assets rework. Collectibles. Optimized loading * TW-683: Assets rework. Collectibles. Optimized loading * TW-683: Assets rework. Refactor * TW-683: Assets rework. Optimized balances loading * TW-683: Assets rework. Collectibles. Fix details loading from OBJKT * TW-683: Assets rework. Migration from IndexedDB * TW-683: Assets rework. Refactor * TW-683: Assets rework. Refactor * TW-683: Assets rework. Refactor * TW-683: Assets rework. + ESLint no-cycle rule * TW-683: Assets rework. Refactor * TW-683: Assets rework. Migrations made async * TW-683: Assets rework. Refactor * TW-683: Assets rework. Refactor * TW-683: Assets rework. Not keeping metadata from TZKT * TW-683: Assets rework. Refactor * TW-683: Assets rework. + __TEMPORARY_COLLECTIBLES_LOAD_LIMIT__ * TW-683: Assets rework. Fix tokens re-render on account switch * TW-683: Assets rework. Fix page crash, when switching to Ghostnet * TW-993: Assets rework. Collectibles pagination logic (#1018) * TW-993: Assets rework. NFTs pagination. + buildCollectibleImagesStack * TW-993: Assets rework. NFTs pagination. WIP. Not sending all NFTs. Not loading all NFTs meta * TW-993: Assets rework. NFTs pagination. WIP. + type StoredCollectible * TW-993: Assets rework. Collectibles pagination. Rolled back to not saving & * TW-993: Assets rework. Collectibles pagination. WIP. Grid. Without search * TW-993: Assets rework. Collectibles pagination. WIP. Grid. + Search * TW-993: Assets rework. Collectibles pagination. WIP. Tuned meta refresh * TW-993: Assets rework. Collectibles pagination. + Search in grid * TW-993: Assets rework. Collectibles pagination. Improved paginated loading * TW-993: Assets rework. Collectibles pagination. Manage assets page. Refactor * TW-993: Assets rework. + Manage Collectibles component * TW-993: Assets rework. Pagination & listing logic. Refactor * TW-993: Assets rework. Pagination logic. Cleared logs * TW-993: Assets rework. Pagination logic. WIP. + ReduxStoreState.collectiblesMetadata * TW-993: Assets rework. Pagination logic. Collectibles meta. WIP. + Slice size check * TW-993: Assets rework. Pagination logic. Metadata refactor * TW-993: Assets rework. Pagination logic. Metadata refactor. + Migration * TW-993: Assets rework. Pagination logic. Refactor * TW-993: Assets rework. Pagination logic. Refactor * TW-993: Assets rework. Pagination logic. ++ To known meta when loading assets * TW-993: Assets rework. Pagination logic. Manage assets page. Refactor * TW-993: Assets rework. Pagination logic. Fix paginated list update + Fix search * TW-993: Assets rework. Pagination logic. Using stored balances * TW-993: Assets rework. Pagination logic. Refactor * TW-993: Assets rework. Pagination logic. ++ * TW-993: Assets rework. Pagination logic. ++ useIntersectionDetection() * TW-993: Assets rework. Pagination logic. ++ * TW-993: Assets rework. Pagination logic. ++ Persistance logic * TW-993: Assets rework. Pagination logic. Refactor * TW-993: Assets rework. Pagination logic. + Kept page items amount in URL * TW-993: Assets rework. Pagination logic. + Map type to Redux store * TW-993: Assets rework. Pagination logic. + <ImageStacked /> * TW-993: Assets rework. Pagination logic. Minor fixes * TW-993: Assets rework. Pagination logic. Minor fixes * TW-993: Assets rework. Pagination logic. ++ Performance * TW-993: Assets rework. Pagination logic. ++ Performance. Removed bottleneck of reducing collectibles in Store * TW-993: Assets rework. Pagination logic. Performance. Refactor * TW-993: Assets rework. Pagination logic. Performance. Refactor * TW-993: Assets rework. Pagination logic. Refactor. -- 'mem' * TW-993: Assets rework. Pagination logic. Tiny fix * TW-993: Fix unit tests * TW-993: Assets rework. Pagination logic. Fix adding token * TW-993: Assets rework. Pagination logic. Fix removing token * TW-993: Fix unit tests. -- Send NFT * TW-993: Assets rework. Clean-up deps * TW-993: Assets rework. NFTs pagination. Loading 30+50 at a time * TW-993: Assets rework. NFTs pagination. <SimpleInfiniteScroll> reduced scrollThreshold * TW-993: Assets rework. NFTs pagination. Rearranged NFTs images sources * TW-993: Assets rework. NFTs pagination. Fix gas balance loading * TW-993: Assets rework. NFTs pagination. Overcome OBJKT API byte-size payload limit * TW-993: Assets rework. NFTs pagination. Fix lost sorting in SendForm * TW-993: Assets rework. NFTs pagination. Fix areStringArraysEqual * TW-1225: [epic] Assets rework. Refactor
- Loading branch information
Showing
202 changed files
with
3,906 additions
and
3,436 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React, { memo, PropsWithChildren, useCallback, useState } from 'react'; | ||
|
||
import InfiniteScroll from 'react-infinite-scroll-component'; | ||
|
||
interface Props { | ||
loadNext: EmptyFn; | ||
} | ||
|
||
export const SimpleInfiniteScroll = memo<PropsWithChildren<Props>>(({ loadNext, children }) => { | ||
const [seedForLoadNext, setSeedForLoadNext] = useState(0); | ||
|
||
const loadNextLocal = useCallback(() => { | ||
setSeedForLoadNext(val => (val % 2) + 1); | ||
loadNext(); | ||
}, [loadNext]); | ||
|
||
return ( | ||
<InfiniteScroll | ||
// For non-array children (e.g. grid layout or other wrapper) this must be `true` | ||
hasChildren={true} | ||
hasMore={true} | ||
/** | ||
* Used only to determine, whether to call `next` on next scroll-to-end event. | ||
* If not updated, `next` will not be triggered - need to update artificially. | ||
* Example: If `loadNext` call throws an error, `dataLength` won't change & `next` is blocked. | ||
*/ | ||
dataLength={seedForLoadNext} | ||
next={loadNextLocal} | ||
// `InfiniteScroll`'s loader conditions r not suited here | ||
loader={null} | ||
scrollThreshold="600px" | ||
> | ||
{children} | ||
</InfiniteScroll> | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { useEffect } from 'react'; | ||
|
||
import { dispatch } from 'app/store'; | ||
import { | ||
loadAccountTokensActions, | ||
loadTokensWhitelistActions, | ||
loadAccountCollectiblesActions | ||
} from 'app/store/assets/actions'; | ||
import { useAreAssetsLoading } from 'app/store/assets/selectors'; | ||
import { ASSETS_SYNC_INTERVAL } from 'lib/fixed-times'; | ||
import { useAccount, useChainId } from 'lib/temple/front'; | ||
import { TempleChainId } from 'lib/temple/types'; | ||
import { useInterval } from 'lib/ui/hooks'; | ||
|
||
export const useAssetsLoading = () => { | ||
const chainId = useChainId()!; | ||
const { publicKeyHash } = useAccount(); | ||
|
||
useEffect(() => { | ||
if (chainId === TempleChainId.Mainnet) dispatch(loadTokensWhitelistActions.submit()); | ||
}, [chainId]); | ||
|
||
const tokensAreLoading = useAreAssetsLoading('tokens'); | ||
|
||
useInterval( | ||
() => { | ||
if (!tokensAreLoading) dispatch(loadAccountTokensActions.submit({ account: publicKeyHash, chainId })); | ||
}, | ||
ASSETS_SYNC_INTERVAL, | ||
[chainId, publicKeyHash] | ||
); | ||
|
||
const collectiblesAreLoading = useAreAssetsLoading('collectibles'); | ||
|
||
useInterval( | ||
() => { | ||
if (!collectiblesAreLoading) dispatch(loadAccountCollectiblesActions.submit({ account: publicKeyHash, chainId })); | ||
}, | ||
ASSETS_SYNC_INTERVAL, | ||
[chainId, publicKeyHash] | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { useAllTokensMetadataSelector } from 'app/store/tokens-metadata/selectors'; | ||
import { migrateFromIndexedDB } from 'lib/assets/migrations'; | ||
import { migrate } from 'lib/local-storage/migrator'; | ||
import { useDidMount } from 'lib/ui/hooks'; | ||
|
||
export const useAssetsMigrations = () => { | ||
const allMetadatas = useAllTokensMetadataSelector(); | ||
|
||
useDidMount( | ||
() => | ||
void migrate([ | ||
{ | ||
name: '[email protected]', | ||
up: () => migrateFromIndexedDB(allMetadatas) | ||
} | ||
]) | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { useDispatch } from 'react-redux'; | ||
|
||
import { loadGasBalanceActions, loadAssetsBalancesActions } from 'app/store/balances/actions'; | ||
import { BALANCES_SYNC_INTERVAL } from 'lib/fixed-times'; | ||
import { useAccount, useChainId } from 'lib/temple/front'; | ||
import { useInterval } from 'lib/ui/hooks'; | ||
|
||
export const useBalancesLoading = () => { | ||
const chainId = useChainId(true)!; | ||
const { publicKeyHash } = useAccount(); | ||
|
||
const dispatch = useDispatch(); | ||
|
||
useInterval( | ||
() => void dispatch(loadGasBalanceActions.submit({ publicKeyHash, chainId })), | ||
BALANCES_SYNC_INTERVAL, | ||
[chainId, publicKeyHash], | ||
true | ||
); | ||
|
||
useInterval( | ||
() => void dispatch(loadAssetsBalancesActions.submit({ publicKeyHash, chainId })), | ||
BALANCES_SYNC_INTERVAL, | ||
[chainId, publicKeyHash], | ||
false // Not calling immediately, because balances are also loaded via assets loading | ||
); | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.