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

@alloy => Working collector profile mutation! #80

Merged
merged 2 commits into from Apr 7, 2017
Merged

@alloy => Working collector profile mutation! #80

merged 2 commits into from Apr 7, 2017

Conversation

mzikherman
Copy link
Collaborator

Thanks for the pairing @alloy and @l2succes

This hooks up the mutation that lets you mark yourself as a loyalty applicant, as well as saving the textbox of self-reported purchases.

console.log("Loyalty Applicant Not Saved");
}
else {
console.log("Success");
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This should navigate us to the thank you page.


const onSuccess = (response) => {
if(!response.updateCollectorProfile.loyalty_applicant_at) {
console.log("Loyalty Applicant Not Saved");
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We may want to just render any errors under/above the button.

@@ -84,7 +155,7 @@ interface RelayProps {
artwork_inquiries_connection: {
edges: Array<{
node: {
id: string,
id: string | null,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure why this showed up...

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Which is the case for most of these types… it’s null galore! 🎊

Copy link
Contributor

@l2succes l2succes left a comment

Choose a reason for hiding this comment

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

Nice work! Looking good

this.setState({ self_reported_purchases: e.target.value })
}

handleClick(e) {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe name onClickSubmitButton, submitButtonClicked, a more descriptive name

Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly this event can probably be typed as React.MouseEvent<Button>

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yup and yup


type RelayMutationProps = State

class UpdateCollectorProfileMutation extends Relay.Mutation<RelayMutationProps, any> {
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 move the mutation to a separate file? maybe inquiries/relay.ts

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yea, I was just starting out all in one file. At the very least I think co-locating it with this component makes the most sense, I can move to a separate file.

Lots of examples I saw online seem to have all the different mutations defined in a completely separate place, but that seems weird. I'm definitely down to keep them close to the app/components for now.

@@ -40,6 +84,33 @@ class Inquiries extends React.Component<RelayProps, any> {
})
}

handleTextboxChange(e) {
Copy link
Contributor

@alloy alloy Apr 6, 2017

Choose a reason for hiding this comment

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

#It looks like you can type the event as React.FormEvent<TextArea>.

FormEvent is just a SyntheticEvent, which for the target property has this tidbit which explains that we should use currentTarget instead and that will get cast as HTMLTextAreaElement through T.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

👍 I have to read about these things more

@@ -82,7 +82,7 @@ app.get("/inquiries", (req, res) => {
styles,
html,
entrypoint: "/bundles/inquiries.js",
bootstrapData: `var DATA = ${JSON.stringify(data)};`,
bootstrapData: `var DATA = ${JSON.stringify(data)}; var USER_DATA = ${JSON.stringify(req.user.toJSON())};`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I remember now, we need to harden this against XSS attacks. In the past I came across this lib of yahoo that should be able to escape HTML.

@alloy
Copy link
Contributor

alloy commented Apr 6, 2017

Yup, great stuff, glad you made it out alive! 👏

@l2succes
Copy link
Contributor

l2succes commented Apr 7, 2017

Ok, looks good. Mergin'! I'll have a PR up with the sharify integration for serializing objects on the client-side

@l2succes l2succes merged commit a72aa3f into artsy:master Apr 7, 2017
@mzikherman
Copy link
Collaborator Author

Cool! I'll leave myself an issue to do more research into those typed event handlers.

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.

None yet

3 participants