提交 f1dcaaea 编写于 作者: R Rachel Macfarlane

Some styling tweaks, fix status calculation

上级 f86589cd
......@@ -135,6 +135,8 @@ body .comment-form {
body .comment-form textarea {
display: block;
box-sizing: border-box;
padding: 10px;
width: 100%;
min-height: 100px;
max-height: 500px;
......
......@@ -52,7 +52,7 @@ function setTitleHTML(pr: any) {
<h2>${pr.title} (<a href=${pr.url}>#${pr.number}</a>) </h2> <button id="checkout" aria-live="polite"><svg class="octicon octicon-desktop-download" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M4 6h3V0h2v6h3l-4 4-4-4zm11-4h-4v1h4v8H1V3h4V2H1c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h5.34c-.25.61-.86 1.39-2.34 2h8c-1.48-.61-2.09-1.39-2.34-2H15c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1z"></path></svg>Checkout Pull Request</button>
</div>
<div>
<div class="status">${getStatus(pr)}</div>
<div class="status">${getStatus(pr.state)}</div>
<img class="avatar" src="${pr.author.avatarUrl}" alt="">
<strong class="author"><a href="${pr.author.html_url}">${pr.author.login}</a></strong>
</div>
......
......@@ -138,6 +138,12 @@ export interface CommitEvent {
event: EventType;
}
export enum PullRequestStateEnum {
Open,
Merged,
Closed,
}
export type TimelineEvent = CommitEvent | ReviewEvent | SubscribeEvent | CommentEvent | MentionEvent;
export function renderComment(comment: CommentEvent): string {
......@@ -199,20 +205,20 @@ export function renderTimelineEvent(timelineEvent: TimelineEvent): string {
return '';
}
// export function getStatusBGCoor(pr: any) {
// if (pr.isMerged) {
// return '#6f42c1';
// } else if (pr.isOpen) {
// return '#2cbe4e';
// } else {
// return '#cb2431';
// }
// }
export function getStatusBGCoor(state: PullRequestStateEnum) {
if (state === PullRequestStateEnum.Merged) {
return '#6f42c1';
} else if (state === PullRequestStateEnum.Open) {
return '#2cbe4e';
} else {
return '#cb2431';
}
}
export function getStatus(pr: any) {
if (pr.isMerged) {
export function getStatus(state: PullRequestStateEnum) {
if (state === PullRequestStateEnum.Merged) {
return 'Merged';
} else if (pr.isOpen) {
} else if (state === PullRequestStateEnum.Open) {
return 'Open';
} else {
return 'Closed';
......
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14"><path style="fill:#FFFFFF;" fill-rule="evenodd" d="M3 5h4v1H3V5zm0 3h4V7H3v1zm0 2h4V9H3v1zm11-5h-4v1h4V5zm0 2h-4v1h4V7zm0 2h-4v1h4V9zm2-6v9c0 .55-.45 1-1 1H9.5l-1 1-1-1H2c-.55 0-1-.45-1-1V3c0-.55.45-1 1-1h5.5l1 1 1-1H15c.55 0 1 .45 1 1zm-8 .5L7.5 3H2v9h6V3.5zm7-.5H9.5l-.5.5V12h6V3z"></path></svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path style="fill:#FFFFFF;" fill-rule="evenodd" d="M3 5h4v1H3V5zm0 3h4V7H3v1zm0 2h4V9H3v1zm11-5h-4v1h4V5zm0 2h-4v1h4V7zm0 2h-4v1h4V9zm2-6v9c0 .55-.45 1-1 1H9.5l-1 1-1-1H2c-.55 0-1-.45-1-1V3c0-.55.45-1 1-1h5.5l1 1 1-1H15c.55 0 1 .45 1 1zm-8 .5L7.5 3H2v9h6V3.5zm7-.5H9.5l-.5.5V12h6V3z"></path></svg>
\ No newline at end of file
......@@ -24,13 +24,15 @@ export class PullRequestOverviewPanel {
public static createOrShow(extensionPath: string, pullRequestModel: PullRequestModel) {
const column = vscode.window.activeTextEditor ? vscode.window.activeTextEditor.viewColumn : undefined;
const title = `Pull Request #${pullRequestModel.prNumber.toString()}`;
// If we already have a panel, show it.
// Otherwise, create a new panel.
if (PullRequestOverviewPanel.currentPanel) {
PullRequestOverviewPanel.currentPanel._panel.reveal(column);
PullRequestOverviewPanel.currentPanel._panel.title = title;
} else {
PullRequestOverviewPanel.currentPanel = new PullRequestOverviewPanel(extensionPath, column || vscode.ViewColumn.One);
PullRequestOverviewPanel.currentPanel = new PullRequestOverviewPanel(extensionPath, column || vscode.ViewColumn.One, title);
}
PullRequestOverviewPanel.currentPanel.update(pullRequestModel);
......@@ -39,11 +41,11 @@ export class PullRequestOverviewPanel {
});
}
private constructor(extensionPath: string, column: vscode.ViewColumn) {
private constructor(extensionPath: string, column: vscode.ViewColumn, title: string) {
this._extensionPath = extensionPath;
// Create and show a new webview panel
this._panel = vscode.window.createWebviewPanel(PullRequestOverviewPanel.viewType, 'Pull Request', column, {
this._panel = vscode.window.createWebviewPanel(PullRequestOverviewPanel.viewType, title, column, {
// Enable javascript in the webview
enableScripts: true,
......
......@@ -277,7 +277,7 @@ export class ReviewController implements IEditorContribution {
this.addComment(lineNumber);
})
: this._newCommentGlyph = new CommentGlyphWidget('comment-hint', this.editor, lineNumber, true, () => {
this.notificationService.warn('Commenting is not supported outside of diff chunk areas.');
this.notificationService.warn('Commenting is not supported outside of diff hunk areas.');
});
this.editor.layoutContentWidget(this._newCommentGlyph);
......
......@@ -34,8 +34,7 @@
}
.monaco-editor .review-widget .body .review-comment {
margin-left: 20px;
padding: 8px 16px 8px 0px;
padding: 8px 16px 8px 20px;
display: flex;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册