-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathactivePullRequests.ts
More file actions
38 lines (34 loc) · 1.17 KB
/
activePullRequests.ts
File metadata and controls
38 lines (34 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { ExtensionContext, StatusBarItem, window } from 'vscode'
import { Store } from '../utils/store'
import { ActivePullRequestItems } from '../views/quickpicks/items/activePullRequestItems'
import { pullRequestActionPicker } from '../views/quickpicks/pullRequestActionPicker'
import { CodeReviewSelectionItem } from '../utils'
import { QuickPick } from '../views/quickpicks/quickPick'
export const ActivePullRequests = (
context: ExtensionContext,
statusBar: StatusBarItem
) => {
const codeReviews = Store.get(context)
if (!codeReviews) return
if (
!codeReviews?.pendingUserCodeReviews?.length &&
!codeReviews?.userAuthoredCodeReviews?.length
) {
window.showInformationMessage('PullFlow: You have no PRs waiting for you.')
return
}
const activePullRequestItems = ActivePullRequestItems.get(codeReviews)
QuickPick.create({
context,
items: activePullRequestItems,
title: 'My Active Pull Requests',
placeholder: 'select pull request',
onDidChangeSelection: (selection) => {
pullRequestActionPicker({
selectedCodeReview: selection[0] as CodeReviewSelectionItem,
context,
statusBar,
})
},
})
}