diff --git a/components/Button.tsx b/components/Button.tsx index 2df02813..f97716ec 100644 --- a/components/Button.tsx +++ b/components/Button.tsx @@ -19,7 +19,7 @@ const Button: FunctionComponent = ({ disabled={disabled} className={`${className} px-6 py-2 bg-th-bkg-4 rounded-full text-th-fgd-1 hover:brightness-[1.15] focus:outline-none disabled:bg-th-bkg-4 - disabled:text-th-fgd-4 disabled:cursor-not-allowed`} + disabled:text-th-fgd-4 disabled:cursor-not-allowed disabled:hover:brightness-100`} {...props} > {children} diff --git a/components/ButtonGroup.tsx b/components/ButtonGroup.tsx index 289044f9..1646c675 100644 --- a/components/ButtonGroup.tsx +++ b/components/ButtonGroup.tsx @@ -18,7 +18,7 @@ const ButtonGroup: FunctionComponent = ({ return (
- {activeValue ? ( + {activeValue && values.includes(activeValue) ? (
{ setMaxSlippage(clamp(slippage / 100, 0, 1).toString()) @@ -1003,35 +1005,61 @@ export default function AdvancedTradeForm({ {tradeType === 'Market' && priceImpact ? (
{editMaxSlippage ? ( - <> -
Max Slippage
-
- setMaxSlippagePercentage(e.target.value)} - suffix={ -
- % -
- } - value={maxSlippagePercentage} - /> - +
+
+
+
+ {t('max-slippage')} +
+ {!isMobile ? ( + + setShowCustomSlippageForm(!showCustomSlippageForm) + } + > + {showCustomSlippageForm ? t('presets') : t('custom')} + + ) : null} +
+ {showCustomSlippageForm || isMobile ? ( + + setMaxSlippagePercentage(e.target.value) + } + suffix={ +
+ % +
+ } + value={maxSlippagePercentage} + /> + ) : ( + setMaxSlippagePercentage(p)} + unit="%" + values={slippagePresets} + /> + )}
- + +
) : ( <> {isPerpMarket ? (
- Max Slippage + {t('max-slippage')}
diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 9e7c2b9e..9697a752 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -55,8 +55,8 @@ "close-and-long": "Close position and open long", "close-and-short": "Close position and open short", "close-confirm": "Are you sure you want to market close your {{config_name}} position?", - "close-open-long": "100% close position and Open {{size}} {{symbol}} long", - "close-open-short": "100% close position and Open {{size}} {{symbol}} short", + "close-open-long": "100% close position and open {{size}} {{symbol}} long", + "close-open-short": "100% close position and open {{size}} {{symbol}} short", "close-position": "Close Position", "collateral-available": "Collateral Available", "collateral-available-tip-desc": "The collateral value that can be used to take on leverage. Assets carry different collateral weights depending on the risk they present to the platform.", @@ -178,6 +178,7 @@ "max": "Max", "max-borrow": "Max Borrow Amount", "max-depth-bps": "Max Depth Bps", + "max-slippage": "Max Slippage", "max-with-borrow": "Max With Borrow", "minutes": "mins", "missing-price": "Missing price", @@ -239,6 +240,7 @@ "position-size": "Position Size", "positions": "Positions", "post": "Post", + "presets": "Presets", "price": "Price", "price-expect": "The price you receive may be worse than you expect and full execution is not guaranteed. Max slippage is 2.5% for your safety. The part of your position with slippage beyond 2.5% will not be closed.", "price-impact": "Est. Price Impact", diff --git a/public/locales/es/common.json b/public/locales/es/common.json index 0f9e14f5..034aecb6 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -176,6 +176,7 @@ "max": "Maximo", "max-borrow": "Monto máximo del préstamo", "max-depth-bps": "Max Depth Bps", + "max-slippage": "Máximo deslizamiento", "max-with-borrow": "Máximo con préstamo", "minutes": "mins", "missing-price": "Falta el precio", @@ -237,6 +238,7 @@ "position-size": "Tamaño de la posición", "positions": "Posiciones", "post": "Correo", + "presets": "Preajustes", "price": "Precio", "price-expect": "El precio que reciba puede ser mayor o menor de lo esperado.", "price-impact": "Est. Impacto en el precio:", diff --git a/public/locales/zh/common.json b/public/locales/zh/common.json index 5e2a6f75..41c42c83 100644 --- a/public/locales/zh/common.json +++ b/public/locales/zh/common.json @@ -176,6 +176,7 @@ "max": "最多", "max-borrow": "最多借贷数量", "max-depth-bps": "最大深度Bps", + "max-slippage": "最多滑移", "max-with-borrow": "借用最大值", "minutes": "分钟", "missing-price": "没有价格", @@ -237,6 +238,7 @@ "position-size": "当前持仓数量", "positions": "当前持仓", "post": "Post", + "presets": "预设", "price": "价格", "price-expect": "成交前价格也许会有变化。", "price-impact": "预计价格影响", diff --git a/public/locales/zh_tw/common.json b/public/locales/zh_tw/common.json index 38462ee8..f30b89cb 100644 --- a/public/locales/zh_tw/common.json +++ b/public/locales/zh_tw/common.json @@ -176,6 +176,7 @@ "max": "最多", "max-borrow": "最多借貸數量", "max-depth-bps": "最大深度Bps", + "max-slippage": "最多滑移", "max-with-borrow": "借用最大值", "minutes": "分鐘", "missing-price": "沒有價格", @@ -237,6 +238,7 @@ "position-size": "當前持倉數量", "positions": "當前持倉", "post": "Post", + "presets": "預設", "price": "價格", "price-expect": "成交前價格也許會有變化。", "price-impact": "預計價格影響",