Merge branch 'main' into fix-colors

This commit is contained in:
Hylke Bons 2023-07-25 16:47:28 +02:00 коммит произвёл GitHub
Родитель 35c5f7da3b 50868d7cd6
Коммит d34bc731ef
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
9 изменённых файлов: 290 добавлений и 191 удалений

Просмотреть файл

@ -578,7 +578,7 @@
],
"github-pull-request": [
{
"id": "github:createPullRequest",
"id": "github:createPullRequestWebview",
"type": "webview",
"name": "%view.github.create.pull.request.name%",
"when": "github:createPullRequest",
@ -586,12 +586,19 @@
"initialSize": 2
},
{
"id": "github:compareChanges",
"id": "github:compareChangesFiles",
"name": "%view.github.compare.changes.name%",
"when": "github:createPullRequest",
"visibility": "visible",
"initialSize": 1
},
{
"id": "github:compareChangesCommits",
"name": "%view.github.compare.changesCommits.name%",
"when": "github:createPullRequest",
"visibility": "visible",
"initialSize": 1
},
{
"id": "prStatus:github",
"name": "%view.pr.status.github.name%",
@ -1801,22 +1808,22 @@
},
{
"command": "pr.addAssigneesToNewPr",
"when": "view == github:createPullRequest && github:createPrPermissions != READ && github:createPrPermissions && config.githubPullRequests.experimental.createView",
"when": "view == github:createPullRequestWebview && github:createPrPermissions != READ && github:createPrPermissions && config.githubPullRequests.experimental.createView",
"group": "navigation@1"
},
{
"command": "pr.addReviewersToNewPr",
"when": "view == github:createPullRequest && github:createPrPermissions != READ && github:createPrPermissions && config.githubPullRequests.experimental.createView",
"when": "view == github:createPullRequestWebview && github:createPrPermissions != READ && github:createPrPermissions && config.githubPullRequests.experimental.createView",
"group": "navigation@2"
},
{
"command": "pr.addLabelsToNewPr",
"when": "view == github:createPullRequest && github:createPrPermissions != READ && github:createPrPermissions",
"when": "view == github:createPullRequestWebview && github:createPrPermissions != READ && github:createPrPermissions",
"group": "navigation@3"
},
{
"command": "pr.addMilestoneToNewPr",
"when": "view == github:createPullRequest && github:createPrPermissions != READ && github:createPrPermissions && config.githubPullRequests.experimental.createView",
"when": "view == github:createPullRequestWebview && github:createPrPermissions != READ && github:createPrPermissions && config.githubPullRequests.experimental.createView",
"group": "navigation@4"
}
],
@ -2332,27 +2339,27 @@
"webview/context": [
{
"command": "pr.createPrMenuCreate",
"when": "webviewId == 'github:createPullRequest' && github:createPrMenu",
"when": "webviewId == 'github:createPullRequestWebview' && github:createPrMenu",
"group": "0_create@0"
},
{
"command": "pr.createPrMenuDraft",
"when": "webviewId == 'github:createPullRequest' && github:createPrMenu && github:createPrMenuDraft",
"when": "webviewId == 'github:createPullRequestWebview' && github:createPrMenu && github:createPrMenuDraft",
"group": "0_create@1"
},
{
"command": "pr.createPrMenuMerge",
"when": "webviewId == 'github:createPullRequest' && github:createPrMenu && github:createPrMenuMerge",
"when": "webviewId == 'github:createPullRequestWebview' && github:createPrMenu && github:createPrMenuMerge",
"group": "1_create@0"
},
{
"command": "pr.createPrMenuSquash",
"when": "webviewId == 'github:createPullRequest' && github:createPrMenu && github:createPrMenuSquash",
"when": "webviewId == 'github:createPullRequestWebview' && github:createPrMenu && github:createPrMenuSquash",
"group": "1_create@1"
},
{
"command": "pr.createPrMenuRebase",
"when": "webviewId == 'github:createPullRequest' && github:createPrMenu && github:createPrMenuRebase",
"when": "webviewId == 'github:createPullRequestWebview' && github:createPrMenu && github:createPrMenuRebase",
"group": "1_create@2"
}
]

Просмотреть файл

@ -122,6 +122,7 @@
"view.issues.github.name": "Issues",
"view.github.create.pull.request.name": "Create",
"view.github.compare.changes.name": "Files Changed",
"view.github.compare.changesCommits.name": "Commits",
"view.pr.status.github.name": "Changes In Pull Request",
"view.github.active.pull.request.name": "Active Pull Request",
"view.github.active.pull.request.welcome.name": "Active Pull Request",

Просмотреть файл

@ -27,7 +27,7 @@ import { registerBuiltinGitProvider, registerLiveShareGitProvider } from './gitP
import { GitHubContactServiceProvider } from './gitProviders/GitHubContactServiceProvider';
import { GitLensIntegration } from './integrations/gitlens/gitlensImpl';
import { IssueFeatureRegistrar } from './issues/issueFeatureRegistrar';
import { CompareChangesTreeProvider } from './view/compareChangesTreeDataProvider';
import { CompareChanges } from './view/compareChangesTreeDataProvider';
import { CreatePullRequestHelper } from './view/createPullRequestHelper';
import { FileTypeDecorationProvider } from './view/fileTypeDecorationProvider';
import { getInMemPRFileSystemProvider } from './view/inMemPRContentProvider';
@ -220,7 +220,7 @@ async function init(
registerPostCommitCommandsProvider(reposManager, git);
// Make sure any compare changes tabs, which come from the create flow, are closed.
CompareChangesTreeProvider.closeTabs();
CompareChanges.closeTabs();
/* __GDPR__
"startup" : {}
*/

Просмотреть файл

@ -38,7 +38,7 @@ const ISSUE_CLOSING_KEYWORDS = new RegExp('closes|closed|close|fixes|fixed|fix|r
export class CreatePullRequestViewProvider extends WebviewViewBase implements vscode.WebviewViewProvider {
private static readonly ID = 'CreatePullRequestViewProvider';
public readonly viewType = 'github:createPullRequest';
public readonly viewType = 'github:createPullRequestWebview';
private _onDone = new vscode.EventEmitter<PullRequestModel | undefined>();
readonly onDone: vscode.Event<PullRequestModel | undefined> = this._onDone.event;
@ -527,7 +527,7 @@ export class CreatePullRequestViewProvider extends WebviewViewBase implements vs
private async create(message: IRequestMessage<CreatePullRequest>): Promise<void> {
Logger.debug(`Creating pull request with args ${JSON.stringify(message.args)}`, CreatePullRequestViewProvider.ID);
vscode.window.withProgress({ location: { viewId: 'github:createPullRequest' } }, () => {
vscode.window.withProgress({ location: { viewId: 'github:createPullRequestWebview' } }, () => {
return vscode.window.withProgress({ location: vscode.ProgressLocation.Notification }, async progress => {
let totalIncrement = 0;
progress.report({ message: vscode.l10n.t('Checking for upstream branch'), increment: totalIncrement });

Просмотреть файл

@ -43,7 +43,7 @@ const ISSUE_CLOSING_KEYWORDS = new RegExp('closes|closed|close|fixes|fixed|fix|r
export class CreatePullRequestViewProviderNew extends WebviewViewBase implements vscode.WebviewViewProvider, vscode.Disposable {
private static readonly ID = 'CreatePullRequestViewProvider';
public readonly viewType = 'github:createPullRequest';
public readonly viewType = 'github:createPullRequestWebview';
private _onDone = new vscode.EventEmitter<PullRequestModel | undefined>();
readonly onDone: vscode.Event<PullRequestModel | undefined> = this._onDone.event;
@ -725,7 +725,7 @@ export class CreatePullRequestViewProviderNew extends WebviewViewBase implements
this.setMilestone(createdPR, message.args.milestone)]);
};
vscode.window.withProgress({ location: { viewId: 'github:createPullRequest' } }, () => {
vscode.window.withProgress({ location: { viewId: 'github:createPullRequestWebview' } }, () => {
return vscode.window.withProgress({ location: vscode.ProgressLocation.Notification }, async progress => {
let totalIncrement = 0;
progress.report({ message: vscode.l10n.t('Checking for upstream branch'), increment: totalIncrement });

Просмотреть файл

@ -36,22 +36,6 @@ export function getGitChangeTypeFromApi(status: Status): GitChangeType {
}
}
class AllFilesNode extends TreeNode {
getTreeItem(): vscode.TreeItem | Promise<vscode.TreeItem> {
return {
label: vscode.l10n.t('All Changes'),
collapsibleState: vscode.TreeItemCollapsibleState.Expanded
};
}
constructor(protected readonly children: TreeNode[]) {
super();
}
async getChildren(): Promise<TreeNode[]> {
return this.children;
}
}
class CommitNode extends TreeNode {
getTreeItem(): vscode.TreeItem | Promise<vscode.TreeItem> {
return {
@ -93,41 +77,31 @@ class CommitNode extends TreeNode {
}
}
export class CompareChangesTreeProvider implements vscode.TreeDataProvider<TreeNode> {
abstract class CompareChangesTreeProvider implements vscode.TreeDataProvider<TreeNode> {
private _view: vscode.TreeView<TreeNode>;
private _onDidChangeTreeData = new vscode.EventEmitter<TreeNode | void>();
readonly onDidChangeTreeData = this._onDidChangeTreeData.event;
private _gitHubcontentProvider: GitHubContentProvider | undefined;
private _gitcontentProvider: GitContentProvider | undefined;
private _disposables: vscode.Disposable[] = [];
private _gitHubRepository: GitHubRepository | undefined;
get view(): vscode.TreeView<TreeNode> {
return this._view;
}
set view(view: vscode.TreeView<TreeNode>) {
this._view = view;
}
constructor(
private readonly repository: Repository,
private baseOwner: string,
private baseBranchName: string,
private repository: Repository,
protected baseOwner: string,
protected baseBranchName: string,
private _compareOwner: string,
private compareBranchName: string,
private compareHasUpstream: boolean,
private folderRepoManager: FolderRepositoryManager,
protected compareBranchName: string,
protected compareHasUpstream: boolean,
protected _gitHubRepository: GitHubRepository | undefined
) {
this._view = vscode.window.createTreeView('github:compareChanges', {
treeDataProvider: this,
});
this._gitHubRepository = this.folderRepoManager.gitHubRepositories.find(
repo => repo.remote.owner === this._compareOwner,
);
this._disposables.push(this._view);
}
updateBaseBranch(branch: string): void {
@ -152,6 +126,14 @@ export class CompareChangesTreeProvider implements vscode.TreeDataProvider<TreeN
this._onDidChangeTreeData.fire();
}
get compareOwner(): string {
return this._compareOwner;
}
set compareOwner(owner: string) {
this._compareOwner = owner;
}
private async updateHasUpstream(branch: string): Promise<boolean> {
// Currently, the list of selectable compare branches it those on GitHub,
// plus the current branch which may not be published yet. Check the
@ -183,25 +165,241 @@ export class CompareChangesTreeProvider implements vscode.TreeDataProvider<TreeN
}
}
get compareOwner(): string {
return this._compareOwner;
getTreeItem(element: TreeNode): vscode.TreeItem | Thenable<vscode.TreeItem> {
return element.getTreeItem();
}
set compareOwner(owner: string) {
if (this._compareOwner !== owner) {
this._gitHubRepository = this.folderRepoManager.gitHubRepositories.find(repo => repo.remote.owner === owner);
protected async getRawGitHubData(gitHubRepository: GitHubRepository) {
const { octokit, remote } = await gitHubRepository.ensure();
if (this._gitHubcontentProvider && this._gitHubRepository) {
this._gitHubcontentProvider.gitHubRepository = this._gitHubRepository;
const { data } = await octokit.call(octokit.api.repos.compareCommits, {
repo: remote.repositoryName,
owner: remote.owner,
base: `${this.baseOwner}:${this.baseBranchName}`,
head: `${this.compareOwner}:${this.compareBranchName}`,
});
const rawFiles = data.files;
const rawCommits = data.commits;
if (!rawFiles?.length || !rawCommits?.length) {
this.view.message = `There are no commits between the base '${this.baseBranchName}' branch and the comparing '${this.compareBranchName}' branch`;
return {};
} else if (this._isDisposed) {
return {};
} else {
this.view.message = undefined;
}
return { rawFiles, rawCommits, octokit, remote, mergeBase: data.merge_base_commit.sha };
}
protected abstract getGitHubChildren(gitHubRepository: GitHubRepository, element?: TreeNode);
protected abstract getGitChildren(element?: TreeNode);
async getChildren(element?: TreeNode) {
if (!this._gitHubRepository) {
return [];
}
try {
if (this.compareHasUpstream) {
return this.getGitHubChildren(this._gitHubRepository, element);
} else {
return this.getGitChildren(element);
}
this._compareOwner = owner;
this._onDidChangeTreeData.fire();
} catch (e) {
Logger.error(`Comparing changes failed: ${e}`);
return [];
}
}
getTreeItem(element: TreeNode): vscode.TreeItem | Thenable<vscode.TreeItem> {
return element.getTreeItem();
protected _isDisposed: boolean = false;
dispose() {
this._isDisposed = true;
this._disposables.forEach(d => d.dispose());
this._view.dispose();
}
public static closeTabs() {
vscode.window.tabGroups.all.forEach(group => group.tabs.forEach(tab => {
if (tab.input instanceof vscode.TabInputTextDiff) {
if ((tab.input.modified.scheme === Schemes.GithubPr) || (tab.input.modified.scheme === Schemes.GitPr)) {
vscode.window.tabGroups.close(tab);
}
}
}));
}
}
class CompareChangesFilesTreeProvider extends CompareChangesTreeProvider {
constructor(
repository: Repository,
baseOwner: string,
baseBranchName: string,
compareOwner: string,
compareBranchName: string,
compareHasUpstream: boolean,
gitHubRepository: GitHubRepository | undefined,
private folderRepoManager: FolderRepositoryManager,
) {
super(repository, baseOwner, baseBranchName, compareOwner, compareBranchName, compareHasUpstream, gitHubRepository);
}
protected async getGitHubChildren(gitHubRepository: GitHubRepository, element?: TreeNode) {
if (element) {
return element.getChildren();
}
const { rawFiles, mergeBase } = await this.getRawGitHubData(gitHubRepository);
if (rawFiles && mergeBase) {
return rawFiles.map(file => {
return new GitHubFileChangeNode(
this,
file.filename,
file.previous_filename,
getGitChangeType(file.status),
mergeBase,
this.compareBranchName,
false,
);
});
}
}
private async getGitFileChildren(diff: Change[]) {
return diff.map(change => {
const filename = pathLib.posix.relative(this.folderRepoManager.repository.rootUri.path, change.uri.path);
const previousFilename = pathLib.posix.relative(this.folderRepoManager.repository.rootUri.path, change.originalUri.path);
return new GitHubFileChangeNode(
this,
filename,
previousFilename,
getGitChangeTypeFromApi(change.status),
this.baseBranchName,
this.compareBranchName,
true,
);
});
}
protected async getGitChildren(element?: TreeNode) {
if (!element) {
const diff = await this.folderRepoManager.repository.diffBetween(this.baseBranchName, this.compareBranchName);
if (diff.length === 0) {
this.view.message = `There are no commits between the base '${this.baseBranchName}' branch and the comparing '${this.compareBranchName}' branch`;
return [];
} else if (!this.compareHasUpstream) {
this.view.message = vscode.l10n.t('Branch {0} has not been pushed yet. Showing local changes.', this.compareBranchName);
} else if (this._isDisposed) {
return [];
} else {
this.view.message = undefined;
}
return this.getGitFileChildren(diff);
} else {
return element.getChildren();
}
}
}
class CompareChangesCommitsTreeProvider extends CompareChangesTreeProvider {
constructor(
repository: Repository,
baseOwner: string,
baseBranchName: string,
compareOwner: string,
compareBranchName: string,
compareHasUpstream: boolean,
gitHubRepository: GitHubRepository | undefined,
) {
super(repository, baseOwner, baseBranchName, compareOwner, compareBranchName, compareHasUpstream, gitHubRepository);
}
protected async getGitHubChildren(gitHubRepository: GitHubRepository, element?: TreeNode) {
if (element) {
return element.getChildren();
}
const { rawCommits, octokit, remote } = await this.getRawGitHubData(gitHubRepository);
if (rawCommits && octokit && remote) {
return rawCommits.map((commit, index) => {
return new CommitNode(commit, octokit, remote, index === 0 ? this.baseBranchName : rawCommits[index - 1].sha);
});
}
}
protected async getGitChildren(_element?: TreeNode) {
this.view.message = vscode.l10n.t('Branch {0} has not been pushed yet. Unable to show commits.', this.compareBranchName);
return [];
}
}
export class CompareChanges implements vscode.Disposable {
private _filesView: vscode.TreeView<TreeNode>;
private _filesDataProvider: CompareChangesFilesTreeProvider;
private _commitsView: vscode.TreeView<TreeNode>;
private _commitsDataProvider: CompareChangesCommitsTreeProvider;
private _gitHubcontentProvider: GitHubContentProvider | undefined;
private _gitcontentProvider: GitContentProvider | undefined;
private _disposables: vscode.Disposable[] = [];
private _gitHubRepository: GitHubRepository | undefined;
constructor(
repository: Repository,
baseOwner: string,
baseBranchName: string,
compareOwner: string,
compareBranchName: string,
compareHasUpstream: boolean,
private folderRepoManager: FolderRepositoryManager,
) {
this._gitHubRepository = this.folderRepoManager.gitHubRepositories.find(
repo => repo.remote.owner === compareOwner,
);
this._filesDataProvider = new CompareChangesFilesTreeProvider(repository, baseOwner, baseBranchName, compareOwner, compareBranchName, compareHasUpstream, this._gitHubRepository, folderRepoManager);
this._filesView = vscode.window.createTreeView('github:compareChangesFiles', {
treeDataProvider: this._filesDataProvider
});
this._filesDataProvider.view = this._filesView;
this._commitsDataProvider = new CompareChangesCommitsTreeProvider(repository, baseOwner, baseBranchName, compareOwner, compareBranchName, compareHasUpstream, this._gitHubRepository);
this._commitsView = vscode.window.createTreeView('github:compareChangesCommits', {
treeDataProvider: this._commitsDataProvider
});
this._commitsDataProvider.view = this._commitsView;
this._disposables.push(this._filesDataProvider);
this._disposables.push(this._filesView);
this._disposables.push(this._commitsDataProvider);
this._disposables.push(this._commitsView);
this.initialize();
}
updateBaseBranch(branch: string): void {
this._filesDataProvider.updateBaseBranch(branch);
this._commitsDataProvider.updateBaseBranch(branch);
}
updateBaseOwner(owner: string) {
this._filesDataProvider.updateBaseOwner(owner);
this._commitsDataProvider.updateBaseOwner(owner);
}
async updateCompareBranch(branch?: string): Promise<void> {
this._filesDataProvider.updateCompareBranch(branch);
this._commitsDataProvider.updateCompareBranch(branch);
}
set compareOwner(owner: string) {
this._filesDataProvider.compareOwner = owner;
this._commitsDataProvider.compareOwner = owner;
}
private initialize() {
@ -232,128 +430,11 @@ export class CompareChangesTreeProvider implements vscode.TreeDataProvider<TreeN
}
}
private async getGitHubFileChildren(files: OctokitCommon.CompareCommits['files'], mergeBase: string) {
return files.map(file => {
return new GitHubFileChangeNode(
this,
file.filename,
file.previous_filename,
getGitChangeType(file.status),
mergeBase,
this.compareBranchName,
false,
);
});
}
private async getGitHubCommitsChildren(commits: OctokitCommon.CompareCommits['commits'], octokit: LoggingOctokit, remote: GitHubRemote): Promise<TreeNode[]> {
return commits.map((commit, index) => {
return new CommitNode(commit, octokit, remote, index === 0 ? this.baseBranchName : commits[index - 1].sha);
});
}
private async getGitHubChildren(gitHubRepository: GitHubRepository, element?: TreeNode) {
if (element) {
return element.getChildren();
}
const { octokit, remote } = await gitHubRepository.ensure();
const { data } = await octokit.call(octokit.api.repos.compareCommits, {
repo: remote.repositoryName,
owner: remote.owner,
base: `${this.baseOwner}:${this.baseBranchName}`,
head: `${this.compareOwner}:${this.compareBranchName}`,
});
const rawFiles = data.files;
const rawCommits = data.commits;
if (!rawFiles?.length || !rawCommits?.length) {
this._view.message = `There are no commits between the base '${this.baseBranchName}' branch and the comparing '${this.compareBranchName}' branch`;
return [];
} else if (this._isDisposed) {
return [];
} else {
this._view.message = undefined;
}
const files = await this.getGitHubFileChildren(rawFiles, data.merge_base_commit.sha);
const commits = await this.getGitHubCommitsChildren(rawCommits, octokit, remote);
return [...commits, new AllFilesNode(files)];
}
private async getGitFileChildren(diff: Change[]) {
return diff.map(change => {
const filename = pathLib.posix.relative(this.folderRepoManager.repository.rootUri.path, change.uri.path);
const previousFilename = pathLib.posix.relative(this.folderRepoManager.repository.rootUri.path, change.originalUri.path);
return new GitHubFileChangeNode(
this,
filename,
previousFilename,
getGitChangeTypeFromApi(change.status),
this.baseBranchName,
this.compareBranchName,
true,
);
});
}
private async getGitChildren(element?: TreeNode) {
if (!element) {
const diff = await this.folderRepoManager.repository.diffBetween(this.baseBranchName, this.compareBranchName);
if (diff.length === 0) {
this._view.message = `There are no commits between the base '${this.baseBranchName}' branch and the comparing '${this.compareBranchName}' branch`;
return [];
} else if (!this.compareHasUpstream) {
this._view.message = vscode.l10n.t('Branch {0} has not been pushed yet. Showing local changes.', this.compareBranchName);
} else if (this._isDisposed) {
return [];
} else {
this._view.message = undefined;
}
return this.getGitFileChildren(diff);
} else {
return element.getChildren();
}
}
async getChildren(element?: TreeNode) {
if (!this._gitHubRepository) {
return [];
}
this.initialize();
// Example tree (only when there's an upstream compare branch, when there isn't we just show files)
// 2 commits
// First commit
// Second commit
// 2 changed files
// file1
// file2
try {
if (this.compareHasUpstream) {
return this.getGitHubChildren(this._gitHubRepository, element);
} else {
return this.getGitChildren(element);
}
} catch (e) {
Logger.error(`Comparing changes failed: ${e}`);
return [];
}
}
private _isDisposed: boolean = false;
dispose() {
this._isDisposed = true;
this._disposables.forEach(d => d.dispose());
this._gitHubcontentProvider = undefined;
this._gitcontentProvider = undefined;
this._view.dispose();
this._filesView.dispose();
}
public static closeTabs() {

Просмотреть файл

@ -11,12 +11,12 @@ import { CreatePullRequestViewProvider } from '../github/createPRViewProvider';
import { CreatePullRequestViewProviderNew } from '../github/createPRViewProviderNew';
import { FolderRepositoryManager, PullRequestDefaults } from '../github/folderRepositoryManager';
import { PullRequestModel } from '../github/pullRequestModel';
import { CompareChangesTreeProvider } from './compareChangesTreeDataProvider';
import { CompareChanges } from './compareChangesTreeDataProvider';
export class CreatePullRequestHelper implements vscode.Disposable {
private _disposables: vscode.Disposable[] = [];
private _createPRViewProvider: CreatePullRequestViewProvider | CreatePullRequestViewProviderNew | undefined;
private _treeView: CompareChangesTreeProvider | undefined;
private _treeView: CompareChanges | undefined;
private _onDidCreate = new vscode.EventEmitter<PullRequestModel>();
readonly onDidCreate: vscode.Event<PullRequestModel> = this._onDidCreate.event;
@ -200,7 +200,7 @@ export class CreatePullRequestHelper implements vscode.Disposable {
);
const compareOrigin = await folderRepoManager.getOrigin(branch);
this._treeView = new CompareChangesTreeProvider(
this._treeView = new CompareChanges(
folderRepoManager.repository,
pullRequestDefaults.owner,
pullRequestDefaults.base,

Просмотреть файл

@ -7,7 +7,7 @@ import * as React from 'react';
import { IAccount, IActor, ITeam, reviewerLabel } from '../../src/github/interface';
import { Icon } from './icon';
export const Avatar = ({ for: author }: { for: Partial<IAccount> }) => (
const InnerAvatar = ({ for: author }: { for: Partial<IAccount> }) => (
<>
{author.avatarUrl ? (
<img className="avatar" src={author.avatarUrl} alt="" role="presentation" />
@ -17,6 +17,16 @@ export const Avatar = ({ for: author }: { for: Partial<IAccount> }) => (
</>
);
export const Avatar = ({ for: author, link = true }: { for: Partial<IAccount>, link?: boolean }) => {
if (link) {
return <a className="avatar-link" href={author.url} title={author.url}>
<InnerAvatar for={author} />
</a>;
} else {
return <InnerAvatar for={author} />;
}
};
export const AuthorLink = ({ for: author, text = reviewerLabel(author) }: { for: IActor | ITeam; text?: string }) => (
<a className="author-link" href={author.url} title={author.url}>
{text}

Просмотреть файл

@ -210,7 +210,7 @@ export function main() {
{params.assignees.map(assignee =>
<li>
<span title={assignee.name} aria-label={assignee.name}>
<Avatar for={assignee} />
<Avatar for={assignee} link={false} />
{assignee.login}
</span>
</li>)}
@ -227,7 +227,7 @@ export function main() {
{params.reviewers.map(reviewer =>
<li>
<span title={reviewer.name} aria-label={reviewer.name}>
<Avatar for={reviewer} />
<Avatar for={reviewer} link={false} />
{isTeam(reviewer) ? reviewer.slug : reviewer.login}
</span>
</li>)}
@ -288,7 +288,7 @@ export function main() {
{createMethodLabel(ctx.createParams.isDraft, ctx.createParams.autoMerge, ctx.createParams.autoMergeMethod).label}
</button>
<div className='split'></div>
<button className='split-right' title='Create with Options' disabled={isBusy || !isCreateable || !ctx.initialized} onClick={(e) => {
<button className='split-right' title='Create with Options' disabled={isBusy || !isCreateable || !ctx.initialized} onClick={(e) =>
e.preventDefault();
const rect = (e.target as HTMLElement).getBoundingClientRect();
const x = rect.left;