From a90a5cba08fdf6c0ceb95101c275108a152a3aed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:35:37 +0200 Subject: Merging upstream version 127.0. Signed-off-by: Daniel Baumann --- browser/components/newtab/common/Reducers.sys.mjs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'browser/components/newtab/common/Reducers.sys.mjs') diff --git a/browser/components/newtab/common/Reducers.sys.mjs b/browser/components/newtab/common/Reducers.sys.mjs index 326217538d..edd3668434 100644 --- a/browser/components/newtab/common/Reducers.sys.mjs +++ b/browser/components/newtab/common/Reducers.sys.mjs @@ -104,6 +104,12 @@ export const INITIAL_STATE = { Wallpapers: { wallpaperList: [], }, + Weather: { + // do we have the data from WeatherFeed yet? + initialized: false, + suggestions: [], + lastUpdated: null, + }, }; function App(prevState = INITIAL_STATE.App, action) { @@ -853,6 +859,20 @@ function Wallpapers(prevState = INITIAL_STATE.Wallpapers, action) { } } +function Weather(prevState = INITIAL_STATE.Weather, action) { + switch (action.type) { + case at.WEATHER_UPDATE: + return { + ...prevState, + suggestions: action.data.suggestions, + lastUpdated: action.data.date, + initialized: true, + }; + default: + return prevState; + } +} + export const reducers = { TopSites, App, @@ -865,4 +885,5 @@ export const reducers = { DiscoveryStream, Search, Wallpapers, + Weather, }; -- cgit v1.2.3