Skip to content

Commit

Permalink
Backed out 2 changesets (bug 1876176) for causing node newtab failure…
Browse files Browse the repository at this point in the history
…s @ browser/components/aboutwelcome CLOSED TREE

Backed out changeset 4899c27af9c2 (bug 1876176)
Backed out changeset 9ae306e9577a (bug 1876176)
  • Loading branch information
Sandor Molnar committed Mar 21, 2024
1 parent ae2a98b commit f76d82b
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 547 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@

import React, { useEffect, useRef } from "react";

export const EmbeddedMigrationWizard = ({ handleAction, content }) => {
export const EmbeddedMigrationWizard = ({ handleAction }) => {
const ref = useRef();
const options = content.migration_wizard_options;
useEffect(() => {
const handleBeginMigration = () => {
handleAction({
Expand All @@ -33,29 +32,9 @@ export const EmbeddedMigrationWizard = ({ handleAction, content }) => {
}, []); // eslint-disable-line react-hooks/exhaustive-deps
return (
<migration-wizard
force-show-import-all={options?.force_show_import_all || "false"}
force-show-import-all="false"
auto-request-state=""
ref={ref}
option-expander-title-string={options?.option_expander_title_string || ""}
hide-option-expander-subtitle={
options?.hide_option_expander_subtitle || false
}
data-import-complete-success-string={
options?.data_import_complete_success_string || ""
}
selection-header-string={options?.selection_header_string || ""}
selection-subheader-string={options?.selection_subheader_string || ""}
hide-select-all={options?.hide_select_all || false}
checkbox-margin-inline={options?.checkbox_margin_inline || ""}
checkbox-margin-block={options?.checkbox_margin_block || ""}
import-button-string={options?.import_button_string || ""}
import-button-class={options?.import_button_class || ""}
header-font-size={options?.header_font_size || ""}
header-font-weight={options?.header_font_weight || ""}
header-margin-block={options?.header_margin_block || ""}
subheader-font-size={options?.subheader_font_size || ""}
subheader-font-weight={options?.subheader_font_weight || ""}
subheader-margin-block={options?.subheader_margin_block || ""}
></migration-wizard>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,7 @@ export class ProtonScreen extends React.PureComponent {
/>
) : null}
{content.tiles && content.tiles.type === "migration-wizard" ? (
<EmbeddedMigrationWizard
handleAction={this.props.handleAction}
content={content}
/>
<EmbeddedMigrationWizard handleAction={this.props.handleAction} />
) : null}
</React.Fragment>
);
Expand Down Expand Up @@ -545,12 +542,6 @@ export class ProtonScreen extends React.PureComponent {
content.width && content.position !== "split"
? content.width
: null,
paddingBlock: content.split_content_padding_block
? content.split_content_padding_block
: null,
paddingInline: content.split_content_padding_inline
? content.split_content_padding_inline
: null,
}}
>
{content.logo ? this.renderPicture(content.logo) : null}
Expand Down
31 changes: 5 additions & 26 deletions browser/components/aboutwelcome/content/aboutwelcome.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -1032,8 +1032,7 @@ class ProtonScreen extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCom
activeMultiSelect: this.props.activeMultiSelect,
setActiveMultiSelect: this.props.setActiveMultiSelect
}) : null, content.tiles && content.tiles.type === "migration-wizard" ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_EmbeddedMigrationWizard__WEBPACK_IMPORTED_MODULE_12__.EmbeddedMigrationWizard, {
handleAction: this.props.handleAction,
content: content
handleAction: this.props.handleAction
}) : null);
}
renderNoodles() {
Expand Down Expand Up @@ -1200,9 +1199,7 @@ class ProtonScreen extends (react__WEBPACK_IMPORTED_MODULE_0___default().PureCom
className: `main-content ${hideStepsIndicator ? "no-steps" : ""}`,
style: {
background: content.background && isCenterPosition ? content.background : null,
width: content.width && content.position !== "split" ? content.width : null,
paddingBlock: content.split_content_padding_block ? content.split_content_padding_block : null,
paddingInline: content.split_content_padding_inline ? content.split_content_padding_inline : null
width: content.width && content.position !== "split" ? content.width : null
}
}, content.logo ? this.renderPicture(content.logo) : null, isRtamo ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
className: "rtamo-icon"
Expand Down Expand Up @@ -2085,11 +2082,9 @@ __webpack_require__.r(__webpack_exports__);


const EmbeddedMigrationWizard = ({
handleAction,
content
handleAction
}) => {
const ref = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();
const options = content.migration_wizard_options;
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
const handleBeginMigration = () => {
handleAction({
Expand Down Expand Up @@ -2117,25 +2112,9 @@ const EmbeddedMigrationWizard = ({
};
}, []); // eslint-disable-line react-hooks/exhaustive-deps
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("migration-wizard", {
"force-show-import-all": options?.force_show_import_all || "false",
"force-show-import-all": "false",
"auto-request-state": "",
ref: ref,
"option-expander-title-string": options?.option_expander_title_string || "",
"hide-option-expander-subtitle": options?.hide_option_expander_subtitle || false,
"data-import-complete-success-string": options?.data_import_complete_success_string || "",
"selection-header-string": options?.selection_header_string || "",
"selection-subheader-string": options?.selection_subheader_string || "",
"hide-select-all": options?.hide_select_all || false,
"checkbox-margin-inline": options?.checkbox_margin_inline || "",
"checkbox-margin-block": options?.checkbox_margin_block || "",
"import-button-string": options?.import_button_string || "",
"import-button-class": options?.import_button_class || "",
"header-font-size": options?.header_font_size || "",
"header-font-weight": options?.header_font_weight || "",
"header-margin-block": options?.header_margin_block || "",
"subheader-font-size": options?.subheader_font_size || "",
"subheader-font-weight": options?.subheader_font_weight || "",
"subheader-margin-block": options?.subheader_margin_block || ""
ref: ref
});
};

Expand Down
151 changes: 12 additions & 139 deletions browser/components/migration/content/migration-wizard.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,20 @@ export class MigrationWizard extends HTMLElement {
<link rel="stylesheet" href="chrome://browser/skin/migration/migration-wizard.css">
<named-deck id="wizard-deck" selected-view="page-loading" aria-busy="true" part="deck">
<div name="page-loading">
<h1 class="migration-wizard-header" data-l10n-id="migration-wizard-selection-header" part="header"></h1>
<h1 data-l10n-id="migration-wizard-selection-header" part="header"></h1>
<div class="loading-block large"></div>
<div class="loading-block small"></div>
<div class="loading-block small"></div>
<moz-button-group class="buttons" part="buttons">
<!-- If possible, use the same button labels as the SELECTION page with the same strings.
That'll prevent flicker when the load state exits if we then enter the SELECTION page. -->
<button class="cancel-close" data-l10n-id="migration-cancel-button-label" disabled></button>
<button class="migration-import-button" data-l10n-id="migration-import-button-label" disabled></button>
<button data-l10n-id="migration-import-button-label" disabled></button>
</moz-button-group>
</div>
<div name="page-selection">
<h1 class="migration-wizard-header" data-l10n-id="migration-wizard-selection-header" part="header"></h1>
<p class="migration-wizard-subheader" part="subheader" hidden=""></p>
<h1 data-l10n-id="migration-wizard-selection-header" part="header"></h1>
<button id="browser-profile-selector" aria-haspopup="menu" aria-labelledby="migrator-name profile-name">
<span class="migrator-icon" role="img"></span>
<div class="migrator-description" role="presentation">
Expand Down Expand Up @@ -90,22 +89,22 @@ export class MigrationWizard extends HTMLElement {
<label id="select-all">
<input type="checkbox" class="select-all-checkbox"/><span data-l10n-id="migration-select-all-option-label"></span>
</label>
<label id="bookmarks" class="resource-type-label" data-resource-type="BOOKMARKS"/>
<label id="bookmarks" data-resource-type="BOOKMARKS"/>
<input type="checkbox"/><span default-data-l10n-id="migration-bookmarks-option-label" ie-edge-data-l10n-id="migration-favorites-option-label"></span>
</label>
<label id="logins-and-passwords" class="resource-type-label" data-resource-type="PASSWORDS">
<label id="logins-and-passwords" data-resource-type="PASSWORDS">
<input type="checkbox"/><span data-l10n-id="migration-passwords-option-label"></span>
</label>
<label id="history" class="resource-type-label" data-resource-type="HISTORY">
<label id="history" data-resource-type="HISTORY">
<input type="checkbox"/><span data-l10n-id="migration-history-option-label"></span>
</label>
<label id="extensions" class="resource-type-label" data-resource-type="EXTENSIONS">
<label id="extensions" data-resource-type="EXTENSIONS">
<input type="checkbox"/><span data-l10n-id="migration-extensions-option-label"></span>
</label>
<label id="form-autofill" class="resource-type-label" data-resource-type="FORMDATA">
<label id="form-autofill" data-resource-type="FORMDATA">
<input type="checkbox"/><span data-l10n-id="migration-form-autofill-option-label"></span>
</label>
<label id="payment-methods" class="resource-type-label" data-resource-type="PAYMENT_METHODS">
<label id="payment-methods" data-resource-type="PAYMENT_METHODS">
<input type="checkbox"/><span data-l10n-id="migration-payment-methods-option-label"></span>
</label>
</fieldset>
Expand All @@ -119,7 +118,7 @@ export class MigrationWizard extends HTMLElement {
<moz-button-group class="buttons" part="buttons">
<button class="cancel-close" data-l10n-id="migration-cancel-button-label"></button>
<button id="import-from-file" class="primary" data-l10n-id="migration-import-from-file-button-label"></button>
<button id="import" class="primary migration-import-button" data-l10n-id="migration-import-button-label"></button>
<button id="import" class="primary" data-l10n-id="migration-import-button-label"></button>
<button id="get-permissions" class="primary" data-l10n-id="migration-continue-button-label"></button>
</moz-button-group>
</div>
Expand Down Expand Up @@ -583,18 +582,6 @@ export class MigrationWizard extends HTMLElement {
"div[name='page-selection']"
);

if (this.hasAttribute("selection-header-string")) {
selectionPage.querySelector(".migration-wizard-header").textContent =
this.getAttribute("selection-header-string");
}

let selectionSubheaderString = this.getAttribute(
"selection-subheader-string"
);
let subheader = selectionPage.querySelector(".migration-wizard-subheader");
subheader.textContent = selectionSubheaderString;
subheader.toggleAttribute("hidden", !selectionSubheaderString);

let details = this.#shadowRoot.querySelector("details");

if (this.hasAttribute("force-show-import-all")) {
Expand All @@ -609,8 +596,6 @@ export class MigrationWizard extends HTMLElement {

this.#expandedDetails = false;

this.#applyContentCustomizations();

for (let migrator of state.migrators) {
let opt = document.createElement("panel-item");
opt.setAttribute("key", migrator.key);
Expand Down Expand Up @@ -835,20 +820,16 @@ export class MigrationWizard extends HTMLElement {

let migrationDone = remainingProgressGroups == 0;
let headerL10nID = "migration-wizard-progress-header";
let header = this.#shadowRoot.getElementById("progress-header");

if (migrationDone) {
if (totalWarnings) {
headerL10nID = "migration-wizard-progress-done-with-warnings-header";
} else if (this.getAttribute("data-import-complete-success-string")) {
header.textContent = this.getAttribute(
"data-import-complete-success-string"
);
} else {
headerL10nID = "migration-wizard-progress-done-header";
}
}

let header = this.#shadowRoot.getElementById("progress-header");
document.l10n.setAttributes(header, headerL10nID);

let finishButtons = progressPage.querySelectorAll(".finish-button");
Expand Down Expand Up @@ -1256,10 +1237,7 @@ export class MigrationWizard extends HTMLElement {
let importButton = this.#shadowRoot.querySelector("#import");
importButton.disabled = checkedResources == 0;

if (this.hasAttribute("option-expander-title-string")) {
let optionString = this.getAttribute("option-expander-title-string");
selectedDataHeader.textContent = optionString;
} else if (checkedResources == 0) {
if (checkedResources == 0) {
document.l10n.setAttributes(
selectedDataHeader,
"migration-no-selected-data-label"
Expand All @@ -1286,111 +1264,6 @@ export class MigrationWizard extends HTMLElement {
);
}

/**
* Updates content and layout to apply changes that are
* informed through element attributes
*/
#applyContentCustomizations() {
let selectionPage = this.#shadowRoot.querySelector(
"div[name='page-selection']"
);
if (this.hasAttribute("hide-select-all")) {
let hideSelectAll = this.getAttribute("hide-select-all");

selectionPage.toggleAttribute("hide-select-all", hideSelectAll);
} else {
selectionPage.removeAttribute("hide-select-all");
}

if (this.hasAttribute("import-button-string")) {
if (this.getAttribute("import-button-string")) {
this.#importButton.textContent = this.getAttribute(
"import-button-string"
);
}
}

if (this.hasAttribute("checkbox-margin-inline")) {
let inlineMargin = this.getAttribute("checkbox-margin-inline");
this.style.setProperty(
"--resource-type-label-margin-inline",
inlineMargin
);
}

if (this.hasAttribute("checkbox-margin-block")) {
let blockMargin = this.getAttribute("checkbox-margin-block");
this.style.setProperty("--resource-type-label-margin-block", blockMargin);
}

if (this.hasAttribute("import-button-class")) {
let importButtonClass = this.getAttribute("import-button-class");
if (importButtonClass) {
this.#importButton.classList.add(importButtonClass);
}
}

if (this.hasAttribute("header-font-size")) {
let headerFontSize = this.getAttribute("header-font-size");
if (headerFontSize) {
this.style.setProperty(
"--embedded-wizard-header-font-size",
headerFontSize
);
}
}

if (this.hasAttribute("header-font-weight")) {
let headerFontWeight = this.getAttribute("header-font-weight");
if (headerFontWeight) {
this.style.setProperty(
"--embedded-wizard-header-font-weight",
headerFontWeight
);
}
}

if (this.hasAttribute("header-margin-block")) {
let headerMarginBlock = this.getAttribute("header-margin-block");
if (headerMarginBlock) {
this.style.setProperty(
"--embedded-wizard-header-margin-block",
headerMarginBlock
);
}
}

if (this.hasAttribute("subheader-font-size")) {
let subheaderFontSize = this.getAttribute("subheader-font-size");
if (subheaderFontSize) {
this.style.setProperty(
"--embedded-wizard-subheader-font-size",
subheaderFontSize
);
}
}

if (this.hasAttribute("subheader-font-weight")) {
let subheaderFontWeight = this.getAttribute("subheader-font-weight");
if (subheaderFontWeight) {
this.style.setProperty(
"--embedded-wizard-subheader-font-weight",
subheaderFontWeight
);
}
}

if (this.hasAttribute("subheader-margin-block")) {
let subheaderMarginBlock = this.getAttribute("subheader-margin-block");
if (subheaderMarginBlock) {
this.style.setProperty(
"--embedded-wizard-subheader-margin-block",
subheaderMarginBlock
);
}
}
}

handleEvent(event) {
switch (event.type) {
case "click": {
Expand Down
Loading

0 comments on commit f76d82b

Please sign in to comment.