import OrderIndexItem from './OrderIndexItem';

const OrderIndex = ({
  orders,
  collapseAll,
  expandAll,
  setCollapseAll,
  setExpandAll,
}) => {
  return (
    <div className="order-index">
      <h1>Orders</h1>
      {orders.allIds.map((orderId) => {
        const order = orders.byId[orderId];
        return (
          <OrderIndexItem
            key={order.id}
            order={order}
            collapseAll={collapseAll}
            expandAll={expandAll}
            setCollapseAll={setCollapseAll}
            setExpandAll={setExpandAll}
          />
        );
      })}
    </div>
  );

}

export default OrderIndex;