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

DT-1152: Migrate Components from @mui/styles #1751

Merged
merged 20 commits into from
Feb 12, 2025

Conversation

rushtong
Copy link
Contributor

@rushtong rushtong commented Feb 6, 2025

Addresses

https://broadworkbench.atlassian.net/browse/DT-1152

Summary

For each component, followed the following process:

  • Use DT-1110: Migrate away from @mui/styles Part 1 #1730 as a model for the copilot conversion
  • Apply prettier formatting
  • Ensure that we import styled from '@mui/material/styles'; instead of '@mui/system';. Copilot doesn't catch that.
  • Refactor the cases where props are destructured inside the function definition. Instead, ensure that props is the passed in function argument and destructure on a separate line in the function. This helps avoid a readonly warning.
  • Ensure that the props have readonly modifiers
  • Add // @ts-ignore where necessary. I found that we needed to do this for a variety of theme-related fields.

Other notes:

  • Failure.jsx is unused, but I'm not aware of the history for this so it is included as part of the migration.
  • InfoModal - Need some guidance on how to find where this is in use.
  • TextContent is visible on all tables

AddUserAccess

Screenshot 2025-02-11 at 7 17 50 AM

FullViewSnapshotButton

Screenshot 2025-02-11 at 7 21 38 AM

LoadingSpinner

Screen.Recording.2025-02-11.at.7.28.44.AM.mov

TabPanel, TabWrapper

Screen.Recording.2025-02-11.at.7.30.04.AM.mov

TerraTooltip

Screenshot 2025-02-11 at 7 31 30 AM

This comment was marked as resolved.

@rushtong rushtong marked this pull request as ready for review February 11, 2025 12:37
@rushtong rushtong requested a review from a team as a code owner February 11, 2025 12:37
@rushtong rushtong requested review from pshapiro4broad and s-rubenstein and removed request for a team February 11, 2025 12:37
Copy link
Contributor

@s-rubenstein s-rubenstein left a comment

Choose a reason for hiding this comment

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

LGTM pending the conversations about theme. I really would love to make that better, but maybe we do it the way that works right now and then file a follow up?

<Button
variant="contained"
color="primary"
disableElevation
disabled={!isEmail(addEmailInput) && !_.some(usersToAdd, (user) => isEmail(user))}
className={clsx(classes.button, classes.section)}
sx={{
backgroundColor: 'common.link',
Copy link
Contributor

Choose a reason for hiding this comment

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

This one is borderline. It only has three properties, but it also has the hover logic? What do you think about pulling this out?

Copy link
Contributor

Choose a reason for hiding this comment

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

That would totally be reasonable to pull it into a styled component.
The approach I took with my PR was just to go with whichever option (sx or styled) copilot picked. Especially for cases where a selection is borderline, I would like to defer to copilot's pick mostly to help expedite these PRs. We can always revisit a given pick if we're working with a component in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm happy with the current approach, and I think once more components are converted, we'll have a better handle on how to generify this to handle more cases. For instance, our CustomTheme + useTheme() approach did not work in TextContent.jsx due to the span as an argument to styled.

Copy link
Contributor

@snf2ye snf2ye left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you!
I think we can make a new ticket to look into a more sharable theme util and do that in the future.

@rushtong rushtong merged commit d9b7d9d into develop Feb 12, 2025
9 checks passed
@rushtong rushtong deleted the gr-DT-1152-mui-style-fixes branch February 12, 2025 18:00
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.

3 participants