Skip to content

Commit 104e977

Browse files
Open deployment mode tooltip support link in help center modal (#103771)
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 19175ef commit 104e977

File tree

2 files changed

+29
-2
lines changed
  • client

2 files changed

+29
-2
lines changed

client/components/support-info/index.jsx

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
import { ExternalLink } from '@automattic/components';
2+
import { HelpCenter } from '@automattic/data-stores';
3+
import { localizeUrl } from '@automattic/i18n-utils';
4+
import { dispatch as dataStoreDispatch } from '@wordpress/data';
25
import { useTranslate } from 'i18n-calypso';
36
import PropTypes from 'prop-types';
47
import InfoPopover from 'calypso/components/info-popover';
58

69
import './style.scss';
710

11+
const HELP_CENTER_STORE = HelpCenter.register();
12+
813
function makePrivacyLink( privacyLink = true, link = '' ) {
914
if ( privacyLink ) {
1015
if ( typeof privacyLink === 'string' ) {
@@ -24,10 +29,23 @@ function SupportInfo( {
2429
position = 'left',
2530
privacyLink,
2631
popoverClassName = '',
32+
supportPostId,
33+
supportBlogId,
2734
} ) {
2835
const translate = useTranslate();
2936
const filteredPrivacyLink = makePrivacyLink( privacyLink, link );
3037

38+
const handleLinkClick = ( event, url ) => {
39+
if ( supportPostId ) {
40+
event.preventDefault();
41+
dataStoreDispatch( HELP_CENTER_STORE ).setShowSupportDoc( url, supportPostId, supportBlogId );
42+
}
43+
// If no supportPostId, let the link open normally in a new tab
44+
};
45+
46+
const LinkComponent = supportPostId ? 'a' : ExternalLink;
47+
const linkUrl = supportPostId ? localizeUrl( link ) : link;
48+
3149
return (
3250
<div className="support-info">
3351
<InfoPopover
@@ -40,9 +58,13 @@ function SupportInfo( {
4058
{ link || filteredPrivacyLink ? ' ' : null }
4159
{ link && (
4260
<span className="support-info__learn-more">
43-
<ExternalLink href={ link } target="_blank">
61+
<LinkComponent
62+
href={ linkUrl }
63+
target={ supportPostId ? undefined : '_blank' }
64+
onClick={ ( event ) => handleLinkClick( event, linkUrl ) }
65+
>
4466
{ translate( 'Learn more' ) }
45-
</ExternalLink>
67+
</LinkComponent>
4668
</span>
4769
) }
4870
{ filteredPrivacyLink && (
@@ -63,6 +85,9 @@ SupportInfo.propTypes = {
6385
link: PropTypes.string,
6486
position: PropTypes.string,
6587
privacyLink: PropTypes.oneOfType( [ PropTypes.string, PropTypes.bool ] ),
88+
popoverClassName: PropTypes.string,
89+
supportPostId: PropTypes.number,
90+
supportBlogId: PropTypes.number,
6691
};
6792

6893
export default SupportInfo;

client/sites/deployments/components/deployment-style/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ export const DeploymentStyle = ( {
6262
popoverClassName="github-deployments-deployments-style-popover"
6363
// @todo Move to contextLinks
6464
link="https://developer.wordpress.com/docs/developer-tools/github-deployments/github-deployments-workflow-recipes/"
65+
supportPostId={ 99879 }
66+
supportBlogId={ 33534099 }
6567
privacyLink={ false }
6668
>
6769
{ supportMessage }

0 commit comments

Comments
 (0)