forked from RocketChat/Rocket.Chat.Electron
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added new reducer & selectors to handle the new "Always start a…
…t home page" setting (RocketChat#2532)
- Loading branch information
Showing
3 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import type { Reducer } from 'redux'; | ||
|
||
import { APP_SETTINGS_LOADED } from '../../app/actions'; | ||
import type { ActionOf } from '../../store/actions'; | ||
import { SETTINGS_SET_DO_ALWAYS_START_AT_HOME_PAGE_CHANGED } from '../actions'; | ||
|
||
type DoAlwaysStartAtHomePageEnabledAction = ActionOf< | ||
typeof SETTINGS_SET_DO_ALWAYS_START_AT_HOME_PAGE_CHANGED | ||
>; | ||
|
||
export const doAlwaysStartAtHomePage: Reducer< | ||
boolean, | ||
DoAlwaysStartAtHomePageEnabledAction | ActionOf<typeof APP_SETTINGS_LOADED> | ||
> = (state = true, action) => { | ||
switch (action.type) { | ||
case APP_SETTINGS_LOADED: | ||
return Boolean(action.payload.doAlwaysStartAtHomePage); | ||
case SETTINGS_SET_DO_ALWAYS_START_AT_HOME_PAGE_CHANGED: { | ||
return action.payload; | ||
} | ||
default: | ||
return state; | ||
} | ||
}; |