import React from 'react';
import {Cart} from "./Cart.jsx";
import {CrateMode} from "./CrateMode.jsx";
import {CrateWarnings} from "./CrateWarnings.jsx";

/**
 * Component that displays the main crate with reminder rules.
 * It includes <Cart> and rules
 */
export function Crate({data, handleToggleOverlayRemove, handleDeleteItem, handleShowOverlayRemove, handleCardsUpdated, isMobile, isTouch}) {
    return (
        <div className="crate">

            <CrateMode current={data.mode} onChange={null} />

            <div className="crate-products">

                <Cart
                    data={data}
                    isMobile={isMobile}
                    isTouch={isTouch}
                    onToggleOverlayRemove={handleToggleOverlayRemove}
                    onClickRemoveItem={handleDeleteItem}
                    onClickItem={handleShowOverlayRemove}
                    onCardUpdate={handleCardsUpdated}>
                </Cart>

                {1||(rules && rules.length > 0) && (
                    <CrateWarnings/>
                )}
            </div>

        </div>
    );

}