/* * * HomePage * */ import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { injectIntl } from 'react-intl'; import { CopyToClipboard } from 'react-copy-to-clipboard'; import { bindActionCreators, compose } from 'redux'; import { get, isEmpty } from 'lodash'; // Components import { auth, PluginHeader, PopUpWarning, LoadingIndicatorPage, InputsIndex as Input, } from 'strapi-helper-plugin'; import pluginId from '../../pluginId'; import Block from '../../components/Block'; import Row from '../../components/Row'; import openWithNewTab from '../../utils/openWithNewTab'; import { ContainerFluid, StyledRow, VersionWrapper } from './components'; // Actions import { getDocInfos, onChange, onClickDeleteDoc, onConfirmDeleteDoc, onSubmit, onUpdateDoc, } from './actions'; // Selectors import selectHomePage from './selectors'; import reducer from './reducer'; import saga from './saga'; const makeTranslation = txt => `${pluginId}.containers.HomePage.${txt}`; export class HomePage extends React.Component { componentDidMount() { this.props.getDocInfos(); } getRestrictedAccessValue = () => { const { form } = this.props; return get(form, [0, 0, 'value'], false); }; getPluginHeaderActions = () => { return [ { label: makeTranslation('Button.open'), className: 'buttonOutline', onClick: this.openCurrentDocumentation, type: 'button', }, { label: makeTranslation('Button.update'), kind: 'primary', onClick: () => {}, type: 'submit', }, ]; }; handleCopy = () => { strapi.notification.info(makeTranslation('copied')); }; openCurrentDocumentation = () => { const { currentDocVersion } = this.props; return openWithNewTab(`/documentation/v${currentDocVersion}`); }; shouldHideInput = inputName => { return !this.getRestrictedAccessValue() && inputName === 'password'; }; toggleModal = () => this.props.onClickDeleteDoc(''); renderForm = (array, i) => { const { didCheckErrors, formErrors } = this.props; return (