Skip to content

Commit

Permalink
Show stats card in products table when large card isnt shown (Automat…
Browse files Browse the repository at this point in the history
…tic#36136)

* Show small stats card when large one is not shown

* changelog
  • Loading branch information
CodeyGuyDylan authored Mar 8, 2024
1 parent 661a2dc commit 22f288b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ const GlobalNotice = ( { message, options } ) => {
export default function MyJetpackScreen() {
useConnectionWatcher();
const { hasBeenDismissed = false } = getMyJetpackWindowState( 'welcomeBanner' );
const { showJetpackStatsCard = false } = getMyJetpackWindowState( 'myJetpackFlags' );
const { showFullJetpackStatsCard = false } = getMyJetpackWindowState( 'myJetpackFlags' );
const { jetpackManage = {}, adminUrl } = getMyJetpackWindowState();

const { currentNotice } = useContext( NoticeContext );
Expand Down Expand Up @@ -163,7 +163,7 @@ export default function MyJetpackScreen() {
{ message && ( hasBeenDismissed || ! isNewUser ) && (
<Col>{ <GlobalNotice message={ message } options={ options } /> }</Col>
) }
{ showJetpackStatsCard && (
{ showFullJetpackStatsCard && (
<Col
className={ classnames( {
[ styles.stats ]: statsDetails?.status !== PRODUCT_STATUSES.ERROR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import CrmCard from './crm-card';
import ProtectCard from './protect-card';
import SearchCard from './search-card';
import SocialCard from './social-card';
import StatsCard from './stats-card';
import styles from './style.module.scss';
import VideopressCard from './videopress-card';

Expand All @@ -20,6 +21,7 @@ import VideopressCard from './videopress-card';
*/
const ProductCardsSection = () => {
const { isAtomic = false, userIsAdmin = false } = getMyJetpackWindowState();
const { showFullJetpackStatsCard = false } = getMyJetpackWindowState( 'myJetpackFlags' );

const items = {
backups: BackupCard,
Expand All @@ -28,7 +30,8 @@ const ProductCardsSection = () => {
boost: BoostCard,
search: SearchCard,
videopress: VideopressCard,
// Stats card is shown in the <StatsSection/> component.
// If we aren't showing the big stats card, we show the smaller one with the rest.
stats: ! showFullJetpackStatsCard ? StatsCard : null,
crm: CrmCard,
creator: ! isAtomic ? CreatorCard : null,
social: SocialCard,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Show small stats card in table if large stats card isn't showing
2 changes: 1 addition & 1 deletion projects/packages/my-jetpack/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface Window {
loadAddLicenseScreen: string;
myJetpackCheckoutUri: string;
myJetpackFlags: {
showJetpackStatsCard: boolean;
showFullJetpackStatsCard: boolean;
videoPressStats: boolean;
};
lifecycleStats: {
Expand Down
4 changes: 2 additions & 2 deletions projects/packages/my-jetpack/src/class-initializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,8 @@ public static function is_user_from_known_host() {
*/
public static function get_my_jetpack_flags() {
$flags = array(
'videoPressStats' => Jetpack_Constants::is_true( 'JETPACK_MY_JETPACK_VIDEOPRESS_STATS_ENABLED' ),
'showJetpackStatsCard' => class_exists( 'Jetpack' ),
'videoPressStats' => Jetpack_Constants::is_true( 'JETPACK_MY_JETPACK_VIDEOPRESS_STATS_ENABLED' ),
'showFullJetpackStatsCard' => class_exists( 'Jetpack' ),
);

return $flags;
Expand Down

0 comments on commit 22f288b

Please sign in to comment.