-
Notifications
You must be signed in to change notification settings - Fork 3
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
Feature see guest responses #193
Conversation
feature-see-guest-responses complete Merge conflicts resolved
<View style={styles.imageView}> | ||
{(guest[1] === '+' && <Image source={inviteConfirmationStatus.YES.imageSource} />) | ||
|| (guest[1] === '-' && <Image source={inviteConfirmationStatus.NO.imageSource} />) | ||
|| <Image source={inviteConfirmationStatus.UNKNOWN.imageSource} />} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is terrifying. It's nice to see that you understand short circuits, but this one goes pretty far!
You should write a function that takes a guest
(or whatever guest[1]
is) and returns an image component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
inviteResponses[key].forEach((item) => { | ||
guestResponses.push([item, '?']); | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest a refactor to write a function:
const createGuestResponse = (key, item) => {
const responseMap = {
userAccept: [`${item.firstName} ${item.lastName}`, '+'],
userReject: [`${item.firstName} ${item.lastName}`, '-'],
...etc
}
return responseMap[key];
}
And just throw in a guard clause to handle the inviteResponses[key].length > 0
repetition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
||
const getPotluckInviteResponses = (potluckId) => { | ||
const promises = [ | ||
processtPotluckUserInviteResponses(potluckId, getGuestInviteUserDetailsAccept) || [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo? processt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
PR issues actioned. |
Completes issue #25