Skip to content

Commit

Permalink
feat: adjust wnear icon and symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
naturexie committed Jan 17, 2025
1 parent 66fbf4b commit 992ab37
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 20 deletions.
5 changes: 2 additions & 3 deletions screens/MarginTrading/components/MarketTrading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,10 @@ const MarketMarginTrading = ({ hidden }: { hidden: boolean }) => {
const results = await Promise.all(promises);
const mergedData: any[] = Object.values(marginConfigList).map((item, index) => {
const volumeData: any | undefined = results[index];
// console.log(volumeData, "volumeData");
return {
...item,
totalVolume: volumeData?.data.total_volume || 0,
volume24h: volumeData?.data["24h_volume"] || 0,
totalVolume: volumeData?.data?.total_volume || 0,
volume24h: volumeData?.data?.["24h_volume"] || 0,
};
});
setMergedData(mergedData);
Expand Down
4 changes: 2 additions & 2 deletions screens/Trading/components/ChangeCollateralMobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ const ChangeCollateralMobile: FC<ChangeCollateralMobileProps> = ({ open, onClose
</div>
<div>
<div className="flex items-center justify-end">
<img src={iconC} alt="" className="w-4 h-4" />
<img src={iconC} alt="" className="w-4 h-4 rounded-full" />
<p className="text-base ml-1">{symbolC}</p>
</div>
<p className="text-xs text-gray-300 mt-1.5">
Expand Down Expand Up @@ -640,7 +640,7 @@ const ChangeCollateralMobile: FC<ChangeCollateralMobileProps> = ({ open, onClose
</div>
<div>
<div className="flex items-center justify-end">
<img src={iconC} alt="" className="w-4 h-4" />
<img src={iconC} alt="" className="w-4 h-4 rounded-full" />
<p className="text-base ml-1">{symbolC}</p>
</div>
<p className="text-xs text-gray-300 mt-1.5">
Expand Down
6 changes: 4 additions & 2 deletions screens/Trading/components/tokenbox.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useState } from "react";
import { useDebounce } from "react-use";
import _ from "lodash";
import Decimal from "decimal.js";
import { NearIcon } from "../../MarginTrading/components/Icon";
import { TokenThinArrow, TokenSelected } from "./TradingIcon";
Expand Down Expand Up @@ -106,10 +107,11 @@ const TradingToken: React.FC<TradingTokenInter> = ({
}
};
function getTokenBalance(asset: Asset) {
if (_.isEmpty(account?.balances)) return "";
if (asset.token_id == nearTokenId) {
return shrinkToken(
new Decimal(account.balances[asset.metadata.token_id])
.plus(account.balances["near"])
new Decimal(account?.balances?.[asset.metadata.token_id] || 0)
.plus(account?.balances?.["near"] || 0)
.toFixed(0),
asset.metadata.decimals,
);
Expand Down
14 changes: 2 additions & 12 deletions screens/Trading/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,7 @@ const Trading = () => {
onClick={handlePopupToggle}
className="flex justify-center items-center"
>
<p className="mr-1">
{currentTokenCate2?.metadata?.symbol ||
(isMainStream
? categoryAssets2[0]?.metadata.symbol
: categoryAssets2MEME[0]?.metadata.symbol)}
</p>
<p className="mr-1">{currentTokenCate2?.metadata?.symbol}</p>
<TokenArrow />
</div>
{showPopupCate2 && (
Expand Down Expand Up @@ -329,12 +324,7 @@ const Trading = () => {
onClick={handlePopupToggle}
className="flex justify-center items-center"
>
<p className="mr-1">
{currentTokenCate2?.metadata?.symbol ||
(isMainStream
? categoryAssets2[0]?.metadata.symbol
: categoryAssets2MEME[0]?.metadata.symbol)}
</p>
<p className="mr-1">{currentTokenCate2?.metadata?.symbol}</p>
<TokenArrow />
</div>
{showPopupCate2 && (
Expand Down
3 changes: 2 additions & 1 deletion transformers/asstets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ export function transformAssets({
asset.config.can_deposit = true;
asset.config.can_withdraw = true;
}
if (!assetMetadata?.icon && nearNativeTokens.includes(assetMetadata?.token_id)) {
if (nearNativeTokens.includes(assetMetadata?.token_id)) {
assetMetadata.icon = nearMetadata.icon;
assetMetadata.symbol = nearMetadata.symbol;
}
map[asset.token_id] = omit(
{
Expand Down

0 comments on commit 992ab37

Please sign in to comment.