Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add value to inactive state of VideoPress #38748

Merged
merged 35 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
de372d3
Update inactive state for videopress card
CodeyGuyDylan Aug 6, 2024
2547376
Update composer for plugins using My Jetpack
CodeyGuyDylan Aug 6, 2024
69645be
changelog
CodeyGuyDylan Aug 6, 2024
da7d827
Update changelog
CodeyGuyDylan Aug 6, 2024
6c4d3f7
Fixup project versions
CodeyGuyDylan Aug 6, 2024
e339c8c
Fixup project version
CodeyGuyDylan Aug 6, 2024
998122f
Fix class_exsists check
CodeyGuyDylan Aug 6, 2024
90ce328
lockfiles
CodeyGuyDylan Aug 6, 2024
38cdfad
Fix composer json file
CodeyGuyDylan Aug 6, 2024
939db2c
Remove import of videopress package
CodeyGuyDylan Aug 6, 2024
bb9b9b5
Remove composer updates
CodeyGuyDylan Aug 6, 2024
26f8d35
Update product card component type name
CodeyGuyDylan Aug 7, 2024
c4223dc
Introduct product slug constants
CodeyGuyDylan Aug 7, 2024
9896c0c
Return null for descripion if description text is null
CodeyGuyDylan Aug 7, 2024
b8b6ff2
optimize scss margin
CodeyGuyDylan Aug 7, 2024
8e79bdb
Improve implementation of prevent widows
CodeyGuyDylan Aug 7, 2024
866075e
Remove unnecessary brackets
CodeyGuyDylan Aug 7, 2024
f6f1056
Revert Description back to inline ternary
CodeyGuyDylan Aug 7, 2024
4dd7d3e
Return video count with rest of videopress stats
CodeyGuyDylan Aug 7, 2024
c2d5208
Revert php typing change
CodeyGuyDylan Aug 7, 2024
ee0ce3e
Fix types
CodeyGuyDylan Aug 8, 2024
023ec96
Remove type casting
CodeyGuyDylan Aug 8, 2024
07c1aae
Re-add type casting
CodeyGuyDylan Aug 8, 2024
83a13dc
Remove composer update
CodeyGuyDylan Aug 8, 2024
8c96cdb
Add endline
CodeyGuyDylan Aug 8, 2024
24e5b5b
Update phan
CodeyGuyDylan Aug 8, 2024
db9e4c3
Fix some php typing
CodeyGuyDylan Aug 8, 2024
680a968
Fix type on jetpack connection function
CodeyGuyDylan Aug 8, 2024
983ba18
changelog
CodeyGuyDylan Aug 8, 2024
978528e
Fixup changelogger
CodeyGuyDylan Aug 8, 2024
a6a16fa
Update primary action type
CodeyGuyDylan Aug 9, 2024
64a0ec0
Clarify why we are exluding ai in display card types
CodeyGuyDylan Aug 9, 2024
3838a41
Shorten boolean prop
CodeyGuyDylan Aug 9, 2024
80cffa0
Simplify video count markup
CodeyGuyDylan Aug 9, 2024
d889837
Add comment sourcing the prevent widows function
CodeyGuyDylan Aug 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Fix type for tracking product string
2 changes: 1 addition & 1 deletion projects/packages/connection/src/class-package-version.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
class Package_Version {

const PACKAGE_VERSION = '2.11.3';
const PACKAGE_VERSION = '2.11.4-alpha';

const PACKAGE_SLUG = 'connection';

Expand Down
2 changes: 1 addition & 1 deletion projects/packages/connection/src/class-tracking.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Tracking {
/**
* Creates the Tracking object.
*
* @param String $product_name the slug of the product that we are tracking.
* @param string $product_name the slug of the product that we are tracking.
* @param \Automattic\Jetpack\Connection\Manager $connection the connection manager object.
*/
public function __construct( $product_name = 'jetpack', $connection = null ) {
Expand Down
12 changes: 5 additions & 7 deletions projects/packages/my-jetpack/.phan/baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,26 @@
// # Issue statistics:
// PhanTypeMismatchArgumentNullable : 60+ occurrences
// PhanTypeMismatchPropertyDefault : 15+ occurrences
// PhanParamTooMany : 10+ occurrences
// PhanTypeMismatchReturnProbablyReal : 10+ occurrences
// PhanParamTooMany : 9 occurrences
// PhanAbstractStaticMethodCallInStatic : 8 occurrences
// PhanNoopNew : 6 occurrences
// PhanTypeMismatchReturn : 6 occurrences
// PhanNoopNew : 7 occurrences
// PhanPluginDuplicateConditionalNullCoalescing : 5 occurrences
// PhanTypeMismatchReturn : 5 occurrences
// PhanTypeMismatchReturnNullable : 3 occurrences
// PhanImpossibleCondition : 2 occurrences
// PhanNonClassMethodCall : 2 occurrences
// PhanRedundantCondition : 2 occurrences
// PhanTypeMismatchArgumentProbablyReal : 2 occurrences
// PhanPluginMixedKeyNoKey : 1 occurrence
// PhanRedundantCondition : 1 occurrence
// PhanTypeMismatchArgumentInternal : 1 occurrence
// PhanTypeMismatchArgumentNullableInternal : 1 occurrence

// Currently, file_suppressions and directory_suppressions are the only supported suppressions
'file_suppressions' => [
'src/class-activitylog.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'src/class-initializer.php' => ['PhanImpossibleCondition', 'PhanNoopNew', 'PhanParamTooMany', 'PhanRedundantCondition', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnNullable', 'PhanTypeMismatchReturnProbablyReal'],
'src/class-initializer.php' => ['PhanImpossibleCondition', 'PhanNoopNew', 'PhanRedundantCondition', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnNullable'],
'src/class-jetpack-manage.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'src/class-products.php' => ['PhanNonClassMethodCall'],
'src/class-rest-product-data.php' => ['PhanParamTooMany', 'PhanTypeMismatchReturn'],
'src/class-rest-products.php' => ['PhanParamTooMany', 'PhanPluginMixedKeyNoKey', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal'],
'src/class-rest-purchases.php' => ['PhanParamTooMany', 'PhanTypeMismatchReturn', 'PhanTypeMismatchReturnProbablyReal'],
'src/class-rest-zendesk-chat.php' => ['PhanParamTooMany'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,23 @@ import useProduct from '../../data/products/use-product';
import useAnalytics from '../../hooks/use-analytics';
import useMyJetpackConnection from '../../hooks/use-my-jetpack-connection';
import useMyJetpackNavigate from '../../hooks/use-my-jetpack-navigate';
import preventWidows from '../../utils/prevent-widows';
import ProductCard from '../product-card';
import type { AdditionalAction, SecondaryAction } from '../product-card/types';
import type { FC, ReactNode } from 'react';

interface ConnectedProductCardProps {
admin: boolean;
recommendation: boolean;
recommendation?: boolean;
showMenu?: boolean;
slug: JetpackModule;
children: ReactNode;
children?: ReactNode;
isDataLoading?: boolean;
Description?: FC;
additionalActions?: AdditionalAction[];
secondaryAction?: SecondaryAction;
upgradeInInterstitial?: boolean;
primaryActionOverride?: AdditionalAction;
primaryActionOverride?: { [ key: string ]: AdditionalAction };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
primaryActionOverride?: { [ key: string ]: AdditionalAction };
primaryActionOverride?: Record< strong, AdditionalAction >

onMouseEnter?: () => void;
onMouseLeave?: () => void;
}
Expand Down Expand Up @@ -85,7 +87,7 @@ const ConnectedProductCard: FC< ConnectedProductCardProps > = ( {

const DefaultDescription = () => {
// Replace the last space with a non-breaking space to prevent widows
const cardDescription = defaultDescription.replace( /\s(?=[^\s]*$)/, '\u00A0' );
const cardDescription = preventWidows( defaultDescription );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reducing technical debt 💪 great!


return (
<Text variant="body-small" style={ { flexGrow: 1, marginBottom: '1rem' } }>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export type ProductCardProps = {
slug: JetpackModule;
additionalActions?: AdditionalAction[];
upgradeInInterstitial?: boolean;
primaryActionOverride?: AdditionalAction;
primaryActionOverride?: { [ key: string ]: AdditionalAction };
secondaryAction?: SecondaryAction;
onInstallStandalone?: InstallCallback;
onActivateStandalone?: () => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ type ProductButtonProps = Pick<
>;

export type AdditionalAction = ProductButtonProps & {
href: string;
label: string;
onClick: () => void;
href?: string;
onClick?: () => void;
isExternalLink?: boolean;
};

export type SecondaryAction = ProductButtonProps & {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { PRODUCT_SLUGS } from '../../data/constants';
import ProductCard from '../connected-product-card';

const AiCard = props => {
return <ProductCard slug="jetpack-ai" upgradeInInterstitial { ...props } />;
return <ProductCard slug={ PRODUCT_SLUGS.JETPACK_AI } upgradeInInterstitial { ...props } />;
};

export default AiCard;
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import PropTypes from 'prop-types';
import React from 'react';
import { PRODUCT_SLUGS } from '../../data/constants';
import ProductCard from '../connected-product-card';

const AntiSpamCard = props => {
return <ProductCard slug="anti-spam" { ...props } />;
return <ProductCard slug={ PRODUCT_SLUGS.ANTI_SPAM } { ...props } />;
};

AntiSpamCard.propTypes = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
REST_API_COUNT_BACKUP_ITEMS_ENDPOINT,
QUERY_BACKUP_HISTORY_KEY,
QUERY_BACKUP_STATS_KEY,
PRODUCT_SLUGS,
} from '../../../data/constants';
import useProduct from '../../../data/products/use-product';
import useSimpleQuery from '../../../data/use-simple-query';
Expand All @@ -19,6 +20,8 @@ import useAnalytics from '../../../hooks/use-analytics';
import ProductCard from '../../connected-product-card';
import styles from './style.module.scss';

const productSlug = PRODUCT_SLUGS.BACKUP;

const getIcon = slug => {
switch ( slug ) {
case 'post':
Expand Down Expand Up @@ -122,15 +125,14 @@ const getTimeSinceLastRenewableEvent = lastRewindableEventTime => {
};

const BackupCard = props => {
const slug = 'backup';
const { detail } = useProduct( slug );
const { detail } = useProduct( productSlug );
const { status } = detail;
const hasBackups = status === PRODUCT_STATUSES.ACTIVE || status === PRODUCT_STATUSES.CAN_UPGRADE;

return hasBackups ? (
<WithBackupsValueSection slug={ slug } { ...props } />
<WithBackupsValueSection slug={ productSlug } { ...props } />
) : (
<ProductCard slug={ slug } { ...props } />
<ProductCard slug={ productSlug } { ...props } />
);
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { __ } from '@wordpress/i18n';
import { useState, useCallback } from 'react';
import { PRODUCT_STATUSES } from '../../../constants';
import { PRODUCT_SLUGS } from '../../../data/constants';
import ProductCard from '../../connected-product-card';
import BoostSpeedScore from './boost-speed-score';
import type { FC } from 'react';
import type { ProductCardComponent } from '../types';

const BoostCard: FC< { admin: boolean } > = props => {
const BoostCard: ProductCardComponent = props => {
const [ shouldShowTooltip, setShouldShowTooltip ] = useState( false );
// Override the primary action button to read "Boost your site" instead
// of the default text, "Lern more".
Expand All @@ -25,7 +26,7 @@ const BoostCard: FC< { admin: boolean } > = props => {

return (
<ProductCard
slug="boost"
slug={ PRODUCT_SLUGS.BOOST }
primaryActionOverride={ primaryActionOverride }
onMouseEnter={ handleMouseEnter }
onMouseLeave={ handleMouseLeave }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import PropTypes from 'prop-types';
import React from 'react';
import { PRODUCT_SLUGS } from '../../data/constants';
import ProductCard from '../connected-product-card';

const CreatorCard = props => {
return <ProductCard slug="creator" upgradeInInterstitial { ...props } />;
return <ProductCard slug={ PRODUCT_SLUGS.CREATOR } upgradeInInterstitial { ...props } />;
};

CreatorCard.propTypes = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import PropTypes from 'prop-types';
import React from 'react';
import { PRODUCT_SLUGS } from '../../data/constants';
import ProductCard from '../connected-product-card';

const CrmCard = props => {
return <ProductCard slug="crm" { ...props } />;
return <ProductCard slug={ PRODUCT_SLUGS.CRM } { ...props } />;
};

CrmCard.propTypes = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import PropTypes from 'prop-types';
import React from 'react';
import { PRODUCT_SLUGS } from '../../data/constants';
import ProductCard from '../connected-product-card';

const ExtrasCard = props => {
return <ProductCard slug="extras" { ...props } />;
return <ProductCard slug={ PRODUCT_SLUGS.EXTRAS } { ...props } />;
};

ExtrasCard.propTypes = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Container, Col, Text, AdminSectionHero } from '@automattic/jetpack-components';
import { __ } from '@wordpress/i18n';
import { useMemo } from 'react';
import { PRODUCT_SLUGS } from '../../data/constants';
import { getMyJetpackWindowInitialState } from '../../data/utils/get-my-jetpack-window-state';
import StatsSection from '../stats-section';
import AiCard from './ai-card';
Expand All @@ -23,7 +24,7 @@ type DisplayItemsProps = {

type DisplayItemType = Record<
// We don't have a card for Security or Extras, and scan is displayed as protect.
Exclude< JetpackModule, 'extras' | 'scan' | 'security' >,
Exclude< JetpackModule, 'extras' | 'scan' | 'security' | 'ai' >,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's update the comment above as well. Currently it's a bit confusing because in a way "ai" card is displayed (I'm aware it's about reducing redundancy of "jetpack-ai" and "ai" - but I might forget it in ~3 months 😅)

FC< { admin: boolean } >
>;

Expand All @@ -46,7 +47,7 @@ const DisplayItems: FC< DisplayItemsProps > = ( { slugs } ) => {
};

const filteredSlugs = slugs.filter( slug => {
if ( slug === 'stats' && showFullJetpackStatsCard ) {
if ( slug === PRODUCT_SLUGS.STATS && showFullJetpackStatsCard ) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import { type FC } from 'react';
import { PRODUCT_SLUGS } from '../../../data/constants';
import ProductCard from '../../connected-product-card';
import ProtectValueSection from './protect-value-section';
import type { ProductCardComponent } from '../types';

const ProtectCard: FC< { admin: boolean; recommendation?: boolean } > = props => {
const slug = 'protect';

return (
<ProductCard { ...props } slug={ slug } upgradeInInterstitial={ true }>
<ProtectValueSection />
</ProductCard>
);
};
const ProtectCard: ProductCardComponent = props => (
<ProductCard { ...props } slug={ PRODUCT_SLUGS.PROTECT } upgradeInInterstitial={ true }>
<ProtectValueSection />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<ProductCard { ...props } slug={ PRODUCT_SLUGS.PROTECT } upgradeInInterstitial={ true }>
<ProductCard { ...props } slug={ PRODUCT_SLUGS.PROTECT } upgradeInInterstitial>

</ProductCard>
);

export default ProtectCard;
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import PropTypes from 'prop-types';
import React from 'react';
import { PRODUCT_SLUGS } from '../../data/constants';
import ProductCard from '../connected-product-card';

const SearchCard = props => {
return <ProductCard slug="search" showMenu { ...props } />;
return <ProductCard slug={ PRODUCT_SLUGS.SEARCH } showMenu { ...props } />;
};

SearchCard.propTypes = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import PropTypes from 'prop-types';
import React from 'react';
import { PRODUCT_SLUGS } from '../../data/constants';
import ProductCard from '../connected-product-card';

const SocialCard = props => {
return <ProductCard slug="social" showMenu { ...props } />;
return <ProductCard slug={ PRODUCT_SLUGS.SOCIAL } showMenu { ...props } />;
};

SocialCard.propTypes = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import PropTypes from 'prop-types';
import React from 'react';
import { PRODUCT_SLUGS } from '../../data/constants';
import ProductCard from '../connected-product-card';

const StatsCard = props => {
return <ProductCard slug="stats" showMenu { ...props } />;
return <ProductCard slug={ PRODUCT_SLUGS.STATS } showMenu { ...props } />;
};

StatsCard.propTypes = {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { FC } from 'react';

export type ProductCardComponent = FC< {
admin: boolean;
recommendation?: boolean;
} >;
Loading
Loading