Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coupons page #1

Merged
merged 13 commits into from
Oct 30, 2017
Merged

Coupons page #1

merged 13 commits into from
Oct 30, 2017

Conversation

giuliaFerretti
Copy link
Collaborator

@giuliaFerretti giuliaFerretti commented Oct 25, 2017

I'm working on Coupons Page. I managed the coupon row and coupon list for coupon used and not.

  • Coupon list
  • Coupon row
  • Dynamic coupons
  • Tab navigations

let merchant = null;
let icon = null;

switch (this.props.category) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of switch, I think you can create a Map of <Category, icon>.
Something like:

const icons = {
   'Cinema' : require();
}

And use it as icons[this.props.category] directly.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking to the future, probably the single coupon will have a categoryId, not the full name.

I think we can move the map inside a common/categories.js, with name and icon (still using the name as key for now) file and use it where we need.

import PropTypes from 'prop-types';
import * as Constants from '../common/constants';

export default class CouponHeader extends Component {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CouponHeader should receive only the quantity of coupons. Then it should define the text logic (zero, one, more than one).

return (
<FlatList
ListHeaderComponent={() => (
<CouponHeader
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As commented above, it should be something like

<CouponHeader activeCoupons={4} />

let headerTextStart,
headerTextQuantity = '1 buono',
headerTextEnd = ' ancora da spendere';
if (headerTextQuantity == '1 buono') {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should only use the number of coupons, not comparing strings.

Get unused coupons with filter/length over coupons array.

@giuliaFerretti giuliaFerretti force-pushed the feature/coupons branch 2 times, most recently from de3e31b to 69669f2 Compare October 29, 2017 22:48
@giuliaFerretti giuliaFerretti changed the title WIP: coupons page Coupons page Oct 30, 2017
@Takeno Takeno merged commit 1e73751 into master Oct 30, 2017
@Takeno Takeno deleted the feature/coupons branch October 30, 2017 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants