chore: code clean

This commit is contained in:
EnixCoda 2021-05-03 21:44:55 +08:00
parent 31f803a03f
commit 5c25d9d0d8
No known key found for this signature in database
GPG key ID: 0C1A07377913A1DD
2 changed files with 2 additions and 29 deletions

View file

@ -125,7 +125,7 @@ const RawGitako: React.FC<Props & ConnectorState> = function RawGitako(props) {
</button>
</div>
<div className={'gitako-side-bar-content'}>
{(() => {
{run(() => {
switch (state) {
case 'loading-meta':
return <LoadingIndicator text={'Fetching repo meta...'} />
@ -152,7 +152,7 @@ const RawGitako: React.FC<Props & ConnectorState> = function RawGitako(props) {
case 'error-due-to-auth':
return <AccessDeniedDescription hasToken={Boolean(accessToken)} />
}
})()}
})}
</div>
<SettingsBar
defer={defer}

View file

@ -281,33 +281,6 @@ async function createPullFileResolver(userName: string, repoName: string, pullId
}
}
function findMissingFolders(nodes: TreeNode[]) {
const folders = new Set<string>()
const foundFolders = new Set<string>()
for (const node of nodes) {
let path = node.path
if (node.type === 'tree') foundFolders.add(path)
else {
while (true) {
// 'a/b' -> 'a'
// 'a' -> ''
path = path.substring(0, path.lastIndexOf('/'))
if (path === '') break
folders.add(path)
}
}
}
const missingFolders: string[] = []
for (const folder of folders) {
if (!foundFolders.has(folder)) {
missingFolders.push(folder)
}
}
return missingFolders
}
export function useGitHubAttachCopySnippetButton(copySnippetButton: boolean) {
const attachCopySnippetButton = React.useCallback(
function attachCopySnippetButton() {