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

feat: Add appless pre-PAT onboarding container #3629

Merged
merged 17 commits into from
Jan 22, 2025

Conversation

calvin-codecov
Copy link
Contributor

@calvin-codecov calvin-codecov commented Jan 3, 2025

Description

Closes codecov/engineering-team#2735 and codecov/engineering-team#2740

Add ?source=onboarding to the end of the org page url and reload. This will trigger the onboarding container to show up

Notable Changes

  • Adds the onboarding container at the top of the org page. Added a context provider here as the container can be open/closed from the user dropdown as well. A combination of localStorage variable with "?source=onboarding" in the URL used to only show to new onboarding users by default.
  • Adds a new version of the AppInstallModal to be opened by the onboarding container.
  • Removed RequestInstallBanner which rendered the old AppInstallModal (after discussion with Adalene)
  • Removed DefaultOrgSelector and all other subcomponents
  • Removed some "customerIntent" instances

Figma file: https://www.figma.com/design/SsoxtY2SB73l0wiLbJ8FhZ/GH-2092?node-id=2288-16704&t=Z9J60jqfEmR3QjIK-1

Screenshots

Screenshot 2025-01-08 at 1 03 14 PM Screenshot 2025-01-08 at 1 37 09 PM Screenshot 2025-01-08 at 1 37 12 PM

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-staging
Copy link

codecov-staging bot commented Jan 3, 2025

Codecov Report

Attention: Patch coverage is 96.29630% with 2 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...rc/pages/OwnerPage/OnboardingOrg/OnboardingOrg.tsx 77.77% 2 Missing ⚠️
@@                  Coverage Diff                  @@
##             cy/non_pat_appless    #3629   +/-   ##
=====================================================
  Coverage                      ?   98.78%           
=====================================================
  Files                         ?      824           
  Lines                         ?    14794           
  Branches                      ?     4205           
=====================================================
  Hits                          ?    14614           
  Misses                        ?      171           
  Partials                      ?        9           
Files with missing lines Coverage Δ
src/App.tsx 100.00% <ø> (ø)
src/layouts/BaseLayout/BaseLayout.tsx 100.00% <100.00%> (ø)
src/layouts/BaseLayout/hooks/useUserAccessGate.js 100.00% <100.00%> (ø)
...ts/Header/components/UserDropdown/UserDropdown.tsx 100.00% <100.00%> (ø)
...rBanners/GithubConfigBanner/GithubConfigBanner.jsx 100.00% <ø> (ø)
...s/OwnerPage/OnboardingContainerContext/context.tsx 100.00% <100.00%> (ø)
src/pages/OwnerPage/OnboardingOrg/constants.ts 100.00% <100.00%> (ø)
src/pages/OwnerPage/OwnerPage.jsx 100.00% <100.00%> (ø)
src/pages/TermsOfService/TermsOfService.tsx 98.00% <100.00%> (ø)
src/pages/TermsOfService/constants.ts 100.00% <100.00%> (ø)
... and 5 more
Components Coverage Δ
Assets 100.00% <ø> (?)
Layouts 99.69% <100.00%> (?)
Pages 98.38% <94.73%> (?)
Services 99.27% <ø> (?)
Shared 99.36% <100.00%> (?)
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 2e32017...b18e4a4. Read the comment docs.

@codecov-qa
Copy link

codecov-qa bot commented Jan 3, 2025

Codecov Report

Attention: Patch coverage is 96.29630% with 2 lines in your changes missing coverage. Please review.

Please upload report for BASE (cy/non_pat_appless@2e32017). Learn more about missing BASE report.
Report is 1 commits behind head on cy/non_pat_appless.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...rc/pages/OwnerPage/OnboardingOrg/OnboardingOrg.tsx 77.77% 2 Missing ⚠️
@@                  Coverage Diff                  @@
##             cy/non_pat_appless    #3629   +/-   ##
=====================================================
  Coverage                      ?   98.78%           
=====================================================
  Files                         ?      824           
  Lines                         ?    14794           
  Branches                      ?     4197           
=====================================================
  Hits                          ?    14614           
  Misses                        ?      171           
  Partials                      ?        9           
Files with missing lines Coverage Δ
src/App.tsx 100.00% <ø> (ø)
src/layouts/BaseLayout/BaseLayout.tsx 100.00% <100.00%> (ø)
src/layouts/BaseLayout/hooks/useUserAccessGate.js 100.00% <100.00%> (ø)
...ts/Header/components/UserDropdown/UserDropdown.tsx 100.00% <100.00%> (ø)
...rBanners/GithubConfigBanner/GithubConfigBanner.jsx 100.00% <ø> (ø)
...s/OwnerPage/OnboardingContainerContext/context.tsx 100.00% <100.00%> (ø)
src/pages/OwnerPage/OnboardingOrg/constants.ts 100.00% <100.00%> (ø)
src/pages/OwnerPage/OwnerPage.jsx 100.00% <100.00%> (ø)
src/pages/TermsOfService/TermsOfService.tsx 98.00% <100.00%> (ø)
src/pages/TermsOfService/constants.ts 100.00% <100.00%> (ø)
... and 5 more
Components Coverage Δ
Assets 100.00% <ø> (?)
Layouts 99.69% <100.00%> (?)
Pages 98.38% <94.73%> (?)
Services 99.27% <ø> (?)
Shared 99.36% <100.00%> (?)
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 2e32017...b18e4a4. Read the comment docs.

Copy link

codecov bot commented Jan 3, 2025

Codecov Report

Attention: Patch coverage is 96.29630% with 2 lines in your changes missing coverage. Please review.

Please upload report for BASE (cy/non_pat_appless@2e32017). Learn more about missing BASE report.
Report is 1 commits behind head on cy/non_pat_appless.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...rc/pages/OwnerPage/OnboardingOrg/OnboardingOrg.tsx 77.77% 2 Missing ⚠️
Additional details and impacted files
@@                  Coverage Diff                  @@
##             cy/non_pat_appless    #3629   +/-   ##
=====================================================
  Coverage                      ?   98.78%           
=====================================================
  Files                         ?      824           
  Lines                         ?    14794           
  Branches                      ?     4197           
=====================================================
  Hits                          ?    14614           
  Misses                        ?      171           
  Partials                      ?        9           
Files with missing lines Coverage Δ
src/App.tsx 100.00% <ø> (ø)
src/layouts/BaseLayout/BaseLayout.tsx 100.00% <100.00%> (ø)
src/layouts/BaseLayout/hooks/useUserAccessGate.js 100.00% <100.00%> (ø)
...ts/Header/components/UserDropdown/UserDropdown.tsx 100.00% <100.00%> (ø)
...rBanners/GithubConfigBanner/GithubConfigBanner.jsx 100.00% <ø> (ø)
...s/OwnerPage/OnboardingContainerContext/context.tsx 100.00% <100.00%> (ø)
src/pages/OwnerPage/OnboardingOrg/constants.ts 100.00% <100.00%> (ø)
src/pages/OwnerPage/OwnerPage.jsx 100.00% <100.00%> (ø)
src/pages/TermsOfService/TermsOfService.tsx 98.00% <100.00%> (ø)
src/pages/TermsOfService/constants.ts 100.00% <100.00%> (ø)
... and 5 more
Components Coverage Δ
Assets 100.00% <ø> (?)
Layouts 99.69% <100.00%> (?)
Pages 98.38% <94.73%> (?)
Services 99.27% <ø> (?)
Shared 99.36% <100.00%> (?)
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 2e32017...b18e4a4. Read the comment docs.

Copy link

codecov-public-qa bot commented Jan 3, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
3410 1 3409 0
View the top 1 failed tests by shortest run time
src/pages/OwnerPage/OnboardingOrg/OnboardingOrg.test.tsx > OnboardingOrg > handles dismiss button click correctly
Stack Traces | 0.0533s run time
AssertionError: expected 'true' to be 'false' // Object.is equality

Expected: "false"
Received: "true"

 ❯ .../OwnerPage/OnboardingOrg/OnboardingOrg.test.tsx:58:75

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

@codecov-staging
Copy link

codecov-staging bot commented Jan 8, 2025

Bundle Report

Changes will increase total bundle size by 6.27MB (100.0%) ⬆️⚠️, exceeding the configured threshold of 5%.

Bundle name Size Change
gazebo-staging-esm 6.27MB 6.27MB (100%) ⬆️⚠️

Copy link

codecov bot commented Jan 8, 2025

Bundle Report

Changes will increase total bundle size by 64.89kB (0.52%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-production-system 6.22MB 32.56kB (0.53%) ⬆️
gazebo-production-esm 6.27MB 32.33kB (0.52%) ⬆️

@codecov-releaser
Copy link
Contributor

codecov-releaser commented Jan 8, 2025

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
08f6fb6 Wed, 08 Jan 2025 00:56:43 GMT Expired Expired
3a50f0c Wed, 08 Jan 2025 18:12:54 GMT Expired Expired
9fca8dd Wed, 08 Jan 2025 19:28:08 GMT Expired Expired
9fca8dd Wed, 08 Jan 2025 19:28:55 GMT Expired Expired
7ee74f9 Wed, 08 Jan 2025 22:00:25 GMT Expired Expired
373cd4d Wed, 15 Jan 2025 00:34:56 GMT Expired Expired
7e81bba Fri, 17 Jan 2025 07:09:50 GMT Expired Expired
fdefb63 Tue, 21 Jan 2025 23:08:42 GMT Expired Expired
e5e1888 Wed, 22 Jan 2025 20:21:18 GMT Expired Expired
e5e1888 Wed, 22 Jan 2025 20:21:32 GMT Expired Expired
b18e4a4 Wed, 22 Jan 2025 21:05:52 GMT Cloud Enterprise

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not really following why we need React context and localstorage. Could you explain how they work together?

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 implemented with React context and localStorage to together solve for two situations.

  • Persistence over time: I'm using localStorage to keep track between sessions and refreshes. So if a user hid it previously, it will stay hidden
  • Toggling show vs hide in one session: using just the localStorage value to allow "showing" and "hiding" from the UserDropdown menu wasn't working because the react tree wasn't rerendering on just a localStorage value change. So I decided to use a setState variable. However, the onboarding container and the UserDropdown components are part of two different component trees so I added a context to share the state variable. The only shared parent they have is App.tsx and I decided against implementing a setState variable in App.tsx to be passed to each of them as I didn't want to clutter up App.

Copy link
Contributor

Choose a reason for hiding this comment

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

Interestinggggg okay. That's annoying but makes sense. In that case, one improvement I think we can do is handle all the local storage stuff inside of the context provider through a useEffect on the state change. That way the only place we interact with local storage is in the provider and the consumers don't have to worry about it.

I was also wondering why the need for the query param? Can't we use local storage/context for that as well?

Copy link
Contributor Author

@calvin-codecov calvin-codecov Jan 8, 2025

Choose a reason for hiding this comment

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

Hmm, you're right. I'll move the extra outside instance of localStorage into the context.

For the query param, I was piggybacking off of our current use of ?source=onboarding but not that I think about it more, we'll actually need to modify that construct too as we will no longer be showing DefaultOrgSelector anywhere in the flow. I will:

  • make a change for the onboarding container to rely on localStorage
  • make a change in useUserAccessGate to remove the showDefaultOrgSelector logic
  • make a change in the onboarding flow to set the source param to "onboarding" again as a replacement for ListRepo's use
    I considered using the same construct for both bullet 1 and 3, but the localStorage value is tied more closely to whether or not we render the onboarding container while the query param is tied to the idea we came from onboarding

Copy link
Contributor

Choose a reason for hiding this comment

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

Gotcha makes sense. Could be useful to have that query param for metrics in the future.

/>
</Route>
</Switch>
<OnboardingContainerProvider>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

only change here is wrapping in the Provider component

Comment on lines +119 to +164
const url = new URL(window.location.href)
url.searchParams.set('source', ONBOARDING_SOURCE)
window.location.href = url.toString()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

adding a query param that used to be applied after the DefaultOrgSelector screen

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 both of these images?

@@ -112,15 +97,11 @@ function BaseLayout({ children }: React.PropsWithChildren) {
<Suspense>
<ErrorBoundary errorComponent={<EmptyErrorComponent />}>
<SilentNetworkErrorWrapper>
{isFullExperience || isImpersonating ? (
{(isFullExperience || isImpersonating) && (
Copy link
Contributor

Choose a reason for hiding this comment

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

In general I think we prefer to use ternaries over && for conditional rendering. Ask Nick if curious there's some reason I can't remember lol.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you are correct. Lemme change this and the other instance

}

function OnboardingOrChildren({
children,
isImpersonating,
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe the intention here is to never show onboarding when impersonating. What's the status of this for the new flow? It might not be relevant anymore, but I'm not sure. You could ask AJ to confirm whether this is something we want.

Copy link
Contributor

Choose a reason for hiding this comment

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

so much red 🥔

@@ -74,6 +78,7 @@ function OwnerPage() {
</SilentNetworkErrorWrapper>
</Suspense>
<div>
{showOnboardingContainer && <OnboardingOrg />}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same thing re: ternaries here

Copy link
Contributor

@spalmurray-codecov spalmurray-codecov left a comment

Choose a reason for hiding this comment

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

Some nit picks, looking great! will approve

@calvin-codecov calvin-codecov changed the base branch from cy/non_pat_appless to main January 22, 2025 20:27
@calvin-codecov calvin-codecov changed the base branch from main to cy/non_pat_appless January 22, 2025 20:30
@calvin-codecov calvin-codecov merged commit 80e41a8 into cy/non_pat_appless Jan 22, 2025
59 checks passed
@calvin-codecov calvin-codecov deleted the cy/how_to_onboard branch January 22, 2025 21:45
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.

How to onboard your organization to Codecov container
3 participants