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

chore(ui): migrate AppShellProvider and CodeBlock to TypeScript #547

Merged
merged 24 commits into from
Nov 5, 2024

Conversation

gjaskiewicz
Copy link
Contributor

@gjaskiewicz gjaskiewicz commented Oct 22, 2024

Summary

Migrate AppShellProvider and CodeBlock to TypeScript

Changes Made

  • migrate AppShellProvider to TypeScript
  • migrate CodeBlock to TypeScript
  • expose deprecated_js version of AppShellProvider in index.js - temporary fix until this component is removed
  • add replacement for CodeBlock in stories (to be replaced after migration of this component)

Related Issues

Testing Instructions

  1. npm i
  2. npm run storybook

Checklist

  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have made corresponding changes to the documentation (if applicable).
  • My changes generate no new warnings or errors.

@gjaskiewicz gjaskiewicz requested review from franzheidl and a team as code owners October 22, 2024 22:34
Copy link

changeset-bot bot commented Oct 22, 2024

🦋 Changeset detected

Latest commit: 21352ac

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cloudoperators/juno-ui-components Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Oct 22, 2024

PR Preview Action v1.4.8
Preview removed because the pull request was closed.
2024-11-05 23:44 UTC

@andypf andypf added the ui-components All tasks related to juno-ui-components library label Oct 23, 2024
Copy link
Contributor

@barsukov barsukov left a comment

Choose a reason for hiding this comment

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

Please fix the Andreas comments and also from my side change index.js to use a deprecated one.

When we migrate Combobox and also Select we will delete all deprecated related files and change the exports in the index.js

@barsukov barsukov closed this Oct 23, 2024
@barsukov
Copy link
Contributor

We close caause we need first to migrate the jsonviewer component and also codeblock

@gjaskiewicz gjaskiewicz changed the title chore(ui): migrate AppShellProvider to TypeScript chore(ui): migrate AppShellProvider and CodeBlock to TypeScript Oct 28, 2024
@gjaskiewicz gjaskiewicz reopened this Oct 28, 2024
Copy link
Contributor

@barsukov barsukov left a comment

Choose a reason for hiding this comment

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

few comments

@gjaskiewicz
Copy link
Contributor Author

(Requested Change)

The AppShellProvider has a few breaking changes 🐞:

See screenshots (JS code on left, TS on right)

Screenshot 2024-10-31 at 11 11 45 Screenshot 2024-10-31 at 11 12 07

  • Setting theme-dark and theme-light is broken.
  • theme Story control has changed from string to object.
  • theme type has changed from string to string|null. If the theme can only be theme-light and theme-dark, let's create a custom type containing these (instead of just string)?
  • theme default value should be theme-dark?

It seems like a potential breaking change in apps to me. If type discrepency is problem in storybook I could just change a control type there. Otherwise it works when theme-light or theme-dark is entered with quotes.

@guoda-puidokaite
Copy link
Contributor

guoda-puidokaite commented Oct 31, 2024

@gjaskiewicz Nice that it's just a Storybook issue. I think that the storybook documentation should stay unchanged though after the migration. At least to me, it's confusing why I can't just enter text and would have to use quotes, since type is only string|null. Please also consider the other suggestions regarding custom type and type default, I think it would be an appropriate time for the improvements. 🚀

@edda
Copy link
Contributor

edda commented Oct 31, 2024

@gjaskiewicz Nice that it's just a Storybook issue. I think that the storybook documentation should stay unchanged though after the migration. At least to me, it's confusing why I can't just enter text and would have to use quotes, since type is only string|null. Please also consider the other suggestions regarding custom type and type default, I think it would be an appropriate time for the improvements. 🚀

Agreed in this case. It is not a breaking change if we ensure that by default the prop is set to "theme-dark". It's also more correct and helps people understand what is happening under the hood.

@gjaskiewicz
Copy link
Contributor Author

gjaskiewicz commented Nov 1, 2024

@gjaskiewicz Nice that it's just a Storybook issue. I think that the storybook documentation should stay unchanged though after the migration. At least to me, it's confusing why I can't just enter text and would have to use quotes, since type is only string|null. Please also consider the other suggestions regarding custom type and type default, I think it would be an appropriate time for the improvements. 🚀

I removed null value as it resolves to "theme-dark" anyway.

@guoda-puidokaite
Copy link
Contributor

guoda-puidokaite commented Nov 4, 2024

(Improvement)

For AppShellProvider, the children type is an array in Storybook but React.ReactNode in the code.

I think we could improve this for AppShellProvider (left old .JS code, right new .TSX code) :
Screenshot 2024-11-04 at 15 13 27

In other components, it's any, as Storybook doesn't have an appropriate type with a comment.
Example of what we do in Message:
Screenshot 2024-11-04 at 15 29 43

Copy link
Contributor

@guoda-puidokaite guoda-puidokaite left a comment

Choose a reason for hiding this comment

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

Small comment on types in Storybook, but idk if necessary to change.
Otherwise Thank You for the type changes! Looks great. 🚀💪🤪

Copy link
Contributor

@barsukov barsukov left a comment

Choose a reason for hiding this comment

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

I left one comment that kinda nice to fix before we merge.

Copy link
Contributor

@barsukov barsukov left a comment

Choose a reason for hiding this comment

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

LGTM from my side good job 🥇

Copy link
Contributor

@guoda-puidokaite guoda-puidokaite left a comment

Choose a reason for hiding this comment

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

LGTM too! 🚀 Thank You!

@barsukov barsukov dismissed edda’s stale review November 5, 2024 15:11

Vacation time, the issues are addressed and fixed.

@gjaskiewicz gjaskiewicz merged commit a278544 into main Nov 5, 2024
15 checks passed
@gjaskiewicz gjaskiewicz deleted the gjaskiewicz/refactor-appshellprovider-ts branch November 5, 2024 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ui-components All tasks related to juno-ui-components library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants