2023-12-12 16:09:29 +08:00
|
|
|
import React from 'react';
|
|
|
|
import {useShopStore} from "./shop_store";
|
2023-12-14 17:45:54 +08:00
|
|
|
import {SummaryCrates} from "./SummaryCrates";
|
|
|
|
import {SummaryTotalPrice} from "./SummaryTotalPrice";
|
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
|
|
|
|
2023-12-14 17:45:54 +08:00
|
|
|
|
2023-11-30 17:26:17 +08:00
|
|
|
/**
|
|
|
|
* Components that displays the list of card that are used in the crate.
|
|
|
|
* It is a summary of purchase
|
|
|
|
*/
|
2023-12-12 16:09:29 +08:00
|
|
|
export function OrderSummary() {
|
2023-12-14 16:29:32 +08:00
|
|
|
// #!render_count
|
2023-12-14 16:09:33 +08:00
|
|
|
const renderCount = useRenderCount();
|
|
|
|
const clearAll = useShopStore((state) => state.clearAll);
|
|
|
|
|
2023-12-14 16:29:32 +08:00
|
|
|
// #!render_count
|
2023-12-14 16:09:33 +08:00
|
|
|
console.log("OrderSummary renders: ", renderCount)
|
2023-12-12 16:09:29 +08:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="summary-price">
|
|
|
|
|
|
|
|
<table>
|
|
|
|
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<td colSpan="2" className="summary-remove-all">
|
2024-01-15 13:01:27 +08:00
|
|
|
<span className="item-card-name">Reset the order</span>
|
2023-12-12 16:09:29 +08:00
|
|
|
|
|
|
|
<button onClick={clearAll}>
|
|
|
|
<img src="/images/shop/icon-remove.svg"/>
|
|
|
|
</button>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
|
2023-12-14 17:45:54 +08:00
|
|
|
<SummaryCrates/>
|
2023-12-12 16:09:29 +08:00
|
|
|
|
|
|
|
<tfoot>
|
|
|
|
<tr>
|
|
|
|
<td className="item-card-name">Price estimate</td>
|
|
|
|
<td className="price">
|
2023-12-14 17:45:54 +08:00
|
|
|
<SummaryTotalPrice/>
|
2023-12-12 16:09:29 +08:00
|
|
|
|
|
|
|
<span style={{
|
|
|
|
'display': 'inline-block',
|
|
|
|
'width': '30px',
|
|
|
|
}}> </span>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tfoot>
|
|
|
|
|
|
|
|
</table>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
);
|
2023-11-30 17:26:17 +08:00
|
|
|
}
|