-
Notifications
You must be signed in to change notification settings - Fork 526
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
Conversation
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.
nice! just one small nitpick but looks great 👍
handleCustomerDeleted = () => { | ||
this.props.history.push('/customers'); | ||
}; | ||
|
||
toggleIsEditModalVisible = (isEditModalVisible: boolean) => { |
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.
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?
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.
I'm indifferent, so if you have a preference, I'll update it :)
phone?: string | number; | ||
}; | ||
|
||
class EditCustomerDetailsModal extends React.Component<Props, State> { |
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.
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 🤷 )
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.
I can give it a try! I haven't really used hooks before, but I'm definitely curious to try the new hotness.
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
Deletion flow
CleanShot.2021-04-14.at.16.38.41.mp4
Checklist
mix test
mix format