Skip to content

Commit

Permalink
feat: update VSCode settings and refactor Pools and UniversalSwap com…
Browse files Browse the repository at this point in the history
…ponents for improved code organization and readability
  • Loading branch information
vuonghuuhung committed Dec 24, 2024
1 parent 36f1e99 commit ecaddd7
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@
},
"[shellscript]": {
"editor.defaultFormatter": "foxundermoon.shell-format"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
38 changes: 33 additions & 5 deletions src/pages/Pools/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const Pools: React.FC<{}> = () => {
// calculate my stake in usdt, we calculate by bond_amount from contract and totalLiquidity from backend.
const myStakedLP = stakingToken
? totalRewardInfoData?.reward_infos.find((item) => isEqual(item.staking_token, stakingToken))?.bond_amount ||
'0'
'0'
: 0;
const lpPrice = Number(totalSupply) ? totalLiquidity / Number(totalSupply) : 0;
const myStakeLPInUsdt = +myStakedLP * lpPrice;
Expand Down Expand Up @@ -122,16 +122,44 @@ const Pools: React.FC<{}> = () => {
if (isReverseLogo) {
return (
<div className={styles.symbols}>
<img style={{ borderRadius: '100%' }} width={32} height={32} src={QuoteTokenIcon} className={styles.symbols_logo_left} alt="" />
<img style={{ borderRadius: '100%' }} width={32} height={32} src={BaseTokenIcon} className={styles.symbols_logo_right} alt="" />
<img
style={{ borderRadius: '100%' }}
width={32}
height={32}
src={QuoteTokenIcon}
className={styles.symbols_logo_left}
alt=""
/>
<img
style={{ borderRadius: '100%' }}
width={32}
height={32}
src={BaseTokenIcon}
className={styles.symbols_logo_right}
alt=""
/>
</div>
);
}

return (
<div className={styles.symbols}>
<img style={{ borderRadius: '100%' }} width={32} height={32} src={BaseTokenIcon} className={styles.symbols_logo_left} alt="" />
<img style={{ borderRadius: '100%' }} width={32} height={32} src={QuoteTokenIcon} className={styles.symbols_logo_right} alt="" />
<img
style={{ borderRadius: '100%' }}
width={32}
height={32}
src={BaseTokenIcon}
className={styles.symbols_logo_left}
alt=""
/>
<img
style={{ borderRadius: '100%' }}
width={32}
height={32}
src={QuoteTokenIcon}
className={styles.symbols_logo_right}
alt=""
/>
</div>
);
};
Expand Down
20 changes: 10 additions & 10 deletions src/pages/UniversalSwap/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { AssetsTab, HeaderTab, HeaderTop, HistoryTab, TabsTxs } from './Component';
import SwapComponent from './Swap';
import { TransactionProcess } from './Modals';
import ModalCustom from 'components/ModalCustom';
import { isMobile } from '@walletconnect/browser-utils';
import classNames from 'classnames';
import cn from 'classnames/bind';
import ModalCustom from 'components/ModalCustom';
import { EVENT_CONFIG_THEME } from 'config/eventConfig';
import useTemporaryConfigReducer from 'hooks/useTemporaryConfigReducer';
import useTheme from 'hooks/useTheme';
import Content from 'layouts/Content';
import { DuckDb } from 'libs/duckdb';
import React, { useEffect, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { useSearchParams } from 'react-router-dom';
import { selectCurrentSwapFilterTime, selectCurrentSwapTabChart } from 'reducer/chartSlice';
import {
selectChartTimeFrame,
Expand All @@ -16,17 +18,15 @@ import {
selectCurrentToken,
setChartTimeFrame
} from 'reducer/tradingSlice';
import { FILTER_TIME_CHART } from 'reducer/type';
import { AssetsTab, HeaderTab, HeaderTop, HistoryTab, TabsTxs } from './Component';
import ChartUsdPrice from './Component/ChartUsdPrice';
import { TransactionProcess } from './Modals';
import SwapComponent from './Swap';
import { initPairSwap } from './Swap/hooks/useFillToken';
import { NetworkFilter, TYPE_TAB_HISTORY, initNetworkFilter } from './helpers';
import { ChartTokenType, useChartUsdPrice } from './hooks/useChartUsdPrice';
import { FILTER_TIME_CHART } from 'reducer/type';
import cn from 'classnames/bind';
import React, { useEffect, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { useSearchParams } from 'react-router-dom';
import styles from './index.module.scss';
import classNames from 'classnames';

const cx = cn.bind(styles);

Expand Down

0 comments on commit ecaddd7

Please sign in to comment.