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

Adds ability to edit customer details page #736

Merged
merged 3 commits into from
Apr 15, 2021

Conversation

rhonsby
Copy link
Collaborator

@rhonsby rhonsby commented Apr 14, 2021

Description

As a follow-up to 048caba, this commit adds the ability to edit the customer from the customer details page.

Screenshots

Editing a user

CleanShot.2021-04-14.at.15.43.36.mp4

When the server returns an error

CleanShot 2021-04-14 at 15 35 01@2x

Deletion flow

CleanShot.2021-04-14.at.16.38.41.mp4

Checklist

  • Everything passes when running mix test
  • Ran mix format
  • No frontend compilation warnings

@rhonsby rhonsby requested a review from reichert621 April 14, 2021 22:17
Copy link
Collaborator

@reichert621 reichert621 left a comment

Choose a reason for hiding this comment

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

nice! just one small nitpick but looks great 👍

handleCustomerDeleted = () => {
this.props.history.push('/customers');
};

toggleIsEditModalVisible = (isEditModalVisible: boolean) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit -- seems kinda redundant to have this function if all it's doing is wrapping this.setState({isEditModalVisible}), i'd almost prefer just having handleOpenEditModal and handleCloseEditModal functions so we can just do onClick={this.handleOpenEditModal} instead of onClick={() => this.toggleIsEditModalVisible(true)} below... what do you think?

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 indifferent, so if you have a preference, I'll update it :)

phone?: string | number;
};

class EditCustomerDetailsModal extends React.Component<Props, State> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

if you're curious to play around with react hooks in a functional component, this could be a good candidate for that! (since it doesn't use any lifecycle hooks and all you'd need to use is React.useState() to manage state)

(i'm not crazy about hooks but sometimes they're nice for the simpler use cases 🤷 )

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 can give it a try! I haven't really used hooks before, but I'm definitely curious to try the new hotness.

@reichert621 reichert621 merged commit a94d3ba into master Apr 15, 2021
@reichert621 reichert621 deleted the customer-details-page-editing branch April 15, 2021 20:44
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