Skip to content

Commit 22a21c6

Browse files
Lightning00BladeDevtools-frontend LUCI CQ
authored and
Devtools-frontend LUCI CQ
committed
[AI Assistance] Fix copy file title
Also don't hide the button after copy Fixed: 406078783 Change-Id: I9ee6a1a9d8b372b5df38b2de5b1380bc75ec0dcd Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6440928 Reviewed-by: Ergün Erdoğmuş <ergunsh@chromium.org> Commit-Queue: Ergün Erdoğmuş <ergunsh@chromium.org> Auto-Submit: Nikolay Vitkov <nvitkov@chromium.org>
1 parent b9d99f9 commit 22a21c6

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

front_end/panels/changes/CombinedDiffView.ts

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ const UIStrings = {
2828
* @description The title of the button after it was pressed and the text was copied to clipboard.
2929
*/
3030
copied: 'Copied to clipboard',
31+
/**
32+
* @description The title of the copy file to clipboard button
33+
* @example {index.css} PH1
34+
*/
35+
copyFile: 'Copy file {PH1} to clipboard',
3136
} as const;
3237

3338
const str_ = i18n.i18n.registerUIStrings('panels/changes/CombinedDiffView.ts', UIStrings);
@@ -53,6 +58,7 @@ type View = (input: ViewInput, output: undefined, target: HTMLElement) => void;
5358
function renderSingleDiffView(singleDiffViewInput: SingleDiffViewInput): Lit.TemplateResult {
5459
const {fileName, fileUrl, mimeType, icon, diff, copied, onCopy, onFileNameClick} = singleDiffViewInput;
5560

61+
// clang-format off
5662
return html`
5763
<details open>
5864
<summary>
@@ -62,24 +68,27 @@ function renderSingleDiffView(singleDiffViewInput: SingleDiffViewInput): Lit.Tem
6268
<button class="file-name-link" @click=${() => onFileNameClick(fileUrl)}>${fileName}</button>
6369
</div>
6470
<div class="summary-right">
65-
${copied ? html`<span class="copied">${i18nString(UIStrings.copied)}</span>` : html`
66-
<devtools-button
67-
title=${'Copy'}
68-
.size=${Buttons.Button.Size.SMALL}
69-
.iconName=${'copy'}
70-
.jslogContext=${'combined-diff-view.copy'}
71-
.variant=${Buttons.Button.Variant.ICON}
72-
@click=${() => onCopy(fileUrl)}></devtools-button>
73-
`}
71+
<devtools-button
72+
title=${i18nString(UIStrings.copyFile, { PH1: fileName })}
73+
.size=${Buttons.Button.Size.SMALL}
74+
.iconName=${'copy'}
75+
.jslogContext=${'combined-diff-view.copy'}
76+
.variant=${Buttons.Button.Variant.ICON}
77+
@click=${() => onCopy(fileUrl)}
78+
></devtools-button>
79+
${copied
80+
? html`<span class="copied">${i18nString(UIStrings.copied)}</span>`
81+
: Lit.nothing}
7482
</div>
7583
</summary>
76-
<div class='diff-view-container'>
84+
<div class="diff-view-container">
7785
<devtools-diff-view
7886
.data=${{diff, mimeType} as DiffView.DiffView.DiffViewData}>
7987
</devtools-diff-view>
8088
</div>
8189
</details>
8290
`;
91+
// clang-format on
8392
}
8493

8594
export class CombinedDiffView extends UI.Widget.Widget {

0 commit comments

Comments
 (0)