Skip to content

Commit

Permalink
Rename slug prop to productSlug, for more context.
Browse files Browse the repository at this point in the history
  • Loading branch information
elliottprogrammer committed Dec 20, 2024
1 parent a1d51a7 commit b70b4b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import styles from './style.module.scss';
import type { FC } from 'react';

interface StatusProps {
slug: JetpackModule;
productSlug: JetpackModule;
status: ProductStatus;
isFetching: boolean;
isInstallingStandalone: boolean;
Expand Down Expand Up @@ -59,7 +59,7 @@ const getStatusLabel: StatusStateFunction = ( slug, status, isOwned ) => {
}
};

const getStatusClassName: StatusStateFunction = ( slug, status, isOwned ) => {
const getStatusClassName: StatusStateFunction = ( productSlug, status, isOwned ) => {
switch ( status ) {
case PRODUCT_STATUSES.ACTIVE:
case PRODUCT_STATUSES.CAN_UPGRADE:
Expand All @@ -82,12 +82,12 @@ const getStatusClassName: StatusStateFunction = ( slug, status, isOwned ) => {
* status (it means threats have been detected), we still want to show the card
* status as 'Active'.
*/
if ( slug === 'protect' ) {
if ( productSlug === 'protect' ) {
return styles.active;
}
return styles.warning;
case PRODUCT_STATUSES.NEEDS_ATTENTION__ERROR:
if ( slug === 'protect' ) {
if ( productSlug === 'protect' ) {
return styles.active;
}
return styles.error;
Expand All @@ -97,14 +97,14 @@ const getStatusClassName: StatusStateFunction = ( slug, status, isOwned ) => {
};

const Status: FC< StatusProps > = ( {
slug,
productSlug,
status,
isFetching,
isInstallingStandalone,
isOwned,
} ) => {
const flagLabel = getStatusLabel( slug, status, isOwned );
const statusClassName = clsx( styles.status, getStatusClassName( slug, status, isOwned ), {
const flagLabel = getStatusLabel( productSlug, status, isOwned );
const statusClassName = clsx( styles.status, getStatusClassName( productSlug, status, isOwned ), {
[ styles[ 'is-fetching' ] ]: isFetching || isInstallingStandalone,
} );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ public static function get_status() {
$status = Products::STATUS_USER_CONNECTION_ERROR;
} elseif ( static::has_paid_plan_for_product() ) {
$needs_attention = static::does_module_need_attention();
if ( ! empty( $needs_attention ) ) {
if ( ! empty( $needs_attention ) && is_array( $needs_attention ) ) {
$status = Products::STATUS_NEEDS_ATTENTION__WARNING;
if ( isset( $needs_attention['type'] ) && 'error' === $needs_attention['type'] ) {
$status = Products::STATUS_NEEDS_ATTENTION__ERROR;
Expand Down

0 comments on commit b70b4b5

Please sign in to comment.