-
Notifications
You must be signed in to change notification settings - Fork 353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[LEMS-2868] Answerless ServerItemRendererWithDebugUI #2289
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4c3d5e1
[LEMS-2868/answerless-stories] make ServerItemRendererWithDebugUI opt…
handeyeco d9ff1b6
[LEMS-2868/answerless-stories] remove console.log
handeyeco 0f0848b
[LEMS-2868/answerless-stories] docs(changeset): Update ServerItemRend…
handeyeco da0f556
[LEMS-2868/answerless-stories] respond to Jeremy's feedback
handeyeco c41f9db
[LEMS-2868/answerless-stories] Merge branch 'main' into LEMS-2868/ans…
handeyeco 25d3d1f
[LEMS-2868/answerless-stories] use renderedItem in JSON preview
handeyeco File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@khanacademy/perseus": patch | ||
--- | ||
|
||
Update ServerItemRendererWithDebugUI to optionally use answerless data for rendering |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import { | ||
ItemExtras, | ||
type PerseusExpressionWidgetOptions, | ||
type Version, | ||
type PerseusItem, | ||
type PerseusAnswerArea, | ||
expressionLogic, | ||
} from "@khanacademy/perseus-core"; | ||
|
||
const createItemJson = ( | ||
widgetOptions: PerseusExpressionWidgetOptions, | ||
version: Version, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like changing version to widgetVersion, adding extra keys, and modifying item 3 below is all that was done here. Did you add an item without answers somewhere? I think the big red and green chunks were just moved code, but I might have missed something. |
||
widgetVersion = expressionLogic.version, | ||
): PerseusItem => { | ||
return { | ||
question: { | ||
|
@@ -19,7 +19,7 @@ const createItemJson = ( | |
type: "expression", | ||
graded: true, | ||
options: widgetOptions, | ||
version: version, | ||
version: widgetVersion, | ||
}, | ||
}, | ||
}, | ||
|
@@ -36,62 +36,55 @@ const createItemJson = ( | |
}; | ||
|
||
export const expressionItemWithAnswer = (answer: string): PerseusItem => { | ||
return createItemJson( | ||
{ | ||
answerForms: [ | ||
{ | ||
considered: "correct", | ||
form: false, | ||
simplify: false, | ||
value: answer, | ||
}, | ||
], | ||
times: false, | ||
buttonSets: ["basic"], | ||
functions: [], | ||
buttonsVisible: "always", | ||
}, | ||
{major: 1, minor: 0}, | ||
); | ||
}; | ||
|
||
export const expressionItemWithLabels = createItemJson( | ||
{ | ||
answerForms: [], | ||
times: false, | ||
buttonSets: ["basic"], | ||
functions: [], | ||
buttonsVisible: "always", | ||
ariaLabel: "Test aria label", | ||
visibleLabel: "Test visible label", | ||
}, | ||
{major: 1, minor: 0}, | ||
); | ||
|
||
export const expressionItem2: PerseusItem = createItemJson( | ||
{ | ||
return createItemJson({ | ||
answerForms: [ | ||
{ | ||
considered: "correct", | ||
form: false, | ||
simplify: false, | ||
value: "123-x", | ||
}, | ||
{ | ||
considered: "correct", | ||
form: false, | ||
simplify: false, | ||
value: "x-123", | ||
value: answer, | ||
}, | ||
], | ||
times: false, | ||
buttonSets: ["basic"], | ||
functions: ["f", "g", "h"], | ||
functions: [], | ||
buttonsVisible: "always", | ||
extraKeys: ["x"], | ||
}, | ||
{major: 1, minor: 0}, | ||
); | ||
extraKeys: [], | ||
}); | ||
}; | ||
|
||
export const expressionItemWithLabels = createItemJson({ | ||
answerForms: [], | ||
times: false, | ||
buttonSets: ["basic"], | ||
functions: [], | ||
buttonsVisible: "always", | ||
ariaLabel: "Test aria label", | ||
visibleLabel: "Test visible label", | ||
extraKeys: [], | ||
}); | ||
|
||
export const expressionItem2: PerseusItem = createItemJson({ | ||
answerForms: [ | ||
{ | ||
considered: "correct", | ||
form: false, | ||
simplify: false, | ||
value: "123-x", | ||
}, | ||
{ | ||
considered: "correct", | ||
form: false, | ||
simplify: false, | ||
value: "x-123", | ||
}, | ||
], | ||
times: false, | ||
buttonSets: ["basic"], | ||
functions: ["f", "g", "h"], | ||
buttonsVisible: "always", | ||
extraKeys: ["x"], | ||
}); | ||
|
||
const expressionItem3Options: PerseusExpressionWidgetOptions = { | ||
answerForms: [ | ||
|
@@ -126,12 +119,9 @@ const expressionItem3Options: PerseusExpressionWidgetOptions = { | |
buttonsVisible: "focused", | ||
visibleLabel: "number of cm", | ||
ariaLabel: "number of centimeters", | ||
extraKeys: ["z", "a"], | ||
}; | ||
|
||
export const expressionItem3: PerseusItem = createItemJson( | ||
expressionItem3Options, | ||
{ | ||
major: 1, | ||
minor: 0, | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this used? I don't see it referenced in this PR at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is how Storybook works, by exporting the function in a
.stories.tsx
file it shows up in SB.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦♂️ I didn't take note this was in a
.stories.tsx
file!