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