diff --git a/lib/.submitButton.js.swp b/lib/.submitButton.js.swp new file mode 100644 index 0000000..8409ea9 Binary files /dev/null and b/lib/.submitButton.js.swp differ diff --git a/lib/.utils.js.swp b/lib/.utils.js.swp deleted file mode 100644 index 991b1f0..0000000 Binary files a/lib/.utils.js.swp and /dev/null differ diff --git a/lib/comparisonView.js b/lib/comparisonView.js index f46809c..50a34a1 100644 --- a/lib/comparisonView.js +++ b/lib/comparisonView.js @@ -2,7 +2,7 @@ import Head from "next/head"; import React, { useState } from "react"; import { DrawGraph, removeOldSvg } from "./labeledGraph"; -import { InputBox } from "./inputBox"; +import { SubmitButton } from "./submitButton"; import { DisplayElement } from "./displayElement"; import { DisplayAsMarkdown } from "./displayAsMarkdown"; import { CreateTable, buildRows } from "./findPaths"; @@ -48,12 +48,15 @@ let checkIfListIsOrdered = (arr, binaryComparisons) => { }; let nicelyFormatLinks = (quantitativeComparisons, listOfElements) => - quantitativeComparisons.map(([element1, element2, distance, reasoning]) => ({ - source: listOfElements[element1].name, - target: listOfElements[element2].name, - distance: distance, - reasoning: reasoning, - })); + quantitativeComparisons.map( + ([element1, element2, distance, reasoning, squiggleString]) => ({ + source: listOfElements[element1].name, + target: listOfElements[element2].name, + distance: distance, + reasoning: reasoning, + squiggleString: squiggleString, + }) + ); // Main react component export default function ComparisonView({ listOfElementsForView }) { @@ -303,6 +306,7 @@ export default function ComparisonView({ listOfElementsForView }) { reasoning, element1, element2, + squiggleString, }) => { if (!dontPushSubmitButtonAnyMore) { if (inputValue < 1 && inputValue > 0) { @@ -323,6 +327,7 @@ export default function ComparisonView({ listOfElementsForView }) { element2, inputValue, reasoning, + squiggleString || inputValue, ]; let newQuantitativeComparisons = [ ...quantitativeComparisons, @@ -396,7 +401,7 @@ export default function ComparisonView({ listOfElementsForView }) { - {/* Comparison actuator (text, previously input) */} + {/* Comparison actuator (text, previously number) */}

@@ -404,7 +409,7 @@ export default function ComparisonView({ listOfElementsForView }) { {`... is `}
{ @@ -418,7 +423,7 @@ export default function ComparisonView({ listOfElementsForView }) {
- { + let onClick = async (event) => { if (!dontPushSubmitButtonAnyMore) { //event.preventDefault(); let obj = { posList, binaryComparisons, inputValue, + squiggleString: inputValue, reasoning, element1: toComparePair[1], element2: toComparePair[0], @@ -30,7 +32,16 @@ export function InputBox({ } else if (!!Number(inputValue) && inputValue < 0) { alert("Negative numbers not yet allowed"); } else { - alert("Your input is not a number"); + let potentialSquiggleOutput = await squiggleWrapper(inputValue); + if (!!Number(potentialSquiggleOutput)) { + nextStepInput({ + ...obj, + inputValue: potentialSquiggleOutput, + squiggleString: inputValue, + }); + } else { + alert("Your input is not a number"); + } } } };