import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { Grid, Typography } from '@material-ui/core'; import ShowStrategy from './show-strategy-component'; import EditStrategy from './form-container'; import { UPDATE_STRATEGY } from '../AccessProvider/permissions'; import ConditionallyRender from '../common/ConditionallyRender/ConditionallyRender'; import TabNav from '../common/TabNav/TabNav'; import PageContent from '../common/PageContent/PageContent'; import AccessContext from '../../contexts/AccessContext'; export default class StrategyDetails extends Component { static contextType = AccessContext; static propTypes = { strategyName: PropTypes.string.isRequired, toggles: PropTypes.array, applications: PropTypes.array, activeTab: PropTypes.string.isRequired, strategy: PropTypes.object.isRequired, fetchStrategies: PropTypes.func.isRequired, fetchApplications: PropTypes.func.isRequired, fetchFeatureToggles: PropTypes.func.isRequired, history: PropTypes.object.isRequired, }; componentDidMount() { if (!this.props.strategy) { this.props.fetchStrategies(); } if (!this.props.applications || this.props.applications.length === 0) { this.props.fetchApplications(); } if (!this.props.toggles || this.props.toggles.length === 0) { this.props.fetchFeatureToggles(); } } render() { const strategy = this.props.strategy; const tabData = [ { label: 'Details', component: ( ), }, { label: 'Edit', component: ( ), }, ]; const { hasAccess } = this.context; return ( {strategy.description} } elseShow={
} />
); } }