import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { OrderSide, OrderType } from "@orderly.network/types";
import { useMemo } from "react";
import { Text } from "../../../text";
export const OrderConfirmView = (props)=>{
    const { order, quote = "USDC", base } = props;
    const type = useMemo(()=>{
        const type = order.order_type === OrderType.MARKET ? "Market" : "Limit";
        if (order.side === OrderSide.BUY) {
            return /*#__PURE__*/ _jsx(Text, {
                type: "buy",
                children: `${type} Buy`
            });
        }
        return /*#__PURE__*/ _jsx(Text, {
            type: "sell",
            children: `${type} Sell`
        });
    }, [
        order.side,
        order.order_type
    ]);
    return /*#__PURE__*/ _jsxs("div", {
        className: "orderly-grid orderly-grid-cols-2 orderly-text-base-contract-54 orderly-text-xs desktop:orderly-text-sm",
        children: [
            /*#__PURE__*/ _jsxs("div", {
                children: [
                    /*#__PURE__*/ _jsx("div", {
                        className: "desktop:orderly-flex desktop:orderly-justify-start",
                        children: type
                    }),
                    /*#__PURE__*/ _jsxs("div", {
                        className: "orderly-flex orderly-gap-1 orderly-items-end",
                        children: [
                            /*#__PURE__*/ _jsx("span", {
                                children: base
                            }),
                            /*#__PURE__*/ _jsxs("span", {
                                className: "orderly-text-3xs orderly-text-base-contrast-54",
                                children: [
                                    "/",
                                    quote
                                ]
                            })
                        ]
                    })
                ]
            }),
            /*#__PURE__*/ _jsxs("div", {
                className: "orderly-flex orderly-flex-col orderly-gap-2",
                children: [
                    /*#__PURE__*/ _jsxs("div", {
                        className: "orderly-flex orderly-justify-between",
                        children: [
                            /*#__PURE__*/ _jsx("span", {
                                className: "orderly-text-base-contrast-54",
                                children: "Qty."
                            }),
                            /*#__PURE__*/ _jsx("span", {
                                children: order.order_quantity
                            })
                        ]
                    }),
                    /*#__PURE__*/ _jsxs("div", {
                        className: "orderly-flex orderly-justify-between",
                        children: [
                            /*#__PURE__*/ _jsx("span", {
                                className: "orderly-text-base-contrast-54",
                                children: "Price"
                            }),
                            /*#__PURE__*/ _jsx("span", {
                                children: order.order_type === OrderType.MARKET ? "Market" : order.order_price
                            })
                        ]
                    }),
                    /*#__PURE__*/ _jsxs("div", {
                        className: "orderly-flex orderly-justify-between",
                        children: [
                            /*#__PURE__*/ _jsx("span", {
                                className: "orderly-text-base-contrast-54",
                                children: "Total"
                            }),
                            /*#__PURE__*/ _jsx("span", {
                                children: order.total
                            })
                        ]
                    })
                ]
            })
        ]
    });
};

//# sourceMappingURL=orderConfirmView.js.map