Bug 1589248 - merging 2 hardcoded layouts into 1 r=thecount

Differential Revision: https://phabricator.services.mozilla.com/D63932

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Gavin Lazar Suntop 2020-02-24 22:19:47 +00:00
Родитель 85e0ffced3
Коммит d68d8d46d6
1 изменённых файлов: 106 добавлений и 221 удалений

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

@ -1749,10 +1749,10 @@ this.DiscoveryStreamFeed = class DiscoveryStreamFeed {
// This function generates a hardcoded layout each call. // This function generates a hardcoded layout each call.
// This is because modifying the original object would // This is because modifying the original object would
// persist across pref changes and system_tick updates. // persist across pref changes and system_tick updates.
getHardcodedLayout = basic => { //
if (basic) { // NOTE: There is some branching logic in the template based on `isBasicLayout`
// Hardcoded version of layout_variant `basic` //
return { getHardcodedLayout = isBasicLayout => ({
lastUpdate: Date.now(), lastUpdate: Date.now(),
spocs: { spocs: {
url: "https://spocs.getpocket.com/spocs", url: "https://spocs.getpocket.com/spocs",
@ -1794,119 +1794,7 @@ getHardcodedLayout = basic => {
{ {
type: "CardGrid", type: "CardGrid",
properties: { properties: {
items: 3, items: isBasicLayout ? 3 : 21,
},
header: {
title: "",
},
feed: {
embed_reference: null,
url:
"https://getpocket.cdn.mozilla.net/v3/firefox/global-recs?version=3&consumer_key=$apiKey&locale_lang=$locale",
},
spocs: {
probability: 1,
positions: [
{
index: 2,
},
],
},
},
{
type: "Navigation",
properties: {
alignment: "left-align",
links: [
{
name: "Must Reads",
url:
"https://getpocket.com/explore/must-reads?src=fx_new_tab",
},
{
name: "Productivity",
url:
"https://getpocket.com/explore/productivity?src=fx_new_tab",
},
{
name: "Health",
url: "https://getpocket.com/explore/health?src=fx_new_tab",
},
{
name: "Finance",
url: "https://getpocket.com/explore/finance?src=fx_new_tab",
},
{
name: "Technology",
url:
"https://getpocket.com/explore/technology?src=fx_new_tab",
},
{
name: "More Recommendations ",
url:
"https://getpocket.com/explore/trending?src=fx_new_tab",
},
],
},
},
],
},
],
};
}
// Hardcoded version of layout_variant `3-col-7-row-octr`
return {
lastUpdate: Date.now(),
spocs: {
url: "https://spocs.getpocket.com/spocs",
spocs_per_domain: 1,
},
layout: [
{
width: 12,
components: [
{
type: "TopSites",
header: {
title: {
id: "newtab-section-header-topsites",
},
},
},
],
},
{
width: 12,
components: [
{
type: "Message",
header: {
title: {
id: "newtab-section-header-pocket",
values: { provider: "Pocket" },
},
subtitle: "",
link_text: {
id: "newtab-pocket-learn-more",
},
link_url: "https://getpocket.com/firefox/new_tab_learn_more",
icon:
"resource://activity-stream/data/content/assets/glyph-pocket-16.svg",
},
properties: {},
styles: {
".ds-message": "margin-bottom: -20px",
},
},
],
},
{
width: 12,
components: [
{
type: "CardGrid",
properties: {
items: 21,
}, },
header: { header: {
title: "", title: "",
@ -1941,8 +1829,7 @@ getHardcodedLayout = basic => {
links: [ links: [
{ {
name: "Must Reads", name: "Must Reads",
url: url: "https://getpocket.com/explore/must-reads?src=fx_new_tab",
"https://getpocket.com/explore/must-reads?src=fx_new_tab",
}, },
{ {
name: "Productivity", name: "Productivity",
@ -1959,8 +1846,7 @@ getHardcodedLayout = basic => {
}, },
{ {
name: "Technology", name: "Technology",
url: url: "https://getpocket.com/explore/technology?src=fx_new_tab",
"https://getpocket.com/explore/technology?src=fx_new_tab",
}, },
{ {
name: "More Recommendations ", name: "More Recommendations ",
@ -1980,7 +1866,6 @@ getHardcodedLayout = basic => {
], ],
}, },
], ],
}; });
};
const EXPORTED_SYMBOLS = ["DiscoveryStreamFeed"]; const EXPORTED_SYMBOLS = ["DiscoveryStreamFeed"];