Skip to content

Commit

Permalink
[Interactive Graph Locked Figures] Remove m2 flag from the code (#1470)
Browse files Browse the repository at this point in the history
## Summary:
Now that locked figures m2 has been released for a while with no issues coming up,
we can remove the flag conditionals from the code.

After this, I'll remove the flag from webapp and growthbook as well.

Issue: https://khanacademy.atlassian.net/browse/LEMS-2016

## Test plan:
`yarn jest`
`yarn typecheck`

Scour the Perseus repo for instances of `m2Features`, `features-m2`, and other
variations. Confirm they no longer exist.

Look for m2b and make sure m2 is no longer next to it in each location.

Author: nishasy

Reviewers: mark-fitzgerald, jeremywiebe

Required Reviewers:

Approved By: mark-fitzgerald

Checks: ✅ codecov/project, ✅ codecov/patch, ✅ Upload Coverage (ubuntu-latest, 20.x), ✅ gerald, ⏭️  Publish npm snapshot, ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Jest Coverage (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x), ✅ gerald

Pull Request URL: #1470
  • Loading branch information
nishasy authored Aug 1, 2024
1 parent 6e1ec85 commit 942b0a9
Show file tree
Hide file tree
Showing 16 changed files with 44 additions and 116 deletions.
6 changes: 6 additions & 0 deletions .changeset/gentle-melons-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@khanacademy/perseus": patch
"@khanacademy/perseus-editor": patch
---

[Interactive Graph Locked Figures] Remove m2 flag from the code
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export const flags = {
ray: true,

// Locked figures flags
"interactive-graph-locked-features-m2": true,
"interactive-graph-locked-features-m2b": true,

// Start coords UI flags
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ export const MafsWithLockedFiguresCurrent = (): React.ReactElement => {
flags: {
mafs: {
...flags.mafs,
"interactive-graph-locked-features-m2": false,
"interactive-graph-locked-features-m2b": false,
},
},
Expand All @@ -140,32 +139,6 @@ MafsWithLockedFiguresCurrent.parameters = {
},
};

export const MafsWithLockedFiguresM2Flag = (): React.ReactElement => {
return (
<EditorPageWithStorybookPreview
apiOptions={{
isMobile: false,
flags: {
mafs: {
...flags.mafs,
"interactive-graph-locked-features-m2": true,
"interactive-graph-locked-features-m2b": false,
},
},
}}
question={segmentWithLockedFigures}
/>
);
};

MafsWithLockedFiguresM2Flag.parameters = {
chromatic: {
// Disabling because this isn't visually testing anything on the
// initial load of the editor page.
disable: true,
},
};

export const MafsWithLockedFiguresM2bFlag = (): React.ReactElement => {
return (
<EditorPageWithStorybookPreview question={segmentWithLockedFigures} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export const Controlled: StoryComponentType = {

return (
<LockedFiguresSection
showM2Features={true}
showM2bFeatures={true}
figures={figures}
onChange={handlePropsUpdate}
Expand All @@ -55,7 +54,6 @@ export const WithProdWidth: StoryComponentType = {
return (
<View style={styles.prodSizeContainer}>
<LockedFiguresSection
showM2Features={true}
showM2bFeatures={true}
figures={figures}
onChange={handlePropsUpdate}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ describe("LockedFiguresSection", () => {
// Arrange, Act
render(
<LockedFiguresSection
showM2Features={true}
showM2bFeatures={true}
onChange={jest.fn()}
/>,
Expand All @@ -59,7 +58,6 @@ describe("LockedFiguresSection", () => {
// Arrange, Act
render(
<LockedFiguresSection
showM2Features={true}
showM2bFeatures={true}
onChange={jest.fn()}
/>,
Expand All @@ -78,7 +76,6 @@ describe("LockedFiguresSection", () => {
render(
<LockedFiguresSection
figures={defaultFigures}
showM2Features={true}
showM2bFeatures={true}
onChange={jest.fn()}
/>,
Expand All @@ -101,7 +98,6 @@ describe("LockedFiguresSection", () => {
render(
<LockedFiguresSection
figures={defaultFigures}
showM2Features={true}
showM2bFeatures={true}
onChange={jest.fn()}
/>,
Expand All @@ -126,7 +122,6 @@ describe("LockedFiguresSection", () => {
render(
<LockedFiguresSection
figures={defaultFigures}
showM2Features={true}
showM2bFeatures={true}
onChange={jest.fn()}
/>,
Expand Down Expand Up @@ -157,7 +152,6 @@ describe("LockedFiguresSection", () => {
render(
<LockedFiguresSection
figures={defaultFigures}
showM2Features={true}
showM2bFeatures={true}
onChange={jest.fn()}
/>,
Expand Down Expand Up @@ -192,7 +186,6 @@ describe("LockedFiguresSection", () => {
// Arrange
render(
<LockedFiguresSection
showM2Features={true}
showM2bFeatures={true}
figures={defaultFigures}
onChange={jest.fn()}
Expand All @@ -219,7 +212,6 @@ describe("LockedFiguresSection", () => {
// Arrange
render(
<LockedFiguresSection
showM2Features={true}
showM2bFeatures={true}
figures={[
getDefaultFigureForType("point"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ const LockedEllipseSettings = (props: Props) => {

{/* Actions */}
<LockedFigureSettingsActions
showM2Features={props.showM2Features}
figureType={props.type}
onMove={onMove}
onRemove={onRemove}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import {StyleSheet} from "aphrodite";
import * as React from "react";

type Props = {
// TODO(LEMS-2016): Remove this prop once the M2 flag is fully rolled out.
showM2Features: boolean;
// TODO(LEMS-2107): Remove this prop once the M2b flag is fully rolled out.
showM2bFeatures: boolean;
id: string;
Expand All @@ -23,17 +21,18 @@ type Props = {
const LockedFigureSelect = (props: Props) => {
const {id, onChange} = props;

const figureTypes = props.showM2Features
? ["point", "line", "vector", "ellipse", "polygon"]
: ["point", "line"];
const figureTypes = ["point", "line", "vector", "ellipse", "polygon"];
const figureTypesCurrent = props.showM2bFeatures
? [...figureTypes, "function"]
: figureTypes;

return (
<View style={styles.container}>
<ActionMenu
menuText="Add locked figure"
style={styles.addElementSelect}
>
{figureTypes.map((figureType) => (
{figureTypesCurrent.map((figureType) => (
<ActionItem
key={`${id}-${figureType}`}
label={figureType}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ export type LockedFigureSettingsMovementType =
| "front";

type Props = {
// Whether to show the M2 features in the locked figure settings.
// TODO(LEMS-2016): Remove this prop once the M2 flag is fully rolled out.
showM2Features?: boolean;
figureType: LockedFigureType;
onMove: (movement: LockedFigureSettingsMovementType) => void;
onRemove: () => void;
Expand All @@ -50,38 +47,34 @@ const LockedFigureSettingsActions = (props: Props) => {

<Spring />

{props.showM2Features && (
<>
<IconButton
icon={caretDoubleUpIcon}
size="small"
aria-label={`Move locked ${figureType} to the back`}
onClick={() => onMove("back")}
style={styles.iconButton}
/>
<IconButton
icon={caretUpIcon}
size="small"
aria-label={`Move locked ${figureType} backward`}
onClick={() => onMove("backward")}
style={styles.iconButton}
/>
<IconButton
icon={caretDownIcon}
size="small"
aria-label={`Move locked ${figureType} forward`}
onClick={() => onMove("forward")}
style={styles.iconButton}
/>
<IconButton
icon={caretDoubleDownIcon}
size="small"
aria-label={`Move locked ${figureType} to the front`}
onClick={() => onMove("front")}
style={styles.iconButton}
/>
</>
)}
<IconButton
icon={caretDoubleUpIcon}
size="small"
aria-label={`Move locked ${figureType} to the back`}
onClick={() => onMove("back")}
style={styles.iconButton}
/>
<IconButton
icon={caretUpIcon}
size="small"
aria-label={`Move locked ${figureType} backward`}
onClick={() => onMove("backward")}
style={styles.iconButton}
/>
<IconButton
icon={caretDownIcon}
size="small"
aria-label={`Move locked ${figureType} forward`}
onClick={() => onMove("forward")}
style={styles.iconButton}
/>
<IconButton
icon={caretDoubleDownIcon}
size="small"
aria-label={`Move locked ${figureType} to the front`}
onClick={() => onMove("front")}
style={styles.iconButton}
/>
</View>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ import type {Props as LockedPolygonProps} from "./locked-polygon-settings";
import type {Props as LockedVectorProps} from "./locked-vector-settings";

export type LockedFigureSettingsCommonProps = {
// Whether to show the M2 features in the locked figure settings.
// TODO(LEMS-2016): Remove this prop once the M2 flag is fully rolled out.
showM2Features?: boolean;
// Whether to show the M2b features in the locked figure settings.
// TODO(LEMS-2107): Remove this prop once the M2b flag is fully rolled out.
showM2bFeatures?: boolean;
Expand Down Expand Up @@ -66,19 +63,11 @@ const LockedFigureSettings = (props: Props) => {
case "line":
return <LockedLineSettings {...props} />;
case "vector":
if (props.showM2Features) {
return <LockedVectorSettings {...props} />;
}
break;
return <LockedVectorSettings {...props} />;
case "ellipse":
if (props.showM2Features) {
return <LockedEllipseSettings {...props} />;
}
break;
return <LockedEllipseSettings {...props} />;
case "polygon":
if (props.showM2Features) {
return <LockedPolygonSettings {...props} />;
}
return <LockedPolygonSettings {...props} />;
}

return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ import type {Props as InteractiveGraphEditorProps} from "../../widgets/interacti
import type {LockedFigure, LockedFigureType} from "@khanacademy/perseus";

type Props = {
// Whether to show the M2 features in the locked figure settings.
// TODO(LEMS-2016): Remove this prop once the M2 flag is fully rolled out.
showM2Features: boolean;
// Whether to show the M2b features in the locked figure settings.
// TODO(LEMS-2107): Remove this prop once the M2b flag is fully rolled out.
showM2bFeatures: boolean;
Expand Down Expand Up @@ -171,7 +168,6 @@ const LockedFiguresSection = (props: Props) => {
return (
<LockedFigureSettings
key={`${uniqueId}-locked-${figure}-${index}`}
showM2Features={props.showM2Features}
showM2bFeatures={props.showM2bFeatures}
expanded={expandedStates[index]}
onToggle={(newValue) => {
Expand All @@ -192,7 +188,6 @@ const LockedFiguresSection = (props: Props) => {
})}
<View style={styles.buttonContainer}>
<LockedFigureSelect
showM2Features={props.showM2Features}
showM2bFeatures={props.showM2bFeatures}
id={`${uniqueId}-select`}
onChange={addLockedFigure}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ const LockedLineSettings = (props: Props) => {

{/* Actions */}
<LockedFigureSettingsActions
showM2Features={props.showM2Features}
figureType={props.type}
onMove={onMove}
onRemove={onRemove}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ const LockedPointSettings = (props: Props) => {
/>

<LockedFigureSettingsActions
showM2Features={props.showM2Features}
figureType={props.type}
onMove={onMove}
onRemove={onRemove}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ const LockedPolygonSettings = (props: Props) => {

{/* Actions */}
<LockedFigureSettingsActions
showM2Features={props.showM2Features}
figureType={props.type}
onMove={onMove}
onRemove={onRemove}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ const LockedVectorSettings = (props: Props) => {

{/* Actions */}
<LockedFigureSettingsActions
showM2Features={props.showM2Features}
figureType={props.type}
onMove={onMove}
onRemove={onRemove}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -615,11 +615,6 @@ class InteractiveGraphEditor extends React.Component<Props> {
this.props.graph.type
] && (
<LockedFiguresSection
showM2Features={
this.props.apiOptions?.flags?.mafs?.[
"interactive-graph-locked-features-m2"
]
}
showM2bFeatures={
this.props.apiOptions?.flags?.mafs?.[
"interactive-graph-locked-features-m2b"
Expand Down
10 changes: 2 additions & 8 deletions packages/perseus/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,8 @@ export const MafsGraphTypeFlags = [

export const InteractiveGraphLockedFeaturesFlags = [
/**
* Enables/Disables inital Milestone 2 locked features in the new Mafs
* interactive-graph widget (ellipses, vectors, polygons).
*/
"interactive-graph-locked-features-m2",
/**
* Enables/Disables remaining Milestone 2 locked features in the new Mafs
* interactive-graph widget (the rest of the figure types:
* function plots, labels).
* Enables/Disables Milestone 2 phase b locked features in the
* new Mafs interactive-graph widget (locked functions).
*/
"interactive-graph-locked-features-m2b",
] as const;
Expand Down

0 comments on commit 942b0a9

Please sign in to comment.