From 02985f35ab10865fd6dcd170180f51c5d3ab2af0 Mon Sep 17 00:00:00 2001 From: Ben Christel Date: Fri, 9 Aug 2024 13:03:39 -0700 Subject: [PATCH] Fix formatting --- .../__stories__/interactive-graph.stories.tsx | 5 +- .../interactive-graph.testdata.ts | 135 +++++++++--------- .../stateful-mafs-graph.tsx | 8 +- 3 files changed, 81 insertions(+), 67 deletions(-) diff --git a/packages/perseus/src/widgets/__stories__/interactive-graph.stories.tsx b/packages/perseus/src/widgets/__stories__/interactive-graph.stories.tsx index f54c913fed..f9000a855f 100644 --- a/packages/perseus/src/widgets/__stories__/interactive-graph.stories.tsx +++ b/packages/perseus/src/widgets/__stories__/interactive-graph.stories.tsx @@ -163,7 +163,10 @@ export const AngleWithMafs = (args: StoryArgs): React.ReactElement => ( ); export const StaticGraph = (args: StoryArgs): React.ReactElement => ( - + ); export const StaticGraphWithAnotherWidget = ( diff --git a/packages/perseus/src/widgets/__testdata__/interactive-graph.testdata.ts b/packages/perseus/src/widgets/__testdata__/interactive-graph.testdata.ts index b963ab1e3a..ca1d93ebf9 100644 --- a/packages/perseus/src/widgets/__testdata__/interactive-graph.testdata.ts +++ b/packages/perseus/src/widgets/__testdata__/interactive-graph.testdata.ts @@ -809,25 +809,8 @@ export const quadraticQuestion: PerseusRenderer = export const quadraticQuestionWithDefaultCorrect: PerseusRenderer = interactiveGraphQuestionBuilder().withQuadratic().build(); -export const staticGraphQuestion: PerseusRenderer = interactiveGraphQuestionBuilder() - .addLockedPointAt(-7, -7) - .addLockedLine([-7, -5], [2, -3]) - .addLockedVector([0, 0], [8, 2], "purple") - .addLockedEllipse([0, 5], [4, 2], {angle: Math.PI / 4, color: "blue"}) - .addLockedPolygon( - [ - [-9, 4], - [-6, 4], - [-6, 1], - [-9, 1], - ], - {color: "pink"}, - ) - .withStaticMode(true) - .build(); - -export const staticGraphQuestionWithAnotherWidget: () => PerseusRenderer = () => { - const result = interactiveGraphQuestionBuilder() +export const staticGraphQuestion: PerseusRenderer = + interactiveGraphQuestionBuilder() .addLockedPointAt(-7, -7) .addLockedLine([-7, -5], [2, -3]) .addLockedVector([0, 0], [8, 2], "purple") @@ -843,51 +826,73 @@ export const staticGraphQuestionWithAnotherWidget: () => PerseusRenderer = () => ) .withStaticMode(true) .build(); - result["widgets"] = { - ...result["widgets"], - "radio 1": { - graded: true, - version: { - major: 1, - minor: 0, - }, - static: false, - type: "radio", - options: { - displayCount: null, - choices: [ - { - content: "$-8$ and $8$", - correct: false, - clue: "The square root operation ($\\sqrt{\\phantom{x}}$) calculates *only* the positive square root when performed on a number, so $x$ is equal to *only* $8$.", - }, - { - content: "$-8$", - correct: false, - clue: "While $(-8)^2=64$, the square root operation ($\\sqrt{\\phantom{x}}$) calculates *only* the positive square root when performed on a number.", - }, - { - content: "The right answer !!!\n\n", - correct: true, - isNoneOfTheAbove: false, - clue: "$8$ is the positive square root of $64$.", - }, - { - content: "No value of $x$ satisfies the equation.", - correct: false, - isNoneOfTheAbove: false, - clue: "$8$ satisfies the equation.", - }, + +export const staticGraphQuestionWithAnotherWidget: () => PerseusRenderer = + () => { + const result = interactiveGraphQuestionBuilder() + .addLockedPointAt(-7, -7) + .addLockedLine([-7, -5], [2, -3]) + .addLockedVector([0, 0], [8, 2], "purple") + .addLockedEllipse([0, 5], [4, 2], { + angle: Math.PI / 4, + color: "blue", + }) + .addLockedPolygon( + [ + [-9, 4], + [-6, 4], + [-6, 1], + [-9, 1], ], - countChoices: false, - hasNoneOfTheAbove: false, - multipleSelect: false, - randomize: false, - deselectEnabled: false, - }, - alignment: "default", - } as RadioWidget, + {color: "pink"}, + ) + .withStaticMode(true) + .build(); + result["widgets"] = { + ...result["widgets"], + "radio 1": { + graded: true, + version: { + major: 1, + minor: 0, + }, + static: false, + type: "radio", + options: { + displayCount: null, + choices: [ + { + content: "$-8$ and $8$", + correct: false, + clue: "The square root operation ($\\sqrt{\\phantom{x}}$) calculates *only* the positive square root when performed on a number, so $x$ is equal to *only* $8$.", + }, + { + content: "$-8$", + correct: false, + clue: "While $(-8)^2=64$, the square root operation ($\\sqrt{\\phantom{x}}$) calculates *only* the positive square root when performed on a number.", + }, + { + content: "The right answer !!!\n\n", + correct: true, + isNoneOfTheAbove: false, + clue: "$8$ is the positive square root of $64$.", + }, + { + content: "No value of $x$ satisfies the equation.", + correct: false, + isNoneOfTheAbove: false, + clue: "$8$ satisfies the equation.", + }, + ], + countChoices: false, + hasNoneOfTheAbove: false, + multipleSelect: false, + randomize: false, + deselectEnabled: false, + }, + alignment: "default", + } as RadioWidget, + }; + result["content"] = "[[\u2603 radio 1]]\n\n" + result["content"]; + return result; }; - result["content"] = "[[\u2603 radio 1]]\n\n" + result["content"]; - return result; -}; diff --git a/packages/perseus/src/widgets/interactive-graphs/stateful-mafs-graph.tsx b/packages/perseus/src/widgets/interactive-graphs/stateful-mafs-graph.tsx index aab0669de6..b4319bf020 100644 --- a/packages/perseus/src/widgets/interactive-graphs/stateful-mafs-graph.tsx +++ b/packages/perseus/src/widgets/interactive-graphs/stateful-mafs-graph.tsx @@ -130,7 +130,13 @@ export const StatefulMafsGraph = React.forwardRef< ]); if (props.static) { - return + return ( + + ); } return ;