Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/visual-editor/src/main-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,8 @@ abstract class MainBase extends SignalWatcher(LitElement) {
this.tooltipRef.value.y = tooltipEvent.y;
this.tooltipRef.value.message = tooltipEvent.message;
this.tooltipRef.value.status = tooltipEvent.extendedOptions.status;
this.tooltipRef.value.isMultiLine =
tooltipEvent.extendedOptions?.isMultiLine || false;
this.tooltipRef.value.visible = true;
}

Expand Down
32 changes: 27 additions & 5 deletions packages/visual-editor/src/ui/elements/shell/header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ import { actionTrackerContext } from "../../contexts/action-tracker-context.js";
import { uiStateContext } from "../../contexts/ui-state.js";
import {
CloseEvent,
HideTooltipEvent,
OverflowMenuActionEvent,
ShareRequestedEvent,
ShowTooltipEvent,
SignOutEvent,
StateEvent,
} from "../../events/events.js";
Expand Down Expand Up @@ -326,13 +328,16 @@ export class VEHeader extends SignalWatcher(LitElement) {

#experiment {
display: none;
font-size: 11px;
line-height: 1;
padding: var(--bb-grid-size) var(--bb-grid-size-3);
font-size: 12px;
line-height: normal;
padding: 2px 6px;
border-radius: var(--bb-grid-size-16);
border: 1px solid light-dark(var(--n-0), var(--n-70));
text-transform: uppercase;
color: light-dark(var(--n-0), var(--n-70));
background-color: #ffecee;
color: #60150f;
font-weight: 500;
font-family: Google Sans Code;
}

#status {
Expand Down Expand Up @@ -644,7 +649,24 @@ export class VEHeader extends SignalWatcher(LitElement) {
#renderExperimentalLabel() {
return html`${Strings.from("PROVIDER_NAME") !== "PROVIDER_NAME" &&
Strings.from("PROVIDER_NAME") !== ""
? html`<span class="sans" id="experiment">Experiment</span>`
? html`<span
class="sans"
id="experiment"
@pointerover=${(evt: PointerEvent) => {
this.dispatchEvent(
new ShowTooltipEvent(
Strings.from("TEXT_EXPERIMENT_MODE"),
evt.clientX,
evt.clientY + 90,
{ status: false, isMultiLine: true }
)
);
}}
@pointerout=${() => {
this.dispatchEvent(new HideTooltipEvent());
}}
>Experiment mode</span
>`
: nothing}`;
}

Expand Down
14 changes: 14 additions & 0 deletions packages/visual-editor/src/ui/elements/tooltip/tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ export class Tooltip extends LitElement {
@property({ reflect: true })
accessor status: { title: string } | false = false;

@property({ reflect: true })
accessor isMultiLine: boolean = false;

#animationStartBound = this.#animationStart.bind(this);
#animationStart() {
// Force the setters to run *now* that the element has a non-zero size
Expand Down Expand Up @@ -127,6 +130,13 @@ export class Tooltip extends LitElement {
animation: none;
pointer-events: none;
white-space: nowrap;

.multiline {
p {
max-width: 170px;
white-space: pre-line !important;
}
}
}

:host(:not([status="false"])) {
Expand Down Expand Up @@ -182,6 +192,10 @@ export class Tooltip extends LitElement {
classes["md-body-small"] = true;
}

if (this.isMultiLine !== false) {
classes["multiline"] = true;
}

return html`<div class=${classMap(classes)} aria-live="polite">
${this.status !== false
? html`<h1 class="w-500 sans md-body-medium">${this.status.title}</h1>`
Expand Down
6 changes: 5 additions & 1 deletion packages/visual-editor/src/ui/events/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,12 @@ export class ShowTooltipEvent extends Event {
public readonly message: string,
public readonly x: number,
public readonly y: number,
public readonly extendedOptions: { status: { title: string } | false } = {
public readonly extendedOptions: {
status: { title: string } | false;
isMultiLine?: boolean;
} = {
status: false,
isMultiLine: false,
}
) {
super(ShowTooltipEvent.eventName, { ...eventInit });
Expand Down
3 changes: 3 additions & 0 deletions packages/visual-editor/src/ui/strings/en_US/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,4 +297,7 @@ export default {
TEXT_WARM_WELCOME_EMAIL_UPDATES: {
str: "Let us know if you’d like to be involved with future research studies or hear about the latest and greatest from Opal!",
},
TEXT_EXPERIMENT_MODE: {
str: "Experiment is a beta feature.\nYou have 3 experiments on.\nTo deactivate, go to settings.",
},
} as LanguagePackEntry;