import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { NetworkImage } from "../../../icon";
import { Text } from "../../../text";
import { cn } from "../../../utils";
import { commify } from "@orderly.network/utils";
export const EditOrderConfirmContent = (isAlgoOrder, isMarketOrder, data, dirtyFields, base, symbol)=>{
    // if (isAlgoOrder) {
    return /*#__PURE__*/ _jsx(AlgoContent, {
        data: data,
        dirtyFields: dirtyFields,
        base: base,
        symbol: symbol,
        isMarketOrder: isMarketOrder,
        isAlgoOrder: isAlgoOrder
    });
// }
// return (<NormalContent
//   data={data}
//   dirtyFields={dirtyFields}
//   base={base}
// />);
};
const NormalContent = (props)=>{
    const { data, dirtyFields, base } = props;
    let confirmText;
    if (dirtyFields["order_price"] && dirtyFields["order_quantity"]) {
        confirmText = /*#__PURE__*/ _jsxs("div", {
            className: "orderly-text-base-contrast-54 orderly-text-2xs desktop:orderly-text-sm",
            children: [
                "You agree changing the price of ",
                base,
                "-PERP order to",
                " ",
                /*#__PURE__*/ _jsx("span", {
                    className: "orderly-text-warning",
                    children: commify(data.order_price)
                }),
                " ",
                "and the quantity to",
                " ",
                /*#__PURE__*/ _jsx("span", {
                    className: "orderly-text-warning",
                    children: commify(data.order_quantity)
                }),
                "."
            ]
        });
    } else {
        if (dirtyFields["order_price"]) {
            confirmText = /*#__PURE__*/ _jsxs("div", {
                className: "orderly-text-base-contrast-54 orderly-text-2xs desktop:orderly-text-sm",
                children: [
                    "You agree changing the price of ",
                    base,
                    "-PERP order to",
                    " ",
                    /*#__PURE__*/ _jsx("span", {
                        className: "orderly-text-warning",
                        children: commify(data.order_price)
                    }),
                    "."
                ]
            });
        }
        if (dirtyFields["order_quantity"]) {
            confirmText = /*#__PURE__*/ _jsxs("div", {
                className: "orderly-text-base-contrast-54 orderly-text-2xs desktop:orderly-text-sm",
                children: [
                    "You agree changing the quantity of ",
                    base,
                    "-PERP order to",
                    " ",
                    /*#__PURE__*/ _jsx("span", {
                        className: "orderly-text-warning",
                        children: commify(data.order_quantity)
                    }),
                    "."
                ]
            });
        }
    }
    return confirmText;
};
const AlgoContent = (props)=>{
    const { data, dirtyFields, base, symbol, isMarketOrder, isAlgoOrder } = props;
    const quote = symbol?.split("_")[2];
    const qty = data.order_quantity || "-";
    const triggerPrice = data.trigger_price || "-";
    const price = data.order_price || "-";
    return /*#__PURE__*/ _jsxs("div", {
        children: [
            /*#__PURE__*/ _jsx("div", {
                className: "orderly-text-sm orderly-text-base-contrast-80",
                children: `You agree to edit your ${base}-PERP order.`
            }),
            /*#__PURE__*/ _jsxs("div", {
                className: "orderly-flex orderly-items-center orderly-pt-6 orderly-pb-3",
                children: [
                    /*#__PURE__*/ _jsx(NetworkImage, {
                        symbol: symbol,
                        type: "symbol",
                        size: 20
                    }),
                    /*#__PURE__*/ _jsx("span", {
                        className: "orderly-text-lg orderly-pl-2",
                        children: `${base}-PERP`
                    })
                ]
            }),
            /*#__PURE__*/ _jsxs("div", {
                className: "orderly-flex orderly-justify-between orderly-text-sm orderly-pb-1",
                children: [
                    /*#__PURE__*/ _jsx("span", {
                        className: "orderly-text-base-contrast-54",
                        children: "Qty"
                    }),
                    /*#__PURE__*/ _jsxs("div", {
                        className: "orderly-inline-block",
                        children: [
                            /*#__PURE__*/ _jsx(Text, {
                                className: cn("orderly-mr-1", data.side === "BUY" ? "orderly-text-trade-profit" : "orderly-text-trade-loss"),
                                children: commify(qty)
                            }),
                            /*#__PURE__*/ _jsx("span", {
                                className: "orderly-text-base-contrast-36",
                                children: base
                            })
                        ]
                    })
                ]
            }),
            isAlgoOrder && /*#__PURE__*/ _jsxs("div", {
                className: "orderly-flex orderly-justify-between orderly-text-sm orderly-pb-1",
                children: [
                    /*#__PURE__*/ _jsx("span", {
                        className: "orderly-text-base-contrast-54",
                        children: "Trigger price"
                    }),
                    /*#__PURE__*/ _jsxs("div", {
                        className: "orderly-inline-block",
                        children: [
                            /*#__PURE__*/ _jsx("span", {
                                className: "orderly-mr-1",
                                children: commify(triggerPrice)
                            }),
                            /*#__PURE__*/ _jsx("span", {
                                className: "orderly-text-base-contrast-36",
                                children: quote
                            })
                        ]
                    })
                ]
            }),
            /*#__PURE__*/ _jsxs("div", {
                className: "orderly-flex orderly-justify-between orderly-text-sm",
                children: [
                    /*#__PURE__*/ _jsx("span", {
                        className: "orderly-text-base-contrast-54",
                        children: "Price"
                    }),
                    /*#__PURE__*/ _jsxs("div", {
                        className: "orderly-inline-block",
                        children: [
                            isMarketOrder ? /*#__PURE__*/ _jsx("span", {
                                children: "Market"
                            }) : /*#__PURE__*/ _jsx("span", {
                                children: commify(price)
                            }),
                            /*#__PURE__*/ _jsx("span", {
                                className: "orderly-ml-1 orderly-text-base-contrast-36",
                                children: quote
                            })
                        ]
                    })
                ]
            })
        ]
    });
};

//# sourceMappingURL=confirmContent.js.map