Skip to content

Commit

Permalink
[DDW-694] Tokens list - progress
Browse files Browse the repository at this point in the history
  • Loading branch information
thedanheller committed Sep 14, 2021
1 parent 2ee90af commit eb3e3a2
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { observer } from 'mobx-react';
import Wallet from '../../../domains/Wallet';
import type { Currency } from '../../../types/currencyTypes';
import WalletSummaryHeader from './WalletSummaryHeader';
import WalletSummaryAssets from './WalletSummaryAssets';
import WalletSummaryCurrency from './WalletSummaryCurrency';
import type { AssetToken } from '../../../api/assets/types';
import WalletSummaryNoTokens from './WalletSummaryNoTokens';
Expand All @@ -30,6 +29,7 @@ type Props = {
isLoadingAssets: boolean,
assetSettingsDialogWasOpened: boolean,
onExternalLinkClick: Function,
onViewAllButtonClick: Function,
};

@observer
Expand All @@ -55,6 +55,7 @@ export default class WalletSummary extends Component<Props> {
assetSettingsDialogWasOpened,
isLoadingAssets,
onExternalLinkClick,
onViewAllButtonClick,
} = this.props;

const { isRestoring } = wallet;
Expand Down Expand Up @@ -95,6 +96,7 @@ export default class WalletSummary extends Component<Props> {
assetSettingsDialogWasOpened={assetSettingsDialogWasOpened}
currentLocale={currentLocale}
title="Recently used tokens"
onViewAllButtonClick={onViewAllButtonClick}
/>
) : (
<WalletSummaryNoTokens
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type Props = {
assets: Array<AssetToken>,
assetSettingsDialogWasOpened: boolean,
currentLocale: string,
onViewAllButtonClick?: Function,
intl: intlShape.isRequired,
isLoadingAssets: boolean,
onAssetSettings: Function,
Expand All @@ -35,9 +36,9 @@ type Props = {

const WalletTokensList = observer((props: Props) => {
const {
// anyAssetWasHovered,
assets,
assetSettingsDialogWasOpened,
onViewAllButtonClick,
intl,
isLoadingAssets,
onAssetSettings,
Expand Down Expand Up @@ -86,6 +87,9 @@ const WalletTokensList = observer((props: Props) => {
assetSettingsDialogWasOpened={assetSettingsDialogWasOpened}
/>
))}
{onViewAllButtonClick && (
<button onClick={onViewAllButtonClick}>VIEW ALL</button>
)}
</BorderedBox>
</div>
);
Expand Down
11 changes: 10 additions & 1 deletion source/renderer/app/containers/wallet/WalletSummaryPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ export default class WalletSummaryPage extends Component<Props> {
});
};

handleViewAllButtonClick = (walletId: string) => {
this.props.actions.router.goToRoute.trigger({
route: ROUTES.WALLETS.PAGE,
params: { id: walletId, page: 'tokens' },
});
};

render() {
const { intl } = this.context;
const { stores, actions } = this.props;
Expand Down Expand Up @@ -83,7 +90,6 @@ export default class WalletSummaryPage extends Component<Props> {
} = transactions;
const { active: wallet } = wallets;
const { isActive, isFetchingRate, lastFetched, rate, selected } = currency;

const { currentTimeFormat, currentDateFormat, currentLocale } = profile;
const hasAssetsEnabled = WALLET_ASSETS_ENABLED;

Expand All @@ -100,6 +106,8 @@ export default class WalletSummaryPage extends Component<Props> {
const hasRawAssets = wallet.assets.total.length > 0;
const isLoadingAssets = hasRawAssets && totalAssets < totalRawAssets;

const onViewAllButtonClick = () => this.handleViewAllButtonClick(wallet.id);

const getUrlByType = (type: 'tx' | 'address', param: string) =>
getNetworkExplorerUrlByType(type, param, network, currentLocale);

Expand Down Expand Up @@ -161,6 +169,7 @@ export default class WalletSummaryPage extends Component<Props> {
onCopyAssetParam={onCopyAssetParam.trigger}
onAssetSettings={onAssetSettingsOpen.trigger}
onExternalLinkClick={app.openExternalLink}
onViewAllButtonClick={onViewAllButtonClick}
/>
{walletTransactions}
</VerticalFlexContainer>
Expand Down
2 changes: 1 addition & 1 deletion source/renderer/app/utils/assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export const hasTokensLeftAfterTransaction = (
*/
export const searchAssets = (
rawSearchValue: string,
assets: Array<{ asset: AssetToken }>
assets: Array<AssetToken>
) => {
const searchValue = rawSearchValue.trim();
if (searchValue.length < 3) {
Expand Down

0 comments on commit eb3e3a2

Please sign in to comment.