Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Migrate ColorInput component to typescript #3589

Merged
merged 5 commits into from
Sep 12, 2019

Conversation

jespino
Copy link
Member

@jespino jespino commented Sep 3, 2019

Summary

Migrate ColorInput component to typescript

Ticket Link

MM-18192

Notes for QA

This is used in the custom theme color selector.

Notes for PMs

My perception is we are not allowing (using) transparency but the widget is showing the alpha channel, there is a setting of the component that allow us to disable the alpha channel in the selector, maybe we should use that to not allow play with the alpha channel if this is not used at all.

@jespino jespino requested a review from a team September 3, 2019 10:15
@jespino jespino added 2: Dev Review Requires review by a core commiter 3: QA Review Requires review by a QA tester labels Sep 3, 2019
@ghost ghost requested review from mickmister and stylianosrigas and removed request for a team September 3, 2019 10:16
Copy link

@stylianosrigas stylianosrigas left a comment

Choose a reason for hiding this comment

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

LGTM :)

Copy link
Member

@mickmister mickmister left a comment

Choose a reason for hiding this comment

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

It's so good to see typescript being used!! Changes requested are non-blocking

checkClick = (e) => {
const colorPickerDOMNode = ReactDom.findDOMNode(this.colorPicker);
if (!colorPickerDOMNode || !colorPickerDOMNode.contains(e.target)) {
private checkClick = (e: MouseEvent): void => {
Copy link
Member

Choose a reason for hiding this comment

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

React.MouseEvent<HTMLElement> is often used in favor of MouseEvent. In my experience, using React.MouseEvent<HTMLElement> usually results in less casting when accessing properties of the event.

Thoughts @jespino?

Copy link
Member Author

@jespino jespino Sep 3, 2019

Choose a reason for hiding this comment

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

In this case we are not talking about a React.MouseEvent, it is just a MouseEvent, because is connecting directly to the document using addListener, not through onClick. I think the proper types is MouseEvent and the casting is needed because the MouseEvent target field is not exactly a Element, is an EventTarget which is a subset of Element based on the event type.

@mickmister mickmister removed the 2: Dev Review Requires review by a core commiter label Sep 3, 2019
@mickmister
Copy link
Member

👍 looks like it just needs needs QA review

@jespino jespino added the 1: PM Review Requires review by a product manager label Sep 3, 2019
@jespino
Copy link
Member Author

jespino commented Sep 3, 2019

@mickmister yes, I didn't added anybody because there is no rush about it, I added the label and I'll wait until anybody is free to take a look :)

@asaadmahmood
Copy link
Contributor

@jespino Yes, we should disable the alpha channel for the colorpicker.

@wiersgallak
Copy link
Contributor

@jespino Please see Asaad's comment -this is good to go from my perspective

@jespino jespino removed the 1: PM Review Requires review by a product manager label Sep 5, 2019
@jespino
Copy link
Member Author

jespino commented Sep 5, 2019

@asaadmahmood @wiersgallak Great, I going to create a ticket for that, and I add that change in another PR (This PR is already reviewed and actually I want to use this as an example for a campaign, so, the less changes, the better).

@lindalumitchell
Copy link
Contributor

Does this one have a milestone / fix version? And will / should there be any QA test steps?

@jespino
Copy link
Member Author

jespino commented Sep 6, 2019

@lindalumitchell Not necessarily have a milestone/fix version, whenever it gets merged is going to determine the fix version. I added the QA steps to the ticket.

@lindalumitchell lindalumitchell added the Setup Cloud Test Server Setup a test server using Mattermost Cloud label Sep 12, 2019
@lindalumitchell
Copy link
Contributor

Tested each color picker in Display > Theme, and all worked as expected. No issues found. Removing QA Review label.

@lindalumitchell lindalumitchell removed the 3: QA Review Requires review by a QA tester label Sep 12, 2019
@hanzei hanzei added 4: Reviews Complete All reviewers have approved the pull request and removed Setup Cloud Test Server Setup a test server using Mattermost Cloud labels Sep 12, 2019
@hanzei hanzei added this to the v5.16.0 milestone Sep 12, 2019
@jespino jespino merged commit 66d56a8 into mattermost:master Sep 12, 2019
@jespino jespino deleted the migrate-color-input-to-typescript branch September 12, 2019 16:53
@amyblais amyblais added Changelog/Not Needed Does not require a changelog entry Docs/Not Needed Does not require documentation and removed Changelog/Not Needed Does not require a changelog entry Docs/Not Needed Does not require documentation labels Sep 12, 2019
@lindy65 lindy65 added Tests/Not Needed Does not require new release tests and removed 4: Reviews Complete All reviewers have approved the pull request labels Sep 23, 2019
skheria pushed a commit to uber-archive/mattermost-webapp that referenced this pull request Oct 3, 2019
* Migrate ColorInput component to typescript

* Being specific about the @types/react-color version

* Changing ColorInput to PureComponent.

Co-Authored-By: Michael Kochell <[email protected]>
skheria pushed a commit to uber-archive/mattermost-webapp that referenced this pull request Oct 3, 2019
* Migrate ColorInput component to typescript

* Being specific about the @types/react-color version

* Changing ColorInput to PureComponent.

Co-Authored-By: Michael Kochell <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Changelog/Not Needed Does not require a changelog entry Docs/Not Needed Does not require documentation Tests/Not Needed Does not require new release tests
Projects
None yet
9 participants