Skip to content

Commit

Permalink
Update logic
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitvinnakota-codecov committed Apr 29, 2024
1 parent 1a769f1 commit 8dabac5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
8 changes: 5 additions & 3 deletions src/pages/RepoPage/RepoPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ function Routes({
bundleAnalysisPrAndCommitPages: false,
})

const productEnabled = coverageEnabled || bundleAnalysisEnabled
const productEnabled =
(coverageEnabled || bundleAnalysisEnabled) && isCurrentUserActivated
console.log(productEnabled)
const showUnauthorizedMessageCoverage =
coverageEnabled && isRepoPrivate && !isCurrentUserActivated
const showUnauthorizedMessageBundles =
Expand Down Expand Up @@ -124,12 +126,12 @@ function Routes({
<BundlesTab />
</SentryRoute>
) : null}
{coverageEnabled ? (
{coverageEnabled && isCurrentUserActivated ? (
<SentryRoute path={`${path}/flags`} exact>
<FlagsTab />
</SentryRoute>
) : null}
{coverageEnabled && componentTab ? (
{coverageEnabled && componentTab && isCurrentUserActivated ? (
<SentryRoute path={`${path}/components`} exact>
<ComponentsTab />
</SentryRoute>
Expand Down
18 changes: 15 additions & 3 deletions src/pages/RepoPage/RepoPageTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,29 @@ export const useRepoTabs = ({ refetchEnabled }: UseRepoTabsArgs) => {
}

const hideFlagsTab = !!repoOverview?.private && tierData === TierNames.TEAM
if (repoOverview?.coverageEnabled && !hideFlagsTab) {
if (
repoOverview?.coverageEnabled &&
!hideFlagsTab &&
repoData?.isCurrentUserActivated
) {
tabs.push({ pageName: 'flagsTab' })
}

const hideComponentsTab =
!!repoOverview?.private && tierData === TierNames.TEAM
if (repoOverview?.coverageEnabled && componentTab && !hideComponentsTab) {
if (
repoOverview?.coverageEnabled &&
componentTab &&
!hideComponentsTab &&
repoData?.isCurrentUserActivated
) {
tabs.push({ pageName: 'componentsTab' })
}

if (repoOverview?.bundleAnalysisEnabled || repoOverview?.coverageEnabled) {
if (
repoOverview?.bundleAnalysisEnabled ||
(repoOverview?.coverageEnabled && repoData?.isCurrentUserActivated)
) {
tabs.push({ pageName: 'commits' }, { pageName: 'pulls' })
}

Expand Down
2 changes: 1 addition & 1 deletion src/pages/RepoPage/shared/UnauthorizedRepoDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Button from 'ui/Button'

export const UnauthorizedRepoDisplay = () => {
return (
<div className="flex h-full flex-col items-center justify-center text-center">
<div className="flex h-full flex-col items-center justify-center pb-16 text-center">
<img src={img403} alt="Forbidden" className="w-1/6" />
<h1 className="mt-6 text-2xl">Unauthorized</h1>
<p className="mt-6">
Expand Down

0 comments on commit 8dabac5

Please sign in to comment.