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

Refactor Toolbar component to TypeScript #47087

Merged

Conversation

mike-day
Copy link
Contributor

@mike-day mike-day commented Jan 11, 2023

Part of #35744

What?

Convert the Toolbar component to TypeScript.

Why?

As a contribution to the ongoing effort to convert @WordPress/components to TypeScript.

How?

By adding types to Toolbar, @ts-nocheck where needed for related Toolbar components, and refactoring of stories.

Testing Instructions

  1. Create or otherwise open a post
  2. Add a block that would have some toolbar controls (e.g. Image)
  3. Expected: The toolbar should fundamentally work the same as before:

Screen Shot 2023-01-24 at 6 38 05 PM

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Jan 11, 2023
@github-actions
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @mike-day! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@skorasaurus skorasaurus added the [Package] Components /packages/components label Jan 12, 2023
@ciampo ciampo added the [Type] Code Quality Issues or PRs that relate to code quality label Jan 16, 2023
@ciampo
Copy link
Contributor

ciampo commented Jan 16, 2023

Hey @mike-day , thank you so much for starting the work on this!

I will try to come back with a proper review later, but for now I just wanted to say that there will be some conflicts with PR #47117 — I would recommend you wait until that's merged (hopefully within 1-2 days) and then rebase your PR on top of latest trunk. There will be some conflicts on the Storybook files but they should be minor :)

@mike-day
Copy link
Contributor Author

Hey @mike-day , thank you so much for starting the work on this!

I will try to come back with a proper review later, but for now I just wanted to say that there will be some conflicts with PR #47117 — I would recommend you wait until that's merged (hopefully within 1-2 days) and then rebase your PR on top of latest trunk. There will be some conflicts on the Storybook files but they should be minor :)

Thanks for following up about this so quickly, @ciampo! I see that #47117 is merged, and I should be able to rebase and resolve conflicts within the next few days.

I will mark this as ready for review and ping you again soon!

@mike-day mike-day marked this pull request as ready for review January 27, 2023 18:04
@mike-day
Copy link
Contributor Author

Regardless of a few failing mobile tests, I believe this PR is at a decent starting point if you want to take a look, @ciampo. Thanks!

Copy link
Member

@mirka mirka left a comment

Choose a reason for hiding this comment

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

Thanks for contributing! 🙌 Good call to keep the scope of this PR to a manageable size.

I just had a few comments, but on the whole this looks clean and pretty close to merging!

packages/components/src/toolbar/stories/index.tsx Outdated Show resolved Hide resolved
packages/components/src/toolbar/stories/index.tsx Outdated Show resolved Hide resolved
packages/components/src/toolbar/stories/index.tsx Outdated Show resolved Hide resolved
packages/components/src/toolbar/toolbar/types.ts Outdated Show resolved Hide resolved
@@ -60,7 +60,6 @@
"src/notice",
"src/palette-edit",
"src/panel",
"src/toolbar",
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitty, but should we add the toolbar subfolders that are not typed yet here, instead of @ts-ignore at the top of the files?

Copy link
Member

Choose a reason for hiding this comment

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

If they're not going to be typed in the next week or so, I think I prefer the ts-nochecks so we can clear out this exclude list and ship the package types 🙈

Copy link
Contributor

@ciampo ciampo Feb 1, 2023

Choose a reason for hiding this comment

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

Ah, I see! But wouldn't it be weird to ship partial types for Toolbar?

Copy link
Contributor Author

@mike-day mike-day Feb 3, 2023

Choose a reason for hiding this comment

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

Fwiw, I am starting work on toolbar-button today with a general plan to run through the remaining toolbar subfolders this month 💻

Copy link
Member

@mirka mirka left a comment

Choose a reason for hiding this comment

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

Looks great, thank you! We can merge once the changelog is tweaked 🚀

packages/components/CHANGELOG.md Outdated Show resolved Hide resolved
@mirka mirka enabled auto-merge (squash) February 6, 2023 19:39
@mirka mirka merged commit e948f63 into WordPress:trunk Feb 6, 2023
@github-actions github-actions bot added this to the Gutenberg 15.2 milestone Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Package] Components /packages/components [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants