Skip to content

Commit

Permalink
fix checkbox state and change github sign in button label
Browse files Browse the repository at this point in the history
  • Loading branch information
icedevera committed May 6, 2024
1 parent 6da54ae commit 0d18a06
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions src/components/sections/GitHub/GithubFileSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const GithubFileSelect = ({
<Button
onClick={() => signIn('github')}
className="bg-gray-800 text-white">
Sign in with Github to select repo files
Sign in with Github to select files
</Button>
)
}
Expand Down Expand Up @@ -67,7 +67,7 @@ type FileTreeProps = {
fileTree: GetRepoFilesResponse | undefined | null
isLoading: boolean
selectedFilePaths: string[]
onSelectFilePaths: (files: string[]) => void
onSelectFilePaths: (newFiles: string[]) => void
}

const FileTree = ({
Expand All @@ -84,10 +84,14 @@ const FileTree = ({
checked: CheckedState,
path: string | undefined,
) => {
if (!path) {
return
}

if (checked) {
onSelectFilePaths(selectedFilePaths.filter((file) => file !== path))
onSelectFilePaths([...selectedFilePaths, path])
} else {
onSelectFilePaths([...selectedFilePaths, path ?? ''])
onSelectFilePaths(selectedFilePaths.filter((file) => file !== path))
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/sections/GitHub/GithubRepoSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const GithubRepoSelect = ({selectedRepo, onSelectRepo}: GithubRepoSelect) => {
<Button
onClick={() => signIn('github')}
className="bg-gray-800 text-white">
Sign in with Github to select repo files
Sign in with Github to select a repo
</Button>
)
}
Expand Down

0 comments on commit 0d18a06

Please sign in to comment.