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: Convert UI files to TS #3475

Merged
merged 7 commits into from
Dec 4, 2024
Merged

refactor: Convert UI files to TS #3475

merged 7 commits into from
Dec 4, 2024

Conversation

calvin-codecov
Copy link
Contributor

@calvin-codecov calvin-codecov commented Nov 8, 2024

Description

Closes codecov/engineering-team#2724

Notable Changes

Screenshots

Link to Sample Entry

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@calvin-codecov calvin-codecov marked this pull request as draft November 8, 2024 18:19
Comment on lines -139 to -142
{
[buttonVariant.outlined]:
'ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-indigo-600 shadow-sm',
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this seemed like a bug... with cs, if we pass an obj, it applies the key as the class string if the value is truthy. Which means this was always just adding the classname "undefined"

@codecov-staging
Copy link

codecov-staging bot commented Nov 8, 2024

Bundle Report

Changes will decrease total bundle size by 1.8kB (-0.01%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-staging-system-esm 5.72MB 813 bytes (-0.01%) ⬇️
gazebo-staging-system 5.66MB 985 bytes (-0.02%) ⬇️

Copy link

codecov bot commented Nov 8, 2024

Bundle Report

Changes will decrease total bundle size by 1.8kB (-0.01%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-production-system 5.66MB 985 bytes (-0.02%) ⬇️
gazebo-production-system-esm 5.72MB 813 bytes (-0.01%) ⬇️

@codecov-staging
Copy link

codecov-staging bot commented Nov 12, 2024

Codecov Report

Attention: Patch coverage is 95.65217% with 1 line in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/ui/ContextSwitcher/ContextSwitcher.tsx 92.30% 1 Missing ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3475      +/-   ##
==========================================
- Coverage   98.90%   98.90%   -0.01%     
==========================================
  Files         806      806              
  Lines       14476    14471       -5     
  Branches     4108     4117       +9     
==========================================
- Hits        14318    14312       -6     
- Misses        151      152       +1     
  Partials        7        7              
Files with missing lines Coverage Δ
...bs/Admin/ManageAdminCard/AdminTable/AdminTable.tsx 100.00% <ø> (ø)
...gPlan/BillingDetails/EmailAddress/EmailAddress.tsx 100.00% <ø> (ø)
...illBanners/TriggerSyncBanner/TriggerSyncBanner.tsx 100.00% <100.00%> (ø)
...illBanners/TriggerSyncBanner/TriggerSyncBanner.tsx 100.00% <100.00%> (ø)
src/shared/AppLink/AppLink.jsx 100.00% <ø> (ø)
.../LicenseExpirationModal/LicenseExpirationModal.tsx 100.00% <ø> (ø)
.../shared/ListRepo/ReposTableTeam/ReposTableTeam.tsx 100.00% <100.00%> (ø)
src/ui/Avatar/Avatar.jsx 100.00% <ø> (ø)
src/ui/Button/Button.tsx 100.00% <100.00%> (ø)
src/ui/LoadingLogo/LoadingLogo.tsx 100.00% <ø> (ø)
... and 3 more
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.59% <100.00%> (+<0.01%) ⬆️
Services 99.33% <ø> (ø)
Shared 99.33% <100.00%> (+<0.01%) ⬆️
UI 99.06% <95.00%> (-0.08%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f192e1f...78779d2. Read the comment docs.

@codecov-qa
Copy link

codecov-qa bot commented Nov 12, 2024

Codecov Report

Attention: Patch coverage is 95.65217% with 1 line in your changes missing coverage. Please review.

Project coverage is 98.90%. Comparing base (f192e1f) to head (78779d2).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/ui/ContextSwitcher/ContextSwitcher.tsx 92.30% 1 Missing ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3475      +/-   ##
==========================================
- Coverage   98.90%   98.90%   -0.01%     
==========================================
  Files         806      806              
  Lines       14476    14471       -5     
  Branches     4115     4110       -5     
==========================================
- Hits        14318    14312       -6     
- Misses        151      152       +1     
  Partials        7        7              
Files with missing lines Coverage Δ
...bs/Admin/ManageAdminCard/AdminTable/AdminTable.tsx 100.00% <ø> (ø)
...gPlan/BillingDetails/EmailAddress/EmailAddress.tsx 100.00% <ø> (ø)
...illBanners/TriggerSyncBanner/TriggerSyncBanner.tsx 100.00% <100.00%> (ø)
...illBanners/TriggerSyncBanner/TriggerSyncBanner.tsx 100.00% <100.00%> (ø)
src/shared/AppLink/AppLink.jsx 100.00% <ø> (ø)
.../LicenseExpirationModal/LicenseExpirationModal.tsx 100.00% <ø> (ø)
.../shared/ListRepo/ReposTableTeam/ReposTableTeam.tsx 100.00% <100.00%> (ø)
src/ui/Avatar/Avatar.jsx 100.00% <ø> (ø)
src/ui/Button/Button.tsx 100.00% <100.00%> (ø)
src/ui/LoadingLogo/LoadingLogo.tsx 100.00% <ø> (ø)
... and 3 more
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.59% <100.00%> (+<0.01%) ⬆️
Services 99.33% <ø> (ø)
Shared 99.33% <100.00%> (+<0.01%) ⬆️
UI 99.06% <95.00%> (-0.08%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f192e1f...78779d2. Read the comment docs.

Copy link

codecov-public-qa bot commented Nov 12, 2024

Codecov Report

Attention: Patch coverage is 95.65217% with 1 line in your changes missing coverage. Please review.

Project coverage is 98.90%. Comparing base (f192e1f) to head (78779d2).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/ui/ContextSwitcher/ContextSwitcher.tsx 92.30% 1 Missing ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3475      +/-   ##
==========================================
- Coverage   98.90%   98.90%   -0.01%     
==========================================
  Files         806      806              
  Lines       14476    14471       -5     
  Branches     4115     4110       -5     
==========================================
- Hits        14318    14312       -6     
- Misses        151      152       +1     
  Partials        7        7              
Files with missing lines Coverage Δ
...bs/Admin/ManageAdminCard/AdminTable/AdminTable.tsx 100.00% <ø> (ø)
...gPlan/BillingDetails/EmailAddress/EmailAddress.tsx 100.00% <ø> (ø)
...illBanners/TriggerSyncBanner/TriggerSyncBanner.tsx 100.00% <100.00%> (ø)
...illBanners/TriggerSyncBanner/TriggerSyncBanner.tsx 100.00% <100.00%> (ø)
src/shared/AppLink/AppLink.jsx 100.00% <ø> (ø)
.../LicenseExpirationModal/LicenseExpirationModal.tsx 100.00% <ø> (ø)
.../shared/ListRepo/ReposTableTeam/ReposTableTeam.tsx 100.00% <100.00%> (ø)
src/ui/Avatar/Avatar.jsx 100.00% <ø> (ø)
src/ui/Button/Button.tsx 100.00% <100.00%> (ø)
src/ui/LoadingLogo/LoadingLogo.tsx 100.00% <ø> (ø)
... and 3 more
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.59% <100.00%> (+<0.01%) ⬆️
Services 99.33% <ø> (ø)
Shared 99.33% <100.00%> (+<0.01%) ⬆️
UI 99.06% <95.00%> (-0.08%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f192e1f...78779d2. Read the comment docs.

Copy link

codecov bot commented Nov 12, 2024

Codecov Report

Attention: Patch coverage is 95.65217% with 1 line in your changes missing coverage. Please review.

Project coverage is 98.90%. Comparing base (f192e1f) to head (78779d2).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/ui/ContextSwitcher/ContextSwitcher.tsx 92.30% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3475      +/-   ##
==========================================
- Coverage   98.90%   98.90%   -0.01%     
==========================================
  Files         806      806              
  Lines       14476    14471       -5     
  Branches     4115     4117       +2     
==========================================
- Hits        14318    14312       -6     
- Misses        151      152       +1     
  Partials        7        7              
Files with missing lines Coverage Δ
...bs/Admin/ManageAdminCard/AdminTable/AdminTable.tsx 100.00% <ø> (ø)
...gPlan/BillingDetails/EmailAddress/EmailAddress.tsx 100.00% <ø> (ø)
...illBanners/TriggerSyncBanner/TriggerSyncBanner.tsx 100.00% <100.00%> (ø)
...illBanners/TriggerSyncBanner/TriggerSyncBanner.tsx 100.00% <100.00%> (ø)
src/shared/AppLink/AppLink.jsx 100.00% <ø> (ø)
.../LicenseExpirationModal/LicenseExpirationModal.tsx 100.00% <ø> (ø)
.../shared/ListRepo/ReposTableTeam/ReposTableTeam.tsx 100.00% <100.00%> (ø)
src/ui/Avatar/Avatar.jsx 100.00% <ø> (ø)
src/ui/Button/Button.tsx 100.00% <100.00%> (ø)
src/ui/LoadingLogo/LoadingLogo.tsx 100.00% <ø> (ø)
... and 3 more
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.59% <100.00%> (+<0.01%) ⬆️
Services 99.33% <ø> (ø)
Shared 99.33% <100.00%> (+<0.01%) ⬆️
UI 99.06% <95.00%> (-0.08%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f192e1f...78779d2. Read the comment docs.

@codecov-releaser
Copy link
Contributor

codecov-releaser commented Nov 12, 2024

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
8fff124 Tue, 12 Nov 2024 08:21:57 GMT Expired Expired
91a6090 Tue, 12 Nov 2024 18:16:07 GMT Expired Expired
dc2431f Tue, 12 Nov 2024 21:56:08 GMT Expired Expired
ca33951 Wed, 20 Nov 2024 07:58:57 GMT Expired Expired
17526ec Wed, 27 Nov 2024 16:42:33 GMT Expired Expired
78779d2 Wed, 04 Dec 2024 00:09:12 GMT Cloud Enterprise

@calvin-codecov calvin-codecov marked this pull request as ready for review November 12, 2024 18:00
Comment on lines +118 to +125
interface WithTo {
to: AppLinkProps
hook?: string
}
interface WithoutTo {
to?: never
hook: string
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this replaces the validation function for hook from the PropTypes

Comment on lines +133 to +135
type ExtendedButtonProps = ButtonProps &
(WithTo | WithoutTo) &
Partial<AppLinkProps>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Button essentially has to shepherd along props to possible AppLink render

@calvin-codecov calvin-codecov changed the title refactor: Convert ContextSwitcher to TS refactor: Convert UI files to TS Nov 12, 2024
@calvin-codecov calvin-codecov changed the base branch from main to staging November 19, 2024 18:23
@calvin-codecov calvin-codecov changed the base branch from staging to main November 19, 2024 18:25
Copy link
Contributor

@nicholas-codecov nicholas-codecov left a comment

Choose a reason for hiding this comment

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

Couple of things to peak at


return set[variant]
// using this type until AppLink is converted to TypeScript
Copy link
Contributor

Choose a reason for hiding this comment

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

You maybe able to get the TS types like so: type Test = PropTypes.InferProps<typeof User.propTypes>

pageName: string
}

export interface Props {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this interface be a bit more explicit as to what it's types are for if we're exporting it?

Copy link
Contributor

@nicholas-codecov nicholas-codecov left a comment

Choose a reason for hiding this comment

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

Approved, pending useCallback removals

@calvin-codecov calvin-codecov added this pull request to the merge queue Dec 4, 2024
Merged via the queue into main with commit c6a90fc Dec 4, 2024
49 of 62 checks passed
@calvin-codecov calvin-codecov deleted the cy/ui_to_ts_p1 branch December 4, 2024 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.

Migrate UI elements to TS (Part 1)
3 participants