Skip to content

Commit

Permalink
[DDW-385] Progress - header
Browse files Browse the repository at this point in the history
  • Loading branch information
thedanheller committed Oct 16, 2020
1 parent ff0be53 commit fe1c655
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 130 deletions.

This file was deleted.

Expand Up @@ -5,13 +5,15 @@ import { defineMessages, intlShape } from 'react-intl';
import WalletTransactionsList, {
WalletTransactionsListScrollContext,
} from './WalletTransactionsList';
import WalletTransactionsHeader from './WalletTransactionsHeader';
import FilterResultInfo from './FilterResultInfo';
import WalletNoTransactions from './WalletNoTransactions';
import VerticalFlexContainer from '../../layout/VerticalFlexContainer';
import { formattedWalletAmount } from '../../../utils/formatters';
import { getNumberOfFilterDimensionsApplied } from '../../../utils/transaction';
import { WalletTransaction } from '../../../domains/WalletTransaction';
import Wallet from '../../../domains/Wallet';
import type { TransactionFilterOptionsType } from '../../../stores/TransactionsStore';

export const messages = defineMessages({
noTransactions: {
Expand All @@ -25,7 +27,7 @@ type Props = {
activeWallet: ?Wallet,
transactions: Array<WalletTransaction>,
shouldDisplayTransactions: boolean,
filterOptions: any,
filterOptions: TransactionFilterOptionsType,
deletePendingTransaction: Function,
onLoadMore: Function,
hasMoreToLoad: boolean,
Expand All @@ -34,8 +36,13 @@ type Props = {
getUrlByType: Function,
isDeletingTransaction: boolean,
totalAvailable: number,
currentLocale: string,
currentDateFormat: string,
currentTimeFormat: string,
currentNumberFormat: string,
defaultFilterOptions: TransactionFilterOptionsType,
populatedFilterOptions: TransactionFilterOptionsType,
onFilter: Function,
onClose: Function,
};
type State = {
isFilterButtonFaded: boolean,
Expand Down Expand Up @@ -72,6 +79,7 @@ export default class WalletTransactions extends Component<Props, State> {
totalAvailable,
currentDateFormat,
currentTimeFormat,
currentLocale,
} = this.props;

// Guard against potential null values
Expand Down Expand Up @@ -107,6 +115,7 @@ export default class WalletTransactions extends Component<Props, State> {
formattedWalletAmount={formattedWalletAmount}
onOpenExternalLink={onOpenExternalLink}
getUrlByType={getUrlByType}
currentLocale={currentLocale}
currentTimeFormat={currentTimeFormat}
currentDateFormat={currentDateFormat}
isRenderingAsVirtualList
Expand All @@ -118,6 +127,7 @@ export default class WalletTransactions extends Component<Props, State> {
<WalletTransactionsListScrollContext.Provider
value={{ setFilterButtonFaded: this.setFilterButtonFaded }}
>
<WalletTransactionsHeader transactions={transactions} />
<VerticalFlexContainer>{walletTransactions}</VerticalFlexContainer>
</WalletTransactionsListScrollContext.Provider>
);
Expand Down
@@ -0,0 +1,102 @@
// @flow
import React, { Component } from 'react';
import { observer, inject } from 'mobx-react';
import { defineMessages, intlShape } from 'react-intl';
import FilterDialog from './FilterDialog';
import FilterButton from './FilterButton';
import FilterResultInfo from './FilterResultInfo';
import styles from './WalletTransactionsHeader.scss';
// import TinyButton from '../widgets/forms/TinyButton';
import type { TransactionFilterOptionsType } from '../../../stores/TransactionsStore';

export const messages = defineMessages({
transactions: {
id: 'wallet.transactions.header.transactions',
defaultMessage: '!!!Transactions',
description: 'Label for the "Transactions" header.',
},
});

type Props = {
transactions: Array<WalletTransaction>,
filterOptions: TransactionFilterOptionsType,
currentLocale: string,
currentDateFormat: string,
currentNumberFormat: string,
defaultFilterOptions: TransactionFilterOptionsType,
populatedFilterOptions: TransactionFilterOptionsType,
onFilter: Function,
onClose: Function,
};

type State = {
isFilterButtonFaded: boolean,
};

@observer
export default class WalletTransactionsHeader extends Component<Props, State> {
static contextTypes = {
intl: intlShape.isRequired,
};

state = {
isFilterButtonFaded: false,
};

setFilterButtonFaded = (isFilterButtonFaded: boolean) =>
this.setState({ isFilterButtonFaded });

render() {
const { intl } = this.context;
const { isFilterButtonFaded } = this.state;
const { transactions, filterOptions } = this.props;
console.log('filterOptions', filterOptions);

return (
<div className={styles.component}>
<div className={styles.numberOfTransactions}>
{intl.formatMessage(messages.transactions)} ({transactions.length})
</div>
</div>
);

// const {
// filterOptions,
// searchRequest,
// hasAny,
// totalAvailable,
// allFiltered,
// recentFiltered,
// deletePendingTransaction,
// deleteTransactionRequest,
// } = stores.transactions;
// const { currentTimeFormat, currentDateFormat, currentLocale } = profile;

// // Guard against potential null values
// if (!filterOptions || !activeWallet) return null;

// let walletTransactions = null;
// const { searchLimit } = filterOptions;
// const numberOfFilterDimensionsApplied = getNumberOfFilterDimensionsApplied(
// filterOptions
// );
// const noTransactionsLabel = intl.formatMessage(messages.noTransactions);
// const hasMoreToLoad = () =>
// searchLimit !== null &&
// searchLimit !== undefined &&
// totalAvailable > searchLimit;

// return (
// <div>
// <FilterDialogContainer />
// {hasAny && (
// <FilterButton
// numberOfFilterDimensionsApplied={numberOfFilterDimensionsApplied}
// faded={isFilterButtonFaded}
// onClick={this.openFilterDialog}
// />
// )}
// </div>
// );
}
}
@@ -0,0 +1,8 @@
.component {
height: 53px;
padding: 0 40px;
}
.numberOfTransactions {
// background: red;
color: orange;
}
Expand Up @@ -87,6 +87,8 @@ export default class WalletTransactionsPage extends Component<Props, State> {
deleteTransactionRequest,
} = stores.transactions;
const { currentTimeFormat, currentDateFormat, currentLocale } = profile;
const { dataForActiveDialog } = stores.uiDialogs;
const { closeActiveDialog } = actions.dialogs;
const { searchLimit = 0 } = filterOptions;

let transactions = [];
Expand Down Expand Up @@ -128,9 +130,13 @@ export default class WalletTransactionsPage extends Component<Props, State> {
isDeletingTransaction={deleteTransactionRequest.isExecuting}
onOpenExternalLink={openExternalLink}
getUrlByType={getUrlByType}
totalAvailable={totalAvailable}
currentLocale={currentLocale}
currentTimeFormat={currentTimeFormat}
currentDateFormat={currentDateFormat}
totalAvailable={totalAvailable}
onFilter={this.onFilter}
onClose={() => closeActiveDialog.trigger()}
{...dataForActiveDialog}
isRenderingAsVirtualList
/>
);
Expand Down
1 change: 1 addition & 0 deletions source/renderer/app/i18n/locales/en-US.json
Expand Up @@ -897,6 +897,7 @@
"wallet.transaction.type.exchange": "Exchange",
"wallet.transaction.unresolvedInputAddressesAdditionalLabel": "to see these addresses.",
"wallet.transaction.unresolvedInputAddressesLinkLabel": "Open this transaction in Cardano explorer",
"wallet.transactions.header.transactions": "Transactions",
"wallet.transactions.no.transactions": "No transactions",
"wallet.transferFunds.dialog1.continueLabel": "Continue",
"wallet.transferFunds.dialog1.sourceWallet": "From Byron legacy wallet",
Expand Down
1 change: 1 addition & 0 deletions source/renderer/app/i18n/locales/ja-JP.json
Expand Up @@ -897,6 +897,7 @@
"wallet.transaction.type.exchange": "換金",
"wallet.transaction.unresolvedInputAddressesAdditionalLabel": "アドレスを表示する。",
"wallet.transaction.unresolvedInputAddressesLinkLabel": "Cardanoエクスプローラーでこのトランザクションを開き",
"wallet.transactions.header.transactions": "トランザクション",
"wallet.transactions.no.transactions": "トランザクションはありません",
"wallet.transferFunds.dialog1.continueLabel": "続ける",
"wallet.transferFunds.dialog1.sourceWallet": "送金元Byronレガシーウォレット",
Expand Down

0 comments on commit fe1c655

Please sign in to comment.