diff --git a/src/components/Market/AssetDropDownCard.jsx b/src/components/Market/AssetDropDownCard.jsx index b550747..4cdb75b 100644 --- a/src/components/Market/AssetDropDownCard.jsx +++ b/src/components/Market/AssetDropDownCard.jsx @@ -48,7 +48,7 @@ export default function AssetDropDown(properties) { marketSearch, type, size, - chain, + chain } = properties; const { t, i18n } = useTranslation(locale.get(), { i18n: i18nInstance }); const blocklist = useSyncExternalStore($blockList.subscribe, $blockList.get, () => true); @@ -93,25 +93,27 @@ export default function AssetDropDown(properties) { }, [thisInput, fuse]); const Row = ({ index, style }) => { - const res = mode === "search" - ? thisResult[index] - : relevantAssets[index]; + let res; + if (mode === "search") { + res = thisResult[index].item; + } else if (mode === "featured") { + res = featuredAssets[index]; + } else if (mode === "favourites") { + res = relevantAssets[index]; + } + return (
{ setTimeout(() => { - storeCallback( - mode === "search" - ? res.item.s - : res.symbol, - ); + if (mode === "search" || mode === "featured") { + storeCallback(res.s); + } else if (mode === "favourites") { + storeCallback(res.symbol); + } }, 0); setDialogOpen(false); }} @@ -119,16 +121,33 @@ export default function AssetDropDown(properties) { { - mode === "search" - ? `${res.item.s} (${res.item.id})` - : `${res.symbol} (${res.id})` + mode === "search" || mode === "featured" + ? `${res.s} (${res.id})` + : null + } + { + mode === "favourites" + ? `${res.symbol} (${res.id})` + : null } - {t( - "AssetDropDownCard:issued", - { user: mode === "search" ? res.item.u : res.issuer } - )} + { + mode === "search" || mode === "featured" + ? t( + "AssetDropDownCard:issued", + { user: res.u } + ) + : null + } + { + mode === "favourites" + ? t( + "AssetDropDownCard:issued", + { user: res.issuer } + ) + : null + } @@ -140,6 +159,30 @@ export default function AssetDropDown(properties) { const favouriteAssets = useStore($favouriteAssets); + const featuredAssets = useMemo(() => { + if (!chain || !marketSearchContents) { + return []; + } + const _featuredSymbols = ["XBTSX.", "xbtsx.", "BTWTY.", "btwty.", "HONEST.", "honest.", "NFTEA.", "nftea."]; + const _featuredIssuers = ["committee-account", "honest-quorum", "nftprofessional1"]; + + let _featuredAssets = marketSearchContents.filter( + (asset) => { + if (chain === "bitshares") { + if (_featuredIssuers.includes(asset.u.split(" ")[0])) { + return true; + } + if (_featuredSymbols.some(str => asset.s.includes(str))) { + return true; + } + } + return false + } + ); + + return _featuredAssets; + }, [assetSymbol, otherAsset, marketSearchContents, chain]); + const relevantAssets = useMemo(() => { if (!chain || !favouriteAssets) { return []; @@ -183,17 +226,19 @@ export default function AssetDropDown(properties) { {size && assetSymbol && assetSymbol.length >= 12 ? assetData.id : null} } - - + + + +

+ {assetSymbol + ? t("AssetDropDownCard:replacing", { assetSymbol: assetSymbol }) + : t("AssetDropDownCard:selecting")} +

+
+
<> -

- {assetSymbol - ? t("AssetDropDownCard:replacing", { assetSymbol: assetSymbol }) - : t("AssetDropDownCard:selecting")} -

- -
+
+