"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "EditOrderConfirmContent", {
    enumerable: true,
    get: function() {
        return EditOrderConfirmContent;
    }
});
const _jsxruntime = require("react/jsx-runtime");
const _icon = require("../../../icon");
const _text = require("../../../text");
const _utils = require("../../../utils");
const _utils1 = require("@orderly.network/utils");
const EditOrderConfirmContent = (isAlgoOrder, isMarketOrder, data, dirtyFields, base, symbol)=>{
    // if (isAlgoOrder) {
    return /*#__PURE__*/ (0, _jsxruntime.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__*/ (0, _jsxruntime.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__*/ (0, _jsxruntime.jsx)("span", {
                    className: "orderly-text-warning",
                    children: (0, _utils1.commify)(data.order_price)
                }),
                " ",
                "and the quantity to",
                " ",
                /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
                    className: "orderly-text-warning",
                    children: (0, _utils1.commify)(data.order_quantity)
                }),
                "."
            ]
        });
    } else {
        if (dirtyFields["order_price"]) {
            confirmText = /*#__PURE__*/ (0, _jsxruntime.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__*/ (0, _jsxruntime.jsx)("span", {
                        className: "orderly-text-warning",
                        children: (0, _utils1.commify)(data.order_price)
                    }),
                    "."
                ]
            });
        }
        if (dirtyFields["order_quantity"]) {
            confirmText = /*#__PURE__*/ (0, _jsxruntime.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__*/ (0, _jsxruntime.jsx)("span", {
                        className: "orderly-text-warning",
                        children: (0, _utils1.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__*/ (0, _jsxruntime.jsxs)("div", {
        children: [
            /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
                className: "orderly-text-sm orderly-text-base-contrast-80",
                children: `You agree to edit your ${base}-PERP order.`
            }),
            /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
                className: "orderly-flex orderly-items-center orderly-pt-6 orderly-pb-3",
                children: [
                    /*#__PURE__*/ (0, _jsxruntime.jsx)(_icon.NetworkImage, {
                        symbol: symbol,
                        type: "symbol",
                        size: 20
                    }),
                    /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
                        className: "orderly-text-lg orderly-pl-2",
                        children: `${base}-PERP`
                    })
                ]
            }),
            /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
                className: "orderly-flex orderly-justify-between orderly-text-sm orderly-pb-1",
                children: [
                    /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
                        className: "orderly-text-base-contrast-54",
                        children: "Qty"
                    }),
                    /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
                        className: "orderly-inline-block",
                        children: [
                            /*#__PURE__*/ (0, _jsxruntime.jsx)(_text.Text, {
                                className: (0, _utils.cn)("orderly-mr-1", data.side === "BUY" ? "orderly-text-trade-profit" : "orderly-text-trade-loss"),
                                children: (0, _utils1.commify)(qty)
                            }),
                            /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
                                className: "orderly-text-base-contrast-36",
                                children: base
                            })
                        ]
                    })
                ]
            }),
            isAlgoOrder && /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
                className: "orderly-flex orderly-justify-between orderly-text-sm orderly-pb-1",
                children: [
                    /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
                        className: "orderly-text-base-contrast-54",
                        children: "Trigger price"
                    }),
                    /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
                        className: "orderly-inline-block",
                        children: [
                            /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
                                className: "orderly-mr-1",
                                children: (0, _utils1.commify)(triggerPrice)
                            }),
                            /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
                                className: "orderly-text-base-contrast-36",
                                children: quote
                            })
                        ]
                    })
                ]
            }),
            /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
                className: "orderly-flex orderly-justify-between orderly-text-sm",
                children: [
                    /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
                        className: "orderly-text-base-contrast-54",
                        children: "Price"
                    }),
                    /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
                        className: "orderly-inline-block",
                        children: [
                            isMarketOrder ? /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
                                children: "Market"
                            }) : /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
                                children: (0, _utils1.commify)(price)
                            }),
                            /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
                                className: "orderly-ml-1 orderly-text-base-contrast-36",
                                children: quote
                            })
                        ]
                    })
                ]
            })
        ]
    });
};

//# sourceMappingURL=confirmContent.js.map