/* global SUI */ /** * External dependencies */ import React from 'react'; /** * WordPress dependencies */ const { __ } = wp.i18n; /** * Internal dependencies */ import Button from '../../components/sui-button'; import Notice from '../../components/sui-notice'; import { UserContext } from '../../context'; import SupportLink from '../../components/support-link'; import CodeSnippet from '../../components/sui-code-snippet'; import OrderedList from '../../components/ordered-list'; import Tabs from '../../components/sui-tabs'; import {createInterpolateElement} from "@wordpress/element"; /** * Server instructions component. */ export default class ServerInstructions extends React.Component { /** * Share UI actions need to be performed manually for elements. * They should be done in this method. */ componentDidMount() { ServerInstructions.initSUIcomponents(); } componentDidUpdate() { ServerInstructions.initSUIcomponents(); } static initSUIcomponents() { const el = document.getElementById( 'wphb-server-instructions-apache' ); if ( el ) { SUI.suiTabs( el.querySelector( '.sui-tabs' ) ); } const troubleshootLink = document.getElementById( 'troubleshooting-link' ); if ( troubleshootLink ) { troubleshootLink.addEventListener( 'click', ( e ) => { e.preventDefault(); jQuery( 'html, body' ).animate( { scrollTop: jQuery( '#troubleshooting-apache' ).offset() .top, }, 'slow' ); } ); } } /** * Render cache wrapper element. * * @return {*} Notice or success message. */ cacheWrap() { let classNames = 'sui-hidden'; if ( 'apache' === this.props.currentServer ) { classNames = ''; } const enableButton = this.props.htaccessWritten ? (