/** * External dependencies */ import jetpackAnalytics from '@automattic/jetpack-analytics'; import { AdminPage, AdminSectionHero, Container, Col, JetpackLogo, useBreakpointMatch, getUserLocale, } from '@automattic/jetpack-components'; import { Button } from '@wordpress/components'; import { useEffect, useMemo, useCallback } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; /** * Internal dependencies */ import { config } from '../index'; import './style.scss'; // Mag-16, see https://wp.me/PCYsg-9nE // Exception: pt-br, since mag-16 code is BR and it's the variation, not the language const availableScreenshotLanguages = [ 'ar', 'pt-br', 'de', 'en', 'es', 'fr', 'he', 'id', 'it', 'ja', 'ko', 'nl', 'ru', 'sv', 'tr', 'zh-cn', 'zh-tw', ]; const getLocaleScreenshotName = ( locale = '', isMobile = false ) => { const baseName = `forms-moved`; let languageSuffix = ''; const lowercaseLocale = locale.toLowerCase(); if ( availableScreenshotLanguages.includes( lowercaseLocale ) ) { languageSuffix = `-${ lowercaseLocale }`; } else { const language = lowercaseLocale.split( '-' )[ 0 ]; if ( availableScreenshotLanguages.includes( language ) ) { languageSuffix = `-${ language }`; } } return `${ baseName }${ languageSuffix }${ isMobile ? '-mobile' : '' }.png`; }; const AdminMigratePage = () => { const [ isSm ] = useBreakpointMatch( 'sm' ); const ASSETS_URL = useMemo( () => config( 'pluginAssetsURL' ), [] ); const dashboardURL = useMemo( () => config( 'dashboardURL' ), [] ); const header = (
{ ' ' } { 'Forms' }
); const screenshotName = useMemo( () => getLocaleScreenshotName( getUserLocale(), isSm ), [ isSm ] ); useEffect( () => { jetpackAnalytics.tracks.recordEvent( 'jetpack_forms_admin_migrate_page_view', { viewport: isSm ? 'mobile' : 'desktop', } ); }, [ isSm ] ); const onCheckNewFormsClick = useCallback( () => { jetpackAnalytics.tracks.recordEvent( 'jetpack_forms_admin_migrate_page_check_new_forms_button_click', { viewport: isSm ? 'mobile' : 'desktop', } ); window.location.href = dashboardURL; }, [ isSm, dashboardURL ] ); return (

{ __( 'Forms responses have moved', 'jetpack-forms' ) }

{ __( 'They can now be found at Jetpack → Forms', 'jetpack-forms' ) }

{

); }; export default AdminMigratePage;