-
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.
Theme Tiers: Switching away from a theme requires confirmation (#99109)
* We now require explicit confirmation that the user understands that by switching away from a theme that has changed the required plan he will not be able to switch back without upgrading * Added the active theme id to the accept and decline events * updated message shown to the user * Refactored the isThemeAllowedOnSite to a selector * Fixed argument order * Exported selector in index file * Update client/state/themes/selectors/is-theme-allowed-on-site.ts Co-authored-by: Miguel Torres <[email protected]> * Centered the checkbox with respect to the text * Improved messaging around why the user can not switch back to the active theme * We now show the checked icon when checking the checkbox --------- Co-authored-by: Miguel Torres <[email protected]>
- Loading branch information
Showing
5 changed files
with
95 additions
and
21 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,12 @@ | ||
import siteHasFeature from 'calypso/state/selectors/site-has-feature'; | ||
import { getThemeTierForTheme } from 'calypso/state/themes/selectors'; | ||
import { IAppState } from 'calypso/state/types'; | ||
|
||
export function isThemeAllowedOnSite( state: IAppState, siteId: number | null, themeId: string ) { | ||
const themeTier = getThemeTierForTheme( state, themeId ); | ||
const features = themeTier?.featureList ?? [ themeTier?.feature ]; | ||
|
||
return features.some( | ||
( feature: string | null | undefined ) => ! feature || siteHasFeature( state, siteId, feature ) | ||
); | ||
} |