diff --git a/src/app/core/constants/token.constant.ts b/src/app/core/constants/token.constant.ts index 4a5779554..57191b478 100644 --- a/src/app/core/constants/token.constant.ts +++ b/src/app/core/constants/token.constant.ts @@ -51,14 +51,30 @@ export enum ETokenNFTTypeBE { export const TOKEN_EVM_BURNT = '0x0000000000000000000000000000000000000000'; export const SOCIAL_MEDIA = { - github: { - name: 'github', - icon: 'assets/icons/icons-svg/basic/github.svg', + youtube: { + name: 'youtube', + icon: 'assets/icons/icons-svg/basic/youtube.svg', }, twitter: { name: 'twitter', icon: 'assets/icons/icons-svg/basic/twitter.svg', }, + discord: { + name: 'discord', + icon: 'assets/icons/icons-svg/basic/discord.svg', + }, + telegram: { + name: 'telegram', + icon: 'assets/icons/icons-svg/basic/telegram.svg', + }, + linkedin: { + name: 'linkedin', + icon: 'assets/icons/icons-svg/basic/linkedIn.svg', + }, + github: { + name: 'github', + icon: 'assets/icons/icons-svg/basic/github.svg', + }, facebook: { name: 'facebook', icon: 'assets/icons/icons-svg/basic/fb-circle.svg', @@ -67,26 +83,10 @@ export const SOCIAL_MEDIA = { name: 'medium', icon: 'assets/icons/icons-svg/basic/medium.svg', }, - telegram: { - name: 'telegram', - icon: 'assets/icons/icons-svg/basic/telegram.svg', - }, - youtube: { - name: 'youtube', - icon: 'assets/icons/icons-svg/basic/youtube.svg', - }, otherWebsite: { name: 'otherWebsite', icon: 'assets/icons/icons-svg/basic/global.svg', }, - discord: { - name: 'discord', - icon: 'assets/icons/icons-svg/basic/discord.svg', - }, - linkedin: { - name: 'linkedin', - icon: 'assets/icons/icons-svg/basic/linkedIn.svg', - }, }; export const USDC_ADDRESS = '0x80b5a32e4f032b2a058b4f29ec95eefeeb87adcd'; diff --git a/src/app/core/data-services/api-cw20-token.service.ts b/src/app/core/data-services/api-cw20-token.service.ts index 34c30f862..4a2f15a4e 100644 --- a/src/app/core/data-services/api-cw20-token.service.ts +++ b/src/app/core/data-services/api-cw20-token.service.ts @@ -217,12 +217,13 @@ export class ApiCw20TokenService { parseNativeToken(account, coinsMarkets) { const nativeId = this.env.coingecko.ids[0]; const coinMarket = coinsMarkets.find((coin) => coin.coinId === nativeId); + return { name: this.env.chainName, symbol: this.currencies.coinDenom, decimals: this.currencies.coinDecimals, denom: this.currencies.coinMinimalDenom, - image: this.currencies.coinImageUrl, + image: this.currencies.coinImageUrl || coinMarket?.image, contract_address: '-', balance: account.data.total, price: coinMarket?.currentPrice || 0, diff --git a/src/app/core/pipes/custom-pipe.module.ts b/src/app/core/pipes/custom-pipe.module.ts index 37e1b09ea..8e7c42f45 100644 --- a/src/app/core/pipes/custom-pipe.module.ts +++ b/src/app/core/pipes/custom-pipe.module.ts @@ -14,6 +14,7 @@ import { ObjectKeysPipe } from './object-keys.pipe'; import { CombineTxsMsgPipe, EllipsisPipe } from './string.pipe'; import { NameTagTooltipPipe } from './tooltip.pipe'; import { HighlightFunctionPipe } from './highlight-function.pipe'; +import { NewlinePipe } from './newline.pipe'; @NgModule({ imports: [CommonModule], @@ -43,6 +44,7 @@ import { HighlightFunctionPipe } from './highlight-function.pipe'; CapacityPipe, EvmAddressPipe, HighlightFunctionPipe, + NewlinePipe ], exports: [ JsonPipe, @@ -70,6 +72,7 @@ import { HighlightFunctionPipe } from './highlight-function.pipe'; CapacityPipe, EvmAddressPipe, HighlightFunctionPipe, + NewlinePipe ], providers: [], }) diff --git a/src/app/core/pipes/newline.pipe.ts b/src/app/core/pipes/newline.pipe.ts new file mode 100644 index 000000000..61052a3e0 --- /dev/null +++ b/src/app/core/pipes/newline.pipe.ts @@ -0,0 +1,14 @@ +import { Pipe, PipeTransform } from '@angular/core'; +import { DomSanitizer } from '@angular/platform-browser'; + +@Pipe({ name: 'newline' }) +export class NewlinePipe implements PipeTransform { + constructor(private sanitizer: DomSanitizer) {} + transform(value: string) { + if (!value) return null; + let replacedValue = value; + replacedValue = replacedValue?.replace(/\n/gi, '
'); + return this.sanitizer.bypassSecurityTrustHtml(replacedValue); + } +} + diff --git a/src/app/core/services/token.service.ts b/src/app/core/services/token.service.ts index 1f2f16b15..7c5d0548b 100644 --- a/src/app/core/services/token.service.ts +++ b/src/app/core/services/token.service.ts @@ -968,14 +968,17 @@ export class TokenService extends CommonService { mappingSocialProfiles(socialProfiles: { [key: string]: string }) { if (!socialProfiles) return []; - return Object.keys(socialProfiles) - ?.filter((key) => socialProfiles[key]) - ?.map((key) => { - return { + const socialMapping = []; + Object.keys(SOCIAL_MEDIA).forEach((key) => { + if (socialProfiles[key]) { + const social = { name: SOCIAL_MEDIA[key]?.name, icon: SOCIAL_MEDIA[key]?.icon, url: socialProfiles[key], - }; - }); + } + socialMapping.push(social); + } + }) + return socialMapping; } } diff --git a/src/app/pages/evm-token/evm-token-content/evm-token-content-tab/evm-token-info-tab/evm-token-info-tab.component.html b/src/app/pages/evm-token/evm-token-content/evm-token-content-tab/evm-token-info-tab/evm-token-info-tab.component.html index 6c4707ec1..a74a7cce9 100644 --- a/src/app/pages/evm-token/evm-token-content/evm-token-content-tab/evm-token-info-tab/evm-token-info-tab.component.html +++ b/src/app/pages/evm-token/evm-token-content/evm-token-content-tab/evm-token-info-tab/evm-token-info-tab.component.html @@ -1,6 +1,4 @@
OVERVIEW
-
- {{overviewInfo}} -
+
\ No newline at end of file diff --git a/src/app/pages/evm-token/evm-token-content/evm-token-content.component.ts b/src/app/pages/evm-token/evm-token-content/evm-token-content.component.ts index e8b8fa08b..1d45e0eca 100644 --- a/src/app/pages/evm-token/evm-token-content/evm-token-content.component.ts +++ b/src/app/pages/evm-token/evm-token-content/evm-token-content.component.ts @@ -25,9 +25,9 @@ export class EvmTokenContentComponent implements OnInit { @Input() contractAddress: string; @Output() hasMore = new EventEmitter(); - tabStaking = [TokenTab.Holders, TokenTab.Info]; - tabIBC = [TokenTab.Transfers, TokenTab.Holders, TokenTab.Info]; - tabToken = [TokenTab.Transfers, TokenTab.Holders, TokenTab.Contract, TokenTab.Info]; + tabStaking = [TokenTab.Holders]; + tabIBC = [TokenTab.Transfers, TokenTab.Holders]; + tabToken = [TokenTab.Transfers, TokenTab.Holders, TokenTab.Contract]; tabNFT = [TokenTab.Transfers, TokenTab.Holders, TokenTab.Inventory, TokenTab.Contract]; TABS = []; paramQuery = ''; @@ -107,6 +107,14 @@ export class EvmTokenContentComponent implements OnInit { this.handleSearch(); this.searchTemp = this.nameTagService.findNameTagByAddress(this.searchTemp); } + + if (!this.paramQuery) { + this.TABS.push({ + key: TokenTab.Info, + value: 'Info', + }); + this.tabsBackup = this.TABS; + } }); if (local.getItem(STORAGE_KEYS.IS_VERIFY_TAB) == 'true') { diff --git a/src/app/pages/evm-token/evm-token-detail/evm-token-detail.component.html b/src/app/pages/evm-token/evm-token-detail/evm-token-detail.component.html index 78c70028e..f65368df4 100644 --- a/src/app/pages/evm-token/evm-token-detail/evm-token-detail.component.html +++ b/src/app/pages/evm-token/evm-token-detail/evm-token-detail.component.html @@ -3,7 +3,7 @@

- Token {{ tokenDetail?.name }} + Token {{ tokenDetail?.name }}
OVERVIEW
-
- {{overviewInfo}} -
+
\ No newline at end of file diff --git a/src/app/pages/token-cosmos/token-detail/token-detail.component.html b/src/app/pages/token-cosmos/token-detail/token-detail.component.html index 86cbd82c4..eb2f347e6 100644 --- a/src/app/pages/token-cosmos/token-detail/token-detail.component.html +++ b/src/app/pages/token-cosmos/token-detail/token-detail.component.html @@ -3,7 +3,7 @@

- Token {{ tokenDetail?.name }} + Token {{ tokenDetail?.name }}
{ + this.tokenService .getCW20Detail(this.contractAddress, this.datePipe.transform(now, DATEFORMAT.DATE_ONLY)) .subscribe({ next: (res) => { const data = _.get(res, `smart_contract`); if (data.length > 0) { - this.tokenService.tokensMarket$ - .pipe( - filter((data) => _.isArray(data)), - take(1), - ) - .subscribe((item) => { - const tokenMarket = item.find((token) => token.denom === data[0].address); - - const token = data[0]; - token.contract_address = token.address; - token.name = tokenMarket?.name || token.cw20_contract.name; - token.symbol = tokenMarket?.symbol || token.cw20_contract.symbol; - token.decimals = token.cw20_contract.decimal; - token.type = this.contractType.CW20; - token.max_total_supply = tokenMarket?.max_supply || 0; - token.price = tokenMarket?.currentPrice || 0; - token.verify_status = tokenMarket?.verifyStatus || ''; - token.verify_text = tokenMarket?.verifyText || ''; - token.modeToken = EModeToken.CWToken; - token.priceChangePercentage24h = tokenMarket?.priceChangePercentage24h || 0; - token.contract_verification = token.code?.code_id_verifications[0]?.verification_status; - token.supplyAmount = BigNumber(token.cw20_contract?.total_supply).dividedBy( - BigNumber(10).pow(token.decimals), - ); - token.officialSite = tokenMarket?.officialSite; - token.overviewInfo = tokenMarket?.overviewInfo; - token.socialProfiles = this.tokenService?.mappingSocialProfiles(tokenMarket?.socialProfiles); - this.tokenDetail = token; - }); + const token = data[0]; + token.contract_address = token.address; + token.name = tokenMarket?.name || token.cw20_contract.name; + token.symbol = tokenMarket?.symbol || token.cw20_contract.symbol; + token.decimals = token.cw20_contract.decimal; + token.type = this.contractType.CW20; + token.max_total_supply = tokenMarket?.max_supply || 0; + token.price = tokenMarket?.currentPrice || 0; + token.verify_status = tokenMarket?.verifyStatus || ''; + token.verify_text = tokenMarket?.verifyText || ''; + token.modeToken = EModeToken.CWToken; + token.priceChangePercentage24h = tokenMarket?.priceChangePercentage24h || 0; + token.contract_verification = token.code?.code_id_verifications[0]?.verification_status; + token.supplyAmount = BigNumber(token.cw20_contract?.total_supply).dividedBy( + BigNumber(10).pow(token.decimals), + ); + token.officialSite = tokenMarket?.officialSite; + token.overviewInfo = tokenMarket?.overviewInfo; + token.socialProfiles = this.tokenService?.mappingSocialProfiles(tokenMarket?.socialProfiles); + + this.tokenDetail = token; } }, error: (e) => { @@ -114,6 +107,7 @@ export class TokenDetailComponent implements OnInit { this.loading = false; }, }); + }) } getTokenDetail(): void { diff --git a/src/app/pages/token-cosmos/token-summary/token-summary.component.scss b/src/app/pages/token-cosmos/token-summary/token-summary.component.scss index 6fb698ab5..d452c0157 100644 --- a/src/app/pages/token-cosmos/token-summary/token-summary.component.scss +++ b/src/app/pages/token-cosmos/token-summary/token-summary.component.scss @@ -11,7 +11,7 @@ .socials { display: flex; align-items: center; - justify-content: center; + justify-content: flex-start; column-gap: 20px; img {