@loafmarkets/ui 0.1.57 → 0.1.58
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/index.js +23 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -10693,6 +10693,17 @@ function OrderPanel({
|
|
|
10693
10693
|
const v = e.target.value;
|
|
10694
10694
|
if (v === "" || /^\d*\.?\d{0,2}$/.test(v)) {
|
|
10695
10695
|
setPayInputValue(v);
|
|
10696
|
+
const parsed = parseInt(v.replace(/[^0-9]/g, ""), 10) || 0;
|
|
10697
|
+
if (parsed <= 0) {
|
|
10698
|
+
setManualOrderAmount(null);
|
|
10699
|
+
setSliderValue(0);
|
|
10700
|
+
} else if (parsed >= availableBalance) {
|
|
10701
|
+
setManualOrderAmount(null);
|
|
10702
|
+
setSliderValue(100);
|
|
10703
|
+
} else {
|
|
10704
|
+
setManualOrderAmount(parsed);
|
|
10705
|
+
setSliderValue(availableBalance === 0 ? 0 : Math.round(Math.max(0, parsed / availableBalance * 100)));
|
|
10706
|
+
}
|
|
10696
10707
|
}
|
|
10697
10708
|
},
|
|
10698
10709
|
onKeyDown: (e) => {
|
|
@@ -10764,6 +10775,18 @@ function OrderPanel({
|
|
|
10764
10775
|
const v = e.target.value;
|
|
10765
10776
|
if (v === "" || /^\d+$/.test(v)) {
|
|
10766
10777
|
setReceiveInputValue(v);
|
|
10778
|
+
const units = Math.floor(parseInt(v.replace(/[^0-9]/g, ""), 10) || 0);
|
|
10779
|
+
const spend = units * tokenPrice;
|
|
10780
|
+
if (units <= 0) {
|
|
10781
|
+
setManualOrderAmount(null);
|
|
10782
|
+
setSliderValue(0);
|
|
10783
|
+
} else if (spend >= availableBalance) {
|
|
10784
|
+
setManualOrderAmount(null);
|
|
10785
|
+
setSliderValue(100);
|
|
10786
|
+
} else {
|
|
10787
|
+
setManualOrderAmount(spend);
|
|
10788
|
+
setSliderValue(availableBalance === 0 ? 0 : Math.round(Math.max(0, spend / availableBalance * 100)));
|
|
10789
|
+
}
|
|
10767
10790
|
}
|
|
10768
10791
|
},
|
|
10769
10792
|
onKeyDown: (e) => {
|