Skip to content

Commit

Permalink
swap tabs, rename TokenPrice to TokenValue, I missed that in previous PR
Browse files Browse the repository at this point in the history
  • Loading branch information
bthaile committed Feb 11, 2025
1 parent 9987b70 commit e443604
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 45 deletions.
14 changes: 7 additions & 7 deletions src/ui/views/NFT/SendNFT/SendToAddress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ import SearchList from '../../Send/SearchList';
import SendNFTConfirmation from './SendNFTConfirmation';

export enum SendPageTabOptions {
Accounts = 'Accounts',
Recent = 'Recent',
AddressBook = 'AddressBook',
Accounts = 'Accounts',
}

const useStyles = makeStyles((_theme) => ({
Expand Down Expand Up @@ -509,18 +509,19 @@ const SendToAddress = () => {
style={{ height: '100%', width: '100%' }}
>
<TabPanel value={tabValue} index={0} dir={theme.direction}>
<RecentList
filteredContacts={recentContacts}
<AccountsList
filteredContacts={filteredContacts}
isLoading={isLoading}
handleClick={(eachgroup) => {
searchResult = eachgroup;
setConfirmationOpen(true);
}}
isSend={false}
/>
</TabPanel>
<TabPanel value={tabValue} index={1} dir={theme.direction}>
<AddressBookList
filteredContacts={filteredContacts}
<RecentList
filteredContacts={recentContacts}
isLoading={isLoading}
handleClick={(eachgroup) => {
searchResult = eachgroup;
Expand All @@ -529,14 +530,13 @@ const SendToAddress = () => {
/>
</TabPanel>
<TabPanel value={tabValue} index={2} dir={theme.direction}>
<AccountsList
<AddressBookList
filteredContacts={filteredContacts}
isLoading={isLoading}
handleClick={(eachgroup) => {
searchResult = eachgroup;
setConfirmationOpen(true);
}}
isSend={false}
/>
</TabPanel>
</SwipeableViews>
Expand Down
14 changes: 7 additions & 7 deletions src/ui/views/NftEvm/SendNFT/SendToAddress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ import SearchList from '../../Send/SearchList';
import SendNFTConfirmation from './SendNFTConfirmation';

export enum SendPageTabOptions {
Accounts = 'Accounts',
Recent = 'Recent',
AddressBook = 'AddressBook',
Accounts = 'Accounts',
}

const useStyles = makeStyles((_theme) => ({
Expand Down Expand Up @@ -503,18 +503,19 @@ const SendToAddress = () => {
style={{ height: '100%', width: '100%' }}
>
<TabPanel value={tabValue} index={0} dir={theme.direction}>
<RecentList
filteredContacts={recentContacts}
<AccountsList
filteredContacts={filteredContacts}
isLoading={isLoading}
handleClick={(eachgroup) => {
searchResult = eachgroup;
setConfirmationOpen(true);
}}
isSend={false}
/>
</TabPanel>
<TabPanel value={tabValue} index={1} dir={theme.direction}>
<AddressBookList
filteredContacts={filteredContacts}
<RecentList
filteredContacts={recentContacts}
isLoading={isLoading}
handleClick={(eachgroup) => {
searchResult = eachgroup;
Expand All @@ -523,14 +524,13 @@ const SendToAddress = () => {
/>
</TabPanel>
<TabPanel value={tabValue} index={2} dir={theme.direction}>
<AccountsList
<AddressBookList
filteredContacts={filteredContacts}
isLoading={isLoading}
handleClick={(eachgroup) => {
searchResult = eachgroup;
setConfirmationOpen(true);
}}
isSend={false}
/>
</TabPanel>
</SwipeableViews>
Expand Down
6 changes: 3 additions & 3 deletions src/ui/views/Send/SendAmount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { withPrefix } from '@/shared/utils/address';
import { LLHeader } from '@/ui/FRWComponent';
import SlideRelative from '@/ui/FRWComponent/SlideRelative';
import { useProfileStore } from '@/ui/stores/profileStore';
import { TokenPrice } from '@/ui/views/TokenDetail/TokenValue';
import { TokenValue } from '@/ui/views/TokenDetail/TokenValue';
import { type CoinItem } from 'background/service/coinList';
import { LLContactCard } from 'ui/FRWComponent';
import { useWallet } from 'ui/utils';
Expand Down Expand Up @@ -241,9 +241,9 @@ const SendAmount = () => {
fontSize: '15px',
}}
>
<TokenPrice value={coinInfo.balance} postFix={coinInfo.unit.toUpperCase()} />
<TokenValue value={coinInfo.balance} postFix={coinInfo.unit.toUpperCase()} />
{' ≈ '}
<TokenPrice value={coinInfo.total} prefix={'$'} />
<TokenValue value={coinInfo.total} prefix={'$'} />
</Typography>
</Box>
</>
Expand Down
9 changes: 7 additions & 2 deletions src/ui/views/Send/SendEth/EvmConfirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import IconNext from 'ui/FRWAssets/svg/next.svg';
import { LLSpinner, LLProfile, FRWProfile } from 'ui/FRWComponent';
import { useWallet } from 'ui/utils';

import { TokenValue } from '../../TokenDetail/TokenValue';

interface ToEthConfirmationProps {
isConfirmationOpen: boolean;
data: any;
Expand Down Expand Up @@ -274,7 +276,10 @@ const ToEthConfirmation = (props: ToEthConfirmationProps) => {
variant="body1"
sx={{ fontSize: '18px', fontWeight: '400', textAlign: 'end' }}
>
{props.data.amount} {props.data.coinInfo.unit}
<TokenValue
value={props.data.amount}
postFix={props.data.coinInfo.unit.toUpperCase()}
/>
</Typography>
</Stack>
<Stack direction="column" spacing={1}>
Expand All @@ -283,7 +288,7 @@ const ToEthConfirmation = (props: ToEthConfirmationProps) => {
color="info"
sx={{ fontSize: '14px', fontWeight: 'semi-bold', textAlign: 'end' }}
>
$ {props.data.secondAmount}
<TokenValue value={props.data.secondAmount} prefix={'$'} />
</Typography>
</Stack>
</Box>
Expand Down
9 changes: 7 additions & 2 deletions src/ui/views/Send/SendEth/ToEthConfirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import IconNext from 'ui/FRWAssets/svg/next.svg';
import { LLSpinner, LLProfile, FRWProfile, FRWTargetProfile } from 'ui/FRWComponent';
import { useWallet } from 'ui/utils';

import { TokenValue } from '../../TokenDetail/TokenValue';

interface ToEthConfirmationProps {
isConfirmationOpen: boolean;
data: any;
Expand Down Expand Up @@ -288,7 +290,10 @@ const ToEthConfirmation = (props: ToEthConfirmationProps) => {
variant="body1"
sx={{ fontSize: '18px', fontWeight: '400', textAlign: 'end' }}
>
{props.data.amount} {props.data.coinInfo.unit}
<TokenValue
value={props.data.amount}
postFix={props.data.coinInfo.unit.toUpperCase()}
/>
</Typography>
</Stack>
<Stack direction="column" spacing={1}>
Expand All @@ -297,7 +302,7 @@ const ToEthConfirmation = (props: ToEthConfirmationProps) => {
color="info"
sx={{ fontSize: '14px', fontWeight: 'semi-bold', textAlign: 'end' }}
>
$ {props.data.secondAmount}
<TokenValue value={props.data.secondAmount} prefix={'$'} />
</Typography>
</Stack>
</Box>
Expand Down
6 changes: 3 additions & 3 deletions src/ui/views/Send/SendEth/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { LLContactCard } from 'ui/FRWComponent';
import { useWallet } from 'ui/utils';

import CancelIcon from '../../../../components/iconfont/IconClose';
import { TokenPrice } from '../../TokenDetail/TokenValue';
import { TokenValue } from '../../TokenDetail/TokenValue';
import TransferAmount from '../TransferAmount';

import EvmConfirmation from './EvmConfirmation';
Expand Down Expand Up @@ -246,9 +246,9 @@ const SendEth = () => {
fontSize: '15px',
}}
>
<TokenPrice value={coinInfo.balance} postFix={coinInfo.unit.toUpperCase()} />
<TokenValue value={coinInfo.balance} postFix={coinInfo.unit.toUpperCase()} />
{' ≈ '}
<TokenPrice value={coinInfo.total} prefix={'$'} />
<TokenValue value={coinInfo.total} prefix={'$'} />
</Typography>
</Box>
</>
Expand Down
6 changes: 3 additions & 3 deletions src/ui/views/Send/TransferAmount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import React, { useState, useEffect, useCallback } from 'react';

import SlideRelative from '@/ui/FRWComponent/SlideRelative';
import { useCoinStore } from '@/ui/stores/coinStore';
import { TokenPrice } from '@/ui/views/TokenDetail/TokenValue';
import { TokenValue } from '@/ui/views/TokenDetail/TokenValue';

import CancelIcon from '../../../components/iconfont/IconClose';
import IconFlow from '../../../components/iconfont/IconFlow';
Expand Down Expand Up @@ -329,10 +329,10 @@ const TransferAmount = ({
<Typography></Typography>
{coinType ? (
<>
<IconFlow size={16} /> <TokenPrice value={amount} />
<IconFlow size={16} /> <TokenValue value={amount} />
</>
) : (
<TokenPrice value={secondAmount} prefix={'$'} />
<TokenValue value={secondAmount} prefix={'$'} />
)}
<IconButton onClick={swap}>
<IconSwitch size={14} />
Expand Down
9 changes: 6 additions & 3 deletions src/ui/views/Send/TransferConfirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import SlideRelative from '@/ui/FRWComponent/SlideRelative';
import StorageExceededAlert from '@/ui/FRWComponent/StorageExceededAlert';
import { WarningStorageLowSnackbar } from '@/ui/FRWComponent/WarningStorageLowSnackbar';
import { useStorageCheck } from '@/ui/utils/useStorageCheck';
import { TokenPrice } from '@/ui/views/TokenDetail/TokenValue';
import { TokenValue } from '@/ui/views/TokenDetail/TokenValue';
import IconNext from 'ui/FRWAssets/svg/next.svg';
import { LLSpinner, LLProfile, FRWProfile, FRWTargetProfile } from 'ui/FRWComponent';
import { useWallet, isEmoji } from 'ui/utils';
Expand Down Expand Up @@ -356,7 +356,10 @@ const TransferConfirmation = (props: TransferConfirmationProps) => {
variant="body1"
sx={{ fontSize: '18px', fontWeight: '400', textAlign: 'end' }}
>
{props.data.amount} {props.data.coinInfo.unit}
<TokenValue
value={props.data.amount}
postFix={props.data.coinInfo.unit.toUpperCase()}
/>
</Typography>
</Stack>
<Stack direction="column" spacing={1}>
Expand All @@ -365,7 +368,7 @@ const TransferConfirmation = (props: TransferConfirmationProps) => {
color="info"
sx={{ fontSize: '14px', fontWeight: 'semi-bold', textAlign: 'end' }}
>
<TokenPrice value={props.data.secondAmount} prefix={'$'} />
<TokenValue value={props.data.secondAmount} prefix={'$'} />
</Typography>
</Stack>
</Box>
Expand Down
12 changes: 6 additions & 6 deletions src/ui/views/Send/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ import RecentList from './RecentList';
import SearchList from './SearchList';

export enum SendPageTabOptions {
Accounts = 'Accounts',
Recent = 'Recent',
AddressBook = 'AddressBook',
Accounts = 'Accounts',
}

const useStyles = makeStyles((theme) => ({
Expand Down Expand Up @@ -516,8 +516,8 @@ const Send = () => {
style={{ height: '100%', width: '100%' }}
>
<TabPanel value={tabValue} index={0} dir={theme.direction}>
<RecentList
filteredContacts={recentContacts}
<AccountsList
filteredContacts={filteredContacts}
isLoading={isLoading}
handleClick={(eachgroup) => {
const isEvmAddress = isValidEthereumAddress(eachgroup.address);
Expand All @@ -534,8 +534,8 @@ const Send = () => {
/>
</TabPanel>
<TabPanel value={tabValue} index={1} dir={theme.direction}>
<AddressBookList
filteredContacts={filteredContacts}
<RecentList
filteredContacts={recentContacts}
isLoading={isLoading}
handleClick={(eachgroup) => {
const isEvmAddress = isValidEthereumAddress(eachgroup.address);
Expand All @@ -552,7 +552,7 @@ const Send = () => {
/>
</TabPanel>
<TabPanel value={tabValue} index={2} dir={theme.direction}>
<AccountsList
<AddressBookList
filteredContacts={filteredContacts}
isLoading={isLoading}
handleClick={(eachgroup) => {
Expand Down
4 changes: 2 additions & 2 deletions src/ui/views/TokenDetail/TokenInfoCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { addDotSeparators } from 'ui/utils/number';

import IconChevronRight from '../../../components/iconfont/IconChevronRight';

import { TokenPrice } from './TokenValue';
import { TokenValue } from './TokenValue';

// import tips from 'ui/FRWAssets/svg/tips.svg';

Expand Down Expand Up @@ -223,7 +223,7 @@ const TokenInfoCard = ({
</Box>
<Typography variant="body1" color="text.secondary" sx={{ fontSize: '16px' }}>
<Box component="span" sx={{ marginRight: '0.25rem' }}>
<TokenPrice
<TokenValue
value={balance * price}
prefix="$"
postFix={chrome.i18n.getMessage('USD')}
Expand Down
4 changes: 2 additions & 2 deletions src/ui/views/TokenDetail/TokenValue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ interface TokenPriceProps {
postFix?: string;
}

export const TokenPrice: React.FC<TokenPriceProps> = ({
export const TokenValue: React.FC<TokenPriceProps> = ({
value,
className = '',
prefix = '$',
prefix = '',
postFix = '',
}) => {
if (value === 0 || value === null || value === undefined) {
Expand Down
6 changes: 3 additions & 3 deletions src/ui/views/Wallet/Coinlist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { useHistory } from 'react-router-dom';
import { formatLargeNumber } from 'ui/utils/number';

import IconCreate from '../../../components/iconfont/IconCreate';
import { TokenPrice } from '../TokenDetail/TokenValue';
import { TokenValue } from '../TokenDetail/TokenValue';

const CoinList = ({ data, ableFt, isActive, childType, coinLoading }) => {
// const wallet = useWallet();
Expand Down Expand Up @@ -110,7 +110,7 @@ const CoinList = ({ data, ableFt, isActive, childType, coinLoading }) => {
}}
>
{props.change === null ? '-' : ''}
<TokenPrice value={props.price} prefix="$" />
<TokenValue value={props.price} prefix="$" />
</Typography>
{props.change !== 0 && (
<Typography
Expand Down Expand Up @@ -191,7 +191,7 @@ const CoinList = ({ data, ableFt, isActive, childType, coinLoading }) => {
secondaryAction={
<EndListItemText
primary={parseFloat(coin.balance).toFixed(3)}
secondary={<TokenPrice value={coin.balance * coin.price} prefix="$" />}
secondary={<TokenValue value={coin.balance * coin.price} prefix="$" />}
unit={coin.unit}
change={parseFloat(coin.change24h.toFixed(2))}
/>
Expand Down
4 changes: 2 additions & 2 deletions src/ui/views/Wallet/TransferList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { useTransferListStore } from '@/ui/stores/transferListStore';
import activity from 'ui/FRWAssets/svg/activity.svg';
import { useWallet } from 'ui/utils';

import { TokenPrice } from '../TokenDetail/TokenValue';
import { TokenValue } from '../TokenDetail/TokenValue';

dayjs.extend(relativeTime);

Expand Down Expand Up @@ -87,7 +87,7 @@ const TransferList = () => {
}}
>
{props.type === 1 ? (
<TokenPrice
<TokenValue
value={`${props.amount}`.replace(/^-/, '')}
prefix={!isContractCall ? (isReceive ? '+' : '-') : ''}
/>
Expand Down

0 comments on commit e443604

Please sign in to comment.