mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* Support redirect to a correct view from search * show domains on address page * migrate to new API version to display address domains * another api update * new design for chain widget on home page + tests * chain widget styles for mobile devices * ecosystems page * update types * add ecosystems to navigation * address portfolio: pt.1 * portfolio tokens list * filter portfolio by chain * skip redirect when navigating to search result by clicking on "show all results" link * net worth block design * add filter input to chain select and fix tokens table * calculate address portfolio * adjust card logic * support custom token types in multichain explorer * handle case when new worth is 0 * add text filter to tokens list * fixes * demo envs * portfolio tests * ecosystems test * change signature for getTokenTypes function * fix adding token to the wallet from the list * lazy load all address domains * show contract creator and implementations info * fix tests * add poor reputation tokens toggle * tweaks * dim celo native tokens * disable env validator * fix tests * remove tokens with 0 usd value from top tokens * fixes * preserve selected chain when switching tabs on address page * add hints to stats widgets on home page * update envs for demo * fix portfolio cards and home page * update styles for contract creator and implementations * fix select issues * add chains from cluster to network menu * hide csv export link on empty logs page * update screenshots * rollback select fix * update cut length calculation for portfolio cards * fix chain select * update screenshots * fix tests * more fixes * add sorting to ecosystems table * fix test * fixes * fix loading state in ecosystems page * review fixes * fix tests
36 lines
1.4 KiB
TypeScript
36 lines
1.4 KiB
TypeScript
import type { TokensSortingValue } from 'types/api/tokens';
|
|
import type { ClusterChainConfig } from 'types/multichain';
|
|
|
|
import config from 'configs/app';
|
|
import getFilterValuesFromQuery from 'lib/getFilterValuesFromQuery';
|
|
import { getTokenTypes } from 'lib/token/tokenTypes';
|
|
import type { SelectOption } from 'toolkit/chakra/select';
|
|
|
|
export const SORT_OPTIONS: Array<SelectOption<TokensSortingValue>> = [
|
|
{ label: 'Default', value: 'default' },
|
|
{ label: 'Price ascending', value: 'fiat_value-asc' },
|
|
{ label: 'Price descending', value: 'fiat_value-desc' },
|
|
{ label: 'Holders ascending', value: 'holders_count-asc' },
|
|
{ label: 'Holders descending', value: 'holders_count-desc' },
|
|
{ label: 'On-chain market cap ascending', value: 'circulating_market_cap-asc' },
|
|
{ label: 'On-chain market cap descending', value: 'circulating_market_cap-desc' },
|
|
];
|
|
|
|
export const getTokenFilterValue = (
|
|
value: string | Array<string> | undefined,
|
|
chainConfig?: Array<ClusterChainConfig['app_config']> | ClusterChainConfig['app_config'],
|
|
) => {
|
|
const tokenTypes = getTokenTypes(false, chainConfig);
|
|
return getFilterValuesFromQuery(Object.keys(tokenTypes), value);
|
|
};
|
|
|
|
const bridgedTokensChainIds = (() => {
|
|
const feature = config.features.bridgedTokens;
|
|
if (!feature.isEnabled) {
|
|
return [];
|
|
}
|
|
|
|
return feature.chains.map(chain => chain.id);
|
|
})();
|
|
export const getBridgedChainsFilterValue = (getFilterValuesFromQuery<string>).bind(null, bridgedTokensChainIds);
|