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

Reward card IA updates #807

Merged
merged 9 commits into from
Aug 21, 2019
Merged

Reward card IA updates #807

merged 9 commits into from
Aug 21, 2019

Conversation

justinswart
Copy link
Contributor

@justinswart justinswart commented Aug 19, 2019

📲 What

Adds the IA changes that we wanted to get in for the reward card before shipping v1:

  • The descriptionLabel is positioned above the includedItemsStackView.
  • descriptionTitleLabel has been removed.
  • sectionTitleLabelStyle has been updated to ksr_text_dark_grey_500 to improve accessibility.
  • estimatedDeliveryDateLabel appears below includedItemsStackView.
  • Limited reward now display a pill indicating <remaining> left of <limit>.
  • A backer count is displayed in place of the limited reward remaining pill when:
    • Reward has at least 1 backer AND:
    • Reward has no limit OR:
    • Limit has been reached OR:
    • Project has ended.
  • If none of the above are matched, the backer count pill isn't shown.

👀 See

Abstract
Jira

Some examples:

Before 🐛 After 🦋
image image
image image
image image

✅ Acceptance criteria

  • Test the backer count displaying/hidden in the states described above.
  • Confirm positioning of items is correct against Abstract designs.

Copy link
Contributor

@ifbarrera ifbarrera left a comment

Choose a reason for hiding this comment

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

lgtm! 🚀


self.pillCollectionViewHidden.assertValues([false])
self.reloadPills.assertValues([
["4 days left", "50 backers", "Anywhere in the world"]
Copy link
Contributor

Choose a reason for hiding this comment

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

This is kind of an interesting case. I would think that if a reward isn't available anymore because remaining == 0 then it's pointless to show 4 days left since it's unavailable anyway. cc @jamielynnroth

Not sure it's necessary to update it now but maybe something we can re-think later.

let endsAt = reward.endsAt,
endsAt > 0,
endsAt >= AppEnvironment.current.dateType.init().timeIntervalSince1970,
reward.limit == nil || reward.remaining ?? 0 > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we extract this last piece to a var?

let isUnlimitedOrAvailable = reward.limit == nil || reward.remaining ?? 0 > 0

Come to think of it, you probably don't need the first part of that statement because if it's an "unlimited" reward then reward.remaining will be nil so you'll still get the same outcome. So:

let isAvailable = reward.remaining ?? 0 > 0 would suffice?

You're the expert on this though 😛

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😄 I extracted it to a variable for readability.

Actually, we do need the OR, coalescing the nil remaining value would assume it's a limited reward. We're saying - return the string if this reward is unlimited OR if it has more than 0 remaining. If the left side is nil the second is ignored.

Tidied it up a little though.

@justinswart
Copy link
Contributor Author

Updated the strings to include _count but realized that wasn't enough, the string in the yaml in fact needs to look like this:

remaining_count_left_of_limit_count:
  zero: "%{remaining_count} left of %{limit_count}"
  one: "%{remaining_count} left of %{limit_count}"
  two: "%{remaining_count} left of %{limit_count}"
  few: "%{remaining_count} left of %{limit_count}"
  many: "%{remaining_count} left of %{limit_count}"
  other: "%{remaining_count} left of %{limit_count}"

This isn't necessary for this particular string as we don't vary the string based on the count. Also I'm not sure that it's built to handle multiple counts in the same string and looking through the rest of the yaml it's fairly inconsistent about that.

🤷‍♂

@justinswart justinswart requested a review from ifbarrera August 21, 2019 00:30
Copy link
Contributor

@ifbarrera ifbarrera left a comment

Choose a reason for hiding this comment

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

Cool!

@justinswart justinswart merged commit 5f87fa2 into master Aug 21, 2019
@justinswart justinswart deleted the reward-card-ia-updates branch August 21, 2019 16:12
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