import * as React from 'react'; import {get} from 'lodash'; import {superdeskApi} from '../../../superdeskApi'; import {IListFieldProps} from '../../../interfaces'; export class ListFieldCategories extends React.PureComponent { render() { const {gettext} = superdeskApi.localization; const field = this.props.field ?? 'anpa_category'; const categoryNames = (get(this.props.item, field) || []) .map((category) => category.name) .join(', '); if (categoryNames.length > 0) { return (
{gettext('ANPA Category:')} {categoryNames}
); } return null; } }