Skip to content

Commit

Permalink
Social | Simplify and clarify social network selection for post shari…
Browse files Browse the repository at this point in the history
…ng (#36734)

* Simplify and clarify social network selection for post sharing

* Add changelog

* Add comments

* Enabled connections are no longer relevant

* Update update-simplify-and-clarify-social-network-selection-for-post-sharing

* Update messages for new posts
  • Loading branch information
manzoorwanijk authored Apr 5, 2024
1 parent 26f9122 commit 48c1804
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 51 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

Simplified social network selection for post sharing
Original file line number Diff line number Diff line change
Expand Up @@ -15,47 +15,32 @@ import { external } from '@wordpress/icons';
import classNames from 'classnames';
import useUpgradeFlow from '../../../../shared/use-upgrade-flow';

function getPanelDescription(
isPostPublished,
isPublicizeEnabled,
hasConnections,
hasEnabledConnections
) {
// Use constants when the string is used in multiple places.
const start_your_posts_string = __(
'Start sharing your posts by connecting your social media accounts.',
const getDescriptions = () => ( {
start: __( 'Start sharing your posts by connecting your social media accounts.', 'jetpack' ),
enabled: __(
'Click on the social icons below to control where you want to share your post.',
'jetpack'
);
const this_post_will_string = __(
'This post will be shared on all your enabled social media accounts the moment you publish the post.',
),
disabled: __( 'Use this tool to share your post on all your social media accounts.', 'jetpack' ),
reshare: __(
'Enable the social media accounts where you want to re-share your post, then click on the "Share post" button below.',
'jetpack'
);

// RePublicize feature is enabled.
// No connections.
if ( ! hasConnections ) {
return start_your_posts_string;
}
),
} );

if ( isPostPublished && isPublicizeEnabled && ! hasEnabledConnections ) {
return __(
'Enable a connection to share this post by clicking on the share post button.',
'jetpack'
);
}
function getPanelDescription( isPostPublished, isPublicizeEnabled, hasConnections ) {
const descriptions = getDescriptions();

if ( ! isPublicizeEnabled || ! hasEnabledConnections ) {
return __( 'Use this tool to share your post on all your social media accounts.', 'jetpack' );
if ( ! hasConnections ) {
return descriptions.start;
}

if ( isPublicizeEnabled && hasEnabledConnections && ! isPostPublished ) {
return this_post_will_string;
if ( isPostPublished ) {
// For published posts, always show the reshare description.
return descriptions.reshare;
}

return __(
'Share this post on all your enabled social media accounts by clicking on the share post button.',
'jetpack'
);
return isPublicizeEnabled ? descriptions.enabled : descriptions.disabled;
}

export default function UpsellNotice() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Simplified social network selection for post sharing
Original file line number Diff line number Diff line change
@@ -1,53 +1,47 @@
import { __ } from '@wordpress/i18n';
import styles from './styles.module.scss';

const descriptions = {
const getDescriptions = () => ( {
start: __(
'Start sharing your posts by connecting your social media accounts.',
'jetpack-social'
),
enabled: __(
'This post will be shared on all your enabled social media accounts the moment you publish the post.',
'Click on the social icons below to control where you want to share your post.',
'jetpack-social'
),
disabled: __(
'Use this tool to share your post on all your social media accounts.',
'jetpack-social'
),
published: __(
'Enable a connection to share this post by clicking on the share post button.',
'jetpack-social'
),
noReshare: __( 'Posts can only be shared as they are first published.', 'jetpack-social' ),
reshare: __(
'Share this post on all your enabled social media accounts by clicking on the share post button.',
'Enable the social media accounts where you want to re-share your post, then click on the "Share post" button below.',
'jetpack-social'
),
};
} );

const getDescription = ( {
isPublicizeEnabled,
hasConnections,
hasEnabledConnections,
hidePublicizeFeature,
isPostPublished,
} ) => {
const descriptions = getDescriptions();

if ( hidePublicizeFeature ) {
return descriptions.noReshare;
}
if ( ! hasConnections ) {
return descriptions.start;
}
if ( isPostPublished && isPublicizeEnabled && ! hasEnabledConnections ) {
return descriptions.published;
}
if ( ! isPublicizeEnabled || ! hasEnabledConnections ) {
return descriptions.disabled;
}
if ( isPublicizeEnabled && hasEnabledConnections && ! isPostPublished ) {
return descriptions.enabled;

if ( isPostPublished ) {
// For published posts, always show the reshare description.
return descriptions.reshare;
}
return descriptions.reshare;

return isPublicizeEnabled ? descriptions.enabled : descriptions.disabled;
};

/**
Expand Down

0 comments on commit 48c1804

Please sign in to comment.