/** * External dependencies */ import React from 'react'; /** * WordPress dependencies */ const { __, sprintf } = wp.i18n; /** * Internal dependencies */ import './style.scss'; import Notice from '../sui-notice'; import Tabs from '../sui-tabs'; import Select from '../sui-select'; import Icon from '../sui-icon'; /** * StepsContent component. * * @since 3.2.0 */ export default class StepsContent extends React.Component { /** * Component constructor. * * @param {Object} props */ constructor( props ) { super( props ); const servers = [ 'Apache', 'NGINX', 'IIS', 'Cloudflare', 'Open LiteSpeed' ]; // Remove Cloudflare from list if not set up. if ( ! this.props.cloudflare.isAuthed && ! this.props.cloudflare.isAuthed.isSetup ) { servers.splice( 3, 1 ); } this.state = { servers }; } /** * Get step description. * * @param {number} step Step. * @return {Object} Step details. */ getStep( step ) { const steps = { 1: { title: __( 'Choose Server Type', 'wphb' ), description: __( 'Choose your server type. If you don’t know this, please contact your hosting provider.', 'wphb' ), }, 2: { title: __( 'Set Expiry Time', 'wphb' ), description: __( 'Please choose your desired expiry time. Google recommends a minimum of 1 year as a good benchmark.', 'wphb' ), }, 3: { title: __( 'Add Rules', 'wphb' ), description: 'apache' === this.props.server ? __( 'Hummingbird can automatically apply browser caching rules for Apache servers by writing to your .htaccess file.', 'wphb' ) : __( 'Please follow the steps below to apply the rules yourself:', 'wphb' ), }, }; return steps[ step ]; } /** * Get content (step 1). * * @return {JSX.Element} Step 1 content. */ getStepOne() { const liElements = this.state.servers.map( ( el, key ) => { let server = el.toLowerCase(); if ( 'open litespeed' === server ) { server = 'litespeed'; } const serverID = 'server-' + server; return (
{ this.getStep( this.props.currentStep ).description }
{ this.props.applyingRules &&