Skip to content

Convert shared P5 to TypeScript #3563

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

Merged
merged 7 commits into from
Dec 13, 2024
Merged

Convert shared P5 to TypeScript #3563

merged 7 commits into from
Dec 13, 2024

Conversation

calvin-codecov
Copy link
Contributor

@calvin-codecov calvin-codecov commented Dec 10, 2024

Description

Closes codecov/engineering-team#2749

Notable Changes

Main change was for AppLink component. The props it takes in and the split of the types of components it renders wasn't ideal for translation as we render a <Component>...</Component> where Component could be an a or NavLink or Link. It was a clever way to reuse code but I think it is worth consideration that we split these out for clarity, especially for parameter type specificity. Currently, all 3 instances receive the same props even though not all of them are needed for each type of component rendered.

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.

@codecov-notifications
Copy link

codecov-notifications bot commented Dec 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3563   +/-   ##
=======================================
  Coverage   98.91%   98.91%           
=======================================
  Files         806      806           
  Lines       14498    14499    +1     
  Branches     4119     4121    +2     
=======================================
+ Hits        14341    14342    +1     
  Misses        150      150           
  Partials        7        7           
Files with missing lines Coverage Δ
.../Header/components/Navigator/MyContextSwitcher.tsx 100.00% <ø> (ø)
...e/BundlesTab/BundleOnboarding/BundleOnboarding.tsx 95.23% <ø> (ø)
...onManager/components/FeatureGroup/FeatureGroup.tsx 100.00% <ø> (ø)
...e/CoverageOnboarding/ExampleBlurb/ExampleBlurb.tsx 100.00% <ø> (ø)
...ages/RepoPage/CoverageTab/CoverageTabNavigator.tsx 100.00% <ø> (ø)
src/services/navigation/useNavLinks/useNavLinks.ts 99.00% <100.00%> (ø)
src/shared/AppLink/AppLink.tsx 100.00% <100.00%> (ø)
src/shared/GlobalBanners/GlobalBanners.tsx 100.00% <ø> (ø)
...issingDesignatedAdmins/MissingDesignatedAdmins.tsx 100.00% <100.00%> (ø)
...dLicenseExpiration/SelfHostedLicenseExpiration.tsx 100.00% <100.00%> (ø)
... and 4 more
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.60% <ø> (ø)
Services 99.36% <100.00%> (ø)
Shared 99.32% <100.00%> (+<0.01%) ⬆️
UI 99.14% <ø> (ø)

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 d09206c...097b9e7. Read the comment docs.

Copy link

codecov bot commented Dec 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.91%. Comparing base (d09206c) to head (097b9e7).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3563   +/-   ##
=======================================
  Coverage   98.91%   98.91%           
=======================================
  Files         806      806           
  Lines       14498    14499    +1     
  Branches     4119     4121    +2     
=======================================
+ Hits        14341    14342    +1     
  Misses        150      150           
  Partials        7        7           
Files with missing lines Coverage Δ
.../Header/components/Navigator/MyContextSwitcher.tsx 100.00% <ø> (ø)
...e/BundlesTab/BundleOnboarding/BundleOnboarding.tsx 95.23% <ø> (ø)
...onManager/components/FeatureGroup/FeatureGroup.tsx 100.00% <ø> (ø)
...e/CoverageOnboarding/ExampleBlurb/ExampleBlurb.tsx 100.00% <ø> (ø)
...ages/RepoPage/CoverageTab/CoverageTabNavigator.tsx 100.00% <ø> (ø)
src/services/navigation/useNavLinks/useNavLinks.ts 99.00% <100.00%> (ø)
src/shared/AppLink/AppLink.tsx 100.00% <100.00%> (ø)
src/shared/GlobalBanners/GlobalBanners.tsx 100.00% <ø> (ø)
...issingDesignatedAdmins/MissingDesignatedAdmins.tsx 100.00% <100.00%> (ø)
...dLicenseExpiration/SelfHostedLicenseExpiration.tsx 100.00% <100.00%> (ø)
... and 4 more
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.60% <ø> (ø)
Services 99.36% <100.00%> (ø)
Shared 99.32% <100.00%> (+<0.01%) ⬆️
UI 99.14% <ø> (ø)

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 d09206c...097b9e7. Read the comment docs.

@codecov-qa
Copy link

codecov-qa bot commented Dec 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.91%. Comparing base (d09206c) to head (097b9e7).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3563   +/-   ##
=======================================
  Coverage   98.91%   98.91%           
=======================================
  Files         806      806           
  Lines       14498    14499    +1     
  Branches     4112     4114    +2     
=======================================
+ Hits        14341    14342    +1     
  Misses        150      150           
  Partials        7        7           
Files with missing lines Coverage Δ
.../Header/components/Navigator/MyContextSwitcher.tsx 100.00% <ø> (ø)
...e/BundlesTab/BundleOnboarding/BundleOnboarding.tsx 95.23% <ø> (ø)
...onManager/components/FeatureGroup/FeatureGroup.tsx 100.00% <ø> (ø)
...e/CoverageOnboarding/ExampleBlurb/ExampleBlurb.tsx 100.00% <ø> (ø)
...ages/RepoPage/CoverageTab/CoverageTabNavigator.tsx 100.00% <ø> (ø)
src/services/navigation/useNavLinks/useNavLinks.ts 99.00% <100.00%> (ø)
src/shared/AppLink/AppLink.tsx 100.00% <100.00%> (ø)
src/shared/GlobalBanners/GlobalBanners.tsx 100.00% <ø> (ø)
...issingDesignatedAdmins/MissingDesignatedAdmins.tsx 100.00% <100.00%> (ø)
...dLicenseExpiration/SelfHostedLicenseExpiration.tsx 100.00% <100.00%> (ø)
... and 4 more
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.60% <ø> (ø)
Services 99.36% <100.00%> (ø)
Shared 99.32% <100.00%> (+<0.01%) ⬆️
UI 99.14% <ø> (ø)

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 d09206c...097b9e7. Read the comment docs.

Copy link

codecov bot commented Dec 11, 2024

Bundle Report

Changes will decrease total bundle size by 595 bytes (-0.0%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-production-system 5.67MB 301 bytes (-0.01%) ⬇️
gazebo-production-system-esm 5.72MB 294 bytes (-0.01%) ⬇️

@codecov-staging
Copy link

codecov-staging bot commented Dec 11, 2024

Bundle Report

Changes will decrease total bundle size by 595 bytes (-0.0%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-staging-system-esm 5.72MB 294 bytes (-0.01%) ⬇️
gazebo-staging-system 5.67MB 301 bytes (-0.01%) ⬇️

Copy link

codecov-public-qa bot commented Dec 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.90%. Comparing base (0899f21) to head (5e1b215).

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3563   +/-   ##
=======================================
  Coverage   98.90%   98.90%           
=======================================
  Files         806      806           
  Lines       14484    14485    +1     
  Branches     4115     4117    +2     
=======================================
+ Hits        14326    14327    +1     
  Misses        151      151           
  Partials        7        7           
Files with missing lines Coverage Δ
.../Header/components/Navigator/MyContextSwitcher.tsx 100.00% <ø> (ø)
...e/BundlesTab/BundleOnboarding/BundleOnboarding.tsx 95.23% <ø> (ø)
...onManager/components/FeatureGroup/FeatureGroup.tsx 100.00% <ø> (ø)
...e/CoverageOnboarding/ExampleBlurb/ExampleBlurb.tsx 100.00% <ø> (ø)
...ages/RepoPage/CoverageTab/CoverageTabNavigator.tsx 100.00% <ø> (ø)
src/services/navigation/useNavLinks/useNavLinks.ts 99.00% <100.00%> (ø)
src/shared/AppLink/AppLink.tsx 100.00% <100.00%> (ø)
src/shared/GlobalBanners/GlobalBanners.tsx 100.00% <ø> (ø)
...issingDesignatedAdmins/MissingDesignatedAdmins.tsx 100.00% <100.00%> (ø)
...dLicenseExpiration/SelfHostedLicenseExpiration.tsx 100.00% <100.00%> (ø)
... and 4 more
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.59% <ø> (ø)
Services 99.33% <100.00%> (ø)
Shared 99.33% <100.00%> (+<0.01%) ⬆️
UI 99.14% <ø> (ø)

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 0899f21...5e1b215. Read the comment docs.

@codecov-releaser
Copy link
Contributor

codecov-releaser commented Dec 11, 2024

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
79a6fbd Wed, 11 Dec 2024 05:36:26 GMT Expired Expired
79a6fbd Wed, 11 Dec 2024 05:36:53 GMT Expired Expired
6c6b0d8 Wed, 11 Dec 2024 17:43:03 GMT Expired Expired
5e1b215 Wed, 11 Dec 2024 19:04:36 GMT Expired Expired
34a1906 Thu, 12 Dec 2024 19:34:52 GMT Expired Expired
097b9e7 Fri, 13 Dec 2024 16:37:53 GMT Cloud Enterprise

@calvin-codecov calvin-codecov changed the title Cy/ts shared p5 Convert shared P5 to TypeScript Dec 11, 2024
import A from 'ui/A'
import Button from 'ui/Button'
import { Card } from 'ui/Card'

interface FeatureGroupProps extends React.PropsWithChildren {
title: string
getStartedLink?: string // navLink key
getStartedLink?:
| keyof ReturnType<typeof useNavLinks>
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need that first |?

Copy link
Contributor Author

@calvin-codecov calvin-codecov Dec 12, 2024

Choose a reason for hiding this comment

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

Nope, it's optional - it's just for ease of readability

@@ -32,7 +32,7 @@ afterAll(() => {

const wrapper =
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: We usually type these as React.FC<React.PropsWIthChildren>

@@ -36,12 +36,12 @@ export function useFlags(fallback) {
'Warning! Self hosted build is missing a default feature flag value.'
)
}
return fallback
return fallback ?? {}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: could set this to the initial param as well since fallback is optional to begin with

@calvin-codecov calvin-codecov added this pull request to the merge queue Dec 13, 2024
Merged via the queue into main with commit ce584a6 Dec 13, 2024
62 checks passed
@calvin-codecov calvin-codecov deleted the cy/ts_shared_p5 branch December 13, 2024 16:39
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 shared from JS to TS (Part 5)
3 participants