Skip to content

Commit

Permalink
Merge pull request #1037 from oraidex/feat/add-dogecoin
Browse files Browse the repository at this point in the history
add modal doge/usdc
  • Loading branch information
haunv3 authored Nov 14, 2024
2 parents 0022684 + c8205d2 commit 83d3cc0
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 20 deletions.
25 changes: 14 additions & 11 deletions src/pages/Pool-V3/components/BannerNoticePool/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import CloseIcon from 'assets/icons/close.svg?react';
import HamsterIcon from 'assets/icons/hmstr.svg?react';
import PepeIcon from 'assets/icons/pepe.svg?react';
import DogecoinIcon from 'assets/icons/dogecoin.svg?react';
import UsdcIcon from 'assets/icons/usd_coin.svg?react';
import { useEffect, useState } from 'react';
import { Link, useNavigate } from 'react-router-dom';
import styles from './index.module.scss';

import { PEPE_ORAICHAIN_EXT_DENOM, HMSTR_ORAICHAIN_DENOM, USDC_CONTRACT } from '@oraichain/oraidex-common';
import {
PEPE_ORAICHAIN_EXT_DENOM,
HMSTR_ORAICHAIN_DENOM,
USDC_CONTRACT,
DOGE_BNB_ORAICHAIN_DENOM
} from '@oraichain/oraidex-common';
import useTemporaryConfigReducer from 'hooks/useTemporaryConfigReducer';

const urlPepe = `/pools/v3/${encodeURIComponent(PEPE_ORAICHAIN_EXT_DENOM)}-${encodeURIComponent(
Expand All @@ -17,21 +23,18 @@ const urlHmstr = `/pools/v3/${encodeURIComponent(HMSTR_ORAICHAIN_DENOM)}-${encod
USDC_CONTRACT
)}-3000000000-100`;

const urlDoge = `/pools/v3/${encodeURIComponent(DOGE_BNB_ORAICHAIN_DENOM)}-${encodeURIComponent(
USDC_CONTRACT
)}-3000000000-100`;

const INTERVAL_TIME = 3000;

const NoticeList = [
{
url: urlHmstr,
XIcon: HamsterIcon,
YIcon: UsdcIcon,
Xname: 'HMSTR',
Yname: 'USDC'
},
{
url: urlPepe,
XIcon: PepeIcon,
url: urlDoge,
XIcon: DogecoinIcon,
YIcon: UsdcIcon,
Xname: 'PEPE',
Xname: 'DOGE',
Yname: 'USDC'
}
];
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Pool-V3/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const PoolV3 = () => {

return (
<>
{/* <BannerNoticePool /> */}
<BannerNoticePool />
<div className={classNames(styles.poolV3, 'small_container')}>
<div className={styles.header}>
<div className={styles.headerTab}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { CustomChainInfo, TokenItemType, truncDecimals, HMSTR_ORAICHAIN_DENOM } from '@oraichain/oraidex-common';
import {
CustomChainInfo,
TokenItemType,
truncDecimals,
HMSTR_ORAICHAIN_DENOM,
DOGE_BNB_ORAICHAIN_DENOM
} from '@oraichain/oraidex-common';
import IconoirCancel from 'assets/icons/iconoir_cancel.svg?react';
import NoResultDark from 'assets/images/no-result-dark.svg?react';
import NoResultLight from 'assets/images/no-result.svg?react';
Expand Down Expand Up @@ -150,15 +156,14 @@ export default function SelectToken({
})
.sort((a, b) => {
const balanceDelta = Number(b.usd) - Number(a.usd);
if (a.denom === DOGE_BNB_ORAICHAIN_DENOM && b.denom !== DOGE_BNB_ORAICHAIN_DENOM) {
return -1; // Push PepePoolKey elements to the top
}
if (a.denom !== DOGE_BNB_ORAICHAIN_DENOM && b.denom === DOGE_BNB_ORAICHAIN_DENOM) {
return 1; // Keep non-'a' elements below 'a'
}

if (!balanceDelta) {
if (a.denom === HMSTR_ORAICHAIN_DENOM && b.denom !== HMSTR_ORAICHAIN_DENOM) {
return -1; // Push PepePoolKey elements to the top
}
if (a.denom !== HMSTR_ORAICHAIN_DENOM && b.denom === HMSTR_ORAICHAIN_DENOM) {
return 1; // Keep non-'a' elements below 'a'
}

return (tokenRank[b.coinGeckoId] || 0) - (tokenRank[a.coinGeckoId] || 0);
}
return balanceDelta;
Expand Down

0 comments on commit 83d3cc0

Please sign in to comment.