Skip to content

Commit 703f9de

Browse files
maxxcrawfordnina-py
authored andcommitted
Bug 2054599 - Update default widget registry order so POTD widget is first r=nina-py
Differential Revision: https://phabricator.services.mozilla.com/D311959
1 parent d0cda84 commit 703f9de

3 files changed

Lines changed: 57 additions & 57 deletions

File tree

browser/extensions/newtab/common/WidgetsRegistry.mjs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,27 @@ export const PREF_WIDGETS_SYSTEM_PICTURE_OF_THE_DAY_ENABLED =
133133

134134
/** @type {WidgetRegistryEntry[]} */
135135
export const WIDGET_REGISTRY = [
136+
{
137+
id: "pictureOfTheDay",
138+
telemetryName: "picture_of_the_day",
139+
order: 0,
140+
enabledPref: PREF_WIDGETS_PICTURE_OF_THE_DAY_ENABLED,
141+
sizePref: PREF_PICTURE_OF_THE_DAY_SIZE,
142+
defaultSize: "medium",
143+
validSizes: ["medium", "large"],
144+
hasSidebar: false,
145+
systemEnabledPref: PREF_WIDGETS_SYSTEM_PICTURE_OF_THE_DAY_ENABLED,
146+
trainhopEnabledKey: "pictureOfTheDayEnabled",
147+
trainhopSizeKey: "pictureOfTheDaySize",
148+
trainhopSidebarKey: null,
149+
widgetsSettingsVisibleKey: "pictureOfTheDayVisible",
150+
widgetsSettingsEnabledKey: "pictureOfTheDayEnabled",
151+
trainhopNamespace: "widgetPictureOfTheDay",
152+
},
136153
{
137154
id: "sportsWidget",
138155
telemetryName: "sports",
139-
order: 0,
156+
order: 1,
140157
enabledPref: PREF_WIDGETS_SPORTS_WIDGET_ENABLED,
141158
sizePref: PREF_SPORTS_WIDGET_SIZE,
142159
defaultSize: "medium",
@@ -152,7 +169,7 @@ export const WIDGET_REGISTRY = [
152169
{
153170
id: "clocks",
154171
telemetryName: "clocks",
155-
order: 1,
172+
order: 2,
156173
enabledPref: PREF_WIDGETS_CLOCKS_ENABLED,
157174
sizePref: PREF_CLOCKS_SIZE,
158175
defaultSize: "medium",
@@ -168,7 +185,7 @@ export const WIDGET_REGISTRY = [
168185
{
169186
id: "lists",
170187
telemetryName: "lists",
171-
order: 2,
188+
order: 3,
172189
enabledPref: PREF_WIDGETS_LISTS_ENABLED,
173190
sizePref: PREF_LISTS_SIZE,
174191
defaultSize: "medium",
@@ -184,7 +201,7 @@ export const WIDGET_REGISTRY = [
184201
{
185202
id: "focusTimer",
186203
telemetryName: "focus_timer",
187-
order: 3,
204+
order: 4,
188205
enabledPref: PREF_WIDGETS_TIMER_ENABLED,
189206
sizePref: PREF_FOCUS_TIMER_SIZE,
190207
defaultSize: "medium",
@@ -200,7 +217,7 @@ export const WIDGET_REGISTRY = [
200217
{
201218
id: "weather",
202219
telemetryName: "weather",
203-
order: 4,
220+
order: 5,
204221
enabledPref: PREF_WIDGETS_WEATHER_ENABLED,
205222
sizePref: PREF_WEATHER_SIZE,
206223
defaultSize: "small",
@@ -216,7 +233,7 @@ export const WIDGET_REGISTRY = [
216233
{
217234
id: "privacy",
218235
telemetryName: "privacy",
219-
order: 5,
236+
order: 6,
220237
enabledPref: PREF_WIDGETS_PRIVACY_ENABLED,
221238
sizePref: PREF_PRIVACY_SIZE,
222239
defaultSize: "medium",
@@ -232,7 +249,7 @@ export const WIDGET_REGISTRY = [
232249
{
233250
id: "crossword",
234251
telemetryName: "crossword",
235-
order: 6,
252+
order: 7,
236253
enabledPref: PREF_WIDGETS_CROSSWORD_ENABLED,
237254
sizePref: PREF_CROSSWORD_SIZE,
238255
defaultSize: "medium",
@@ -248,7 +265,7 @@ export const WIDGET_REGISTRY = [
248265
{
249266
id: "stocks",
250267
telemetryName: "stocks",
251-
order: 7,
268+
order: 8,
252269
enabledPref: PREF_WIDGETS_STOCKS_ENABLED,
253270
sizePref: PREF_STOCKS_SIZE,
254271
defaultSize: "medium",
@@ -261,23 +278,6 @@ export const WIDGET_REGISTRY = [
261278
widgetsSettingsVisibleKey: "stocksVisible",
262279
widgetsSettingsEnabledKey: "stocksEnabled",
263280
},
264-
{
265-
id: "pictureOfTheDay",
266-
telemetryName: "picture_of_the_day",
267-
order: 8,
268-
enabledPref: PREF_WIDGETS_PICTURE_OF_THE_DAY_ENABLED,
269-
sizePref: PREF_PICTURE_OF_THE_DAY_SIZE,
270-
defaultSize: "medium",
271-
validSizes: ["medium", "large"],
272-
hasSidebar: false,
273-
systemEnabledPref: PREF_WIDGETS_SYSTEM_PICTURE_OF_THE_DAY_ENABLED,
274-
trainhopEnabledKey: "pictureOfTheDayEnabled",
275-
trainhopSizeKey: "pictureOfTheDaySize",
276-
trainhopSidebarKey: null,
277-
widgetsSettingsVisibleKey: "pictureOfTheDayVisible",
278-
widgetsSettingsEnabledKey: "pictureOfTheDayEnabled",
279-
trainhopNamespace: "widgetPictureOfTheDay",
280-
},
281281
];
282282

283283
/**

browser/extensions/newtab/data/content/activity-stream.bundle.js

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13219,10 +13219,27 @@ const PREF_WIDGETS_SYSTEM_PICTURE_OF_THE_DAY_ENABLED =
1321913219

1322013220
/** @type {WidgetRegistryEntry[]} */
1322113221
const WIDGET_REGISTRY = [
13222+
{
13223+
id: "pictureOfTheDay",
13224+
telemetryName: "picture_of_the_day",
13225+
order: 0,
13226+
enabledPref: PREF_WIDGETS_PICTURE_OF_THE_DAY_ENABLED,
13227+
sizePref: PREF_PICTURE_OF_THE_DAY_SIZE,
13228+
defaultSize: "medium",
13229+
validSizes: ["medium", "large"],
13230+
hasSidebar: false,
13231+
systemEnabledPref: PREF_WIDGETS_SYSTEM_PICTURE_OF_THE_DAY_ENABLED,
13232+
trainhopEnabledKey: "pictureOfTheDayEnabled",
13233+
trainhopSizeKey: "pictureOfTheDaySize",
13234+
trainhopSidebarKey: null,
13235+
widgetsSettingsVisibleKey: "pictureOfTheDayVisible",
13236+
widgetsSettingsEnabledKey: "pictureOfTheDayEnabled",
13237+
trainhopNamespace: "widgetPictureOfTheDay",
13238+
},
1322213239
{
1322313240
id: "sportsWidget",
1322413241
telemetryName: "sports",
13225-
order: 0,
13242+
order: 1,
1322613243
enabledPref: PREF_WIDGETS_SPORTS_WIDGET_ENABLED,
1322713244
sizePref: PREF_SPORTS_WIDGET_SIZE,
1322813245
defaultSize: "medium",
@@ -13238,7 +13255,7 @@ const WIDGET_REGISTRY = [
1323813255
{
1323913256
id: "clocks",
1324013257
telemetryName: "clocks",
13241-
order: 1,
13258+
order: 2,
1324213259
enabledPref: PREF_WIDGETS_CLOCKS_ENABLED,
1324313260
sizePref: PREF_CLOCKS_SIZE,
1324413261
defaultSize: "medium",
@@ -13254,7 +13271,7 @@ const WIDGET_REGISTRY = [
1325413271
{
1325513272
id: "lists",
1325613273
telemetryName: "lists",
13257-
order: 2,
13274+
order: 3,
1325813275
enabledPref: PREF_WIDGETS_LISTS_ENABLED,
1325913276
sizePref: PREF_LISTS_SIZE,
1326013277
defaultSize: "medium",
@@ -13270,7 +13287,7 @@ const WIDGET_REGISTRY = [
1327013287
{
1327113288
id: "focusTimer",
1327213289
telemetryName: "focus_timer",
13273-
order: 3,
13290+
order: 4,
1327413291
enabledPref: PREF_WIDGETS_TIMER_ENABLED,
1327513292
sizePref: PREF_FOCUS_TIMER_SIZE,
1327613293
defaultSize: "medium",
@@ -13286,7 +13303,7 @@ const WIDGET_REGISTRY = [
1328613303
{
1328713304
id: "weather",
1328813305
telemetryName: "weather",
13289-
order: 4,
13306+
order: 5,
1329013307
enabledPref: PREF_WIDGETS_WEATHER_ENABLED,
1329113308
sizePref: PREF_WEATHER_SIZE,
1329213309
defaultSize: "small",
@@ -13302,7 +13319,7 @@ const WIDGET_REGISTRY = [
1330213319
{
1330313320
id: "privacy",
1330413321
telemetryName: "privacy",
13305-
order: 5,
13322+
order: 6,
1330613323
enabledPref: PREF_WIDGETS_PRIVACY_ENABLED,
1330713324
sizePref: PREF_PRIVACY_SIZE,
1330813325
defaultSize: "medium",
@@ -13318,7 +13335,7 @@ const WIDGET_REGISTRY = [
1331813335
{
1331913336
id: "crossword",
1332013337
telemetryName: "crossword",
13321-
order: 6,
13338+
order: 7,
1332213339
enabledPref: PREF_WIDGETS_CROSSWORD_ENABLED,
1332313340
sizePref: PREF_CROSSWORD_SIZE,
1332413341
defaultSize: "medium",
@@ -13334,7 +13351,7 @@ const WIDGET_REGISTRY = [
1333413351
{
1333513352
id: "stocks",
1333613353
telemetryName: "stocks",
13337-
order: 7,
13354+
order: 8,
1333813355
enabledPref: PREF_WIDGETS_STOCKS_ENABLED,
1333913356
sizePref: PREF_STOCKS_SIZE,
1334013357
defaultSize: "medium",
@@ -13347,23 +13364,6 @@ const WIDGET_REGISTRY = [
1334713364
widgetsSettingsVisibleKey: "stocksVisible",
1334813365
widgetsSettingsEnabledKey: "stocksEnabled",
1334913366
},
13350-
{
13351-
id: "pictureOfTheDay",
13352-
telemetryName: "picture_of_the_day",
13353-
order: 8,
13354-
enabledPref: PREF_WIDGETS_PICTURE_OF_THE_DAY_ENABLED,
13355-
sizePref: PREF_PICTURE_OF_THE_DAY_SIZE,
13356-
defaultSize: "medium",
13357-
validSizes: ["medium", "large"],
13358-
hasSidebar: false,
13359-
systemEnabledPref: PREF_WIDGETS_SYSTEM_PICTURE_OF_THE_DAY_ENABLED,
13360-
trainhopEnabledKey: "pictureOfTheDayEnabled",
13361-
trainhopSizeKey: "pictureOfTheDaySize",
13362-
trainhopSidebarKey: null,
13363-
widgetsSettingsVisibleKey: "pictureOfTheDayVisible",
13364-
widgetsSettingsEnabledKey: "pictureOfTheDayEnabled",
13365-
trainhopNamespace: "widgetPictureOfTheDay",
13366-
},
1336713367
];
1336813368

1336913369
/**

browser/extensions/newtab/test/jest/content-src/components/Widgets/WidgetsRegistry.test.jsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,36 +108,36 @@ describe("getWidgetOrder", () => {
108108
"clocks",
109109
"privacy",
110110
"crossword",
111-
"stocks",
112111
"pictureOfTheDay",
112+
"stocks",
113113
]);
114114
});
115115

116116
it("appends missing registry IDs after saved ones", () => {
117117
expect(getWidgetOrder("weather")).toEqual([
118118
"weather",
119+
"pictureOfTheDay",
119120
"sportsWidget",
120121
"clocks",
121122
"lists",
122123
"focusTimer",
123124
"privacy",
124125
"crossword",
125126
"stocks",
126-
"pictureOfTheDay",
127127
]);
128128
});
129129

130130
it("filters out unknown IDs from the saved pref", () => {
131131
expect(getWidgetOrder("unknownWidget,lists,weather")).toEqual([
132132
"lists",
133133
"weather",
134+
"pictureOfTheDay",
134135
"sportsWidget",
135136
"clocks",
136137
"focusTimer",
137138
"privacy",
138139
"crossword",
139140
"stocks",
140-
"pictureOfTheDay",
141141
]);
142142
});
143143

@@ -152,13 +152,13 @@ describe("getWidgetOrder", () => {
152152
expect(result).toEqual([
153153
"focusTimer",
154154
"lists",
155+
"pictureOfTheDay",
155156
"sportsWidget",
156157
"clocks",
157158
"weather",
158159
"privacy",
159160
"crossword",
160161
"stocks",
161-
"pictureOfTheDay",
162162
]);
163163
expect(result.length).toBe(registryIds.length);
164164
});
@@ -178,12 +178,12 @@ describe("resolveWidgetOrder", () => {
178178
"weather",
179179
"lists",
180180
"focusTimer",
181+
"pictureOfTheDay",
181182
"sportsWidget",
182183
"clocks",
183184
"privacy",
184185
"crossword",
185186
"stocks",
186-
"pictureOfTheDay",
187187
]);
188188
});
189189

@@ -197,12 +197,12 @@ describe("resolveWidgetOrder", () => {
197197
"focusTimer",
198198
"weather",
199199
"lists",
200+
"pictureOfTheDay",
200201
"sportsWidget",
201202
"clocks",
202203
"privacy",
203204
"crossword",
204205
"stocks",
205-
"pictureOfTheDay",
206206
]);
207207
});
208208

@@ -216,12 +216,12 @@ describe("resolveWidgetOrder", () => {
216216
"lists",
217217
"focusTimer",
218218
"weather",
219+
"pictureOfTheDay",
219220
"sportsWidget",
220221
"clocks",
221222
"privacy",
222223
"crossword",
223224
"stocks",
224-
"pictureOfTheDay",
225225
]);
226226
});
227227
});

0 commit comments

Comments
 (0)