Skip to content

Commit

Permalink
fix: Use repo secret screenshot when repo token selected
Browse files Browse the repository at this point in the history
  • Loading branch information
calvin-codecov committed Dec 13, 2024
1 parent 702cf70 commit 61604f7
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { useParams } from 'react-router-dom'

import orgSecretDark from 'assets/onboarding/org_secret_dark.png'
import orgSecretLight from 'assets/onboarding/org_secret_light.png'
import repoSecretDark from 'assets/onboarding/repo_secret_dark.png'
import repoSecretLight from 'assets/onboarding/repo_secret_light.png'
import useGenerateOrgUploadToken from 'pages/AccountSettings/tabs/OrgUploadToken/useGenerateOrgUploadToken'
import {
EVENT_METRICS,
Expand Down Expand Up @@ -35,24 +37,27 @@ interface URLParams {
}

interface SecretGHExampleProps {
isUsingGlobalToken: boolean
owner: string
storeEventMetric: UseMutateFunction<
any,
unknown,
StoreEventMetricMutationArgs,
unknown
>
uploadToken: string
owner: string
}

function GitHubOrgSecretExample({
isUsingGlobalToken,
storeEventMetric,
uploadToken,
owner,
}: SecretGHExampleProps) {
const { theme } = useThemeContext()
const isDarkMode = theme === Theme.DARK
const orgSecretImg = isDarkMode ? orgSecretDark : orgSecretLight
const repoSecretImg = isDarkMode ? repoSecretDark : repoSecretLight

return (
<>
Expand Down Expand Up @@ -93,7 +98,7 @@ function GitHubOrgSecretExample({
<img
className="size-full object-cover"
alt="org settings secret"
src={orgSecretImg}
src={isUsingGlobalToken ? orgSecretImg : repoSecretImg}
/>
</ExpandableSection.Content>
</ExpandableSection>
Expand Down Expand Up @@ -215,11 +220,12 @@ const AddTokenStep = ({
</Card.Header>
<Card.Content className="flex flex-col gap-4">
<GitHubOrgSecretExample
isUsingGlobalToken={isUsingGlobalToken}
owner={owner}
storeEventMetric={storeEventMetric}
uploadToken={
isUsingGlobalToken ? (orgUploadToken ?? '') : repoUploadToken
}
owner={owner}
/>
</Card.Content>
</Card>
Expand Down

0 comments on commit 61604f7

Please sign in to comment.