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> </Box>
<OperationsList canShowMore account={account} title={t('account:lastOperations')} /> <OperationsList account={account} title={t('account:lastOperations')} />
</Fragment> </Fragment>
) : ( ) : (
<EmptyStateAccount account={account} /> <EmptyStateAccount account={account} />

1
src/components/DashboardPage/index.js

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

24
src/components/OperationsList/index.js

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

6
src/components/OperationsList/stories.js

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

Loading…
Cancel
Save