Skip to content

feat: Add recently visited repo at top of list#3734

Merged
calvin-codecov merged 8 commits intomainfrom
cy/org_page_recently_visited
Feb 20, 2025
Merged

feat: Add recently visited repo at top of list#3734
calvin-codecov merged 8 commits intomainfrom
cy/org_page_recently_visited

Conversation

@calvin-codecov
Copy link
Copy Markdown
Contributor

@calvin-codecov calvin-codecov commented Feb 13, 2025

Description

Address bullet 3 of codecov/engineering-team#2263
"Recently Visited auto-pin concept
This support iteration V0 of the previously discussed pinning concept AND is a familiar pattern (think: google docs etc where the most recently visited docs are surfaced atop) – concept works like our default org selector where the user last visited by users is the default repo"

Screenshots

Screenshot 2025-02-12 at 4 16 29 PM

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

codecov-staging bot commented Feb 13, 2025

Bundle Report

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

Detailed changes
Bundle name Size Change
gazebo-staging-system 6.13MB 1.2kB (0.02%) ⬆️
gazebo-staging-esm 6.2MB 1.44kB (0.02%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: gazebo-staging-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index.*.js 446 bytes 19.91kB 2.29%
assets/ReposTable.*.js 996 bytes 11.24kB 9.72% ⚠️

Files in assets/index.*.js:

  • ./src/shared/ListRepo/ReposTableTeam/ReposTableTeam.tsx → Total Size: 6.94kB

Files in assets/ReposTable.*.js:

  • ./src/shared/ListRepo/ReposTable/getReposColumnsHelper.tsx → Total Size: 2.56kB

  • ./src/shared/utils/getFilteredRecentlyVisitedRepo.ts → Total Size: 565 bytes

  • ./src/shared/ListRepo/RepoTitleLink/RepoTitleLink.jsx → Total Size: 3.64kB

  • ./src/shared/utils/transformStringToLocalStorageKey.ts → Total Size: 148 bytes

  • ./src/shared/ListRepo/ReposTable/ReposTable.tsx → Total Size: 6.81kB

view changes for bundle: gazebo-staging-system

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index-legacy.*.js 375 bytes 18.86kB 2.03%
assets/ReposTable-legacy.*.js 827 bytes 10.49kB 8.56% ⚠️

Files in assets/index-legacy.*.js:

  • ./src/shared/ListRepo/ReposTableTeam/ReposTableTeam.tsx → Total Size: 6.94kB

Files in assets/ReposTable-legacy.*.js:

  • ./src/shared/ListRepo/RepoTitleLink/RepoTitleLink.jsx → Total Size: 3.64kB

  • ./src/shared/utils/transformStringToLocalStorageKey.ts → Total Size: 148 bytes

  • ./src/shared/ListRepo/ReposTable/ReposTable.tsx → Total Size: 6.83kB

  • ./src/shared/ListRepo/ReposTable/getReposColumnsHelper.tsx → Total Size: 2.56kB

  • ./src/shared/utils/getFilteredRecentlyVisitedRepo.ts → Total Size: 565 bytes

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 13, 2025

Codecov Report

Attention: Patch coverage is 90.90909% with 4 lines in your changes missing coverage. Please review.

Project coverage is 98.67%. Comparing base (3f72266) to head (fd464e6).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...rc/shared/ListRepo/RepoTitleLink/RepoTitleLink.jsx 42.85% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3734      +/-   ##
==========================================
- Coverage   98.70%   98.67%   -0.03%     
==========================================
  Files         823      825       +2     
  Lines       14801    14841      +40     
  Branches     4220     4241      +21     
==========================================
+ Hits        14609    14645      +36     
- Misses        186      189       +3     
- Partials        6        7       +1     
Files with missing lines Coverage Δ
src/shared/ListRepo/ReposTable/ReposTable.tsx 98.71% <100.00%> (+0.14%) ⬆️
...ared/ListRepo/ReposTable/getReposColumnsHelper.tsx 100.00% <100.00%> (ø)
.../shared/ListRepo/ReposTableTeam/ReposTableTeam.tsx 100.00% <100.00%> (ø)
src/shared/utils/getFilteredRecentlyVisitedRepo.ts 100.00% <100.00%> (ø)
...c/shared/utils/transformStringToLocalStorageKey.ts 100.00% <100.00%> (ø)
...rc/shared/ListRepo/RepoTitleLink/RepoTitleLink.jsx 85.18% <42.85%> (-14.82%) ⬇️
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.69% <ø> (ø)
Pages 98.26% <ø> (ø)
Services 99.24% <ø> (ø)
Shared 99.11% <90.90%> (-0.26%) ⬇️
UI 99.07% <ø> (ø)

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 3f72266...fd464e6. Read the comment docs.

@codecov-staging
Copy link
Copy Markdown

codecov-staging bot commented Feb 13, 2025

Codecov Report

Attention: Patch coverage is 90.90909% with 4 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...rc/shared/ListRepo/RepoTitleLink/RepoTitleLink.jsx 42.85% 3 Missing and 1 partial ⚠️
@@            Coverage Diff             @@
##             main    #3734      +/-   ##
==========================================
- Coverage   98.70%   98.67%   -0.03%     
==========================================
  Files         823      825       +2     
  Lines       14770    14810      +40     
  Branches     4206     4227      +21     
==========================================
+ Hits        14578    14614      +36     
- Misses        186      189       +3     
- Partials        6        7       +1     
Files with missing lines Coverage Δ
src/shared/ListRepo/ReposTable/ReposTable.tsx 98.71% <100.00%> (+0.14%) ⬆️
...ared/ListRepo/ReposTable/getReposColumnsHelper.tsx 100.00% <100.00%> (ø)
.../shared/ListRepo/ReposTableTeam/ReposTableTeam.tsx 100.00% <100.00%> (ø)
src/shared/utils/getFilteredRecentlyVisitedRepo.ts 100.00% <100.00%> (ø)
...c/shared/utils/transformStringToLocalStorageKey.ts 100.00% <100.00%> (ø)
...rc/shared/ListRepo/RepoTitleLink/RepoTitleLink.jsx 85.18% <42.85%> (-14.82%) ⬇️
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.69% <ø> (ø)
Pages 98.26% <ø> (ø)
Services 99.24% <ø> (ø)
Shared 99.09% <90.90%> (-0.27%) ⬇️
UI 99.07% <ø> (ø)

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 f812bcb...648e07c. Read the comment docs.

@codecov-qa
Copy link
Copy Markdown

codecov-qa bot commented Feb 13, 2025

Codecov Report

Attention: Patch coverage is 90.90909% with 4 lines in your changes missing coverage. Please review.

Project coverage is 98.67%. Comparing base (3f72266) to head (fd464e6).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...rc/shared/ListRepo/RepoTitleLink/RepoTitleLink.jsx 42.85% 3 Missing and 1 partial ⚠️
@@            Coverage Diff             @@
##             main    #3734      +/-   ##
==========================================
- Coverage   98.70%   98.67%   -0.03%     
==========================================
  Files         823      825       +2     
  Lines       14801    14841      +40     
  Branches     4228     4241      +13     
==========================================
+ Hits        14609    14645      +36     
- Misses        186      189       +3     
- Partials        6        7       +1     
Files with missing lines Coverage Δ
src/shared/ListRepo/ReposTable/ReposTable.tsx 98.71% <100.00%> (+0.14%) ⬆️
...ared/ListRepo/ReposTable/getReposColumnsHelper.tsx 100.00% <100.00%> (ø)
.../shared/ListRepo/ReposTableTeam/ReposTableTeam.tsx 100.00% <100.00%> (ø)
src/shared/utils/getFilteredRecentlyVisitedRepo.ts 100.00% <100.00%> (ø)
...c/shared/utils/transformStringToLocalStorageKey.ts 100.00% <100.00%> (ø)
...rc/shared/ListRepo/RepoTitleLink/RepoTitleLink.jsx 85.18% <42.85%> (-14.82%) ⬇️
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.69% <ø> (ø)
Pages 98.26% <ø> (ø)
Services 99.24% <ø> (ø)
Shared 99.11% <90.90%> (-0.26%) ⬇️
UI 99.07% <ø> (ø)

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 3f72266...fd464e6. Read the comment docs.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 13, 2025

Bundle Report

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

Detailed changes
Bundle name Size Change
gazebo-production-system 6.14MB 1.2kB (0.02%) ⬆️
gazebo-production-esm 6.2MB 1.44kB (0.02%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: gazebo-production-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index.*.js 446 bytes 19.91kB 2.29%
assets/ReposTable.*.js 996 bytes 11.24kB 9.72% ⚠️

Files in assets/index.*.js:

  • ./src/shared/ListRepo/ReposTableTeam/ReposTableTeam.tsx → Total Size: 6.94kB

Files in assets/ReposTable.*.js:

  • ./src/shared/utils/getFilteredRecentlyVisitedRepo.ts → Total Size: 565 bytes

  • ./src/shared/ListRepo/RepoTitleLink/RepoTitleLink.jsx → Total Size: 3.64kB

  • ./src/shared/ListRepo/ReposTable/getReposColumnsHelper.tsx → Total Size: 2.56kB

  • ./src/shared/ListRepo/ReposTable/ReposTable.tsx → Total Size: 6.81kB

  • ./src/shared/utils/transformStringToLocalStorageKey.ts → Total Size: 148 bytes

view changes for bundle: gazebo-production-system

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index-legacy.*.js 375 bytes 18.86kB 2.03%
assets/ReposTable-legacy.*.js 827 bytes 10.49kB 8.56% ⚠️

Files in assets/index-legacy.*.js:

  • ./src/shared/ListRepo/ReposTableTeam/ReposTableTeam.tsx → Total Size: 6.94kB

Files in assets/ReposTable-legacy.*.js:

  • ./src/shared/ListRepo/ReposTable/ReposTable.tsx → Total Size: 6.83kB

  • ./src/shared/utils/getFilteredRecentlyVisitedRepo.ts → Total Size: 565 bytes

  • ./src/shared/utils/transformStringToLocalStorageKey.ts → Total Size: 148 bytes

  • ./src/shared/ListRepo/ReposTable/getReposColumnsHelper.tsx → Total Size: 2.56kB

  • ./src/shared/ListRepo/RepoTitleLink/RepoTitleLink.jsx → Total Size: 3.64kB

@codecov-public-qa
Copy link
Copy Markdown

codecov-public-qa bot commented Feb 13, 2025

Codecov Report

Attention: Patch coverage is 90.90909% with 4 lines in your changes missing coverage. Please review.

Project coverage is 98.67%. Comparing base (3f72266) to head (fd464e6).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...rc/shared/ListRepo/RepoTitleLink/RepoTitleLink.jsx 42.85% 3 Missing and 1 partial ⚠️
@@            Coverage Diff             @@
##             main    #3734      +/-   ##
==========================================
- Coverage   98.70%   98.67%   -0.03%     
==========================================
  Files         823      825       +2     
  Lines       14801    14841      +40     
  Branches     4220     4249      +29     
==========================================
+ Hits        14609    14645      +36     
- Misses        186      189       +3     
- Partials        6        7       +1     
Files with missing lines Coverage Δ
src/shared/ListRepo/ReposTable/ReposTable.tsx 98.71% <100.00%> (+0.14%) ⬆️
...ared/ListRepo/ReposTable/getReposColumnsHelper.tsx 100.00% <100.00%> (ø)
.../shared/ListRepo/ReposTableTeam/ReposTableTeam.tsx 100.00% <100.00%> (ø)
src/shared/utils/getFilteredRecentlyVisitedRepo.ts 100.00% <100.00%> (ø)
...c/shared/utils/transformStringToLocalStorageKey.ts 100.00% <100.00%> (ø)
...rc/shared/ListRepo/RepoTitleLink/RepoTitleLink.jsx 85.18% <42.85%> (-14.82%) ⬇️
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.69% <ø> (ø)
Pages 98.26% <ø> (ø)
Services 99.24% <ø> (ø)
Shared 99.11% <90.90%> (-0.26%) ⬇️
UI 99.07% <ø> (ø)

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 3f72266...fd464e6. Read the comment docs.

@codecov-releaser
Copy link
Copy Markdown
Collaborator

codecov-releaser commented Feb 13, 2025

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
07af2b8 Thu, 13 Feb 2025 00:25:45 GMT Expired Expired
163c15d Thu, 13 Feb 2025 00:31:38 GMT Expired Expired
29e1a57 Thu, 13 Feb 2025 23:02:14 GMT Expired Expired
adda605 Fri, 14 Feb 2025 00:26:35 GMT Expired Expired
9b6e9f1 Fri, 14 Feb 2025 05:51:02 GMT Expired Expired
34fce66 Fri, 14 Feb 2025 06:34:05 GMT Expired Expired
4f1164a Tue, 18 Feb 2025 21:27:54 GMT Expired Expired
648e07c Thu, 20 Feb 2025 00:28:51 GMT Expired Expired
fd464e6 Thu, 20 Feb 2025 21:26:28 GMT Cloud Enterprise

@calvin-codecov calvin-codecov force-pushed the cy/org_page_recently_visited branch from 07af2b8 to 163c15d Compare February 13, 2025 00:25
import PropTypes from 'prop-types'

import AppLink from 'shared/AppLink'
import { transformStringToLocalStorageKey } from 'shared/utils/transformStringToLocalStorageKey'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

any taste for converting this file to TS? Hopefully not too bad since its only 100 lines (famous last words)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I actually started the conversion. All of the repo fields started complaining so I tabled it for now haha

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lol fair enough, some of those can be pretty annoying

import { ExtractInfiniteQueryDataType } from './queries'
import { transformStringToLocalStorageKey } from './transformStringToLocalStorageKey'

export const DEMO_REPO = {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is this meant to be here? And removed from

provider: 'github',
owner: 'codecov',
repo: 'gazebo',
displayName: 'Codecov demo',
}
?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

hmm... it is not. I don't know how this got here, good catch

return null
}

const repos = (recentlyVisitedReposData?.pages[0]?.repos ?? [])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

rather than passing in the full Data object, can we get away with just passing the repos? Might help clean up the TS error as well in ReposTable

pageName={pageName}
disabledLink={!isCurrentUserPartOfOrg && !repo?.active}
isRecentlyVisited={
!!recentlyVisitedRepoName && recentlyVisitedRepoName === repo?.name
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we need the !!recentlyVisitedRepoName check here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We do I believe. recentlyVisitedRepoName is very possible to be undefined since it is from localStorage getItem and repo's name could also be undefined

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

gotcha yeah, I see what you mean

pageName={pageName}
disabledLink={!isCurrentUserPartOfOrg && !repo?.active}
isRecentlyVisited={
!!recentlyVisitedRepoName && recentlyVisitedRepoName === repo?.name
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

similar question here with !!recentlyVisitedRepoName

owner,
}),
getCoreRowModel: getCoreRowModel(),
// @ts-expect-error taking in both ReposQueryData and ReposTeamQueryData
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we still need this even with the pick stuff above? Lowkey idk how I feel about that either 😂

Copy link
Copy Markdown
Contributor

@ajay-sentry ajay-sentry left a comment

Choose a reason for hiding this comment

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

lgtm, might be worth playing around cleaning up those types but I wouldn't spend too long on that

@calvin-codecov calvin-codecov force-pushed the cy/org_page_recently_visited branch from 4f1164a to 13d275c Compare February 19, 2025 20:18
@calvin-codecov calvin-codecov added this pull request to the merge queue Feb 20, 2025
Merged via the queue into main with commit 9eac42c Feb 20, 2025
45 of 54 checks passed
@calvin-codecov calvin-codecov deleted the cy/org_page_recently_visited branch February 20, 2025 21:27
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