Skip to content

Commit 4621d93

Browse files
Merge pull request #960 from ProvableHQ/fix/algebra-ui-fixes
[Fix] Fix minor UI issues with scalar multiplication and multiplicative inverse of fields.
2 parents d89181c + f2c73e8 commit 4621d93

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

website/src/tabs/algebra/FieldArithmetic.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ export const FieldArithmetic = () => {
4747
};
4848

4949
const calculateResult = (num1, num2, op) => {
50-
if ((op === "inv" && num1 === "") ||
51-
(op !== "inv" && (num1 === "" || num2 === ""))) {
50+
if (((op === "inv" || op === "mulinv") && num1 === "") ||
51+
((op !== "inv" && op !== "mulinv") && (num1 === "" || num2 === ""))) {
5252
setResult("");
5353
return;
5454
}

website/src/tabs/algebra/GroupArithmetic.jsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ export const GroupArithmetic = () => {
152152
calculateResult(groupValueOne, newValue, operation);
153153
};
154154

155+
const onScalarRandom = () => {
156+
const newValue = generateRandomScalar();
157+
setScalarValue(newValue);
158+
calculateResult(groupValueOne, groupValueTwo, operation, newValue);
159+
}
160+
155161
const layout = {
156162
labelCol: { span: 6 },
157163
wrapperCol: { span: 18 },
@@ -264,7 +270,7 @@ export const GroupArithmetic = () => {
264270
/>
265271
<Button
266272
size="large"
267-
onClick={() => setScalarValue(generateRandomScalar())}
273+
onClick={onScalarRandom}
268274
style={{ width: '110px' }}
269275
>
270276
Random

0 commit comments

Comments
 (0)