-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add: App Banner Visibility state - hide banner in sidebar and post er…
…ror views (#56772) * AppBannerVisibility: Add UI Selectors, reducers and actions * AppBannerVisibility: Add to the App Banner Component * AppBannerVisibility: Update reader Sidebar Hide the app banner when the sidebar is open * AppBannerVisibility: Update the single post App banner visibility do not show the App Banner if the post is_error * Update to use state and new names * Use getCurrentLayoutFocus selector * Try to refresh the banner state if we have post state has changed. * Only run the call if the post is loaded. * Fixup the app banner update logic Co-authored-by: Jarda Snajdr <[email protected]>
- Loading branch information
Showing
9 changed files
with
66 additions
and
2 deletions.
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
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,17 @@ | ||
import { APP_BANNER_TOGGLE_VISIBILITY } from 'calypso/state/action-types'; | ||
|
||
import 'calypso/state/ui/init'; | ||
|
||
/** | ||
* Hide the AppBanner. | ||
* | ||
* @returns {object} Action object | ||
*/ | ||
export const disableAppBanner = () => ( { type: APP_BANNER_TOGGLE_VISIBILITY, isVisible: false } ); | ||
|
||
/** | ||
* Show the AppBanner. | ||
* | ||
* @returns {object} Action object | ||
*/ | ||
export const enableAppBanner = () => ( { type: APP_BANNER_TOGGLE_VISIBILITY, isVisible: true } ); |
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,4 @@ | ||
import { APP_BANNER_TOGGLE_VISIBILITY } from 'calypso/state/action-types'; | ||
|
||
export default ( state = true, { type, isVisible } ) => | ||
type === APP_BANNER_TOGGLE_VISIBILITY ? isVisible : state; |
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,8 @@ | ||
import 'calypso/state/ui/init'; | ||
import { getCurrentLayoutFocus } from 'calypso/state/ui/layout-focus/selectors'; | ||
|
||
export default function isAppBannerEnabled( state ) { | ||
// since on mobile the sidebar layout focus take up the whole "Page" we never want to show the App Banner | ||
// when the side bar in in focus. | ||
return state.ui.appBannerVisibility && getCurrentLayoutFocus( state ) !== 'sidebar'; | ||
} |
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