Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
benchristel committed Aug 9, 2024
1 parent 3fe6622 commit 02985f3
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@ export const AngleWithMafs = (args: StoryArgs): React.ReactElement => (
);

export const StaticGraph = (args: StoryArgs): React.ReactElement => (
<RendererWithDebugUI apiOptions={enableMafs} question={staticGraphQuestion} />
<RendererWithDebugUI
apiOptions={enableMafs}
question={staticGraphQuestion}
/>
);

export const StaticGraphWithAnotherWidget = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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;
};
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,13 @@ export const StatefulMafsGraph = React.forwardRef<
]);

if (props.static) {
return <MafsGraph {...props} state={initializeGraphState({...props, graph: props.correct})} dispatch={dispatch} />
return (
<MafsGraph
{...props}
state={initializeGraphState({...props, graph: props.correct})}
dispatch={dispatch}
/>
);
}

Check warning on line 140 in packages/perseus/src/widgets/interactive-graphs/stateful-mafs-graph.tsx

View check run for this annotation

Codecov / codecov/patch

packages/perseus/src/widgets/interactive-graphs/stateful-mafs-graph.tsx#L133-L140

Added lines #L133 - L140 were not covered by tests

return <MafsGraph {...props} state={state} dispatch={dispatch} />;
Expand Down

0 comments on commit 02985f3

Please sign in to comment.