瀏覽代碼

Remove decimals from InputNumber

Edvin 4 年之前
父節點
當前提交
0f3b82fef0

+ 1 - 0
pioneer/packages/apps/public/locales/en/index.json

@@ -24,6 +24,7 @@
   "joy-election.json",
   "joy-media.json",
   "joy-members.json",
+  "joy-proposals.json",
   "joy-roles.json",
   "joy-utils.json",
   "react-components.json",

+ 4 - 1
pioneer/packages/apps/public/locales/en/joy-proposals.json

@@ -1 +1,4 @@
-{}
+{
+  "Current": "Current",
+  "Historical": "Historical"
+}

+ 2 - 0
pioneer/packages/apps/public/locales/en/translation.json

@@ -125,6 +125,7 @@
   "Create and backup account": "",
   "Crypto not detected": "",
   "Cryptography used to create this signature. It is auto-detected on valid signatures.": "",
+  "Current": "",
   "Current account nonce: {{accountNonce}}": "",
   "Current prime member, default voting": "",
   "Current society head, exempt": "",
@@ -184,6 +185,7 @@
   "Genesis Hash refers to initial state of the chain, it cannot be changed once the chain is launched": "",
   "Grandpa": "",
   "Hash data": "",
+  "Historical": "",
   "I'm Online": "",
   "If the recipient account is new, the balance needs to be more than the existential deposit. Likewise if the sending account balance drops below the same value, the account will be removed from the state.": "",
   "If this proposal is passed, the changes will be applied via dispatch and the deposit returned.": "",

+ 4 - 4
pioneer/packages/react-components/src/InputNumber.tsx

@@ -120,12 +120,12 @@ function inputToBn (input: string, si: SiDef | null, bitLength: BitLength, isZer
     }
 
     const div = new BN(input.replace(/\.\d*$/, ''));
-    const modString = input.replace(/^\d+\./, '');
-    const mod = new BN(modString);
+    // const modString = input.replace(/^\d+\./, '');
+    // const mod = new BN(modString);
 
     result = div
-      .mul(BN_TEN.pow(siPower))
-      .add(mod.mul(BN_TEN.pow(new BN(basePower + siUnitPower - modString.length))));
+      .mul(BN_TEN.pow(siPower));
+    // .add(mod.mul(BN_TEN.pow(new BN(basePower + siUnitPower - modString.length))));
   } else {
     result = new BN(input.replace(/[^\d]/g, ''))
       .mul(BN_TEN.pow(siPower));