2023-12-11 17:05:35 +08:00
|
|
|
import React from 'react'
|
2024-01-30 17:20:29 +08:00
|
|
|
import {SummaryOrder} from "./SummaryOrder";
|
2023-12-12 18:21:09 +08:00
|
|
|
import {OrderForm} from "./OrderForm";
|
|
|
|
import {CrateList} from "./CrateList";
|
2023-12-11 17:05:35 +08:00
|
|
|
import {useShopStore} from "./shop_store";
|
2023-12-13 12:39:15 +08:00
|
|
|
import {ImportJSON} from "./ImportJSON";
|
|
|
|
import {RFQFeedback} from "./RFQFeedback";
|
2023-12-14 16:29:32 +08:00
|
|
|
|
|
|
|
// #!render_count
|
2023-12-14 16:09:33 +08:00
|
|
|
import {useRenderCount} from "@uidotdev/usehooks";
|
2023-11-30 17:26:17 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Component that renders all things for order.
|
|
|
|
* It acts like-a layout, this component do nothing more.
|
|
|
|
*/
|
2024-01-03 16:18:53 +08:00
|
|
|
export function OrderPanel({title, description}) {
|
2023-12-14 16:29:32 +08:00
|
|
|
// #!render_count
|
2023-12-14 16:09:33 +08:00
|
|
|
const renderCount = useRenderCount();
|
2023-12-11 17:05:35 +08:00
|
|
|
const isMobile = useShopStore((state) => state.isMobile);
|
|
|
|
const onClickToggleMobileSideMenu = useShopStore((state) => state.switchSideMenu);
|
2023-11-30 17:26:17 +08:00
|
|
|
|
2023-12-14 16:29:32 +08:00
|
|
|
// #!render_count
|
2023-12-14 16:09:33 +08:00
|
|
|
console.log("OrderPanel renders: ", renderCount)
|
|
|
|
|
2023-12-11 17:05:35 +08:00
|
|
|
return (<section className="panel">
|
2023-11-30 17:26:17 +08:00
|
|
|
|
2023-12-11 17:05:35 +08:00
|
|
|
<h2>{title}</h2>
|
2023-11-30 17:26:17 +08:00
|
|
|
|
2023-12-15 17:26:52 +08:00
|
|
|
<div className="control justify-content-between">
|
2023-12-11 17:05:35 +08:00
|
|
|
{description}
|
|
|
|
</div>
|
2023-11-30 17:26:17 +08:00
|
|
|
|
2023-12-11 17:05:35 +08:00
|
|
|
<div>
|
2023-12-13 12:39:15 +08:00
|
|
|
<ImportJSON/>
|
2023-12-11 17:05:35 +08:00
|
|
|
</div>
|
2023-11-30 17:26:17 +08:00
|
|
|
|
2023-12-13 12:39:15 +08:00
|
|
|
<RFQFeedback/>
|
|
|
|
|
2023-12-11 17:05:35 +08:00
|
|
|
{isMobile ? (
|
|
|
|
<div className="mobileBtnDisplaySideMenu">
|
|
|
|
<button onClick={onClickToggleMobileSideMenu}>
|
|
|
|
<img src="/images/shop/icon-add.svg" alt="add"/>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
) : null}
|
2023-11-30 17:26:17 +08:00
|
|
|
|
2023-12-11 17:05:35 +08:00
|
|
|
<CrateList/>
|
2023-11-30 17:26:17 +08:00
|
|
|
|
2023-12-11 17:05:35 +08:00
|
|
|
<section className="summary">
|
2024-01-30 17:20:29 +08:00
|
|
|
<SummaryOrder/>
|
2023-12-11 17:05:35 +08:00
|
|
|
<OrderForm/>
|
|
|
|
</section>
|
2023-11-30 17:26:17 +08:00
|
|
|
|
2023-12-11 17:05:35 +08:00
|
|
|
</section>);
|
2023-11-30 17:26:17 +08:00
|
|
|
}
|