import React from 'react'; import ng from 'core/services/ng'; import {gettext} from 'core/utils'; import {IGroup, IGroupData} from './UserActivityWidget'; import {IArticle} from 'superdesk-api'; import {WidgetItemList} from 'apps/search/components'; interface IProps { group: IGroup; data: IGroupData; toggleCollapseExpand(group: IGroup): void; } export class GroupComponent extends React.Component { services: { authoringWorkspace: any; superdesk: any; }; constructor(props: IProps) { super(props); this.services = { authoringWorkspace: ng.get('authoringWorkspace'), superdesk: ng.get('superdesk'), }; } render() { const {group, data, toggleCollapseExpand} = this.props; const loadedItemsCount = data.itemIds.length; return (
{group.label}
{loadedItemsCount < data.total ? `${data.itemIds.length} / ${data.total}` : data.total}
{group.collapsed === true ? null : (
{ this.services.superdesk.intent( 'preview', 'item', item, ); }} select={(item: IArticle) => { this.services.superdesk.intent( 'preview', 'item', item, ); }} edit={(item: IArticle) => { this.services.authoringWorkspace.edit(item); }} itemIds={data.itemIds} itemsById={data.itemsById} loading={false} />
)}
); } }