-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Batch 2 of simple default widget option transfers (#2145)
## Summary: I couldn't justify doing a PR per widget because all of these are really straight-forward; there's no prop upgrades or versions or anything. It's just moving "default props" from editors into "default widget options" in core so we can do minor upgrades on the server. [LEMS-2737/default-collection-2] video [LEMS-2737/default-collection-2] sorter [LEMS-2737/default-collection-2] phet [LEMS-2737/default-collection-2] orderer [LEMS-2737/default-collection-2] numeric-input [LEMS-2737/default-collection-2] matrix Issue: LEMS-2737 ## Test plan: Nothing should change, just moving code Author: handeyeco Reviewers: jeremywiebe Required Reviewers: Approved By: jeremywiebe Checks: ✅ Cypress (ubuntu-latest, 20.x), ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x) Pull Request URL: #2145
- Loading branch information
Showing
18 changed files
with
221 additions
and
57 deletions.
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,6 @@ | ||
--- | ||
"@khanacademy/perseus-core": minor | ||
"@khanacademy/perseus-editor": patch | ||
--- | ||
|
||
Move simple widget upgrade logic to Perseus Core (pt 2) |
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
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,22 @@ | ||
import type {PerseusMatrixWidgetOptions} from "../../data-schema"; | ||
import type {WidgetLogic} from "../logic-export.types"; | ||
|
||
export type MatrixDefaultWidgetOptions = Pick< | ||
PerseusMatrixWidgetOptions, | ||
"matrixBoardSize" | "answers" | "prefix" | "suffix" | "cursorPosition" | ||
>; | ||
|
||
const defaultWidgetOptions: MatrixDefaultWidgetOptions = { | ||
matrixBoardSize: [3, 3], | ||
answers: [[]], | ||
prefix: "", | ||
suffix: "", | ||
cursorPosition: [0, 0], | ||
}; | ||
|
||
const matrixWidgetLogic: WidgetLogic = { | ||
name: "matrix", | ||
defaultWidgetOptions, | ||
}; | ||
|
||
export default matrixWidgetLogic; |
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,32 @@ | ||
import type {PerseusNumericInputWidgetOptions} from "../../data-schema"; | ||
import type {WidgetLogic} from "../logic-export.types"; | ||
|
||
export type NumericInputDefaultWidgetOptions = Pick< | ||
PerseusNumericInputWidgetOptions, | ||
"answers" | "size" | "coefficient" | "labelText" | "rightAlign" | ||
>; | ||
|
||
const defaultWidgetOptions: NumericInputDefaultWidgetOptions = { | ||
answers: [ | ||
{ | ||
value: null, | ||
status: "correct", | ||
message: "", | ||
simplify: "required", | ||
answerForms: [], | ||
strict: false, | ||
maxError: null, | ||
}, | ||
], | ||
size: "normal", | ||
coefficient: false, | ||
labelText: "", | ||
rightAlign: false, | ||
}; | ||
|
||
const numericInputWidgetLogic: WidgetLogic = { | ||
name: "numeric-input", | ||
defaultWidgetOptions, | ||
}; | ||
|
||
export default numericInputWidgetLogic; |
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,21 @@ | ||
import type {PerseusOrdererWidgetOptions} from "../../data-schema"; | ||
import type {WidgetLogic} from "../logic-export.types"; | ||
|
||
export type OrdererDefaultWidgetOptions = Pick< | ||
PerseusOrdererWidgetOptions, | ||
"correctOptions" | "otherOptions" | "height" | "layout" | ||
>; | ||
|
||
const defaultWidgetOptions: OrdererDefaultWidgetOptions = { | ||
correctOptions: [{content: "$x$"}] as any, | ||
otherOptions: [{content: "$y$"}] as any, | ||
height: "normal", | ||
layout: "horizontal", | ||
}; | ||
|
||
const ordererWidgetLogic: WidgetLogic = { | ||
name: "orderer", | ||
defaultWidgetOptions, | ||
}; | ||
|
||
export default ordererWidgetLogic; |
19 changes: 19 additions & 0 deletions
19
packages/perseus-core/src/widgets/phet-simulation/index.ts
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,19 @@ | ||
import type {PerseusPhetSimulationWidgetOptions} from "../../data-schema"; | ||
import type {WidgetLogic} from "../logic-export.types"; | ||
|
||
export type PhetSimulationDefaultWidgetOptions = Pick< | ||
PerseusPhetSimulationWidgetOptions, | ||
"url" | "description" | ||
>; | ||
|
||
const defaultWidgetOptions: PhetSimulationDefaultWidgetOptions = { | ||
url: "", | ||
description: "", | ||
}; | ||
|
||
const PhetSimulationWidgetLogic: WidgetLogic = { | ||
name: "phet-simulation", | ||
defaultWidgetOptions, | ||
}; | ||
|
||
export default PhetSimulationWidgetLogic; |
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,19 @@ | ||
import type {PerseusPythonProgramWidgetOptions} from "../../data-schema"; | ||
import type {WidgetLogic} from "../logic-export.types"; | ||
|
||
export type PythonProgramDefaultWidgetOptions = Pick< | ||
PerseusPythonProgramWidgetOptions, | ||
"programID" | "height" | ||
>; | ||
|
||
const defaultWidgetOptions: PythonProgramDefaultWidgetOptions = { | ||
programID: "", | ||
height: 400, | ||
}; | ||
|
||
const pythonProgramWidgetLogic: WidgetLogic = { | ||
name: "python-program", | ||
defaultWidgetOptions, | ||
}; | ||
|
||
export default pythonProgramWidgetLogic; |
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,20 @@ | ||
import type {PerseusSorterWidgetOptions} from "../../data-schema"; | ||
import type {WidgetLogic} from "../logic-export.types"; | ||
|
||
export type SorterDefaultWidgetOptions = Pick< | ||
PerseusSorterWidgetOptions, | ||
"correct" | "layout" | "padding" | ||
>; | ||
|
||
const defaultWidgetOptions: SorterDefaultWidgetOptions = { | ||
correct: ["$x$", "$y$", "$z$"], | ||
layout: "horizontal", | ||
padding: true, | ||
}; | ||
|
||
const sorterWidgetLogic: WidgetLogic = { | ||
name: "sorter", | ||
defaultWidgetOptions, | ||
}; | ||
|
||
export default sorterWidgetLogic; |
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,18 @@ | ||
import type {PerseusVideoWidgetOptions} from "../../data-schema"; | ||
import type {WidgetLogic} from "../logic-export.types"; | ||
|
||
export type VideoDefaultWidgetOptions = Pick< | ||
PerseusVideoWidgetOptions, | ||
"location" | ||
>; | ||
|
||
const defaultWidgetOptions: VideoDefaultWidgetOptions = { | ||
location: "", | ||
}; | ||
|
||
const videoWidgetLogic: WidgetLogic = { | ||
name: "video", | ||
defaultWidgetOptions, | ||
}; | ||
|
||
export default videoWidgetLogic; |
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
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
20 changes: 8 additions & 12 deletions
20
packages/perseus-editor/src/widgets/phet-simulation-editor.tsx
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
Oops, something went wrong.