/* * * HomePage * */ import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { CopyToClipboard } from 'react-copy-to-clipboard'; import { bindActionCreators, compose } from 'redux'; import { get, isEmpty } from 'lodash'; import { Header } from '@buffetjs/custom'; import { auth, PopUpWarning, LoadingIndicatorPage, InputsIndex as Input, GlobalContext, } from 'strapi-helper-plugin'; import pluginId from '../../pluginId'; import getTrad from '../../utils/getTrad'; 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 saga from './saga'; export class HomePage extends React.Component { componentDidMount() { this.props.getDocInfos(); } getRestrictedAccessValue = () => { const { form } = this.props; return get(form, [0, 0, 'value'], false); }; getPluginHeaderActions = () => { return [ { color: 'none', label: this.context.formatMessage({ id: getTrad('containers.HomePage.Button.open'), }), className: 'buttonOutline', onClick: this.openCurrentDocumentation, type: 'button', key: 'button-open', }, { label: this.context.formatMessage({ id: getTrad('containers.HomePage.Button.update'), }), color: 'success', onClick: () => {}, type: 'submit', key: 'button-submit', }, ]; }; handleCopy = () => { strapi.notification.info(getTrad('containers.HomePage.copied')); }; openCurrentDocumentation = () => { const { currentDocVersion, prefix } = this.props; const slash = prefix.startsWith('/') ? '' : '/'; return openWithNewTab(`${slash}${prefix}/v${currentDocVersion}`); }; shouldHideInput = inputName => { return !this.getRestrictedAccessValue() && inputName === 'password'; }; toggleModal = () => this.props.onClickDeleteDoc(''); renderForm = (array, i) => { const { didCheckErrors, formErrors } = this.props; return (