/* eslint-disable react/no-multi-comp */ import React from 'react'; import PropTypes from 'prop-types'; import {get} from 'lodash'; import {FeaturedPlanningItem} from './FeaturedPlanningItem'; import {Header, Group} from '../../UI/List'; import {PanelInfo} from '../../UI'; import {AuditInformation, StateLabel} from '../../'; import {getCreator, planningUtils} from '../../../utils'; import {POST_STATE} from '../../../constants'; import {SortableContainer, SortableElement} from 'react-sortable-hoc'; import './style.scss'; export const FeaturedPlanningList = ({ item, items, readOnly, lockedItems, currentSearchDate, selectedPlanningIds, loadingIndicator, desks, users, onAddToSelectedFeaturedPlanning, onRemoveFromSelectedFeaturedPlanning, sortable, onSortEnd, onSortStart, highlights, onClick, header, withMargin, emptyMsg, showAuditInformation, contentTypes, disabled, }) => { const getItem = (item) => ( ); const SortableItem = SortableElement(({item}) => (
  • {getItem(item)}
  • )); const SortableList = SortableContainer(({items}) => ( ) ); const createdBy = getCreator(item, 'original_creator', users); const updatedBy = getCreator(item, 'version_creator', users); const postedBy = getCreator(item, 'last_posted_by', users); const creationDate = get(item, '_created'); const updatedDate = get(item, '_updated'); const postedDate = get(item, 'last_posted_time'); return (
    {showAuditInformation && item && (
    )} {!planningUtils.isFeaturedPlanningUpdatedAfterPosting(item) && get(item, 'posted') && (
    )}
    {(get(items, 'length', 0) === 0 && !loadingIndicator) ? () : ( {!sortable ? items.map((item) => (getItem(item))) : ( )} )}
    ); }; FeaturedPlanningList.propTypes = { items: PropTypes.array, readOnly: PropTypes.bool, currentSearchDate: PropTypes.object, featuredPlannings: PropTypes.array, selectedPlanningIds: PropTypes.array, onAddToSelectedFeaturedPlanning: PropTypes.func, onRemoveFromSelectedFeaturedPlanning: PropTypes.func, onSortStart: PropTypes.func, onSortEnd: PropTypes.func, highlights: PropTypes.array, onClick: PropTypes.func, header: PropTypes.string, withMargin: PropTypes.bool, lockedItems: PropTypes.object.isRequired, loadingIndicator: PropTypes.bool, desks: PropTypes.array, users: PropTypes.array, itemActions: PropTypes.object, hideItemActions: PropTypes.bool, showAddCoverage: PropTypes.bool, sortable: PropTypes.bool, emptyMsg: PropTypes.string, item: PropTypes.object, showAuditInformation: PropTypes.bool, contentTypes: PropTypes.array, disabled: PropTypes.bool, }; FeaturedPlanningList.defaultProps = {selectedPlanningIds: []};