File size: 1,216 Bytes
1e92f2d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | import config from '@automattic/calypso-config';
import { localizeUrl } from '@automattic/i18n-utils';
import { upload } from '@wordpress/icons';
import { useTranslate } from 'i18n-calypso';
import React from 'react';
import EmptyStateAction from 'calypso/my-sites/stats/components/empty-state-action';
import {
JETPACK_SUPPORT_VIDEOPRESS_URL,
JETPACK_VIDEOPRESS_LANDING_PAGE_URL,
} from 'calypso/my-sites/stats/const';
import type { StatsEmptyActionProps } from './';
const StatsEmptyActionEmail: React.FC< StatsEmptyActionProps > = ( { from } ) => {
const translate = useTranslate();
const isOdysseyStats = config.isEnabled( 'is_running_in_jetpack_site' );
return (
<EmptyStateAction
icon={ upload }
text={ translate( 'Upload videos with VideoPress' ) }
analyticsDetails={ {
from: from,
feature: 'videopress',
} }
onClick={ () => {
// analytics event tracting handled in EmptyStateAction component
const redirectUrl = isOdysseyStats
? localizeUrl( JETPACK_SUPPORT_VIDEOPRESS_URL )
: localizeUrl( JETPACK_VIDEOPRESS_LANDING_PAGE_URL );
setTimeout( () => ( window.location.href = redirectUrl ), 250 );
} }
/>
);
};
export default StatsEmptyActionEmail;
|