From 404c720b356636a75d2ae32fcf161081db42a9bb Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Mon, 31 Jan 2022 16:59:14 -0500 Subject: [PATCH] feat: Allow for squiggle/guesstimate type inputs --- lib/.submitButton.js.swp | Bin 0 -> 12288 bytes lib/.utils.js.swp | Bin 20480 -> 0 bytes lib/comparisonView.js | 25 +++++++++++++++---------- lib/node | 0 lib/squiggleWrapper.js | 23 +++++++++++++++++++++++ lib/{inputBox.js => submitButton.js} | 17 ++++++++++++++--- 6 files changed, 52 insertions(+), 13 deletions(-) create mode 100644 lib/.submitButton.js.swp delete mode 100644 lib/.utils.js.swp create mode 100644 lib/node create mode 100644 lib/squiggleWrapper.js rename lib/{inputBox.js => submitButton.js} (71%) diff --git a/lib/.submitButton.js.swp b/lib/.submitButton.js.swp new file mode 100644 index 0000000000000000000000000000000000000000..8409ea952de845f98688e1df5683f7248018a0c6 GIT binary patch literal 12288 zcmeHNTaOe)6fV4h7Z6#ZA{x&Q3Cxn6>0OjamR-C+NQi>SDn<#3Ju@}44Lx0LcQw1? zW+6WK2lUlMUyN@iJ{kXjiNAptjfom~9!Lz;$+y*AQ+?{3uf94} zGh2`{y-?j+yS+=q>T<-@n_csIRC1oi@d?-1fw;9KA-a1l5Hi~+xG7vehb8Sv9n zLM#IpfWyE};P)qm_!;N|CxL&T5aI{mJK$^JByj6-AwCD@fM2!=aScd;n_GqW5@-Rl zz#oqZ@fGj|pn+-N0Pr%f2iOga0o#Dvj|y=E_z~Cve2*Bv0dk-Vd;**UP6HhOpMbwS z1D=6Hf4(1#)Pek+Pu#S0fRVq0iN6pJ~%jL}qXCHwXE^Z(lxt|}| z7!g}`*9=t}of=L8C3%WtLy0DhgF&@MT*%sMQ&ZGdiLT|c8#PqiqO?~#MCnrPRcffL zC9|@y%@3n_ri!E`Th!IH!U3f`ud^uW%-DX;hZyWhfz?J}^)aSh=6(s!96W1iFmP+p_-Wps zp;T$eCko^FvXgfUjVP>PXT%xa1EbHChGE-W&Pguo^}1?YnlvKj&)I>|c6_vLUd!|p z(^XwI>~I*Pk|&DVR2?5bW01WU7R%fz{b%i(am1= z*$u{^67SfW9=0`o54JKH<|;v^vTm?cc|tfhY#bYBHGXF}t8wxf9$IH>Rp7Qy*KWAa zMwEnE&yp3v$=o)7W*rw(mA@0^NQUf>lf|G-&LfZxa)wQ0Yl|WXX)WBQUz(U?t-j$`Oq&W~O($hv2N0_mU=6O&1e1cMPxftITaDo`)&78aW-fx|{Hy z-{I?i)DZ;%y}y7pvs5#+qE>Q1QzDx(&%-Q=d$bTD8EQpxi3fwQSQD~yH*85Rp|%Kn znzqWQB^yPj1LaX#WEeb|ixno1Xaja9%|ssMb|9bGMx(Q5VCJpYsBc2BJluqE+(Q7o z5|#@(w{Y@ZZLx-MxuFy8YQsB{<&T|Y-N$k%RhcGtn7rJP+MI-in62TP>cH|PqON&o zd3ZI%#-*L9E>-G*+n72w-^+{T$BFE+>#0Jp41WKA34Y^CsQ~kQTA9cY& MI%NXO>0luK0|Fegga7~l literal 0 HcmV?d00001 diff --git a/lib/.utils.js.swp b/lib/.utils.js.swp deleted file mode 100644 index 991b1f0ffe208788688fac28eeff6d26d9afb670..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 20480 zcmeHOZHy#E8EypxLFD^W!MfQ!u4i{=W@q;M_V&(`0Y~g zcK0~;_+d4F=C2#y=(qB%(2*Bpw*?hkrDn5iww*NCHOjBcRdesqUKXsp+}B zJ4_JmPM+=Qx2xWI>#4WiuD7~(e)yI>`^03iY~Z-iFn<2vUoHP?^X#$F3yp?%$f0*1Nall{1$i?_%ZM>@F}1U)PNg+>wymdR|4k(e}~;a1ik^x1ABmf zonsiU0#5-?0#5+PfX@K;0yc0NaQtk;SOIPY_5-uP5b*jt&Qcm{Y1_yO<;Fb^CAZUqhi`+@fX*8(qL zv*i!KkAR1PgTOej8OQ;ffS0jha}0O@xEi<$cp95FU%?rNy}IQ2p{ROp5DLew`nDA~ z?&4ktmovh2^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{T49 zj<=WW3?v&Q{8Vv`rsmW)0rZA(-FwsGh_qYp&mfH8AhJL3n&?PLt&<5CW=mHcu8Bm- zwuoGZ$Ssxiyo&X84rv#>TiSt{BM&Yzl#FK{eSmK73ES3_x>IQ!Q&JkF8t?DX_!~_U z5y}k4at?y(JXbQ^9X-WlGHs*~AG;beA!EZdfOUB2&ebCkzR1Lr zTadBsGEwFv(+%e%MqhVxsjo~@&9}28WR^JEnK{}y{Up1WL3-owfkEUZ$(z8n9yP8@ zDaWv@^eKM%FH=gUI>?oh-o~~>IaRk!gi5&8#sHbrm7W?^9J3zV5pNb#rIb#Mr!a+0 zn|9}WG8J!dY)F*K4$U6vsoM1DMM|1K>*;G+$KoACZ1$*46h?&ZFKw`~s&dE;4RtvoTls1!lX>)!3M}oCEarfN2)UZ%Ir z2(EWph?Tn2u(3nW@sGCR(#xTpbhQH81HNP=mm89SUN;=u=yELhcTnJ!1+CC6Av3y6 zzGP5u3gl}7Z`t;-;#$#O6O4{cOiqlBP2s<>U6csbi-OQASdFE+h1X7aHNah$!kyN# z6;yp^DJ(^`CMUXc#UPb z;V1$--0w7PuN5lskZ1Q1CEj_B_at;u`2^ggSulfZWtHj$^Z&;&KkMu= zrV|Jg$Hcc-mZX5Eg97l{W{3hQ(mooh9F~>#r25Fw#q5xxX#h_ZB40b{4ee)b0Mfm zQW*sKXH^NH^Ql$A=>2btb$Gf`K$3g?|( zH=ecTDAOQA|3y4+0s4lpaM|a<~;i zBuy{3DIrtklB6lw>3wua0`(S?)++7%$7NMc$#Re>@|A3Jifk}NmOkx}*hL$yNY8{k zl5bny*awj8sqTEpu-Y=^eB3M2d&RU+m$9e%yQduqeaanoC1k3NJt_Lw-3?y5^!`AT lL#7*;P}uvU%?&E{{*d!zDn{>i@DXYIE17N^- { }; 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"); + } } } };