-
Notifications
You must be signed in to change notification settings - Fork 609
Display linked issue(s) from the PR Overview #5824 #6835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
6447686
d714138
dc5e558
41842ab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,6 +96,7 @@ export interface PullRequest extends Issue { | |
lastReviewType?: ReviewType; | ||
revertable?: boolean; | ||
busy?: boolean; | ||
closingIssues: Pick<Issue, 'title' | 'number' | 'state'>[]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
|
||
export interface ProjectItemsReply { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,15 +6,15 @@ | |
import React, { useContext } from 'react'; | ||
import { COPILOT_LOGINS } from '../../src/common/copilot'; | ||
import { gitHubLabelColor } from '../../src/common/utils'; | ||
import { IMilestone, IProjectItem, reviewerId } from '../../src/github/interface'; | ||
import { IMilestone, IProjectItem, Issue, reviewerId, } from '../../src/github/interface'; | ||
import { PullRequest } from '../../src/github/views'; | ||
import PullRequestContext from '../common/context'; | ||
import { Label } from '../common/label'; | ||
import { AuthorLink, Avatar } from '../components/user'; | ||
import { closeIcon, copilotIcon, settingsIcon } from './icon'; | ||
import { Reviewer } from './reviewer'; | ||
|
||
export default function Sidebar({ reviewers, labels, hasWritePermission, isIssue, projectItems: projects, milestone, assignees, canAssignCopilot }: PullRequest) { | ||
export default function Sidebar({ reviewers, labels, closingIssues, hasWritePermission, isIssue, projectItems: projects, milestone, assignees, canAssignCopilot }: PullRequest) { | ||
const { | ||
addReviewers, | ||
addAssignees, | ||
|
@@ -54,7 +54,7 @@ export default function Sidebar({ reviewers, labels, hasWritePermission, isIssue | |
</div> | ||
{reviewers && reviewers.length ? ( | ||
reviewers.map(state => ( | ||
<Reviewer key={reviewerId(state.reviewer)} {...{reviewState: state}} /> | ||
<Reviewer key={reviewerId(state.reviewer)} {...{ reviewState: state }} /> | ||
)) | ||
) : ( | ||
<div className="section-placeholder">None yet</div> | ||
|
@@ -199,7 +199,27 @@ export default function Sidebar({ reviewers, labels, hasWritePermission, isIssue | |
{milestone ? ( | ||
<Milestone key={milestone.title} {...milestone} canDelete={hasWritePermission} /> | ||
) : ( | ||
<div className="section-placeholder">No milestone</div> | ||
<> | ||
<div className="section-placeholder">No milestone</div> | ||
</> | ||
)} | ||
</div> | ||
<div id="closingIssues" className="section"> | ||
<div className="section-header"> | ||
<div className="section-title">Linked Issues</div> | ||
</div> | ||
{closingIssues.length > 0 ? ( | ||
<div className="p-2"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use a class name that is consistent with the class naming scheme in the file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same for |
||
{closingIssues.map(issue => ( | ||
<div className="section-item reviewer"> | ||
<div className="avatar-with-author gap-2"> | ||
<IssueItem key={issue.title} issue={issue} /> | ||
</div> | ||
</div> | ||
))} | ||
</div> | ||
) : ( | ||
<div className="p-4 text-sm text-gray-500 text-center">None yet</div> | ||
)} | ||
</div> | ||
</div> | ||
|
@@ -273,3 +293,27 @@ function Project(project: IProjectItem & { canDelete: boolean }) { | |
</div> | ||
); | ||
} | ||
|
||
function IssueItem({ issue }: { issue: Pick<Issue, 'title' | 'number' | 'state'> }) { | ||
return ( | ||
<> | ||
<IssueStateIcon state={issue.state} /> | ||
<span className="h2">{issue.title}</span> | ||
</> | ||
|
||
); | ||
} | ||
|
||
function IssueStateIcon({ state }: { state: string }) { | ||
const normalizedState = state.toLowerCase().trim(); | ||
|
||
switch (normalizedState) { | ||
case 'open': | ||
return settingsIcon; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not |
||
case 'closed': | ||
return closeIcon; | ||
default: | ||
return closeIcon; | ||
} | ||
} | ||
|
This comment was marked as spam.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.