Skip to content

Commit 72880a0

Browse files
hashseedDevtools-frontend LUCI CQ
authored andcommitted
[AiAssistance] increase visibility of the floating button
Fixed: 396059754 Change-Id: I680c13c883553ab3db127c9431452c096efd994f Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6257992 Commit-Queue: Ergün Erdoğmuş <[email protected]> Auto-Submit: Yang Guo <[email protected]> Commit-Queue: Yang Guo <[email protected]> Reviewed-by: Ergün Erdoğmuş <[email protected]>
1 parent 7fdc637 commit 72880a0

File tree

4 files changed

+39
-35
lines changed

4 files changed

+39
-35
lines changed

front_end/panels/console/ConsoleViewMessage.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ describeWithMockConnection('ConsoleViewMessage', () => {
135135
const {message} = createConsoleViewMessageWithStubDeps(rawMessage);
136136
const messageElement = message.toMessageElement(); // Trigger rendering.
137137
const button = messageElement.querySelector('[aria-label=\'Understand this error. Powered by AI.\']');
138-
assert.strictEqual(button?.textContent, 'Understand this errorAI');
138+
assert.strictEqual(button?.textContent, 'Understand this error');
139139
});
140140

141141
it('does not show a hover button if the console message text is empty', () => {

front_end/panels/console/ConsoleViewMessage.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,7 +1458,7 @@ export class ConsoleViewMessage implements ConsoleViewportElement {
14581458
const icon = new IconButton.Icon.Icon();
14591459
icon.data = {
14601460
iconName: 'lightbulb-spark',
1461-
color: 'var(--sys-color-on-surface-subtle)',
1461+
color: 'var(--devtools-icon-color)',
14621462
width: '16px',
14631463
height: '16px',
14641464
};
@@ -1475,10 +1475,6 @@ export class ConsoleViewMessage implements ConsoleViewportElement {
14751475
const text = document.createElement('div');
14761476
text.innerText = this.getExplainLabel();
14771477
label.append(text);
1478-
const badge = document.createElement('div');
1479-
badge.classList.add('badge');
1480-
badge.innerText = i18n.i18n.lockedString('AI');
1481-
label.append(badge);
14821478
button.append(label);
14831479
button.classList.add('hover-button');
14841480
button.ariaLabel = this.#getExplainAriaLabel();

front_end/panels/console/consoleView.css

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -469,11 +469,6 @@
469469
margin-bottom: -5px;
470470
}
471471

472-
.console-message-badge {
473-
float: right;
474-
margin-left: 4px;
475-
}
476-
477472
.console-message-nowrap-below,
478473
.console-message-nowrap-below div,
479474
.console-message-nowrap-below span {
@@ -530,13 +525,13 @@ devtools-console-insight {
530525
--width: 24px;
531526

532527
align-items: center;
533-
background-color: var(--sys-color-cdt-base-container);
534528
border-radius: 50%;
535529
border: none;
536530
/* todo: extract to global styles and make it work with dark mode. */
537531
box-shadow: 0 1px 3px 1px rgb(0 0 0 / 15%), 0 1px 2px 0 rgb(0 0 0 / 30%); /* stylelint-disable-line plugin/use_theme_colors */
538532
box-sizing: border-box;
539-
color: var(--sys-color-on-surface);
533+
background-color: var(--sys-color-tonal-container);
534+
color: var(--sys-color-on-tonal-container);
540535
font: var(--sys-typescale-body4-medium);
541536
height: var(--width);
542537
justify-content: center;
@@ -551,6 +546,28 @@ devtools-console-insight {
551546
right: 6px;
552547
display: none;
553548
width: var(--width);
549+
z-index: 1;
550+
551+
.theme-with-dark-background & {
552+
border: 1px solid var(--sys-color-neutral-outline);
553+
background-color: var(--sys-color-primary);
554+
color: var(--sys-color-on-primary);
555+
}
556+
557+
& devtools-icon {
558+
box-sizing: border-box;
559+
flex-shrink: 0;
560+
height: var(--sys-size-8);
561+
min-height: var(--sys-size-8);
562+
min-width: var(--sys-size-8);
563+
width: var(--sys-size-8);
564+
565+
--devtools-icon-color: var(--sys-color-on-tonal-container);
566+
}
567+
568+
.theme-with-dark-background & devtools-icon {
569+
--devtools-icon-color: var(--sys-color-on-primary);
570+
}
554571
}
555572

556573
.hover-button:focus,
@@ -569,15 +586,6 @@ devtools-console-insight {
569586
outline-offset: 2px;
570587
}
571588

572-
.hover-button devtools-icon {
573-
box-sizing: border-box;
574-
flex-shrink: 0;
575-
height: 16px;
576-
min-height: 16px;
577-
min-width: 16px;
578-
width: 16px;
579-
}
580-
581589
.button-label {
582590
display: block;
583591
overflow: hidden;
@@ -589,17 +597,6 @@ devtools-console-insight {
589597
}
590598
}
591599

592-
.button-label .badge {
593-
background: linear-gradient(135deg, var(--sys-color-gradient-primary), var(--sys-color-gradient-tertiary));
594-
border-radius: var(--sys-size-3);
595-
font-size: 9px;
596-
font-weight: var(--ref-typeface-weight-bold);
597-
line-height: 9px;
598-
padding: var(--sys-size-3);
599-
margin-left: var(--sys-size-4);
600-
vertical-align: 0;
601-
}
602-
603600
.console-message-wrapper:not(.has-insight) {
604601
&:hover,
605602
&:focus,

front_end/ui/components/floating_button/floatingButton.css

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,33 @@
1717
position: relative;
1818
width: var(--sys-size-8);
1919
height: var(--sys-size-8);
20-
background-color: var(--sys-color-surface);
2120
box-shadow: var(--sys-elevation-level2);
2221
border-radius: var(--sys-shape-corner-extra-small);
2322
display: flex;
2423
justify-content: center;
2524
align-items: center;
2625

26+
:host-context(:not(.theme-with-dark-background)) & {
27+
background-color: var(--sys-color-tonal-container);
28+
}
29+
2730
:host-context(.theme-with-dark-background) & {
28-
border: 1px solid var(--sys-color-neutral-outline);
31+
background-color: var(--sys-color-primary);
2932
}
3033

3134
& .icon {
3235
width: var(--sys-size-7);
3336
height: var(--sys-size-7);
3437
}
3538

39+
:host-context(:not(.theme-with-dark-background)) & .icon {
40+
color: var(--sys-color-on-tonal-container);
41+
}
42+
43+
:host-context(.theme-with-dark-background) & .icon {
44+
color: var(--sys-color-on-primary);
45+
}
46+
3647
&:not(:disabled):hover::after,
3748
&:not(:disabled):hover::before {
3849
content: "";

0 commit comments

Comments
 (0)