import React from 'react'; import {SummaryPopup} from "./options/SummaryPopup"; import {formatMoney} from "./utils"; import {WarningIndicator} from "./CardWarnings"; import {useShopStore} from "./shop_store"; import {useRenderCount} from "@uidotdev/usehooks"; /** * Components that displays the list of card that are used in the crate. * It is a summary of purchase */ export function OrderSummary() { const renderCount = useRenderCount(); const currency = useShopStore((state) => state.currency); const crates = useShopStore((state) => state.crates); const total_price = useShopStore((state) => state.totalOrderPrice()); const crateParams = useShopStore((state) => state.crateParams); const deleteCard = useShopStore((state) => state.deleteCard); const setHighlight = useShopStore((state) => state.highlightCard); const resetHighlight = useShopStore((state) => state.highlightReset); const highlighted = useShopStore((state) => state.highlighted); const clearAll = useShopStore((state) => state.clearAll); const clearCrate = useShopStore((state) => state.clearCrate); const delCrate = useShopStore((state) => state.delCrate); console.log("OrderSummary renders: ", renderCount) return (
Remove all cards | |
{crate_type.name} |
{`${currency} ${formatMoney(crate_type.price)}`}
|
{`${item.name_number} ${item.name} ${item.name_codename}`}
|
{`${currency} ${formatMoney(item.price)}`}
{(warnings && warnings.length > 0 ? (
|
Price estimate |
{currency} {formatMoney(total_price)}
|