Skip to content

Commit

Permalink
Update get help link (#90245)
Browse files Browse the repository at this point in the history
  • Loading branch information
nateweller authored May 8, 2024
1 parent b3dd5c0 commit efbea48
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
import page from '@automattic/calypso-router';
import { Button, Gravatar } from '@automattic/components';
import { Icon, chevronDown, external } from '@wordpress/icons';
import { Icon, chevronDown } from '@wordpress/icons';
import classNames from 'classnames';
import { useTranslate } from 'i18n-calypso';
import { useCallback, useRef, useState } from 'react';
import { CONTACT_URL_HASH_FRAGMENT } from 'calypso/a8c-for-agencies/sections/overview/sidebar/contact-support';
import useOutsideClickCallback from 'calypso/lib/use-outside-click-callback';
import { useDispatch, useSelector } from 'calypso/state';
import { recordTracksEvent } from 'calypso/state/analytics/actions/record';
import { redirectToLogout } from 'calypso/state/current-user/actions';
import { getCurrentUser } from 'calypso/state/current-user/selectors';
import { A4A_OVERVIEW_LINK } from '../../sidebar-menu/lib/constants';

import './style.scss';

type DropdownMenuProps = {
isExpanded: boolean;
setMenuExpanded: ( isExpanded: boolean ) => void;
};
const DropdownMenu = ( { isExpanded }: DropdownMenuProps ) => {
const DropdownMenu = ( { isExpanded, setMenuExpanded }: DropdownMenuProps ) => {
const dispatch = useDispatch();
const translate = useTranslate();

const onGetHelp = useCallback( () => {
page( A4A_OVERVIEW_LINK + CONTACT_URL_HASH_FRAGMENT );
setMenuExpanded( false );
dispatch( recordTracksEvent( 'calypso_a4a_sidebar_gethelp' ) );
}, [ dispatch ] );
}, [ dispatch, setMenuExpanded ] );
const onSignOut = useCallback( () => {
dispatch( recordTracksEvent( 'calypso_a4a_sidebar_signout' ) );
dispatch( redirectToLogout() );
Expand All @@ -29,16 +35,8 @@ const DropdownMenu = ( { isExpanded }: DropdownMenuProps ) => {
return (
<ul className="a4a-sidebar__profile-dropdown-menu" hidden={ ! isExpanded }>
<li className="a4a-sidebar__profile-dropdown-menu-item">
<Button
className="a4a-sidebar__external-link"
borderless
href="https://agencies.automattic.com/support"
rel="noreferrer"
target="_blank"
onClick={ onGetHelp }
>
<Button borderless onClick={ onGetHelp }>
{ translate( 'Get help' ) }
<Icon icon={ external } size={ 24 } />
</Button>
</li>
<li className="a4a-sidebar__profile-dropdown-menu-item">
Expand Down Expand Up @@ -113,7 +111,7 @@ const ProfileDropdown = ( { compact, dropdownPosition = 'down' }: ProfileDropdow
</div>
) }
</Button>
<DropdownMenu isExpanded={ isMenuExpanded } />
<DropdownMenu isExpanded={ isMenuExpanded } setMenuExpanded={ setMenuExpanded } />
</nav>
);
};
Expand Down
7 changes: 5 additions & 2 deletions client/a8c-for-agencies/components/sidebar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import page from '@automattic/calypso-router';
import classNames from 'classnames';
import { useTranslate } from 'i18n-calypso';
import { CONTACT_URL_HASH_FRAGMENT } from 'calypso/a8c-for-agencies/sections/overview/sidebar/contact-support';
import JetpackIcons from 'calypso/components/jetpack/sidebar/menu-items/jetpack-icons';
import Sidebar, {
SidebarV2Main as SidebarMain,
Expand All @@ -10,6 +12,7 @@ import Sidebar, {
} from 'calypso/layout/sidebar-v2';
import { useDispatch } from 'calypso/state';
import { recordTracksEvent } from 'calypso/state/analytics/actions';
import { A4A_OVERVIEW_LINK } from '../sidebar-menu/lib/constants';
import SidebarHeader from './header';
import ProfileDropdown from './header/profile-dropdown';

Expand Down Expand Up @@ -87,14 +90,14 @@ const A4ASidebar = ( {
<ul>
{ withGetHelpLink && (
<SidebarNavigatorMenuItem
isExternalLink
title={ translate( 'Get help', {
comment: 'A4A sidebar navigation item',
} ) }
link="https://agencies.automattic.com/support"
link=""
path=""
icon={ <JetpackIcons icon="help" /> }
onClickMenuItem={ () => {
page( A4A_OVERVIEW_LINK + CONTACT_URL_HASH_FRAGMENT );
dispatch(
recordTracksEvent( 'calypso_a4a_sidebar_menu_click', {
menu_item: 'A4A / Support',
Expand Down

0 comments on commit efbea48

Please sign in to comment.