remove close long/short hotkey templates until fixed
This commit is contained in:
parent
a2127fcfe2
commit
ba45ecdb3d
|
@ -34,6 +34,7 @@ type HotKeyForm = {
|
|||
}
|
||||
|
||||
type TEMPLATE = {
|
||||
custom?: string
|
||||
price: string
|
||||
side: 'buy' | 'sell'
|
||||
size: string
|
||||
|
@ -74,29 +75,31 @@ const DEFAULT_FORM_VALUES: HotKeyForm = {
|
|||
reduce: false,
|
||||
}
|
||||
|
||||
const CLOSE_LONG: TEMPLATE = {
|
||||
price: '',
|
||||
side: 'sell',
|
||||
size: '100',
|
||||
sizeType: 'percentage',
|
||||
orderType: 'market',
|
||||
ioc: false,
|
||||
post: false,
|
||||
margin: true,
|
||||
reduce: true,
|
||||
}
|
||||
// const CLOSE_LONG: TEMPLATE = {
|
||||
// custom: HOTKEY_TEMPLATES.CLOSE_LONG,
|
||||
// price: '',
|
||||
// side: 'sell',
|
||||
// size: '100',
|
||||
// sizeType: 'percentage',
|
||||
// orderType: 'market',
|
||||
// ioc: false,
|
||||
// post: false,
|
||||
// margin: true,
|
||||
// reduce: true,
|
||||
// }
|
||||
|
||||
const CLOSE_SHORT: TEMPLATE = {
|
||||
price: '',
|
||||
side: 'buy',
|
||||
size: '100',
|
||||
sizeType: 'percentage',
|
||||
orderType: 'market',
|
||||
ioc: false,
|
||||
post: false,
|
||||
margin: true,
|
||||
reduce: true,
|
||||
}
|
||||
// const CLOSE_SHORT: TEMPLATE = {
|
||||
// custom: HOTKEY_TEMPLATES.CLOSE_SHORT,
|
||||
// price: '',
|
||||
// side: 'buy',
|
||||
// size: '100',
|
||||
// sizeType: 'percentage',
|
||||
// orderType: 'market',
|
||||
// ioc: false,
|
||||
// post: false,
|
||||
// margin: true,
|
||||
// reduce: true,
|
||||
// }
|
||||
|
||||
const CLOSE_ALL_PERP: CUSTOM_TEMPLATE = {
|
||||
custom: HOTKEY_TEMPLATES.CLOSE_ALL_PERP,
|
||||
|
@ -216,26 +219,27 @@ const HotKeyModal = ({ isOpen, onClose }: ModalProps) => {
|
|||
return
|
||||
}
|
||||
const name = hotKeyForm.name ? hotKeyForm.name : selectedTemplate || ''
|
||||
const newHotKey = !hotKeyForm.custom
|
||||
? {
|
||||
keySequence: `${hotKeyForm.baseKey}+${hotKeyForm.triggerKey}`,
|
||||
custom: hotKeyForm.custom,
|
||||
name: name,
|
||||
orderSide: hotKeyForm.side,
|
||||
orderSizeType: hotKeyForm.sizeType,
|
||||
orderSize: hotKeyForm.size,
|
||||
orderType: hotKeyForm.orderType,
|
||||
orderPrice: hotKeyForm.price,
|
||||
ioc: hotKeyForm.ioc,
|
||||
margin: hotKeyForm.margin,
|
||||
postOnly: hotKeyForm.post,
|
||||
reduceOnly: hotKeyForm.reduce,
|
||||
}
|
||||
: {
|
||||
keySequence: `${hotKeyForm.baseKey}+${hotKeyForm.triggerKey}`,
|
||||
custom: hotKeyForm.custom,
|
||||
name: name,
|
||||
}
|
||||
const newHotKey =
|
||||
hotKeyForm.custom !== HOTKEY_TEMPLATES.CLOSE_ALL_PERP
|
||||
? {
|
||||
keySequence: `${hotKeyForm.baseKey}+${hotKeyForm.triggerKey}`,
|
||||
custom: hotKeyForm.custom,
|
||||
name: name,
|
||||
orderSide: hotKeyForm.side,
|
||||
orderSizeType: hotKeyForm.sizeType,
|
||||
orderSize: hotKeyForm.size,
|
||||
orderType: hotKeyForm.orderType,
|
||||
orderPrice: hotKeyForm.price,
|
||||
ioc: hotKeyForm.ioc,
|
||||
margin: hotKeyForm.margin,
|
||||
postOnly: hotKeyForm.post,
|
||||
reduceOnly: hotKeyForm.reduce,
|
||||
}
|
||||
: {
|
||||
keySequence: `${hotKeyForm.baseKey}+${hotKeyForm.triggerKey}`,
|
||||
custom: hotKeyForm.custom,
|
||||
name: name,
|
||||
}
|
||||
setHotKeys([...hotKeys, newHotKey])
|
||||
onClose()
|
||||
}
|
||||
|
@ -296,7 +300,7 @@ const HotKeyModal = ({ isOpen, onClose }: ModalProps) => {
|
|||
</div>
|
||||
{activeTab === 'settings:templates' ? (
|
||||
<div className="border-b border-th-bkg-3">
|
||||
<button
|
||||
{/* <button
|
||||
className={TEMPLATE_BUTTON_CLASSES}
|
||||
onClick={() =>
|
||||
handleSetTemplate(CLOSE_LONG, HOTKEY_TEMPLATES.CLOSE_LONG)
|
||||
|
@ -321,7 +325,7 @@ const HotKeyModal = ({ isOpen, onClose }: ModalProps) => {
|
|||
<TemplateCheckMark
|
||||
isActive={selectedTemplate === HOTKEY_TEMPLATES.CLOSE_SHORT}
|
||||
/>
|
||||
</button>
|
||||
</button> */}
|
||||
<button
|
||||
className={TEMPLATE_BUTTON_CLASSES}
|
||||
onClick={() =>
|
||||
|
|
|
@ -191,6 +191,7 @@ const TradeHotKeys = ({ children }: { children: ReactNode }) => {
|
|||
const actions = mangoStore.getState().actions
|
||||
const selectedMarket = mangoStore.getState().selectedMarket.current
|
||||
const {
|
||||
custom,
|
||||
ioc,
|
||||
orderPrice,
|
||||
orderSide,
|
||||
|
@ -203,10 +204,25 @@ const TradeHotKeys = ({ children }: { children: ReactNode }) => {
|
|||
if (!group || !mangoAccount || !serumOrPerpMarket || !selectedMarket)
|
||||
return
|
||||
try {
|
||||
let useMargin
|
||||
if (
|
||||
(custom === HOTKEY_TEMPLATES.CLOSE_LONG ||
|
||||
custom === HOTKEY_TEMPLATES.CLOSE_SHORT) &&
|
||||
selectedMarket instanceof Serum3Market
|
||||
) {
|
||||
useMargin = false
|
||||
} else {
|
||||
useMargin = margin
|
||||
}
|
||||
const orderMax =
|
||||
serumOrPerpMarket instanceof PerpMarket
|
||||
? calcPerpMax(mangoAccount, selectedMarket, orderSide)
|
||||
: calcSpotMarketMax(mangoAccount, selectedMarket, orderSide, margin)
|
||||
: calcSpotMarketMax(
|
||||
mangoAccount,
|
||||
selectedMarket,
|
||||
orderSide,
|
||||
useMargin,
|
||||
)
|
||||
const quoteTokenIndex =
|
||||
selectedMarket instanceof PerpMarket
|
||||
? 0
|
||||
|
|
Loading…
Reference in New Issue