Browse Source

Polish operationslist: Drop always true prop

master
Gaëtan Renaudeau 7 years ago
parent
commit
40d8915310
  1. 2
      src/components/AccountPage/index.js
  2. 1
      src/components/DashboardPage/index.js
  3. 24
      src/components/OperationsList/index.js
  4. 6
      src/components/OperationsList/stories.js

2
src/components/AccountPage/index.js

@ -180,7 +180,7 @@ class AccountPage extends PureComponent<Props, State> {
)}
/>
</Box>
<OperationsList canShowMore account={account} title={t('account:lastOperations')} />
<OperationsList account={account} title={t('account:lastOperations')} />
</Fragment>
) : (
<EmptyStateAccount account={account} />

1
src/components/DashboardPage/index.js

@ -167,7 +167,6 @@ class DashboardPage extends PureComponent<Props, State> {
</Box>
{displayOperations && (
<OperationsList
canShowMore
onAccountClick={this.onAccountClick}
accounts={accounts}
title={t('dashboard:recentActivity')}

24
src/components/OperationsList/index.js

@ -52,8 +52,7 @@ const mapDispatchToProps = {
type Props = {
account: Account,
accounts: Account[],
canShowMore: boolean,
openModal: Function,
openModal: (string, Object) => *,
t: T,
withAccount?: boolean,
title?: string,
@ -66,10 +65,12 @@ type State = {
const initialState = {
nbToShow: 20,
}
const footerPlaceholder = null // TODO figure out with design what we want here
export class OperationsList extends PureComponent<Props, State> {
static defaultProps = {
withAccount: false,
canShowMore: false,
}
state = initialState
@ -86,7 +87,7 @@ export class OperationsList extends PureComponent<Props, State> {
}
render() {
const { account, accounts, canShowMore, t, title, withAccount } = this.props
const { account, accounts, t, title, withAccount } = this.props
const { nbToShow } = this.state
if (!account && !accounts) {
@ -130,13 +131,14 @@ export class OperationsList extends PureComponent<Props, State> {
</Card>
</Box>
))}
{canShowMore &&
!groupedOperations.completed && (
<ShowMore onClick={this.fetchMoreOperations}>
<span>{t('operationsList:showMore')}</span>
<IconAngleDown size={12} />
</ShowMore>
)}
{!groupedOperations.completed ? (
<ShowMore onClick={this.fetchMoreOperations}>
<span>{t('operationsList:showMore')}</span>
<IconAngleDown size={12} />
</ShowMore>
) : (
footerPlaceholder
)}
</Box>
</Defer>
)

6
src/components/OperationsList/stories.js

@ -15,10 +15,6 @@ const account2 = genAccount('account2')
stories.add('OperationsList', () => (
<Box bg="lightGrey" p={6} m={-4}>
<OperationsList
accounts={[account1, account2]}
canShowMore={boolean('canShowMore')}
withAccount={boolean('withAccount')}
/>
<OperationsList accounts={[account1, account2]} withAccount={boolean('withAccount')} />
</Box>
))

Loading…
Cancel
Save