import React, {PureComponent} from 'react'; import PropTypes from "prop-types"; import {v4 as uuidv4} from "uuid"; import {Droppable} from "@hello-pangea/dnd"; import {ProductItem} from "./ProductItem.jsx"; /** * Component that renders the backlog in the aside */ export class Backlog extends PureComponent { static get propTypes() { return { currency: PropTypes.string, data: PropTypes.object.isRequired, items: PropTypes.object, isMobile: PropTypes.bool, onClickAddItem: PropTypes.func, onClickToggleMobileSideMenu: PropTypes.func, }; } static get defaultProps() { return { items: {}, }; } render() { const { currency, data, items, onClickAddItem, onClickToggleMobileSideMenu, isMobile, } = this.props; const ordered_groups = data.categories.map(groupItem => ({ name: groupItem.name, items: groupItem.itemIds.map(itemId => items[itemId]) })); let item_index = -1; const groups = ordered_groups.map((group, g_index) => { return (

{group.items.map(item => { item_index++; return ( ) })}
); } ); return ( {(provided) => (
{isMobile ? (
) : null}
{groups}
{provided.placeholder && (
{provided.placeholder}
)}
)}
); } }