@n1xyz/wallet-widget 0.0.14 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Modal/LoadingFallback.js +1 -1
- package/dist/Modal/LoadingFallback.js.map +1 -1
- package/dist/Modal/N1WalletModal.d.ts +1 -0
- package/dist/Modal/N1WalletModal.js +7 -5
- package/dist/Modal/N1WalletModal.js.map +1 -1
- package/dist/Modal/NTSFlow/LoadingFallback.js +1 -1
- package/dist/Modal/NTSFlow/LoadingFallback.js.map +1 -1
- package/dist/Modal/NTSFlow/components/BackButton.js +1 -1
- package/dist/Modal/NTSFlow/components/BackButton.js.map +1 -1
- package/dist/Modal/NTSFlow/components/ModalHeader.js +1 -1
- package/dist/Modal/NTSFlow/components/ModalHeader.js.map +1 -1
- package/dist/Modal/NTSFlow/views/ConnectView.js +2 -2
- package/dist/Modal/NTSFlow/views/ConnectView.js.map +1 -1
- package/dist/Modal/NTSFlow/views/CreateSessionView.js +5 -5
- package/dist/Modal/NTSFlow/views/CreateSessionView.js.map +1 -1
- package/dist/Modal/NTSFlow/views/CreateUserView.js +1 -1
- package/dist/Modal/NTSFlow/views/CreateUserView.js.map +1 -1
- package/dist/Modal/NTSFlow/views/NoWhitelistView.js +3 -3
- package/dist/Modal/NTSFlow/views/NoWhitelistView.js.map +1 -1
- package/dist/Modal/NTSFlow/views/SigningView.js +1 -1
- package/dist/Modal/NTSFlow/views/SigningView.js.map +1 -1
- package/dist/Modal/NordFlow/NordFlow.js +2 -2
- package/dist/Modal/NordFlow/NordFlow.js.map +1 -1
- package/dist/Modal/NordFlow/components/ChainButton.js +5 -5
- package/dist/Modal/NordFlow/components/ChainButton.js.map +1 -1
- package/dist/Modal/NordFlow/components/EVMChainsButton.js +4 -4
- package/dist/Modal/NordFlow/components/EVMChainsButton.js.map +1 -1
- package/dist/Modal/NordFlow/components/Header.js +1 -1
- package/dist/Modal/NordFlow/components/Header.js.map +1 -1
- package/dist/Modal/NordFlow/components/ImageWithFallback.js +1 -1
- package/dist/Modal/NordFlow/components/ImageWithFallback.js.map +1 -1
- package/dist/Modal/NordFlow/components/LoadingSquares.js +1 -1
- package/dist/Modal/NordFlow/components/LoadingSquares.js.map +1 -1
- package/dist/Modal/NordFlow/components/MoreButton.js +4 -4
- package/dist/Modal/NordFlow/components/MoreButton.js.map +1 -1
- package/dist/Modal/NordFlow/components/TransactionTable.js +6 -6
- package/dist/Modal/NordFlow/components/TransactionTable.js.map +1 -1
- package/dist/Modal/NordFlow/components/WaitingMessage.js +1 -1
- package/dist/Modal/NordFlow/components/WaitingMessage.js.map +1 -1
- package/dist/Modal/NordFlow/screens/00-IdleScreen.js +1 -1
- package/dist/Modal/NordFlow/screens/00-IdleScreen.js.map +1 -1
- package/dist/Modal/NordFlow/screens/01-ConnectWalletScreen.js +3 -3
- package/dist/Modal/NordFlow/screens/01-ConnectWalletScreen.js.map +1 -1
- package/dist/Modal/NordFlow/screens/02-EvmWalletAuthScreen.js +4 -4
- package/dist/Modal/NordFlow/screens/02-EvmWalletAuthScreen.js.map +1 -1
- package/dist/Modal/NordFlow/screens/03-ChainSelectionScreen.js +2 -2
- package/dist/Modal/NordFlow/screens/03-ChainSelectionScreen.js.map +1 -1
- package/dist/Modal/NordFlow/screens/04-AmountInputScreen.js +4 -4
- package/dist/Modal/NordFlow/screens/04-AmountInputScreen.js.map +1 -1
- package/dist/Modal/NordFlow/screens/05-DepositProgressScreen.js +1 -1
- package/dist/Modal/NordFlow/screens/05-DepositProgressScreen.js.map +1 -1
- package/dist/Modal/NordFlow/screens/06-DepositSuccessScreen.js +4 -4
- package/dist/Modal/NordFlow/screens/06-DepositSuccessScreen.js.map +1 -1
- package/dist/Modal/NordFlow/screens/07-AuthLoadingScreen.js +3 -3
- package/dist/Modal/NordFlow/screens/07-AuthLoadingScreen.js.map +1 -1
- package/dist/Modal/NordFlow/screens/08-FinalSuccessScreen.d.ts +1 -1
- package/dist/Modal/NordFlow/screens/08-FinalSuccessScreen.js +16 -14
- package/dist/Modal/NordFlow/screens/08-FinalSuccessScreen.js.map +1 -1
- package/dist/Modal/NordFlow/screens/09-ErrorScreen.js +2 -2
- package/dist/Modal/NordFlow/screens/09-ErrorScreen.js.map +1 -1
- package/dist/Modal/Sidebar/N1Sidebar.js +10 -10
- package/dist/Modal/Sidebar/N1Sidebar.js.map +1 -1
- package/dist/Modal/Sidebar/NordTradingView/MarketOverview/MarketSelector.js +5 -5
- package/dist/Modal/Sidebar/NordTradingView/MarketOverview/MarketSelector.js.map +1 -1
- package/dist/Modal/Sidebar/NordTradingView/MarketOverview/MarketStats.js +3 -3
- package/dist/Modal/Sidebar/NordTradingView/MarketOverview/MarketStats.js.map +1 -1
- package/dist/Modal/Sidebar/NordTradingView/NordTradingView.js +2 -2
- package/dist/Modal/Sidebar/NordTradingView/NordTradingView.js.map +1 -1
- package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBook.js +2 -2
- package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBook.js.map +1 -1
- package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBookDepthVisualizer.js +1 -1
- package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBookDepthVisualizer.js.map +1 -1
- package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBookHeader.js +4 -4
- package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBookHeader.js.map +1 -1
- package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBookTable.js +6 -6
- package/dist/Modal/Sidebar/NordTradingView/OrderBook/OrderBookTable.js.map +1 -1
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/AmountInput.js +1 -1
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/AmountInput.js.map +1 -1
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/BuySellTabs.js +3 -3
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/BuySellTabs.js.map +1 -1
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/FillModeSelector.js +7 -7
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/FillModeSelector.js.map +1 -1
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/OrderTypeSelector.js +13 -13
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/OrderTypeSelector.js.map +1 -1
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/PriceInput.js +1 -1
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/PriceInput.js.map +1 -1
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/SubmitButton.js +2 -2
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/SubmitButton.js.map +1 -1
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/TotalCalculator.js +1 -1
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/TotalCalculator.js.map +1 -1
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/TradeForm.js +5 -5
- package/dist/Modal/Sidebar/NordTradingView/TradeForm/TradeForm.js.map +1 -1
- package/dist/Modal/Sidebar/NordTradingView/UserBalances/UserBalances.js +1 -1
- package/dist/Modal/Sidebar/NordTradingView/UserBalances/UserBalances.js.map +1 -1
- package/dist/Modal/Sidebar/NordTradingView/UserOrders/UserOrders.js +5 -5
- package/dist/Modal/Sidebar/NordTradingView/UserOrders/UserOrders.js.map +1 -1
- package/dist/Modal/Sidebar/NordTradingView/UserPositions/UserPositions.js +4 -4
- package/dist/Modal/Sidebar/NordTradingView/UserPositions/UserPositions.js.map +1 -1
- package/dist/Provider/N1WalletProvider.d.ts +1 -1
- package/dist/Provider/N1WalletProvider.js +65 -37
- package/dist/Provider/N1WalletProvider.js.map +1 -1
- package/dist/Provider/types.d.ts +13 -0
- package/dist/Provider/types.js.map +1 -1
- package/dist/WidgetButton/N1ConnectButton.js +1 -1
- package/dist/WidgetButton/N1ConnectButton.js.map +1 -1
- package/dist/components/Logo.js.map +1 -1
- package/dist/components/QRCodeLoader.js +1 -1
- package/dist/components/QRCodeLoader.js.map +1 -1
- package/dist/components/logos/EVMChainsGroup.js +1 -1
- package/dist/components/logos/EVMChainsGroup.js.map +1 -1
- package/dist/components/logos/MoreChainsGroup.js +1 -1
- package/dist/components/logos/MoreChainsGroup.js.map +1 -1
- package/dist/embedded-main-css.d.ts +2 -0
- package/dist/embedded-main-css.js +3 -0
- package/dist/embedded-main-css.js.map +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/main.css +2 -1
- package/package.json +8 -5
- package/dist/Modal/NordFlow/context/deposit/types.d.ts +0 -26
- package/dist/Modal/NordFlow/context/deposit/types.js +0 -2
- package/dist/Modal/NordFlow/context/deposit/types.js.map +0 -1
- package/dist/Modal/NordFlow/context/deposit/useDepositAuth.d.ts +0 -7
- package/dist/Modal/NordFlow/context/deposit/useDepositAuth.js +0 -113
- package/dist/Modal/NordFlow/context/deposit/useDepositAuth.js.map +0 -1
- package/dist/Modal/NordFlow/context/deposit/useDepositTransaction.d.ts +0 -20
- package/dist/Modal/NordFlow/context/deposit/useDepositTransaction.js +0 -235
- package/dist/Modal/NordFlow/context/deposit/useDepositTransaction.js.map +0 -1
- package/dist/Modal/NordFlow/hooks/index.d.ts +0 -3
- package/dist/Modal/NordFlow/hooks/index.js +0 -4
- package/dist/Modal/NordFlow/hooks/index.js.map +0 -1
- package/dist/Modal/NordFlow/hooks/useDepositFlow.d.ts +0 -52
- package/dist/Modal/NordFlow/hooks/useDepositFlow.js +0 -385
- package/dist/Modal/NordFlow/hooks/useDepositFlow.js.map +0 -1
- package/dist/Modal/NordFlow/hooks/useFlowState.d.ts +0 -32
- package/dist/Modal/NordFlow/hooks/useFlowState.js +0 -189
- package/dist/Modal/NordFlow/hooks/useFlowState.js.map +0 -1
- package/dist/Modal/NordFlow/hooks/useInterruptHandler.d.ts +0 -24
- package/dist/Modal/NordFlow/hooks/useInterruptHandler.js +0 -59
- package/dist/Modal/NordFlow/hooks/useInterruptHandler.js.map +0 -1
- package/dist/Modal/NordFlow/hooks/useNordInstance.d.ts +0 -0
- package/dist/Modal/NordFlow/hooks/useNordInstance.js +0 -3
- package/dist/Modal/NordFlow/hooks/useNordInstance.js.map +0 -1
- package/dist/Modal/NordFlow/hooks/useNordWalletConnect.d.ts +0 -13
- package/dist/Modal/NordFlow/hooks/useNordWalletConnect.js +0 -259
- package/dist/Modal/NordFlow/hooks/useNordWalletConnect.js.map +0 -1
- package/dist/Modal/NordFlow/utils/persistence.d.ts +0 -24
- package/dist/Modal/NordFlow/utils/persistence.js +0 -84
- package/dist/Modal/NordFlow/utils/persistence.js.map +0 -1
- package/dist/Provider/useN1WalletProvider.d.ts +0 -37
- package/dist/Provider/useN1WalletProvider.js +0 -398
- package/dist/Provider/useN1WalletProvider.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderTypeSelector.js","sourceRoot":"","sources":["../../../../../src/Modal/Sidebar/NordTradingView/TradeForm/OrderTypeSelector.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAU3C,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EAKjB;QAJtB,SAAS,eAAA,EACT,QAAQ,cAAA,EACR,iBAAiB,uBAAA,EACjB,gBAAgB,sBAAA;IAEV,IAAA,KAAwC,QAAQ,CAAC,KAAK,CAAC,EAAtD,eAAe,QAAA,EAAE,kBAAkB,QAAmB,CAAC;IACxD,IAAA,KAAsC,QAAQ,CAAC,KAAK,CAAC,EAApD,cAAc,QAAA,EAAE,iBAAiB,QAAmB,CAAC;IACtD,IAAA,KAA0C,QAAQ,CACtD,IAAI,CACL,EAFM,gBAAgB,QAAA,EAAE,mBAAmB,QAE3C,CAAC;IACI,IAAA,KAAwC,QAAQ,CAAkB,IAAI,CAAC,E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sWAAsW,aAEhX,yBAAO,SAAS,GAAQ,EACxB,KAAC,WAAW,IACV,IAAI,EAAE,EAAE,EACR,SAAS,EAAE,4CACT,eAAe;oCACb,CAAC,CAAC,mDAAmD;oCACrD,CAAC,CAAC,wCAAwC,CAC5C,GACF,IACK,EAER,uBAAuB,EAAE,IACtB,EAGL,SAAS,KAAK,OAAO,IAAI,CACxB,eAAK,SAAS,EAAC,UAAU,EAAC,GAAG,EAAE,WAAW,aACxC,gBAAO,SAAS,EAAC,uEAAuE,0BAEhF,EACR,kBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,cAAM,OAAA,iBAAiB,CAAC,CAAC,cAAc,CAAC,EAAlC,CAAkC,EACjD,SAAS,EAAC,sWAAsW,aAEhX,yBAAO,QAAQ,GAAQ,EACvB,KAAC,WAAW,IACV,IAAI,EAAE,EAAE,EACR,SAAS,EAAE,4CACT,cAAc;oCACZ,CAAC,CAAC,mDAAmD;oCACrD,CAAC,CAAC,wCAAwC,CAC5C,GACF,IACK,EAER,sBAAsB,EAAE,IACrB,CACP,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { useState, useRef, useEffect } from 'react';\nimport { createPortal } from 'react-dom';\nimport { ChevronDown } from 'lucide-react';\nimport { OrderType, FillMode } from './TradeForm';\n\ninterface FillModeSelectorProps {\n orderType: OrderType;\n fillMode: FillMode;\n onOrderTypeChange: (type: OrderType) => void;\n onFillModeChange: (mode: FillMode) => void;\n}\n\nexport default function FillModeSelector({\n orderType,\n fillMode,\n onOrderTypeChange,\n onFillModeChange,\n}: FillModeSelectorProps) {\n const [isOrderTypeOpen, setIsOrderTypeOpen] = useState(false);\n const [isFillModeOpen, setIsFillModeOpen] = useState(false);\n const [hoveredOrderType, setHoveredOrderType] = useState<OrderType | null>(\n null\n );\n const [hoveredFillMode, setHoveredFillMode] = useState<FillMode | null>(null);\n const orderTypeRef = useRef<HTMLDivElement>(null);\n const fillModeRef = useRef<HTMLDivElement>(null);\n const [orderTypeRect, setOrderTypeRect] = useState<DOMRect | null>(null);\n const [fillModeRect, setFillModeRect] = useState<DOMRect | null>(null);\n\n // Update rect when dropdown opens\n useEffect(() => {\n if (isOrderTypeOpen && orderTypeRef.current) {\n setOrderTypeRect(orderTypeRef.current.getBoundingClientRect());\n }\n }, [isOrderTypeOpen]);\n\n useEffect(() => {\n if (isFillModeOpen && fillModeRef.current) {\n setFillModeRect(fillModeRef.current.getBoundingClientRect());\n }\n }, [isFillModeOpen]);\n\n // Close dropdowns when clicking outside\n useEffect(() => {\n function handleClickOutside(event: MouseEvent) {\n if (\n orderTypeRef.current &&\n !orderTypeRef.current.contains(event.target as Node)\n ) {\n setIsOrderTypeOpen(false);\n }\n if (\n fillModeRef.current &&\n !fillModeRef.current.contains(event.target as Node)\n ) {\n setIsFillModeOpen(false);\n }\n }\n\n document.addEventListener('mousedown', handleClickOutside);\n return () => {\n document.removeEventListener('mousedown', handleClickOutside);\n };\n }, []);\n\n // Order type options\n const orderTypes: OrderType[] = ['LIMIT', 'MARKET'];\n\n // Fill mode options\n const fillModes: FillMode[] = ['GTC', 'IOC', 'FOK', 'POST_ONLY'];\n\n // Fill mode descriptions\n const fillModeDescriptions: Record<FillMode, string> = {\n GTC: 'Good Till Cancelled',\n IOC: 'Immediate or Cancel',\n FOK: 'Fill or Kill',\n POST_ONLY: 'Post Only',\n };\n\n // Render dropdown via portal\n const renderOrderTypeDropdown = () => {\n if (!isOrderTypeOpen || !orderTypeRect) return null;\n\n const dropdownStyle: React.CSSProperties = {\n position: 'fixed',\n top: `${orderTypeRect.bottom + window.scrollY}px`,\n left: `${orderTypeRect.left + window.scrollX}px`,\n width: `${orderTypeRect.width}px`,\n zIndex: 9999,\n maxHeight: '200px',\n overflowY: 'auto',\n };\n\n return createPortal(\n <div\n className=\"bg-white dark:bg-n1-dark-950 rounded-sm shadow-lg border border-n1-gray-200 dark:border-n1-gray-800 overflow-hidden n1-animate-dropdown-open\"\n style={dropdownStyle}\n >\n {orderTypes.map((type) => (\n <button\n key={type}\n type=\"button\"\n onClick={() => {\n onOrderTypeChange(type);\n setIsOrderTypeOpen(false);\n }}\n onMouseEnter={() => setHoveredOrderType(type)}\n onMouseLeave={() => setHoveredOrderType(null)}\n className={`w-full text-left px-3 py-2 text-sm cursor-pointer transition-colors duration-200 relative overflow-hidden ${\n orderType === type\n ? 'bg-n1-gray-100 dark:bg-n1-gray-800 font-medium text-n1-gray-900 dark:text-white'\n : 'text-n1-gray-900 dark:text-n1-gray-100 hover:bg-n1-gray-50 dark:hover:bg-n1-gray-800'\n }`}\n >\n <div className=\"flex items-center\">\n <div\n className={`w-1 h-10 absolute left-0 top-0 bottom-0 my-auto rounded-r-sm ${\n orderType === type\n ? 'bg-emerald-600 dark:bg-emerald-500'\n : 'bg-transparent'\n }`}\n />\n <span className=\"ml-1\">{type}</span>\n </div>\n\n {orderType === type && hoveredOrderType === type && (\n <span\n className=\"absolute inset-0 bg-gradient-to-r from-transparent via-white to-transparent opacity-25 pointer-events-none translate-x-[-200%] n1-animate-shimmer dark:via-n1-gray-300\"\n style={{\n backgroundSize: '200% 100%',\n animationDuration: '1.5s',\n }}\n />\n )}\n </button>\n ))}\n </div>,\n document.body\n );\n };\n\n // Render fill mode dropdown via portal\n const renderFillModeDropdown = () => {\n if (!isFillModeOpen || !fillModeRect) return null;\n\n const dropdownStyle: React.CSSProperties = {\n position: 'fixed',\n top: `${fillModeRect.bottom + window.scrollY}px`,\n left: `${fillModeRect.left + window.scrollX}px`,\n width: `${fillModeRect.width}px`,\n zIndex: 9999,\n maxHeight: '200px',\n overflowY: 'auto',\n };\n\n return createPortal(\n <div\n className=\"bg-white dark:bg-n1-dark-950 rounded-sm shadow-lg border border-n1-gray-200 dark:border-n1-gray-800 overflow-hidden n1-animate-dropdown-open\"\n style={dropdownStyle}\n >\n {fillModes.map((mode) => (\n <button\n key={mode}\n type=\"button\"\n onClick={() => {\n onFillModeChange(mode);\n setIsFillModeOpen(false);\n }}\n onMouseEnter={() => setHoveredFillMode(mode)}\n onMouseLeave={() => setHoveredFillMode(null)}\n className={`w-full text-left px-3 py-2 text-sm cursor-pointer transition-colors duration-200 relative overflow-hidden ${\n fillMode === mode\n ? 'bg-n1-gray-100 dark:bg-n1-gray-800 font-medium text-n1-gray-900 dark:text-white'\n : 'text-n1-gray-900 dark:text-n1-gray-100 hover:bg-n1-gray-50 dark:hover:bg-n1-gray-800'\n }`}\n >\n <div className=\"flex items-center\">\n <div\n className={`w-1 h-10 absolute left-0 top-0 bottom-0 my-auto rounded-r-sm ${\n fillMode === mode\n ? 'bg-emerald-600 dark:bg-emerald-500'\n : 'bg-transparent'\n }`}\n />\n <div className=\"flex flex-col ml-1\">\n <span>{mode}</span>\n <span className=\"text-[10px] text-n1-gray-500 dark:text-n1-gray-400\">\n {fillModeDescriptions[mode]}\n </span>\n </div>\n </div>\n\n {fillMode === mode && hoveredFillMode === mode && (\n <span\n className=\"absolute inset-0 bg-gradient-to-r from-transparent via-white to-transparent opacity-25 pointer-events-none translate-x-[-200%] n1-animate-shimmer dark:via-n1-gray-300\"\n style={{\n backgroundSize: '200% 100%',\n animationDuration: '1.5s',\n }}\n />\n )}\n </button>\n ))}\n </div>,\n document.body\n );\n };\n\n return (\n <div className=\"grid grid-cols-2 gap-3\">\n {/* Order Type Selector */}\n <div className=\"relative\" ref={orderTypeRef}>\n <label className=\"block text-xs font-medium text-n1-gray-700 dark:text-n1-gray-300 mb-1\">\n Order Type\n </label>\n <button\n type=\"button\"\n onClick={() => setIsOrderTypeOpen(!isOrderTypeOpen)}\n className=\"w-full flex items-center justify-between px-3 py-2 border border-n1-gray-200 dark:border-n1-gray-800 rounded-sm text-sm text-n1-gray-900 dark:text-n1-gray-100 hover:border-n1-gray-400 dark:hover:border-n1-gray-500 transition-colors duration-200 bg-white dark:bg-n1-dark-950 focus:outline-none focus:ring-1 focus:ring-n1-gray-400 dark:focus:ring-n1-gray-600\"\n >\n <span>{orderType}</span>\n <ChevronDown\n size={14}\n className={`transition-transform duration-200 ${\n isOrderTypeOpen\n ? 'rotate-180 text-n1-gray-700 dark:text-n1-gray-300'\n : 'text-n1-gray-500 dark:text-n1-gray-400'\n }`}\n />\n </button>\n\n {renderOrderTypeDropdown()}\n </div>\n\n {/* Fill Mode Selector (only for LIMIT orders) */}\n {orderType === 'LIMIT' && (\n <div className=\"relative\" ref={fillModeRef}>\n <label className=\"block text-xs font-medium text-n1-gray-700 dark:text-n1-gray-300 mb-1\">\n Fill Mode\n </label>\n <button\n type=\"button\"\n onClick={() => setIsFillModeOpen(!isFillModeOpen)}\n className=\"w-full flex items-center justify-between px-3 py-2 border border-n1-gray-200 dark:border-n1-gray-800 rounded-sm text-sm text-n1-gray-900 dark:text-n1-gray-100 hover:border-n1-gray-400 dark:hover:border-n1-gray-500 transition-colors duration-200 bg-white dark:bg-n1-dark-950 focus:outline-none focus:ring-1 focus:ring-n1-gray-400 dark:focus:ring-n1-gray-600\"\n >\n <span>{fillMode}</span>\n <ChevronDown\n size={14}\n className={`transition-transform duration-200 ${\n isFillModeOpen\n ? 'rotate-180 text-n1-gray-700 dark:text-n1-gray-300'\n : 'text-n1-gray-500 dark:text-n1-gray-400'\n }`}\n />\n </button>\n\n {renderFillModeDropdown()}\n </div>\n )}\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"OrderTypeSelector.js","sourceRoot":"","sources":["../../../../../src/Modal/Sidebar/NordTradingView/TradeForm/OrderTypeSelector.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAU3C,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EAKjB;QAJtB,SAAS,eAAA,EACT,QAAQ,cAAA,EACR,iBAAiB,uBAAA,EACjB,gBAAgB,sBAAA;IAEV,IAAA,KAAwC,QAAQ,C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d,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CACL,eAAK,SAAS,EAAC,wBAAwB,aAErC,eAAK,SAAS,EAAC,UAAU,EAAC,GAAG,EAAE,YAAY,aACzC,gBAAO,SAAS,EAAC,6EAA6E,2BAEtF,EACR,kBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,cAAM,OAAA,kBAAkB,CAAC,CAAC,eAAe,CAAC,EAApC,CAAoC,EACnD,SAAS,EAAC,iYAAiY,aAE3Y,yBAAO,SAAS,GAAQ,EACxB,KAAC,WAAW,IACV,IAAI,EAAE,EAAE,EACR,SAAS,EAAE,4CACT,eAAe;oCACb,CAAC,CAAC,yDAAyD;oCAC3D,CAAC,CAAC,8CAA8C,CAClD,GACF,IACK,EAER,uBAAuB,EAAE,IACtB,EAGL,SAAS,KAAK,OAAO,IAAI,CACxB,eAAK,SAAS,EAAC,UAAU,EAAC,GAAG,EAAE,WAAW,aACxC,gBAAO,SAAS,EAAC,6EAA6E,0BAEtF,EACR,kBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,cAAM,OAAA,iBAAiB,CAAC,CAAC,cAAc,CAAC,EAAlC,CAAkC,EACjD,SAAS,EAAC,iYAAiY,aAE3Y,yBAAO,QAAQ,GAAQ,EACvB,KAAC,WAAW,IACV,IAAI,EAAE,EAAE,EACR,SAAS,EAAE,4CACT,cAAc;oCACZ,CAAC,CAAC,yDAAyD;oCAC3D,CAAC,CAAC,8CAA8C,CAClD,GACF,IACK,EAER,sBAAsB,EAAE,IACrB,CACP,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { useState, useRef, useEffect } from 'react';\nimport { createPortal } from 'react-dom';\nimport { ChevronDown } from 'lucide-react';\nimport { OrderType, FillMode } from './TradeForm';\n\ninterface FillModeSelectorProps {\n orderType: OrderType;\n fillMode: FillMode;\n onOrderTypeChange: (type: OrderType) => void;\n onFillModeChange: (mode: FillMode) => void;\n}\n\nexport default function FillModeSelector({\n orderType,\n fillMode,\n onOrderTypeChange,\n onFillModeChange,\n}: FillModeSelectorProps) {\n const [isOrderTypeOpen, setIsOrderTypeOpen] = useState(false);\n const [isFillModeOpen, setIsFillModeOpen] = useState(false);\n const [hoveredOrderType, setHoveredOrderType] = useState<OrderType | null>(\n null\n );\n const [hoveredFillMode, setHoveredFillMode] = useState<FillMode | null>(null);\n const orderTypeRef = useRef<HTMLDivElement>(null);\n const fillModeRef = useRef<HTMLDivElement>(null);\n const [orderTypeRect, setOrderTypeRect] = useState<DOMRect | null>(null);\n const [fillModeRect, setFillModeRect] = useState<DOMRect | null>(null);\n\n // Update rect when dropdown opens\n useEffect(() => {\n if (isOrderTypeOpen && orderTypeRef.current) {\n setOrderTypeRect(orderTypeRef.current.getBoundingClientRect());\n }\n }, [isOrderTypeOpen]);\n\n useEffect(() => {\n if (isFillModeOpen && fillModeRef.current) {\n setFillModeRect(fillModeRef.current.getBoundingClientRect());\n }\n }, [isFillModeOpen]);\n\n // Close dropdowns when clicking outside\n useEffect(() => {\n function handleClickOutside(event: MouseEvent) {\n if (\n orderTypeRef.current &&\n !orderTypeRef.current.contains(event.target as Node)\n ) {\n setIsOrderTypeOpen(false);\n }\n if (\n fillModeRef.current &&\n !fillModeRef.current.contains(event.target as Node)\n ) {\n setIsFillModeOpen(false);\n }\n }\n\n document.addEventListener('mousedown', handleClickOutside);\n return () => {\n document.removeEventListener('mousedown', handleClickOutside);\n };\n }, []);\n\n // Order type options\n const orderTypes: OrderType[] = ['LIMIT', 'MARKET'];\n\n // Fill mode options\n const fillModes: FillMode[] = ['GTC', 'IOC', 'FOK', 'POST_ONLY'];\n\n // Fill mode descriptions\n const fillModeDescriptions: Record<FillMode, string> = {\n GTC: 'Good Till Cancelled',\n IOC: 'Immediate or Cancel',\n FOK: 'Fill or Kill',\n POST_ONLY: 'Post Only',\n };\n\n // Render dropdown via portal\n const renderOrderTypeDropdown = () => {\n if (!isOrderTypeOpen || !orderTypeRect) return null;\n\n const dropdownStyle: React.CSSProperties = {\n position: 'fixed',\n top: `${orderTypeRect.bottom + window.scrollY}px`,\n left: `${orderTypeRect.left + window.scrollX}px`,\n width: `${orderTypeRect.width}px`,\n zIndex: 9999,\n maxHeight: '200px',\n overflowY: 'auto',\n };\n\n return createPortal(\n <div\n className=\"bg-white dark:bg-n1-ww-dark-950 rounded-sm shadow-lg border border-n1-ww-gray-200 dark:border-n1-ww-gray-800 overflow-hidden n1-ww-animate-dropdown-open\"\n style={dropdownStyle}\n >\n {orderTypes.map((type) => (\n <button\n key={type}\n type=\"button\"\n onClick={() => {\n onOrderTypeChange(type);\n setIsOrderTypeOpen(false);\n }}\n onMouseEnter={() => setHoveredOrderType(type)}\n onMouseLeave={() => setHoveredOrderType(null)}\n className={`w-full text-left px-3 py-2 text-sm cursor-pointer transition-colors duration-200 relative overflow-hidden ${\n orderType === type\n ? 'bg-n1-ww-gray-100 dark:bg-n1-ww-gray-800 font-medium text-n1-ww-gray-900 dark:text-white'\n : 'text-n1-ww-gray-900 dark:text-n1-ww-gray-100 hover:bg-n1-ww-gray-50 dark:hover:bg-n1-ww-gray-800'\n }`}\n >\n <div className=\"flex items-center\">\n <div\n className={`w-1 h-10 absolute left-0 top-0 bottom-0 my-auto rounded-r-sm ${\n orderType === type\n ? 'bg-emerald-600 dark:bg-emerald-500'\n : 'bg-transparent'\n }`}\n />\n <span className=\"ml-1\">{type}</span>\n </div>\n\n {orderType === type && hoveredOrderType === type && (\n <span\n className=\"absolute inset-0 bg-gradient-to-r from-transparent via-white to-transparent opacity-25 pointer-events-none translate-x-[-200%] n1-ww-animate-shimmer dark:via-n1-ww-gray-300\"\n style={{\n backgroundSize: '200% 100%',\n animationDuration: '1.5s',\n }}\n />\n )}\n </button>\n ))}\n </div>,\n document.body\n );\n };\n\n // Render fill mode dropdown via portal\n const renderFillModeDropdown = () => {\n if (!isFillModeOpen || !fillModeRect) return null;\n\n const dropdownStyle: React.CSSProperties = {\n position: 'fixed',\n top: `${fillModeRect.bottom + window.scrollY}px`,\n left: `${fillModeRect.left + window.scrollX}px`,\n width: `${fillModeRect.width}px`,\n zIndex: 9999,\n maxHeight: '200px',\n overflowY: 'auto',\n };\n\n return createPortal(\n <div\n className=\"bg-white dark:bg-n1-ww-dark-950 rounded-sm shadow-lg border border-n1-ww-gray-200 dark:border-n1-ww-gray-800 overflow-hidden n1-ww-animate-dropdown-open\"\n style={dropdownStyle}\n >\n {fillModes.map((mode) => (\n <button\n key={mode}\n type=\"button\"\n onClick={() => {\n onFillModeChange(mode);\n setIsFillModeOpen(false);\n }}\n onMouseEnter={() => setHoveredFillMode(mode)}\n onMouseLeave={() => setHoveredFillMode(null)}\n className={`w-full text-left px-3 py-2 text-sm cursor-pointer transition-colors duration-200 relative overflow-hidden ${\n fillMode === mode\n ? 'bg-n1-ww-gray-100 dark:bg-n1-ww-gray-800 font-medium text-n1-ww-gray-900 dark:text-white'\n : 'text-n1-ww-gray-900 dark:text-n1-ww-gray-100 hover:bg-n1-ww-gray-50 dark:hover:bg-n1-ww-gray-800'\n }`}\n >\n <div className=\"flex items-center\">\n <div\n className={`w-1 h-10 absolute left-0 top-0 bottom-0 my-auto rounded-r-sm ${\n fillMode === mode\n ? 'bg-emerald-600 dark:bg-emerald-500'\n : 'bg-transparent'\n }`}\n />\n <div className=\"flex flex-col ml-1\">\n <span>{mode}</span>\n <span className=\"text-[10px] text-n1-ww-gray-500 dark:text-n1-ww-gray-400\">\n {fillModeDescriptions[mode]}\n </span>\n </div>\n </div>\n\n {fillMode === mode && hoveredFillMode === mode && (\n <span\n className=\"absolute inset-0 bg-gradient-to-r from-transparent via-white to-transparent opacity-25 pointer-events-none translate-x-[-200%] n1-ww-animate-shimmer dark:via-n1-ww-gray-300\"\n style={{\n backgroundSize: '200% 100%',\n animationDuration: '1.5s',\n }}\n />\n )}\n </button>\n ))}\n </div>,\n document.body\n );\n };\n\n return (\n <div className=\"grid grid-cols-2 gap-3\">\n {/* Order Type Selector */}\n <div className=\"relative\" ref={orderTypeRef}>\n <label className=\"block text-xs font-medium text-n1-ww-gray-700 dark:text-n1-ww-gray-300 mb-1\">\n Order Type\n </label>\n <button\n type=\"button\"\n onClick={() => setIsOrderTypeOpen(!isOrderTypeOpen)}\n className=\"w-full flex items-center justify-between px-3 py-2 border border-n1-ww-gray-200 dark:border-n1-ww-gray-800 rounded-sm text-sm text-n1-ww-gray-900 dark:text-n1-ww-gray-100 hover:border-n1-ww-gray-400 dark:hover:border-n1-ww-gray-500 transition-colors duration-200 bg-white dark:bg-n1-ww-dark-950 focus:outline-none focus:ring-1 focus:ring-n1-ww-gray-400 dark:focus:ring-n1-ww-gray-600\"\n >\n <span>{orderType}</span>\n <ChevronDown\n size={14}\n className={`transition-transform duration-200 ${\n isOrderTypeOpen\n ? 'rotate-180 text-n1-ww-gray-700 dark:text-n1-ww-gray-300'\n : 'text-n1-ww-gray-500 dark:text-n1-ww-gray-400'\n }`}\n />\n </button>\n\n {renderOrderTypeDropdown()}\n </div>\n\n {/* Fill Mode Selector (only for LIMIT orders) */}\n {orderType === 'LIMIT' && (\n <div className=\"relative\" ref={fillModeRef}>\n <label className=\"block text-xs font-medium text-n1-ww-gray-700 dark:text-n1-ww-gray-300 mb-1\">\n Fill Mode\n </label>\n <button\n type=\"button\"\n onClick={() => setIsFillModeOpen(!isFillModeOpen)}\n className=\"w-full flex items-center justify-between px-3 py-2 border border-n1-ww-gray-200 dark:border-n1-ww-gray-800 rounded-sm text-sm text-n1-ww-gray-900 dark:text-n1-ww-gray-100 hover:border-n1-ww-gray-400 dark:hover:border-n1-ww-gray-500 transition-colors duration-200 bg-white dark:bg-n1-ww-dark-950 focus:outline-none focus:ring-1 focus:ring-n1-ww-gray-400 dark:focus:ring-n1-ww-gray-600\"\n >\n <span>{fillMode}</span>\n <ChevronDown\n size={14}\n className={`transition-transform duration-200 ${\n isFillModeOpen\n ? 'rotate-180 text-n1-ww-gray-700 dark:text-n1-ww-gray-300'\n : 'text-n1-ww-gray-500 dark:text-n1-ww-gray-400'\n }`}\n />\n </button>\n\n {renderFillModeDropdown()}\n </div>\n )}\n </div>\n );\n}\n"]}
|
|
@@ -25,6 +25,6 @@ export default function PriceInput(_a) {
|
|
|
25
25
|
var newPrice = currentPrice * (1 + percentage / 100);
|
|
26
26
|
onChange(newPrice.toString());
|
|
27
27
|
};
|
|
28
|
-
return (_jsxs("div", { className: "relative z-20", children: [_jsx("label", { className: "block text-xs font-medium text-n1-gray-700 dark:text-n1-gray-300 mb-1", children: "Price" }), _jsxs("div", { className: "relative", children: [_jsx("input", { type: "text", value: price, onChange: handlePriceChange, className: "w-full px-3 py-2 border border-n1-gray-200 dark:border-n1-gray-800 rounded-sm text-sm text-n1-gray-900 dark:text-n1-gray-100 focus:outline-none focus:ring-1 focus:ring-n1-gray-400 dark:focus:ring-n1-gray-600 focus:border-n1-gray-400 dark:focus:border-n1-gray-600 bg-white dark:bg-n1-dark-950 font-mono transition-colors duration-200", placeholder: "Enter price" }), marketPrice && (_jsx("button", { type: "button", onClick: setMarketPrice, className: "absolute right-2 top-1/2 transform -translate-y-1/2 text-[10px] border border-n1-gray-200 dark:border-n1-gray-800 text-n1-gray-700 dark:text-n1-gray-300 px-1.5 py-0.5 rounded-sm hover:bg-emerald-600 hover:border-emerald-600 hover:text-white dark:hover:bg-emerald-600 dark:hover:border-emerald-600 dark:hover:text-white transition-colors duration-200", children: "Market" }))] }), _jsxs("div", { className: "grid grid-cols-4 gap-1 mt-2", children: [_jsx("button", { type: "button", onClick: function () { return adjustPrice(-1); }, className: "text-xs px-1 py-0.5 bg-n1-gray-100 dark:bg-n1-gray-800 hover:bg-n1-gray-200 dark:hover:bg-n1-gray-700 rounded text-n1-gray-700 dark:text-n1-gray-300 transition-colors duration-200", children: "-1%" }), _jsx("button", { type: "button", onClick: function () { return adjustPrice(-0.1); }, className: "text-xs px-1 py-0.5 bg-n1-gray-100 dark:bg-n1-gray-800 hover:bg-n1-gray-200 dark:hover:bg-n1-gray-700 rounded text-n1-gray-700 dark:text-n1-gray-300 transition-colors duration-200", children: "-0.1%" }), _jsx("button", { type: "button", onClick: function () { return adjustPrice(0.1); }, className: "text-xs px-1 py-0.5 bg-n1-gray-100 dark:bg-n1-gray-800 hover:bg-n1-gray-200 dark:hover:bg-n1-gray-700 rounded text-n1-gray-700 dark:text-n1-gray-300 transition-colors duration-200", children: "+0.1%" }), _jsx("button", { type: "button", onClick: function () { return adjustPrice(1); }, className: "text-xs px-1 py-0.5 bg-n1-gray-100 dark:bg-n1-gray-800 hover:bg-n1-gray-200 dark:hover:bg-n1-gray-700 rounded text-n1-gray-700 dark:text-n1-gray-300 transition-colors duration-200", children: "+1%" })] })] }));
|
|
28
|
+
return (_jsxs("div", { className: "relative z-20", children: [_jsx("label", { className: "block text-xs font-medium text-n1-ww-gray-700 dark:text-n1-ww-gray-300 mb-1", children: "Price" }), _jsxs("div", { className: "relative", children: [_jsx("input", { type: "text", value: price, onChange: handlePriceChange, className: "w-full px-3 py-2 border border-n1-ww-gray-200 dark:border-n1-ww-gray-800 rounded-sm text-sm text-n1-ww-gray-900 dark:text-n1-ww-gray-100 focus:outline-none focus:ring-1 focus:ring-n1-ww-gray-400 dark:focus:ring-n1-ww-gray-600 focus:border-n1-ww-gray-400 dark:focus:border-n1-ww-gray-600 bg-white dark:bg-n1-ww-dark-950 font-mono transition-colors duration-200", placeholder: "Enter price" }), marketPrice && (_jsx("button", { type: "button", onClick: setMarketPrice, className: "absolute right-2 top-1/2 transform -translate-y-1/2 text-[10px] border border-n1-ww-gray-200 dark:border-n1-ww-gray-800 text-n1-ww-gray-700 dark:text-n1-ww-gray-300 px-1.5 py-0.5 rounded-sm hover:bg-emerald-600 hover:border-emerald-600 hover:text-white dark:hover:bg-emerald-600 dark:hover:border-emerald-600 dark:hover:text-white transition-colors duration-200", children: "Market" }))] }), _jsxs("div", { className: "grid grid-cols-4 gap-1 mt-2", children: [_jsx("button", { type: "button", onClick: function () { return adjustPrice(-1); }, className: "text-xs px-1 py-0.5 bg-n1-ww-gray-100 dark:bg-n1-ww-gray-800 hover:bg-n1-ww-gray-200 dark:hover:bg-n1-ww-gray-700 rounded text-n1-ww-gray-700 dark:text-n1-ww-gray-300 transition-colors duration-200", children: "-1%" }), _jsx("button", { type: "button", onClick: function () { return adjustPrice(-0.1); }, className: "text-xs px-1 py-0.5 bg-n1-ww-gray-100 dark:bg-n1-ww-gray-800 hover:bg-n1-ww-gray-200 dark:hover:bg-n1-ww-gray-700 rounded text-n1-ww-gray-700 dark:text-n1-ww-gray-300 transition-colors duration-200", children: "-0.1%" }), _jsx("button", { type: "button", onClick: function () { return adjustPrice(0.1); }, className: "text-xs px-1 py-0.5 bg-n1-ww-gray-100 dark:bg-n1-ww-gray-800 hover:bg-n1-ww-gray-200 dark:hover:bg-n1-ww-gray-700 rounded text-n1-ww-gray-700 dark:text-n1-ww-gray-300 transition-colors duration-200", children: "+0.1%" }), _jsx("button", { type: "button", onClick: function () { return adjustPrice(1); }, className: "text-xs px-1 py-0.5 bg-n1-ww-gray-100 dark:bg-n1-ww-gray-800 hover:bg-n1-ww-gray-200 dark:hover:bg-n1-ww-gray-700 rounded text-n1-ww-gray-700 dark:text-n1-ww-gray-300 transition-colors duration-200", children: "+1%" })] })] }));
|
|
29
29
|
}
|
|
30
30
|
//# sourceMappingURL=PriceInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PriceInput.js","sourceRoot":"","sources":["../../../../../src/Modal/Sidebar/NordTradingView/TradeForm/PriceInput.tsx"],"names":[],"mappings":";AAQA,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAIjB;QAHhB,KAAK,WAAA,EACL,QAAQ,cAAA,EACR,WAAW,iBAAA;IAEX,sBAAsB;IACtB,IAAM,iBAAiB,GAAG,UAAC,CAAsC;QAC/D,IAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;QAE7B,uCAAuC;QACvC,IAAI,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,EAAE,EAAE,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BAG1M,EACT,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,cAAM,OAAA,WAAW,CAAC,CAAC,CAAC,EAAd,CAAc,EAC7B,SAAS,EAAC,uMAAuM,oBAG1M,IACL,IACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\n\ninterface PriceInputProps {\n price: string;\n onChange: (price: string) => void;\n marketPrice?: number;\n}\n\nexport default function PriceInput({\n price,\n onChange,\n marketPrice,\n}: PriceInputProps) {\n // Handle price change\n const handlePriceChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const value = e.target.value;\n\n // Allow only numbers and decimal point\n if (/^[0-9]*\\.?[0-9]*$/.test(value) || value === '') {\n onChange(value);\n }\n };\n\n // Set price to market price\n const setMarketPrice = () => {\n if (marketPrice) {\n onChange(marketPrice.toString());\n }\n };\n\n // Adjust price by percentage\n const adjustPrice = (percentage: number) => {\n if (!price) return;\n\n const currentPrice = parseFloat(price);\n if (isNaN(currentPrice)) return;\n\n const newPrice = currentPrice * (1 + percentage / 100);\n onChange(newPrice.toString());\n };\n\n return (\n <div className=\"relative z-20\">\n <label className=\"block text-xs font-medium text-n1-ww-gray-700 dark:text-n1-ww-gray-300 mb-1\">\n Price\n </label>\n\n <div className=\"relative\">\n <input\n type=\"text\"\n value={price}\n onChange={handlePriceChange}\n className=\"w-full px-3 py-2 border border-n1-ww-gray-200 dark:border-n1-ww-gray-800 rounded-sm text-sm text-n1-ww-gray-900 dark:text-n1-ww-gray-100 focus:outline-none focus:ring-1 focus:ring-n1-ww-gray-400 dark:focus:ring-n1-ww-gray-600 focus:border-n1-ww-gray-400 dark:focus:border-n1-ww-gray-600 bg-white dark:bg-n1-ww-dark-950 font-mono transition-colors duration-200\"\n placeholder=\"Enter price\"\n />\n\n {marketPrice && (\n <button\n type=\"button\"\n onClick={setMarketPrice}\n className=\"absolute right-2 top-1/2 transform -translate-y-1/2 text-[10px] border border-n1-ww-gray-200 dark:border-n1-ww-gray-800 text-n1-ww-gray-700 dark:text-n1-ww-gray-300 px-1.5 py-0.5 rounded-sm hover:bg-emerald-600 hover:border-emerald-600 hover:text-white dark:hover:bg-emerald-600 dark:hover:border-emerald-600 dark:hover:text-white transition-colors duration-200\"\n >\n Market\n </button>\n )}\n </div>\n\n {/* Price adjustment buttons */}\n <div className=\"grid grid-cols-4 gap-1 mt-2\">\n <button\n type=\"button\"\n onClick={() => adjustPrice(-1)}\n className=\"text-xs px-1 py-0.5 bg-n1-ww-gray-100 dark:bg-n1-ww-gray-800 hover:bg-n1-ww-gray-200 dark:hover:bg-n1-ww-gray-700 rounded text-n1-ww-gray-700 dark:text-n1-ww-gray-300 transition-colors duration-200\"\n >\n -1%\n </button>\n <button\n type=\"button\"\n onClick={() => adjustPrice(-0.1)}\n className=\"text-xs px-1 py-0.5 bg-n1-ww-gray-100 dark:bg-n1-ww-gray-800 hover:bg-n1-ww-gray-200 dark:hover:bg-n1-ww-gray-700 rounded text-n1-ww-gray-700 dark:text-n1-ww-gray-300 transition-colors duration-200\"\n >\n -0.1%\n </button>\n <button\n type=\"button\"\n onClick={() => adjustPrice(0.1)}\n className=\"text-xs px-1 py-0.5 bg-n1-ww-gray-100 dark:bg-n1-ww-gray-800 hover:bg-n1-ww-gray-200 dark:hover:bg-n1-ww-gray-700 rounded text-n1-ww-gray-700 dark:text-n1-ww-gray-300 transition-colors duration-200\"\n >\n +0.1%\n </button>\n <button\n type=\"button\"\n onClick={() => adjustPrice(1)}\n className=\"text-xs px-1 py-0.5 bg-n1-ww-gray-100 dark:bg-n1-ww-gray-800 hover:bg-n1-ww-gray-200 dark:hover:bg-n1-ww-gray-700 rounded text-n1-ww-gray-700 dark:text-n1-ww-gray-300 transition-colors duration-200\"\n >\n +1%\n </button>\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -18,7 +18,7 @@ export default function SubmitButton(_a) {
|
|
|
18
18
|
var getButtonClass = function () {
|
|
19
19
|
var baseClasses = 'w-full py-3 rounded-sm font-medium transition-all duration-200 flex items-center justify-center relative overflow-hidden';
|
|
20
20
|
if (disabled || loading) {
|
|
21
|
-
return "".concat(baseClasses, " bg-n1-gray-200 dark:bg-n1-gray-800 text-n1-gray-400 dark:text-n1-gray-500 cursor-not-allowed");
|
|
21
|
+
return "".concat(baseClasses, " bg-n1-ww-gray-200 dark:bg-n1-ww-gray-800 text-n1-ww-gray-400 dark:text-n1-ww-gray-500 cursor-not-allowed");
|
|
22
22
|
}
|
|
23
23
|
if (side === 'BUY') {
|
|
24
24
|
return "".concat(baseClasses, " bg-emerald-600 hover:bg-emerald-700 text-white shadow-sm transform hover:scale-[0.99] active:scale-[0.98]");
|
|
@@ -30,7 +30,7 @@ export default function SubmitButton(_a) {
|
|
|
30
30
|
return (_jsxs("button", { type: "submit", disabled: disabled || loading, className: getButtonClass(), onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () {
|
|
31
31
|
setIsHovered(false);
|
|
32
32
|
setIsPressed(false);
|
|
33
|
-
}, onMouseDown: function () { return setIsPressed(true); }, onMouseUp: function () { return setIsPressed(false); }, children: [_jsx("span", { className: "relative z-10 flex items-center justify-center transition-transform duration-200 ".concat(isPressed ? 'scale-95' : ''), children: loading ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { size: 18, className: "n1-animate-spin mr-2 inline-block" }), "Processing..."] })) : (_jsxs(_Fragment, { children: [side === 'BUY' ? (_jsx("svg", { className: "w-4 h-4 mr-2", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M12 5L12 19M12 5L6 11M12 5L18 11", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "transition-transform duration-300 ".concat(isHovered ? 'translate-y-[-2px]' : '') }) })) : (_jsx("svg", { className: "w-4 h-4 mr-2", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M12 19L12 5M12 19L6 13M12 19L18 13", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "transition-transform duration-300 ".concat(isHovered ? 'translate-y-[2px]' : '') }) })), getButtonText()] })) }), !disabled && !loading && (_jsxs(_Fragment, { children: [_jsx("span", { className: "absolute inset-0 bg-gradient-to-r from-transparent via-white to-transparent opacity-25 pointer-events-none translate-x-[-200%] ".concat(isHovered ? 'animate-shimmer' : ''), style: {
|
|
33
|
+
}, onMouseDown: function () { return setIsPressed(true); }, onMouseUp: function () { return setIsPressed(false); }, children: [_jsx("span", { className: "relative z-10 flex items-center justify-center transition-transform duration-200 ".concat(isPressed ? 'scale-95' : ''), children: loading ? (_jsxs(_Fragment, { children: [_jsx(Loader2, { size: 18, className: "n1-ww-animate-spin mr-2 inline-block" }), "Processing..."] })) : (_jsxs(_Fragment, { children: [side === 'BUY' ? (_jsx("svg", { className: "w-4 h-4 mr-2", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M12 5L12 19M12 5L6 11M12 5L18 11", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "transition-transform duration-300 ".concat(isHovered ? 'translate-y-[-2px]' : '') }) })) : (_jsx("svg", { className: "w-4 h-4 mr-2", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: _jsx("path", { d: "M12 19L12 5M12 19L6 13M12 19L18 13", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "transition-transform duration-300 ".concat(isHovered ? 'translate-y-[2px]' : '') }) })), getButtonText()] })) }), !disabled && !loading && (_jsxs(_Fragment, { children: [_jsx("span", { className: "absolute inset-0 bg-gradient-to-r from-transparent via-white to-transparent opacity-25 pointer-events-none translate-x-[-200%] ".concat(isHovered ? 'animate-shimmer' : ''), style: {
|
|
34
34
|
backgroundSize: '200% 100%',
|
|
35
35
|
animationDuration: '1.5s',
|
|
36
36
|
} }), _jsx("span", { className: "absolute inset-0 rounded-sm transition-opacity duration-300 pointer-events-none ".concat(isPressed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubmitButton.js","sourceRoot":"","sources":["../../../../../src/Modal/Sidebar/NordTradingView/TradeForm/SubmitButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAUjC,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAKjB;QAJlB,OAAO,aAAA,EACP,IAAI,UAAA,EACJ,SAAS,eAAA,EACT,QAAQ,cAAA;IAEF,IAAA,KAA4B,QAAQ,CAAC,KAAK,CAAC,EAA1C,SAAS,QAAA,EAAE,YAAY,QAAmB,CAAC;IAC5C,IAAA,KAA4B,QAAQ,CAAC,KAAK,CAAC,EAA1C,SAAS,QAAA,EAAE,YAAY,QAAmB,CAAC;IAElD,oDAAoD;IACpD,IAAM,aAAa,GAAG;QACpB,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;YACnB,OAAO,cAAO,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAE,CAAC;QAC9D,CAAC;aAAM,CAAC;YACN,OAAO,eAAQ,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAE,CAAC;QAC/D,CAAC;IACH,CAAC,CAAC;IAEF,sCAAsC;IACtC,IAAM,cAAc,GAAG;QACrB,IAAM,WAAW,GACf,0HAA0H,CAAC;QAE7H,IAAI,QAAQ,IAAI,OAAO,EAAE,CAAC;YACxB,OAAO,UAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"SubmitButton.js","sourceRoot":"","sources":["../../../../../src/Modal/Sidebar/NordTradingView/TradeForm/SubmitButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,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,SAAS,EAAE,yIAAkI,SAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAE,EACjL,KAAK,EAAE;4BACL,cAAc,EAAE,WAAW;4BAC3B,iBAAiB,EAAE,MAAM;yBAC1B,GACD,EACF,eACE,SAAS,EAAE,0FACT,SAAS;4BACP,CAAC,CAAC,mDAAmD;4BACrD,CAAC,CAAC,WAAW,CACf,GACF,IACD,CACJ,IACM,CACV,CAAC;AACJ,CAAC","sourcesContent":["import { Loader2 } from 'lucide-react';\nimport { useState } from 'react';\nimport { OrderSide, OrderType } from './TradeForm';\n\ninterface SubmitButtonProps {\n loading: boolean;\n side: OrderSide;\n orderType: OrderType;\n disabled: boolean;\n}\n\nexport default function SubmitButton({\n loading,\n side,\n orderType,\n disabled,\n}: SubmitButtonProps) {\n const [isHovered, setIsHovered] = useState(false);\n const [isPressed, setIsPressed] = useState(false);\n\n // Generate button text based on side and order type\n const getButtonText = () => {\n if (side === 'BUY') {\n return `Buy ${orderType === 'MARKET' ? 'Market' : 'Limit'}`;\n } else {\n return `Sell ${orderType === 'MARKET' ? 'Market' : 'Limit'}`;\n }\n };\n\n // Generate button color based on side\n const getButtonClass = () => {\n const baseClasses =\n 'w-full py-3 rounded-sm font-medium transition-all duration-200 flex items-center justify-center relative overflow-hidden';\n\n if (disabled || loading) {\n return `${baseClasses} bg-n1-ww-gray-200 dark:bg-n1-ww-gray-800 text-n1-ww-gray-400 dark:text-n1-ww-gray-500 cursor-not-allowed`;\n }\n\n if (side === 'BUY') {\n return `${baseClasses} bg-emerald-600 hover:bg-emerald-700 text-white shadow-sm transform hover:scale-[0.99] active:scale-[0.98]`;\n } else {\n return `${baseClasses} bg-red-700 hover:bg-red-800 text-white shadow-sm transform hover:scale-[0.99] active:scale-[0.98]`;\n }\n };\n\n return (\n <button\n type=\"submit\"\n disabled={disabled || loading}\n className={getButtonClass()}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => {\n setIsHovered(false);\n setIsPressed(false);\n }}\n onMouseDown={() => setIsPressed(true)}\n onMouseUp={() => setIsPressed(false)}\n >\n <span\n className={`relative z-10 flex items-center justify-center transition-transform duration-200 ${isPressed ? 'scale-95' : ''}`}\n >\n {loading ? (\n <>\n <Loader2 size={18} className=\"n1-ww-animate-spin mr-2 inline-block\" />\n Processing...\n </>\n ) : (\n <>\n {side === 'BUY' ? (\n <svg\n className=\"w-4 h-4 mr-2\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M12 5L12 19M12 5L6 11M12 5L18 11\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={`transition-transform duration-300 ${isHovered ? 'translate-y-[-2px]' : ''}`}\n />\n </svg>\n ) : (\n <svg\n className=\"w-4 h-4 mr-2\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M12 19L12 5M12 19L6 13M12 19L18 13\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={`transition-transform duration-300 ${isHovered ? 'translate-y-[2px]' : ''}`}\n />\n </svg>\n )}\n {getButtonText()}\n </>\n )}\n </span>\n\n {!disabled && !loading && (\n <>\n <span\n className={`absolute inset-0 bg-gradient-to-r from-transparent via-white to-transparent opacity-25 pointer-events-none translate-x-[-200%] ${isHovered ? 'animate-shimmer' : ''}`}\n style={{\n backgroundSize: '200% 100%',\n animationDuration: '1.5s',\n }}\n />\n <span\n className={`absolute inset-0 rounded-sm transition-opacity duration-300 pointer-events-none ${\n isPressed\n ? 'bg-black opacity-10 dark:bg-white dark:opacity-10'\n : 'opacity-0'\n }`}\n />\n </>\n )}\n </button>\n );\n}\n"]}
|
|
@@ -5,6 +5,6 @@ export default function TotalCalculator(_a) {
|
|
|
5
5
|
var fee = total && orderType === 'LIMIT'
|
|
6
6
|
? (parseFloat(total) * 0.001).toFixed(6)
|
|
7
7
|
: '0.00';
|
|
8
|
-
return (_jsxs("div", { className: "relative z-20", children: [_jsx("label", { className: "block text-xs font-medium text-n1-gray-700 dark:text-n1-gray-300 mb-1", children: "Total" }), _jsx("div", { className: "px-3 py-2 border border-n1-gray-200 dark:border-n1-gray-800 rounded-sm text-sm text-n1-gray-900 dark:text-n1-gray-100 bg-n1-gray-50 dark:bg-n1-dark-950 font-mono", children: orderType === 'MARKET' ? (_jsx("span", { className: "text-n1-gray-500 dark:text-n1-gray-400", children: "Market Order" })) : total ? (total) : (_jsx("span", { className: "text-n1-gray-400 dark:text-n1-gray-500", children: "0.00" })) }), _jsxs("div", { className: "mt-1 text-[10px] text-n1-gray-500 dark:text-n1-gray-400 flex justify-between", children: [_jsx("span", { children: "Estimated fee:" }), _jsx("span", { className: "font-mono", children: fee })] })] }));
|
|
8
|
+
return (_jsxs("div", { className: "relative z-20", children: [_jsx("label", { className: "block text-xs font-medium text-n1-ww-gray-700 dark:text-n1-ww-gray-300 mb-1", children: "Total" }), _jsx("div", { className: "px-3 py-2 border border-n1-ww-gray-200 dark:border-n1-ww-gray-800 rounded-sm text-sm text-n1-ww-gray-900 dark:text-n1-ww-gray-100 bg-n1-ww-gray-50 dark:bg-n1-ww-dark-950 font-mono", children: orderType === 'MARKET' ? (_jsx("span", { className: "text-n1-ww-gray-500 dark:text-n1-ww-gray-400", children: "Market Order" })) : total ? (total) : (_jsx("span", { className: "text-n1-ww-gray-400 dark:text-n1-ww-gray-500", children: "0.00" })) }), _jsxs("div", { className: "mt-1 text-[10px] text-n1-ww-gray-500 dark:text-n1-ww-gray-400 flex justify-between", children: [_jsx("span", { children: "Estimated fee:" }), _jsx("span", { className: "font-mono", children: fee })] })] }));
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=TotalCalculator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TotalCalculator.js","sourceRoot":"","sources":["../../../../../src/Modal/Sidebar/NordTradingView/TradeForm/TotalCalculator.tsx"],"names":[],"mappings":";AAUA,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAGjB;QAFrB,KAAK,WAAA,EACL,SAAS,eAAA;IAET,oCAAoC;IACpC,IAAM,GAAG,GACP,KAAK,IAAI,SAAS,KAAK,OAAO;QAC5B,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QACxC,CAAC,CAAC,MAAM,CAAC;IAEb,OAAO,CACL,eAAK,SAAS,EAAC,eAAe,aAC5B,gBAAO,SAAS,EAAC,
|
|
1
|
+
{"version":3,"file":"TotalCalculator.js","sourceRoot":"","sources":["../../../../../src/Modal/Sidebar/NordTradingView/TradeForm/TotalCalculator.tsx"],"names":[],"mappings":";AAUA,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EAGjB;QAFrB,KAAK,WAAA,EACL,SAAS,eAAA;IAET,oCAAoC;IACpC,IAAM,GAAG,GACP,KAAK,IAAI,SAAS,KAAK,OAAO;QAC5B,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QACxC,CAAC,CAAC,MAAM,CAAC;IAEb,OAAO,CACL,eAAK,SAAS,EAAC,eAAe,aAC5B,gBAAO,SAAS,EAAC,6EAA6E,sBAEtF,EACR,cAAK,SAAS,EAAC,qLAAqL,YACjM,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,CACxB,eAAM,SAAS,EAAC,8CAA8C,6BAAoB,CACnF,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CACV,KAAK,CACN,CAAC,CAAC,CAAC,CACF,eAAM,SAAS,EAAC,8CAA8C,qBAAY,CAC3E,GACG,EAGN,eAAK,SAAS,EAAC,oFAAoF,aACjG,4CAA2B,EAC3B,eAAM,SAAS,EAAC,WAAW,YAAE,GAAG,GAAQ,IACpC,IACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\n\n// We still need OrderType for backward compatibility with the TotalCalculator\ntype OrderType = 'LIMIT' | 'MARKET';\n\ninterface TotalCalculatorProps {\n total: string;\n orderType: OrderType;\n}\n\nexport default function TotalCalculator({\n total,\n orderType,\n}: TotalCalculatorProps) {\n // Calculate fee (example: 0.1% fee)\n const fee =\n total && orderType === 'LIMIT'\n ? (parseFloat(total) * 0.001).toFixed(6)\n : '0.00';\n\n return (\n <div className=\"relative z-20\">\n <label className=\"block text-xs font-medium text-n1-ww-gray-700 dark:text-n1-ww-gray-300 mb-1\">\n Total\n </label>\n <div className=\"px-3 py-2 border border-n1-ww-gray-200 dark:border-n1-ww-gray-800 rounded-sm text-sm text-n1-ww-gray-900 dark:text-n1-ww-gray-100 bg-n1-ww-gray-50 dark:bg-n1-ww-dark-950 font-mono\">\n {orderType === 'MARKET' ? (\n <span className=\"text-n1-ww-gray-500 dark:text-n1-ww-gray-400\">Market Order</span>\n ) : total ? (\n total\n ) : (\n <span className=\"text-n1-ww-gray-400 dark:text-n1-ww-gray-500\">0.00</span>\n )}\n </div>\n\n {/* Fee estimate */}\n <div className=\"mt-1 text-[10px] text-n1-ww-gray-500 dark:text-n1-ww-gray-400 flex justify-between\">\n <span>Estimated fee:</span>\n <span className=\"font-mono\">{fee}</span>\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -237,21 +237,21 @@ export default function TradeForm(_a) {
|
|
|
237
237
|
}
|
|
238
238
|
});
|
|
239
239
|
}); };
|
|
240
|
-
return (_jsxs("div", { className: "p-4 bg-white dark:bg-n1-dark-950 transition-colors duration-300", children: [_jsxs("h2", { className: "text-base font-semibold text-n1-gray-900 dark:text-n1-gray-100 mb-3 transform transition-all duration-500 ".concat(formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'), children: ["Place Order", ' ', marketSymbol ? (_jsx("span", { className: side === 'BUY'
|
|
240
|
+
return (_jsxs("div", { className: "p-4 bg-white dark:bg-n1-ww-dark-950 transition-colors duration-300", children: [_jsxs("h2", { className: "text-base font-semibold text-n1-ww-gray-900 dark:text-n1-ww-gray-100 mb-3 transform transition-all duration-500 ".concat(formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'), children: ["Place Order", ' ', marketSymbol ? (_jsx("span", { className: side === 'BUY'
|
|
241
241
|
? 'text-emerald-600 dark:text-emerald-500'
|
|
242
|
-
: 'text-red-700 dark:text-red-600', children: marketSymbol })) : ('')] }), !marketSymbol ? (_jsx("div", { className: "p-3 border border-n1-gray-200 dark:border-n1-gray-800 rounded-sm text-n1-gray-500 dark:text-n1-gray-400 text-xs bg-n1-gray-50 dark:bg-n1-dark-950 transform transition-all duration-500 ".concat(formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'), children: "Select a market to place orders" })) : (_jsx("form", { onSubmit: handleSubmit, children: _jsxs("div", { className: "space-y-3", children: [_jsx("div", { className: "transform transition-all duration-500 delay-100 ".concat(formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'), children: _jsx(BuySellTabs, { side: side, onChange: setSide }) }), _jsx("div", { className: "transform transition-all duration-500 delay-200 ".concat(formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'), children: _jsx(FillModeSelector, { fillMode: fillMode, onFillModeChange: setFillMode }) }), !isMarketOrder(fillMode) && (_jsx("div", { className: "transform transition-all duration-500 delay-300 ".concat(formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'), children: _jsx(PriceInput, { price: price, onChange: setPrice, marketPrice: marketInfo === null || marketInfo === void 0 ? void 0 : marketInfo.lastPrice }) })), _jsx("div", { className: "transform transition-all duration-500 delay-400 ".concat(formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'), children: _jsx(AmountInput, { amount: amount, onChange: setAmount, marketInfo: marketInfo }) }), _jsx("div", { className: "transform transition-all duration-500 delay-500 ".concat(formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'), children: _jsx(TotalCalculator, { total: total, orderType: isMarketOrder(fillMode) ? 'MARKET' : 'LIMIT' }) }), accountId && (_jsx("div", { className: "transform transition-all duration-500 delay-550 ".concat(formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'), children: _jsxs("div", { className: "flex items-center text-xs text-n1-gray-500 dark:text-n1-gray-400", children: [_jsx(Info, { size: 12, className: "mr-1" }), _jsxs("span", { children: ["Account ID: ", accountId] })] }) })), _jsx("div", { className: "transform transition-all duration-500 delay-600 ".concat(formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'), children: _jsxs("button", { type: "button", onClick: function () { return setIsReduceOnly(!isReduceOnly); }, className: "w-full flex items-center justify-between px-3 py-2 rounded-sm text-sm transition-all duration-300 ".concat(isReduceOnly
|
|
242
|
+
: 'text-red-700 dark:text-red-600', children: marketSymbol })) : ('')] }), !marketSymbol ? (_jsx("div", { className: "p-3 border border-n1-ww-gray-200 dark:border-n1-ww-gray-800 rounded-sm text-n1-ww-gray-500 dark:text-n1-ww-gray-400 text-xs bg-n1-ww-gray-50 dark:bg-n1-ww-dark-950 transform transition-all duration-500 ".concat(formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'), children: "Select a market to place orders" })) : (_jsx("form", { onSubmit: handleSubmit, children: _jsxs("div", { className: "space-y-3", children: [_jsx("div", { className: "transform transition-all duration-500 delay-100 ".concat(formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'), children: _jsx(BuySellTabs, { side: side, onChange: setSide }) }), _jsx("div", { className: "transform transition-all duration-500 delay-200 ".concat(formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'), children: _jsx(FillModeSelector, { fillMode: fillMode, onFillModeChange: setFillMode }) }), !isMarketOrder(fillMode) && (_jsx("div", { className: "transform transition-all duration-500 delay-300 ".concat(formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'), children: _jsx(PriceInput, { price: price, onChange: setPrice, marketPrice: marketInfo === null || marketInfo === void 0 ? void 0 : marketInfo.lastPrice }) })), _jsx("div", { className: "transform transition-all duration-500 delay-400 ".concat(formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'), children: _jsx(AmountInput, { amount: amount, onChange: setAmount, marketInfo: marketInfo }) }), _jsx("div", { className: "transform transition-all duration-500 delay-500 ".concat(formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'), children: _jsx(TotalCalculator, { total: total, orderType: isMarketOrder(fillMode) ? 'MARKET' : 'LIMIT' }) }), accountId && (_jsx("div", { className: "transform transition-all duration-500 delay-550 ".concat(formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'), children: _jsxs("div", { className: "flex items-center text-xs text-n1-ww-gray-500 dark:text-n1-ww-gray-400", children: [_jsx(Info, { size: 12, className: "mr-1" }), _jsxs("span", { children: ["Account ID: ", accountId] })] }) })), _jsx("div", { className: "transform transition-all duration-500 delay-600 ".concat(formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'), children: _jsxs("button", { type: "button", onClick: function () { return setIsReduceOnly(!isReduceOnly); }, className: "w-full flex items-center justify-between px-3 py-2 rounded-sm text-sm transition-all duration-300 ".concat(isReduceOnly
|
|
243
243
|
? side === 'BUY'
|
|
244
244
|
? 'bg-emerald-50 dark:bg-emerald-900/10 text-emerald-700 dark:text-emerald-400 border border-emerald-200 dark:border-emerald-800/30'
|
|
245
245
|
: 'bg-red-50 dark:bg-red-900/10 text-red-700 dark:text-red-400 border border-red-200 dark:border-red-800/30'
|
|
246
|
-
: 'bg-n1-gray-50 dark:bg-n1-gray-900 text-n1-gray-700 dark:text-n1-gray-300 border border-n1-gray-200 dark:border-n1-gray-800 hover:border-n1-gray-300 dark:hover:border-n1-gray-600'), children: [_jsxs("div", { className: "flex items-center", children: [_jsx("div", { className: "mr-2 transition-colors duration-300 ".concat(isReduceOnly
|
|
246
|
+
: 'bg-n1-ww-gray-50 dark:bg-n1-ww-gray-900 text-n1-ww-gray-700 dark:text-n1-ww-gray-300 border border-n1-ww-gray-200 dark:border-n1-ww-gray-800 hover:border-n1-ww-gray-300 dark:hover:border-n1-ww-gray-600'), children: [_jsxs("div", { className: "flex items-center", children: [_jsx("div", { className: "mr-2 transition-colors duration-300 ".concat(isReduceOnly
|
|
247
247
|
? side === 'BUY'
|
|
248
248
|
? 'text-emerald-600 dark:text-emerald-500'
|
|
249
249
|
: 'text-red-600 dark:text-red-500'
|
|
250
|
-
: 'text-n1-gray-500 dark:text-n1-gray-400'), children: isReduceOnly ? _jsx(Lock, { size: 14 }) : _jsx(Unlock, { size: 14 }) }), _jsx("span", { className: "text-xs", children: "Reduce Only" })] }), _jsx("div", { className: "flex items-center justify-center w-4 h-4 rounded-full transition-all duration-300 ".concat(isReduceOnly
|
|
250
|
+
: 'text-n1-ww-gray-500 dark:text-n1-ww-gray-400'), children: isReduceOnly ? _jsx(Lock, { size: 14 }) : _jsx(Unlock, { size: 14 }) }), _jsx("span", { className: "text-xs", children: "Reduce Only" })] }), _jsx("div", { className: "flex items-center justify-center w-4 h-4 rounded-full transition-all duration-300 ".concat(isReduceOnly
|
|
251
251
|
? side === 'BUY'
|
|
252
252
|
? 'bg-emerald-600 dark:bg-emerald-500 text-white'
|
|
253
253
|
: 'bg-red-600 dark:bg-red-500 text-white'
|
|
254
|
-
: 'bg-n1-gray-200 dark:bg-n1-gray-700'), children: isReduceOnly && _jsx(Check, { size: 10 }) })] }) }), _jsxs("div", { className: "p-2 border rounded-sm text-xs transition-all duration-300 transform ".concat(error
|
|
254
|
+
: 'bg-n1-ww-gray-200 dark:bg-n1-ww-gray-700'), children: isReduceOnly && _jsx(Check, { size: 10 }) })] }) }), _jsxs("div", { className: "p-2 border rounded-sm text-xs transition-all duration-300 transform ".concat(error
|
|
255
255
|
? 'opacity-100 max-h-20 border-red-200 dark:border-red-900/30 bg-red-50 dark:bg-red-900/10 text-red-700 dark:text-red-400 flex items-center translate-y-0'
|
|
256
256
|
: 'opacity-0 max-h-0 overflow-hidden border-transparent translate-y-2'), children: [error && (_jsx(AlertCircle, { size: 14, className: "mr-2 flex-shrink-0" })), error] }), _jsx("div", { className: "p-2 border rounded-sm text-xs transition-all duration-300 transform ".concat(success
|
|
257
257
|
? 'opacity-100 max-h-20 border-emerald-200 dark:border-emerald-900/30 bg-emerald-50 dark:bg-emerald-900/10 text-emerald-700 dark:text-emerald-400 translate-y-0'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TradeForm.js","sourceRoot":"","sources":["../../../../../src/Modal/Sidebar/NordTradingView/TradeForm/TradeForm.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAWlD,6CAA6C;AAC7C,IAAM,WAAW,GAAG,UAAC,IAAc;IACjC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,KAAK;YACR,OAAO,CAAC,CAAC,CAAC,QAAQ;QACpB,KAAK,WAAW;YACd,OAAO,CAAC,CAAC,CAAC,YAAY;QACxB,KAAK,KAAK;YACR,OAAO,CAAC,CAAC,CAAC,sBAAsB;QAClC,KAAK,KAAK;YACR,OAAO,CA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CAAoC,CACxC,YAED,YAAY,IAAI,KAAC,KAAK,IAAC,IAAI,EAAE,EAAE,GAAI,GAChC,IACC,GACL,EAGN,eACE,SAAS,EAAE,8EACT,KAAK;gCACH,CAAC,CAAC,wJAAwJ;gCAC1J,CAAC,CAAC,oEAAoE,CACxE,aAED,KAAK,IAAI,CACR,KAAC,WAAW,IAAC,IAAI,EAAE,EAAE,EAAE,SAAS,EAAC,oBAAoB,GAAG,CACzD,EACA,KAAK,IACF,EAGN,cACE,SAAS,EAAE,8EACT,OAAO;gCACL,CAAC,CAAC,8JAA8J;gCAChK,CAAC,CAAC,oEAAoE,CACxE,YAED,OAAO,GACJ,EAGN,cACE,SAAS,EAAE,0DAAmD,WAAW,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,yBAAyB,CAAE,YAErI,KAAC,YAAY,IACX,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,EACvD,QAAQ,EAAE,CAAC,YAAY,IAAI,OAAO,GAClC,GACE,IACF,GACD,CACR,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { useState, useEffect } from 'react';\nimport { useN1WalletContext } from '../../../../Provider/hooks';\nimport BuySellTabs from './BuySellTabs';\nimport FillModeSelector from './FillModeSelector';\nimport PriceInput from './PriceInput';\nimport AmountInput from './AmountInput';\nimport TotalCalculator from './TotalCalculator';\nimport SubmitButton from './SubmitButton';\nimport { AlertCircle, Check, Lock, Unlock, Info } from 'lucide-react';\nimport { logger } from '../../../../utils/logger';\n\ninterface TradeFormProps {\n marketSymbol: string | null;\n}\n\n// Define order types\nexport type OrderSide = 'BUY' | 'SELL';\nexport type OrderType = 'LIMIT' | 'MARKET'; // Keep for backward compatibility\nexport type FillMode = 'GTC' | 'POST_ONLY' | 'IOC' | 'FOK';\n\n// Map our FillMode to the Nord FillMode enum\nconst mapFillMode = (mode: FillMode): number => {\n switch (mode) {\n case 'GTC':\n return 0; // LIMIT\n case 'POST_ONLY':\n return 1; // POST_ONLY\n case 'IOC':\n return 2; // IMMEDIATE_OR_CANCEL\n case 'FOK':\n return 3; // FILL_OR_KILL\n default:\n return 0;\n }\n};\n\n// Map our OrderSide to the Nord Side enum\nconst mapSide = (side: OrderSide): number => {\n return side === 'BUY' ? 1 : 0; // BID = 1, ASK = 0\n};\n\n// Helper to determine if a fill mode is a market order\nconst isMarketOrder = (mode: FillMode): boolean => {\n return mode === 'IOC'; // IOC is used for market orders\n};\n\nexport default function TradeForm({ marketSymbol }: TradeFormProps) {\n const { nord, nordUser } = useN1WalletContext();\n\n // Form state\n const [side, setSide] = useState<OrderSide>('BUY');\n const [fillMode, setFillMode] = useState<FillMode>('GTC');\n const [price, setPrice] = useState<string>('');\n const [amount, setAmount] = useState<string>('');\n const [total, setTotal] = useState<string>('');\n const [isReduceOnly, setIsReduceOnly] = useState<boolean>(false);\n const [accountId, setAccountId] = useState<number | undefined>(undefined);\n\n // UI state\n const [loading, setLoading] = useState<boolean>(false);\n const [error, setError] = useState<string | null>(null);\n const [success, setSuccess] = useState<string | null>(null);\n const [formVisible, setFormVisible] = useState<boolean>(false);\n\n // Market data\n const [marketInfo, setMarketInfo] = useState<any>(null);\n\n // Show form with animation after initial render\n useEffect(() => {\n const timer = setTimeout(() => {\n setFormVisible(true);\n }, 100);\n return () => clearTimeout(timer);\n }, []);\n\n // Fetch market info and user account ID when market changes\n useEffect(() => {\n if (!marketSymbol || !nord) return;\n\n const fetchMarketInfo = async () => {\n try {\n const stats = await nord.getMarketStats();\n const selectedMarket = stats.markets.find(\n (m: any) => m.symbol === marketSymbol\n );\n setMarketInfo(selectedMarket || null);\n\n // Set default price to current market price\n if ((selectedMarket as any)?.lastPrice) {\n setPrice((selectedMarket as any).lastPrice.toString());\n }\n } catch (err) {\n console.error('Error fetching market info:', err);\n }\n };\n\n const fetchUserAccount = async () => {\n if (nordUser) {\n try {\n // Update account ID\n await nordUser.updateAccountId();\n // Set the first account ID if available\n if (nordUser.accountIds && nordUser.accountIds.length > 0) {\n setAccountId(nordUser.accountIds[0]);\n }\n } catch (err) {\n console.error('Error fetching user account:', err);\n }\n }\n };\n\n fetchMarketInfo();\n fetchUserAccount();\n }, [marketSymbol, nord, nordUser]);\n\n // Calculate total when price or amount changes\n useEffect(() => {\n if (!isMarketOrder(fillMode) && price && amount) {\n const calculatedTotal = parseFloat(price) * parseFloat(amount);\n setTotal(calculatedTotal.toFixed(8));\n } else if (isMarketOrder(fillMode)) {\n setTotal('Market');\n } else {\n setTotal('');\n }\n }, [price, amount, fillMode]);\n\n // Handle order submission\n const handleSubmit = async (e: React.FormEvent) => {\n e.preventDefault();\n\n if (!marketSymbol || !nordUser) {\n setError('User or market not available');\n return;\n }\n\n if (!isMarketOrder(fillMode) && (!price || parseFloat(price) <= 0)) {\n setError('Please enter a valid price');\n return;\n }\n\n if (!amount || parseFloat(amount) <= 0) {\n setError('Please enter a valid amount');\n return;\n }\n\n setLoading(true);\n setError(null);\n setSuccess(null);\n\n try {\n // Find market ID from symbol\n const market = nord?.markets?.find((m) => m.symbol === marketSymbol);\n const marketId = market\n ? (market as any).id || (market as any).marketId || 0\n : 0;\n\n // Prepare order parameters\n const orderParams = {\n marketId,\n side: mapSide(side),\n fillMode: mapFillMode(fillMode),\n isReduceOnly,\n // For limit orders or SELL orders, we need size\n size: !isMarketOrder(fillMode) || side === 'SELL' ? amount : undefined,\n // For limit orders, we need price\n price: !isMarketOrder(fillMode) ? price : undefined,\n // For market BUY orders, we need quoteSize (total amount to spend)\n quoteSize:\n isMarketOrder(fillMode) && side === 'BUY' ? total : undefined,\n // Use the first account ID if available\n accountId: accountId,\n };\n\n logger.debug('Placing order with params:', orderParams);\n\n // Place order\n const orderId = await nordUser.placeOrder(orderParams);\n\n if (orderId) {\n setSuccess(`Order placed successfully! Order ID: ${orderId}`);\n // Reset form\n setAmount('');\n if (isMarketOrder(fillMode)) {\n setPrice('');\n }\n } else {\n throw new Error('Failed to place order');\n }\n } catch (err: any) {\n logger.error('Error placing order:', err);\n setError(err.message || 'Failed to place order');\n } finally {\n setLoading(false);\n }\n };\n\n return (\n <div className=\"p-4 bg-white dark:bg-n1-dark-950 transition-colors duration-300\">\n <h2\n className={`text-base font-semibold text-n1-gray-900 dark:text-n1-gray-100 mb-3 transform transition-all duration-500 ${formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'}`}\n >\n Place Order{' '}\n {marketSymbol ? (\n <span\n className={\n side === 'BUY'\n ? 'text-emerald-600 dark:text-emerald-500'\n : 'text-red-700 dark:text-red-600'\n }\n >\n {marketSymbol}\n </span>\n ) : (\n ''\n )}\n </h2>\n\n {!marketSymbol ? (\n <div\n className={`p-3 border border-n1-gray-200 dark:border-n1-gray-800 rounded-sm text-n1-gray-500 dark:text-n1-gray-400 text-xs bg-n1-gray-50 dark:bg-n1-dark-950 transform transition-all duration-500 ${formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'}`}\n >\n Select a market to place orders\n </div>\n ) : (\n <form onSubmit={handleSubmit}>\n <div className=\"space-y-3\">\n {/* Buy/Sell Tabs */}\n <div\n className={`transform transition-all duration-500 delay-100 ${formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'}`}\n >\n <BuySellTabs side={side} onChange={setSide} />\n </div>\n\n {/* Order Type (Fill Mode) */}\n <div\n className={`transform transition-all duration-500 delay-200 ${formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'}`}\n >\n <FillModeSelector\n fillMode={fillMode}\n onFillModeChange={setFillMode}\n />\n </div>\n\n {/* Price Input (hidden for market orders) */}\n {!isMarketOrder(fillMode) && (\n <div\n className={`transform transition-all duration-500 delay-300 ${formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'}`}\n >\n <PriceInput\n price={price}\n onChange={setPrice}\n marketPrice={(marketInfo as any)?.lastPrice}\n />\n </div>\n )}\n\n {/* Amount Input */}\n <div\n className={`transform transition-all duration-500 delay-400 ${formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'}`}\n >\n <AmountInput\n amount={amount}\n onChange={setAmount}\n marketInfo={marketInfo}\n />\n </div>\n\n {/* Total Calculator */}\n <div\n className={`transform transition-all duration-500 delay-500 ${formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'}`}\n >\n <TotalCalculator\n total={total}\n orderType={isMarketOrder(fillMode) ? 'MARKET' : 'LIMIT'}\n />\n </div>\n\n {/* Account ID Info */}\n {accountId && (\n <div\n className={`transform transition-all duration-500 delay-550 ${formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'}`}\n >\n <div className=\"flex items-center text-xs text-n1-gray-500 dark:text-n1-gray-400\">\n <Info size={12} className=\"mr-1\" />\n <span>Account ID: {accountId}</span>\n </div>\n </div>\n )}\n\n {/* Reduce Only Button */}\n <div\n className={`transform transition-all duration-500 delay-600 ${formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'}`}\n >\n <button\n type=\"button\"\n onClick={() => setIsReduceOnly(!isReduceOnly)}\n className={`w-full flex items-center justify-between px-3 py-2 rounded-sm text-sm transition-all duration-300 ${\n isReduceOnly\n ? side === 'BUY'\n ? 'bg-emerald-50 dark:bg-emerald-900/10 text-emerald-700 dark:text-emerald-400 border border-emerald-200 dark:border-emerald-800/30'\n : 'bg-red-50 dark:bg-red-900/10 text-red-700 dark:text-red-400 border border-red-200 dark:border-red-800/30'\n : 'bg-n1-gray-50 dark:bg-n1-gray-900 text-n1-gray-700 dark:text-n1-gray-300 border border-n1-gray-200 dark:border-n1-gray-800 hover:border-n1-gray-300 dark:hover:border-n1-gray-600'\n }`}\n >\n <div className=\"flex items-center\">\n <div\n className={`mr-2 transition-colors duration-300 ${\n isReduceOnly\n ? side === 'BUY'\n ? 'text-emerald-600 dark:text-emerald-500'\n : 'text-red-600 dark:text-red-500'\n : 'text-n1-gray-500 dark:text-n1-gray-400'\n }`}\n >\n {isReduceOnly ? <Lock size={14} /> : <Unlock size={14} />}\n </div>\n <span className=\"text-xs\">Reduce Only</span>\n </div>\n <div\n className={`flex items-center justify-center w-4 h-4 rounded-full transition-all duration-300 ${\n isReduceOnly\n ? side === 'BUY'\n ? 'bg-emerald-600 dark:bg-emerald-500 text-white'\n : 'bg-red-600 dark:bg-red-500 text-white'\n : 'bg-n1-gray-200 dark:bg-n1-gray-700'\n }`}\n >\n {isReduceOnly && <Check size={10} />}\n </div>\n </button>\n </div>\n\n {/* Error Message */}\n <div\n className={`p-2 border rounded-sm text-xs transition-all duration-300 transform ${\n error\n ? 'opacity-100 max-h-20 border-red-200 dark:border-red-900/30 bg-red-50 dark:bg-red-900/10 text-red-700 dark:text-red-400 flex items-center translate-y-0'\n : 'opacity-0 max-h-0 overflow-hidden border-transparent translate-y-2'\n }`}\n >\n {error && (\n <AlertCircle size={14} className=\"mr-2 flex-shrink-0\" />\n )}\n {error}\n </div>\n\n {/* Success Message */}\n <div\n className={`p-2 border rounded-sm text-xs transition-all duration-300 transform ${\n success\n ? 'opacity-100 max-h-20 border-emerald-200 dark:border-emerald-900/30 bg-emerald-50 dark:bg-emerald-900/10 text-emerald-700 dark:text-emerald-400 translate-y-0'\n : 'opacity-0 max-h-0 overflow-hidden border-transparent translate-y-2'\n }`}\n >\n {success}\n </div>\n\n {/* Submit Button */}\n <div\n className={`transform transition-all duration-500 delay-700 ${formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'}`}\n >\n <SubmitButton\n loading={loading}\n side={side}\n orderType={isMarketOrder(fillMode) ? 'MARKET' : 'LIMIT'}\n disabled={!marketSymbol || loading}\n />\n </div>\n </div>\n </form>\n )}\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TradeForm.js","sourceRoot":"","sources":["../../../../../src/Modal/Sidebar/NordTradingView/TradeForm/TradeForm.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;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CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,yBAAyB,CAAE,YAErI,KAAC,YAAY,IACX,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,EACvD,QAAQ,EAAE,CAAC,YAAY,IAAI,OAAO,GAClC,GACE,IACF,GACD,CACR,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { useState, useEffect } from 'react';\nimport { useN1WalletContext } from '../../../../Provider/hooks';\nimport BuySellTabs from './BuySellTabs';\nimport FillModeSelector from './FillModeSelector';\nimport PriceInput from './PriceInput';\nimport AmountInput from './AmountInput';\nimport TotalCalculator from './TotalCalculator';\nimport SubmitButton from './SubmitButton';\nimport { AlertCircle, Check, Lock, Unlock, Info } from 'lucide-react';\nimport { logger } from '../../../../utils/logger';\n\ninterface TradeFormProps {\n marketSymbol: string | null;\n}\n\n// Define order types\nexport type OrderSide = 'BUY' | 'SELL';\nexport type OrderType = 'LIMIT' | 'MARKET'; // Keep for backward compatibility\nexport type FillMode = 'GTC' | 'POST_ONLY' | 'IOC' | 'FOK';\n\n// Map our FillMode to the Nord FillMode enum\nconst mapFillMode = (mode: FillMode): number => {\n switch (mode) {\n case 'GTC':\n return 0; // LIMIT\n case 'POST_ONLY':\n return 1; // POST_ONLY\n case 'IOC':\n return 2; // IMMEDIATE_OR_CANCEL\n case 'FOK':\n return 3; // FILL_OR_KILL\n default:\n return 0;\n }\n};\n\n// Map our OrderSide to the Nord Side enum\nconst mapSide = (side: OrderSide): number => {\n return side === 'BUY' ? 1 : 0; // BID = 1, ASK = 0\n};\n\n// Helper to determine if a fill mode is a market order\nconst isMarketOrder = (mode: FillMode): boolean => {\n return mode === 'IOC'; // IOC is used for market orders\n};\n\nexport default function TradeForm({ marketSymbol }: TradeFormProps) {\n const { nord, nordUser } = useN1WalletContext();\n\n // Form state\n const [side, setSide] = useState<OrderSide>('BUY');\n const [fillMode, setFillMode] = useState<FillMode>('GTC');\n const [price, setPrice] = useState<string>('');\n const [amount, setAmount] = useState<string>('');\n const [total, setTotal] = useState<string>('');\n const [isReduceOnly, setIsReduceOnly] = useState<boolean>(false);\n const [accountId, setAccountId] = useState<number | undefined>(undefined);\n\n // UI state\n const [loading, setLoading] = useState<boolean>(false);\n const [error, setError] = useState<string | null>(null);\n const [success, setSuccess] = useState<string | null>(null);\n const [formVisible, setFormVisible] = useState<boolean>(false);\n\n // Market data\n const [marketInfo, setMarketInfo] = useState<any>(null);\n\n // Show form with animation after initial render\n useEffect(() => {\n const timer = setTimeout(() => {\n setFormVisible(true);\n }, 100);\n return () => clearTimeout(timer);\n }, []);\n\n // Fetch market info and user account ID when market changes\n useEffect(() => {\n if (!marketSymbol || !nord) return;\n\n const fetchMarketInfo = async () => {\n try {\n const stats = await nord.getMarketStats();\n const selectedMarket = stats.markets.find(\n (m: any) => m.symbol === marketSymbol\n );\n setMarketInfo(selectedMarket || null);\n\n // Set default price to current market price\n if ((selectedMarket as any)?.lastPrice) {\n setPrice((selectedMarket as any).lastPrice.toString());\n }\n } catch (err) {\n console.error('Error fetching market info:', err);\n }\n };\n\n const fetchUserAccount = async () => {\n if (nordUser) {\n try {\n // Update account ID\n await nordUser.updateAccountId();\n // Set the first account ID if available\n if (nordUser.accountIds && nordUser.accountIds.length > 0) {\n setAccountId(nordUser.accountIds[0]);\n }\n } catch (err) {\n console.error('Error fetching user account:', err);\n }\n }\n };\n\n fetchMarketInfo();\n fetchUserAccount();\n }, [marketSymbol, nord, nordUser]);\n\n // Calculate total when price or amount changes\n useEffect(() => {\n if (!isMarketOrder(fillMode) && price && amount) {\n const calculatedTotal = parseFloat(price) * parseFloat(amount);\n setTotal(calculatedTotal.toFixed(8));\n } else if (isMarketOrder(fillMode)) {\n setTotal('Market');\n } else {\n setTotal('');\n }\n }, [price, amount, fillMode]);\n\n // Handle order submission\n const handleSubmit = async (e: React.FormEvent) => {\n e.preventDefault();\n\n if (!marketSymbol || !nordUser) {\n setError('User or market not available');\n return;\n }\n\n if (!isMarketOrder(fillMode) && (!price || parseFloat(price) <= 0)) {\n setError('Please enter a valid price');\n return;\n }\n\n if (!amount || parseFloat(amount) <= 0) {\n setError('Please enter a valid amount');\n return;\n }\n\n setLoading(true);\n setError(null);\n setSuccess(null);\n\n try {\n // Find market ID from symbol\n const market = nord?.markets?.find((m) => m.symbol === marketSymbol);\n const marketId = market\n ? (market as any).id || (market as any).marketId || 0\n : 0;\n\n // Prepare order parameters\n const orderParams = {\n marketId,\n side: mapSide(side),\n fillMode: mapFillMode(fillMode),\n isReduceOnly,\n // For limit orders or SELL orders, we need size\n size: !isMarketOrder(fillMode) || side === 'SELL' ? amount : undefined,\n // For limit orders, we need price\n price: !isMarketOrder(fillMode) ? price : undefined,\n // For market BUY orders, we need quoteSize (total amount to spend)\n quoteSize:\n isMarketOrder(fillMode) && side === 'BUY' ? total : undefined,\n // Use the first account ID if available\n accountId: accountId,\n };\n\n logger.debug('Placing order with params:', orderParams);\n\n // Place order\n const orderId = await nordUser.placeOrder(orderParams);\n\n if (orderId) {\n setSuccess(`Order placed successfully! Order ID: ${orderId}`);\n // Reset form\n setAmount('');\n if (isMarketOrder(fillMode)) {\n setPrice('');\n }\n } else {\n throw new Error('Failed to place order');\n }\n } catch (err: any) {\n logger.error('Error placing order:', err);\n setError(err.message || 'Failed to place order');\n } finally {\n setLoading(false);\n }\n };\n\n return (\n <div className=\"p-4 bg-white dark:bg-n1-ww-dark-950 transition-colors duration-300\">\n <h2\n className={`text-base font-semibold text-n1-ww-gray-900 dark:text-n1-ww-gray-100 mb-3 transform transition-all duration-500 ${formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'}`}\n >\n Place Order{' '}\n {marketSymbol ? (\n <span\n className={\n side === 'BUY'\n ? 'text-emerald-600 dark:text-emerald-500'\n : 'text-red-700 dark:text-red-600'\n }\n >\n {marketSymbol}\n </span>\n ) : (\n ''\n )}\n </h2>\n\n {!marketSymbol ? (\n <div\n className={`p-3 border border-n1-ww-gray-200 dark:border-n1-ww-gray-800 rounded-sm text-n1-ww-gray-500 dark:text-n1-ww-gray-400 text-xs bg-n1-ww-gray-50 dark:bg-n1-ww-dark-950 transform transition-all duration-500 ${formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'}`}\n >\n Select a market to place orders\n </div>\n ) : (\n <form onSubmit={handleSubmit}>\n <div className=\"space-y-3\">\n {/* Buy/Sell Tabs */}\n <div\n className={`transform transition-all duration-500 delay-100 ${formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'}`}\n >\n <BuySellTabs side={side} onChange={setSide} />\n </div>\n\n {/* Order Type (Fill Mode) */}\n <div\n className={`transform transition-all duration-500 delay-200 ${formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'}`}\n >\n <FillModeSelector\n fillMode={fillMode}\n onFillModeChange={setFillMode}\n />\n </div>\n\n {/* Price Input (hidden for market orders) */}\n {!isMarketOrder(fillMode) && (\n <div\n className={`transform transition-all duration-500 delay-300 ${formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'}`}\n >\n <PriceInput\n price={price}\n onChange={setPrice}\n marketPrice={(marketInfo as any)?.lastPrice}\n />\n </div>\n )}\n\n {/* Amount Input */}\n <div\n className={`transform transition-all duration-500 delay-400 ${formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'}`}\n >\n <AmountInput\n amount={amount}\n onChange={setAmount}\n marketInfo={marketInfo}\n />\n </div>\n\n {/* Total Calculator */}\n <div\n className={`transform transition-all duration-500 delay-500 ${formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'}`}\n >\n <TotalCalculator\n total={total}\n orderType={isMarketOrder(fillMode) ? 'MARKET' : 'LIMIT'}\n />\n </div>\n\n {/* Account ID Info */}\n {accountId && (\n <div\n className={`transform transition-all duration-500 delay-550 ${formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'}`}\n >\n <div className=\"flex items-center text-xs text-n1-ww-gray-500 dark:text-n1-ww-gray-400\">\n <Info size={12} className=\"mr-1\" />\n <span>Account ID: {accountId}</span>\n </div>\n </div>\n )}\n\n {/* Reduce Only Button */}\n <div\n className={`transform transition-all duration-500 delay-600 ${formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'}`}\n >\n <button\n type=\"button\"\n onClick={() => setIsReduceOnly(!isReduceOnly)}\n className={`w-full flex items-center justify-between px-3 py-2 rounded-sm text-sm transition-all duration-300 ${\n isReduceOnly\n ? side === 'BUY'\n ? 'bg-emerald-50 dark:bg-emerald-900/10 text-emerald-700 dark:text-emerald-400 border border-emerald-200 dark:border-emerald-800/30'\n : 'bg-red-50 dark:bg-red-900/10 text-red-700 dark:text-red-400 border border-red-200 dark:border-red-800/30'\n : 'bg-n1-ww-gray-50 dark:bg-n1-ww-gray-900 text-n1-ww-gray-700 dark:text-n1-ww-gray-300 border border-n1-ww-gray-200 dark:border-n1-ww-gray-800 hover:border-n1-ww-gray-300 dark:hover:border-n1-ww-gray-600'\n }`}\n >\n <div className=\"flex items-center\">\n <div\n className={`mr-2 transition-colors duration-300 ${\n isReduceOnly\n ? side === 'BUY'\n ? 'text-emerald-600 dark:text-emerald-500'\n : 'text-red-600 dark:text-red-500'\n : 'text-n1-ww-gray-500 dark:text-n1-ww-gray-400'\n }`}\n >\n {isReduceOnly ? <Lock size={14} /> : <Unlock size={14} />}\n </div>\n <span className=\"text-xs\">Reduce Only</span>\n </div>\n <div\n className={`flex items-center justify-center w-4 h-4 rounded-full transition-all duration-300 ${\n isReduceOnly\n ? side === 'BUY'\n ? 'bg-emerald-600 dark:bg-emerald-500 text-white'\n : 'bg-red-600 dark:bg-red-500 text-white'\n : 'bg-n1-ww-gray-200 dark:bg-n1-ww-gray-700'\n }`}\n >\n {isReduceOnly && <Check size={10} />}\n </div>\n </button>\n </div>\n\n {/* Error Message */}\n <div\n className={`p-2 border rounded-sm text-xs transition-all duration-300 transform ${\n error\n ? 'opacity-100 max-h-20 border-red-200 dark:border-red-900/30 bg-red-50 dark:bg-red-900/10 text-red-700 dark:text-red-400 flex items-center translate-y-0'\n : 'opacity-0 max-h-0 overflow-hidden border-transparent translate-y-2'\n }`}\n >\n {error && (\n <AlertCircle size={14} className=\"mr-2 flex-shrink-0\" />\n )}\n {error}\n </div>\n\n {/* Success Message */}\n <div\n className={`p-2 border rounded-sm text-xs transition-all duration-300 transform ${\n success\n ? 'opacity-100 max-h-20 border-emerald-200 dark:border-emerald-900/30 bg-emerald-50 dark:bg-emerald-900/10 text-emerald-700 dark:text-emerald-400 translate-y-0'\n : 'opacity-0 max-h-0 overflow-hidden border-transparent translate-y-2'\n }`}\n >\n {success}\n </div>\n\n {/* Submit Button */}\n <div\n className={`transform transition-all duration-500 delay-700 ${formVisible ? 'translate-y-0 opacity-100' : 'translate-y-4 opacity-0'}`}\n >\n <SubmitButton\n loading={loading}\n side={side}\n orderType={isMarketOrder(fillMode) ? 'MARKET' : 'LIMIT'}\n disabled={!marketSymbol || loading}\n />\n </div>\n </div>\n </form>\n )}\n </div>\n );\n}\n"]}
|
|
@@ -104,6 +104,6 @@ export default function UserBalances() {
|
|
|
104
104
|
var intervalId = setInterval(fetchBalances, 10000); // Update every 10 seconds
|
|
105
105
|
return function () { return clearInterval(intervalId); };
|
|
106
106
|
}, [nordUser, nord]);
|
|
107
|
-
return (_jsx("div", { className: "bg-white dark:bg-n1-gray-950 overflow-hidden", children: _jsxs("div", { className: "p-4", children: [_jsx("h2", { className: "text-lg font-semibold text-n1-gray-900 dark:text-n1-gray-100 mb-4", children: "Balances" }), loading && balances.length === 0 ? (_jsx("div", { className: "flex items-center justify-center h-32", children: _jsx(RefreshCw, { size: 20, className: "text-n1-gray-400 n1-animate-spin" }) })) : error ? (_jsx("div", { className: "p-3 bg-red-50 dark:bg-red-900/20 rounded-lg text-red-600 dark:text-red-400 text-sm", children: error })) : balances.length === 0 ? (_jsx("div", { className: "p-3 bg-n1-gray-50 dark:bg-n1-gray-950 rounded-lg text-n1-gray-500 dark:text-n1-gray-400 text-sm text-center", children: "No balances found" })) : (_jsxs("div", { className: "space-y-3", children: [balances.map(function (balance, index) { return (_jsxs("div", { className: "p-3 bg-n1-gray-50 dark:bg-n1-gray-950 rounded-lg", children: [_jsxs("div", { className: "flex items-center justify-between mb-2", children: [_jsx("div", { className: "flex items-center", children: _jsx("span", { className: "font-medium text-n1-gray-900 dark:text-n1-gray-100", children: balance.symbol }) }), _jsx("div", { className: "font-medium text-n1-gray-900 dark:text-n1-gray-100 font-mono", children: balance.balance.toFixed(6) })] }), _jsxs("div", { className: "text-xs text-n1-gray-500 dark:text-n1-gray-400", children: ["Account ID: ", balance.accountId] })] }, index)); }), loading && balances.length > 0 && (_jsx("div", { className: "flex justify-center mt-2", children: _jsx(RefreshCw, { size: 16, className: "text-n1-gray-400 n1-animate-spin" }) }))] }))] }) }));
|
|
107
|
+
return (_jsx("div", { className: "bg-white dark:bg-n1-ww-gray-950 overflow-hidden", children: _jsxs("div", { className: "p-4", children: [_jsx("h2", { className: "text-lg font-semibold text-n1-ww-gray-900 dark:text-n1-ww-gray-100 mb-4", children: "Balances" }), loading && balances.length === 0 ? (_jsx("div", { className: "flex items-center justify-center h-32", children: _jsx(RefreshCw, { size: 20, className: "text-n1-ww-gray-400 n1-ww-animate-spin" }) })) : error ? (_jsx("div", { className: "p-3 bg-red-50 dark:bg-red-900/20 rounded-lg text-red-600 dark:text-red-400 text-sm", children: error })) : balances.length === 0 ? (_jsx("div", { className: "p-3 bg-n1-ww-gray-50 dark:bg-n1-ww-gray-950 rounded-lg text-n1-ww-gray-500 dark:text-n1-ww-gray-400 text-sm text-center", children: "No balances found" })) : (_jsxs("div", { className: "space-y-3", children: [balances.map(function (balance, index) { return (_jsxs("div", { className: "p-3 bg-n1-ww-gray-50 dark:bg-n1-ww-gray-950 rounded-lg", children: [_jsxs("div", { className: "flex items-center justify-between mb-2", children: [_jsx("div", { className: "flex items-center", children: _jsx("span", { className: "font-medium text-n1-ww-gray-900 dark:text-n1-ww-gray-100", children: balance.symbol }) }), _jsx("div", { className: "font-medium text-n1-ww-gray-900 dark:text-n1-ww-gray-100 font-mono", children: balance.balance.toFixed(6) })] }), _jsxs("div", { className: "text-xs text-n1-ww-gray-500 dark:text-n1-ww-gray-400", children: ["Account ID: ", balance.accountId] })] }, index)); }), loading && balances.length > 0 && (_jsx("div", { className: "flex justify-center mt-2", children: _jsx(RefreshCw, { size: 16, className: "text-n1-ww-gray-400 n1-ww-animate-spin" }) }))] }))] }) }));
|
|
108
108
|
}
|
|
109
109
|
//# sourceMappingURL=UserBalances.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserBalances.js","sourceRoot":"","sources":["../../../../../src/Modal/Sidebar/NordTradingView/UserBalances/UserBalances.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAQzC,MAAM,CAAC,OAAO,UAAU,YAAY;IAApC,iBAiHC;IAhHO,IAAA,KAAqB,kBAAkB,EAAE,EAAvC,IAAI,UAAA,EAAE,QAAQ,cAAyB,CAAC;IAC1C,IAAA,KAA0B,QAAQ,CAAY,EAAE,CAAC,EAAhD,QAAQ,QAAA,EAAE,WAAW,QAA2B,CAAC;IAClD,IAAA,KAAwB,QAAQ,CAAC,KAAK,CAAC,EAAtC,OAAO,QAAA,EAAE,UAAU,QAAmB,CAAC;IACxC,IAAA,KAAoB,QAAQ,CAAgB,IAAI,CAAC,EAAhD,KAAK,QAAA,EAAE,QAAQ,QAAiC,CAAC;IAExD,sBAAsB;IACtB,SAAS,CAAC;QACR,IAAI,CAAC,QAAQ,IAAI,C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ClB,aAAI,SAAS,EAAC,yEAAyE,yBAElF,EAEJ,OAAO,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAClC,cAAK,SAAS,EAAC,uCAAuC,YACpD,KAAC,SAAS,IAAC,IAAI,EAAE,EAAE,EAAE,SAAS,EAAC,wCAAwC,GAAG,GACtE,CACP,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CACV,cAAK,SAAS,EAAC,oFAAoF,YAChG,KAAK,GACF,CACP,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAC1B,cAAK,SAAS,EAAC,yHAAyH,kCAElI,CACP,CAAC,CAAC,CAAC,CACF,eAAK,SAAS,EAAC,WAAW,aACvB,QAAQ,CAAC,GAAG,CAAC,UAAC,OAAO,EAAE,KAAK,IAAK,OAAA,CAChC,eAEE,SAAS,EAAC,wDAAwD,aAElE,eAAK,SAAS,EAAC,wCAAwC,aACrD,cAAK,SAAS,EAAC,mBAAmB,YAChC,eAAM,SAAS,EAAC,0DAA0D,YACvE,OAAO,CAAC,MAAM,GACV,GACH,EACN,cAAK,SAAS,EAAC,oEAAoE,YAChF,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GACvB,IACF,EACN,eAAK,SAAS,EAAC,sDAAsD,6BACtD,OAAO,CAAC,SAAS,IAC1B,KAfD,KAAK,CAgBN,CACP,EAnBiC,CAmBjC,CAAC,EAGD,OAAO,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,CACjC,cAAK,SAAS,EAAC,0BAA0B,YACvC,KAAC,SAAS,IAAC,IAAI,EAAE,EAAE,EAAE,SAAS,EAAC,wCAAwC,GAAG,GACtE,CACP,IACG,CACP,IACG,GACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { useState, useEffect } from 'react';\nimport { useN1WalletContext } from '../../../../Provider/hooks';\nimport { RefreshCw } from 'lucide-react';\n\ninterface Balance {\n symbol: string;\n balance: number;\n accountId: number;\n}\n\nexport default function UserBalances() {\n const { nord, nordUser } = useN1WalletContext();\n const [balances, setBalances] = useState<Balance[]>([]);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n // Fetch user balances\n useEffect(() => {\n if (!nordUser || !nord) return;\n\n const fetchBalances = async () => {\n setLoading(true);\n setError(null);\n\n try {\n // Refresh user info to get latest balances\n await nordUser.fetchInfo();\n\n // Extract real balances from nordUser\n const realBalances: Balance[] = [];\n\n // Loop through all accounts\n if (nordUser.accountIds) {\n for (const accountId of nordUser.accountIds) {\n // Check if this account has balances\n const accountBalances = nordUser.balances[accountId];\n\n if (accountBalances && accountBalances.length > 0) {\n // Add each balance to our list\n for (const balance of accountBalances) {\n // Only include non-zero balances\n if (balance.balance > 0) {\n realBalances.push({\n symbol: balance.symbol,\n balance: balance.balance,\n accountId: accountId,\n });\n }\n }\n }\n }\n }\n\n setBalances(realBalances);\n } catch (err) {\n console.error('Error fetching balances:', err);\n setError('Failed to load balances');\n } finally {\n setLoading(false);\n }\n };\n\n fetchBalances();\n\n // Set up polling for balance updates\n const intervalId = setInterval(fetchBalances, 10000); // Update every 10 seconds\n\n return () => clearInterval(intervalId);\n }, [nordUser, nord]);\n\n return (\n <div className=\"bg-white dark:bg-n1-ww-gray-950 overflow-hidden\">\n <div className=\"p-4\">\n <h2 className=\"text-lg font-semibold text-n1-ww-gray-900 dark:text-n1-ww-gray-100 mb-4\">\n Balances\n </h2>\n\n {loading && balances.length === 0 ? (\n <div className=\"flex items-center justify-center h-32\">\n <RefreshCw size={20} className=\"text-n1-ww-gray-400 n1-ww-animate-spin\" />\n </div>\n ) : error ? (\n <div className=\"p-3 bg-red-50 dark:bg-red-900/20 rounded-lg text-red-600 dark:text-red-400 text-sm\">\n {error}\n </div>\n ) : balances.length === 0 ? (\n <div className=\"p-3 bg-n1-ww-gray-50 dark:bg-n1-ww-gray-950 rounded-lg text-n1-ww-gray-500 dark:text-n1-ww-gray-400 text-sm text-center\">\n No balances found\n </div>\n ) : (\n <div className=\"space-y-3\">\n {balances.map((balance, index) => (\n <div\n key={index}\n className=\"p-3 bg-n1-ww-gray-50 dark:bg-n1-ww-gray-950 rounded-lg\"\n >\n <div className=\"flex items-center justify-between mb-2\">\n <div className=\"flex items-center\">\n <span className=\"font-medium text-n1-ww-gray-900 dark:text-n1-ww-gray-100\">\n {balance.symbol}\n </span>\n </div>\n <div className=\"font-medium text-n1-ww-gray-900 dark:text-n1-ww-gray-100 font-mono\">\n {balance.balance.toFixed(6)}\n </div>\n </div>\n <div className=\"text-xs text-n1-ww-gray-500 dark:text-n1-ww-gray-400\">\n Account ID: {balance.accountId}\n </div>\n </div>\n ))}\n\n {/* Loading indicator for refreshing */}\n {loading && balances.length > 0 && (\n <div className=\"flex justify-center mt-2\">\n <RefreshCw size={16} className=\"text-n1-ww-gray-400 n1-ww-animate-spin\" />\n </div>\n )}\n </div>\n )}\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -170,14 +170,14 @@ export default function UserOrders() {
|
|
|
170
170
|
}
|
|
171
171
|
});
|
|
172
172
|
}); };
|
|
173
|
-
return (_jsx("div", { className: "bg-white dark:bg-n1-gray-950 shadow-sm border border-n1-gray-200 dark:border-n1-gray-800 overflow-hidden", children: _jsxs("div", { className: "p-4", children: [_jsx("h2", { className: "text-lg font-semibold text-n1-gray-900 dark:text-n1-gray-100 mb-4", children: "Orders" }), _jsxs("div", { className: "overflow-hidden", ref: containerRef, children: [loading && activeOrders.length === 0 && orderHistory.length === 0 ? (_jsx("div", { className: "flex items-center justify-center h-32", children: _jsx(RefreshCw, { size: 20, className: "text-n1-gray-400 n1-animate-spin" }) })) : error ? (_jsx("div", { className: "p-3 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm", children: error })) : activeOrders.length === 0 ? (_jsx("div", { className: "p-3 bg-n1-gray-50 dark:bg-n1-gray-800 text-n1-gray-500 dark:text-n1-gray-400 text-sm text-center", children: "No active orders" })) : !compactView ? (
|
|
173
|
+
return (_jsx("div", { className: "bg-white dark:bg-n1-ww-gray-950 shadow-sm border border-n1-ww-gray-200 dark:border-n1-ww-gray-800 overflow-hidden", children: _jsxs("div", { className: "p-4", children: [_jsx("h2", { className: "text-lg font-semibold text-n1-ww-gray-900 dark:text-n1-ww-gray-100 mb-4", children: "Orders" }), _jsxs("div", { className: "overflow-hidden", ref: containerRef, children: [loading && activeOrders.length === 0 && orderHistory.length === 0 ? (_jsx("div", { className: "flex items-center justify-center h-32", children: _jsx(RefreshCw, { size: 20, className: "text-n1-ww-gray-400 n1-ww-animate-spin" }) })) : error ? (_jsx("div", { className: "p-3 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm", children: error })) : activeOrders.length === 0 ? (_jsx("div", { className: "p-3 bg-n1-ww-gray-50 dark:bg-n1-ww-gray-800 text-n1-ww-gray-500 dark:text-n1-ww-gray-400 text-sm text-center", children: "No active orders" })) : !compactView ? (
|
|
174
174
|
// Standard table view for larger containers
|
|
175
|
-
_jsx("div", { className: "overflow-x-auto", children: _jsxs("table", { className: "min-w-full divide-y divide-n1-gray-200 dark:divide-n1-gray-800", children: [_jsx("thead", { className: "bg-n1-gray-50 dark:bg-n1-gray-800", children: _jsxs("tr", { children: [_jsx("th", { className: "px-3 py-2 text-left text-xs font-medium text-n1-gray-500 dark:text-n1-gray-400 uppercase tracking-wider", children: "Market" }), _jsx("th", { className: "px-3 py-2 text-left text-xs font-medium text-n1-gray-500 dark:text-n1-gray-400 uppercase tracking-wider", children: "Side" }), _jsx("th", { className: "px-3 py-2 text-right text-xs font-medium text-n1-gray-500 dark:text-n1-gray-400 uppercase tracking-wider", children: "Size" }), _jsx("th", { className: "px-3 py-2 text-right text-xs font-medium text-n1-gray-500 dark:text-n1-gray-400 uppercase tracking-wider", children: "Price" }), _jsx("th", { className: "px-3 py-2 text-right text-xs font-medium text-n1-gray-500 dark:text-n1-gray-400 uppercase tracking-wider", children: "Action" })] }) }), _jsx("tbody", { className: "bg-white dark:bg-n1-gray-950 divide-y divide-n1-gray-200 dark:divide-n1-gray-800", children: activeOrders.map(function (order) { return (_jsxs("tr", { className: "hover:bg-n1-gray-50 dark:hover:bg-n1-gray-800", children: [_jsx("td", { className: "px-3 py-2 whitespace-nowrap text-sm text-n1-gray-900 dark:text-n1-gray-100", children: order.symbol }), _jsx("td", { className: "px-3 py-2 whitespace-nowrap text-sm", children: _jsx("span", { className: "font-medium ".concat(order.isLong ? 'text-green-600 dark:text-green-400' : 'text-red-600 dark:text-red-400'), children: order.isLong ? 'BUY' : 'SELL' }) }), _jsx("td", { className: "px-3 py-2 whitespace-nowrap text-sm text-n1-gray-900 dark:text-n1-gray-100 text-right font-mono", children: order.size }), _jsx("td", { className: "px-3 py-2 whitespace-nowrap text-sm text-n1-gray-900 dark:text-n1-gray-100 text-right font-mono", children: order.price }), _jsx("td", { className: "px-3 py-2 whitespace-nowrap text-sm text-right", children: _jsx("button", { onClick: function () { return handleCancelOrder(order.orderId); }, disabled: cancellingOrderId === order.orderId, className: "text-red-600 dark:text-red-400 hover:text-red-800 dark:hover:text-red-300 relative ".concat(cancellingOrderId === order.orderId
|
|
175
|
+
_jsx("div", { className: "overflow-x-auto", children: _jsxs("table", { className: "min-w-full divide-y divide-n1-ww-gray-200 dark:divide-n1-ww-gray-800", children: [_jsx("thead", { className: "bg-n1-ww-gray-50 dark:bg-n1-ww-gray-800", children: _jsxs("tr", { children: [_jsx("th", { className: "px-3 py-2 text-left text-xs font-medium text-n1-ww-gray-500 dark:text-n1-ww-gray-400 uppercase tracking-wider", children: "Market" }), _jsx("th", { className: "px-3 py-2 text-left text-xs font-medium text-n1-ww-gray-500 dark:text-n1-ww-gray-400 uppercase tracking-wider", children: "Side" }), _jsx("th", { className: "px-3 py-2 text-right text-xs font-medium text-n1-ww-gray-500 dark:text-n1-ww-gray-400 uppercase tracking-wider", children: "Size" }), _jsx("th", { className: "px-3 py-2 text-right text-xs font-medium text-n1-ww-gray-500 dark:text-n1-ww-gray-400 uppercase tracking-wider", children: "Price" }), _jsx("th", { className: "px-3 py-2 text-right text-xs font-medium text-n1-ww-gray-500 dark:text-n1-ww-gray-400 uppercase tracking-wider", children: "Action" })] }) }), _jsx("tbody", { className: "bg-white dark:bg-n1-ww-gray-950 divide-y divide-n1-ww-gray-200 dark:divide-n1-ww-gray-800", children: activeOrders.map(function (order) { return (_jsxs("tr", { className: "hover:bg-n1-ww-gray-50 dark:hover:bg-n1-ww-gray-800", children: [_jsx("td", { className: "px-3 py-2 whitespace-nowrap text-sm text-n1-ww-gray-900 dark:text-n1-ww-gray-100", children: order.symbol }), _jsx("td", { className: "px-3 py-2 whitespace-nowrap text-sm", children: _jsx("span", { className: "font-medium ".concat(order.isLong ? 'text-green-600 dark:text-green-400' : 'text-red-600 dark:text-red-400'), children: order.isLong ? 'BUY' : 'SELL' }) }), _jsx("td", { className: "px-3 py-2 whitespace-nowrap text-sm text-n1-ww-gray-900 dark:text-n1-ww-gray-100 text-right font-mono", children: order.size }), _jsx("td", { className: "px-3 py-2 whitespace-nowrap text-sm text-n1-ww-gray-900 dark:text-n1-ww-gray-100 text-right font-mono", children: order.price }), _jsx("td", { className: "px-3 py-2 whitespace-nowrap text-sm text-right", children: _jsx("button", { onClick: function () { return handleCancelOrder(order.orderId); }, disabled: cancellingOrderId === order.orderId, className: "text-red-600 dark:text-red-400 hover:text-red-800 dark:hover:text-red-300 relative ".concat(cancellingOrderId === order.orderId
|
|
176
176
|
? 'cursor-not-allowed'
|
|
177
|
-
: ''), children: cancellingOrderId === order.orderId ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "opacity-0", children: "Cancel" }), _jsx(X, { size: 16, className: "absolute inset-0 m-auto n1-animate-pulse text-red-500" })] })) : ('Cancel') }) })] }, order.orderId)); }) })] }) })) : (
|
|
177
|
+
: ''), children: cancellingOrderId === order.orderId ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "opacity-0", children: "Cancel" }), _jsx(X, { size: 16, className: "absolute inset-0 m-auto n1-ww-animate-pulse text-red-500" })] })) : ('Cancel') }) })] }, order.orderId)); }) })] }) })) : (
|
|
178
178
|
// Compact card view for smaller containers
|
|
179
|
-
_jsx("div", { className: "grid gap-2", children: activeOrders.map(function (order) { return (_jsxs("div", { className: "bg-white dark:bg-n1-gray-900 border border-n1-gray-200 dark:border-n1-gray-800 rounded p-2 hover:bg-n1-gray-50 dark:hover:bg-n1-gray-800", children: [_jsxs("div", { className: "flex justify-between items-start mb-1", children: [_jsx("div", { className: "font-medium text-sm text-n1-gray-900 dark:text-n1-gray-100", children: order.symbol }), _jsx("button", { onClick: function () { return handleCancelOrder(order.orderId); }, disabled: cancellingOrderId === order.orderId, className: "text-red-600 dark:text-red-400 hover:text-red-800 dark:hover:text-red-300 text-xs relative ".concat(cancellingOrderId === order.orderId
|
|
179
|
+
_jsx("div", { className: "grid gap-2", children: activeOrders.map(function (order) { return (_jsxs("div", { className: "bg-white dark:bg-n1-ww-gray-900 border border-n1-ww-gray-200 dark:border-n1-ww-gray-800 rounded p-2 hover:bg-n1-ww-gray-50 dark:hover:bg-n1-ww-gray-800", children: [_jsxs("div", { className: "flex justify-between items-start mb-1", children: [_jsx("div", { className: "font-medium text-sm text-n1-ww-gray-900 dark:text-n1-ww-gray-100", children: order.symbol }), _jsx("button", { onClick: function () { return handleCancelOrder(order.orderId); }, disabled: cancellingOrderId === order.orderId, className: "text-red-600 dark:text-red-400 hover:text-red-800 dark:hover:text-red-300 text-xs relative ".concat(cancellingOrderId === order.orderId
|
|
180
180
|
? 'cursor-not-allowed'
|
|
181
|
-
: ''), children: cancellingOrderId === order.orderId ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "opacity-0", children: "Cancel" }), _jsx(X, { size: 14, className: "absolute inset-0 m-auto n1-animate-pulse text-red-500" })] })) : ('Cancel') })] }), _jsxs("div", { className: "grid grid-cols-3 gap-1 text-xs", children: [_jsx("div", { children: _jsx("span", { className: "font-medium ".concat(order.isLong ? 'text-green-600 dark:text-green-400' : 'text-red-600 dark:text-red-400'), children: order.isLong ? 'BUY' : 'SELL' }) }), _jsx("div", { className: "text-right font-mono text-n1-gray-700 dark:text-n1-gray-300", children: order.size }), _jsx("div", { className: "text-right font-mono text-n1-gray-700 dark:text-n1-gray-300", children: order.price })] })] }, order.orderId)); }) })), loading && (activeOrders.length > 0 || orderHistory.length > 0) && (_jsx("div", { className: "flex justify-center mt-2", children: _jsx(RefreshCw, { size: 16, className: "text-n1-gray-400 n1-animate-spin" }) }))] })] }) }));
|
|
181
|
+
: ''), children: cancellingOrderId === order.orderId ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "opacity-0", children: "Cancel" }), _jsx(X, { size: 14, className: "absolute inset-0 m-auto n1-ww-animate-pulse text-red-500" })] })) : ('Cancel') })] }), _jsxs("div", { className: "grid grid-cols-3 gap-1 text-xs", children: [_jsx("div", { children: _jsx("span", { className: "font-medium ".concat(order.isLong ? 'text-green-600 dark:text-green-400' : 'text-red-600 dark:text-red-400'), children: order.isLong ? 'BUY' : 'SELL' }) }), _jsx("div", { className: "text-right font-mono text-n1-ww-gray-700 dark:text-n1-ww-gray-300", children: order.size }), _jsx("div", { className: "text-right font-mono text-n1-ww-gray-700 dark:text-n1-ww-gray-300", children: order.price })] })] }, order.orderId)); }) })), loading && (activeOrders.length > 0 || orderHistory.length > 0) && (_jsx("div", { className: "flex justify-center mt-2", children: _jsx(RefreshCw, { size: 16, className: "text-n1-ww-gray-400 n1-ww-animate-spin" }) }))] })] }) }));
|
|
182
182
|
}
|
|
183
183
|
//# sourceMappingURL=UserOrders.js.map
|