Skip to content

Commit

Permalink
a/b/c options for costumes button
Browse files Browse the repository at this point in the history
  • Loading branch information
ajpal committed Oct 27, 2021
1 parent 2f0029a commit f9230da
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
29 changes: 25 additions & 4 deletions apps/src/p5lab/spritelab/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import {APP_HEIGHT, P5LabInterfaceMode} from '../constants';
import {TOOLBOX_EDIT_MODE} from '../../constants';
import {animationSourceUrl} from '../redux/animationList';
import {changeInterfaceMode} from '../actions';
import {Goal, showBackground} from '../redux/animationPicker';
import {Goal, show, showBackground} from '../redux/animationPicker';
import i18n from '@cdo/locale';
import experiments from '@cdo/apps/util/experiments';
import spritelabMsg from '@cdo/spritelab/locale';
function animations(areBackgrounds) {
const animationList = getStore().getState().animationList;
Expand Down Expand Up @@ -177,6 +178,17 @@ const customInputTypes = {
costumePicker: {
addInput(blockly, block, inputConfig, currentInputRow) {
let buttons;
/*
* A/B/C experiment for costume tab:
* Treatment A: Clicking button opens the animation picker modal over the codespace
* Treatment B: Clicking button switches to the Costume Tab and opens the animation picker modal
* Original (No treatment): Clicking button switches to the Costume Tab (and does not open the modal)
*
* This user experiment will be conducted in November 2021. This code should be removed
* and the behavior should revert to the original behavior by November 11, 2021.
*/
const isAEnabled = experiments.isEnabled(experiments.COSTUME_TAB_A);
const isBEnabled = experiments.isEnabled(experiments.COSTUME_TAB_B);
if (
getStore().getState().pageConstants &&
getStore().getState().pageConstants.showAnimationMode
Expand All @@ -185,9 +197,18 @@ const customInputTypes = {
{
text: i18n.costumeMode(),
action: () => {
getStore().dispatch(
changeInterfaceMode(P5LabInterfaceMode.ANIMATION)
);
if (isAEnabled) {
getStore().dispatch(show(Goal.NEW_ANIMATION, true));
} else if (isBEnabled) {
getStore().dispatch(
changeInterfaceMode(P5LabInterfaceMode.ANIMATION)
);
getStore().dispatch(show(Goal.NEW_ANIMATION, true));
} else {
getStore().dispatch(
changeInterfaceMode(P5LabInterfaceMode.ANIMATION)
);
}
}
}
];
Expand Down
3 changes: 2 additions & 1 deletion apps/src/util/experiments.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ experiments.I18N_TRACKING = 'i18n-tracking';
experiments.TIME_SPENT = 'time-spent';
experiments.BYPASS_DIALOG_POPUP = 'bypass-dialog-popup';
experiments.SPECIAL_TOPIC = 'special-topic';
experiments.POEM_BOT = 'poemBot';
experiments.CLEARER_SIGN_UP_USER_TYPE = 'clearerSignUpUserType';
experiments.OPT_IN_EMAIL_REG_PARTNER = 'optInEmailRegPartner';
experiments.MULTISELECT = 'multiselect';
experiments.JAVALAB_UNIT_TESTS = 'javalabUnitTests';
experiments.COSTUME_TAB_A = 'costumeTabA';
experiments.COSTUME_TAB_B = 'costumeTabB';

/**
* This was a gamified version of the finish dialog, built in 2018,
Expand Down

0 comments on commit f9230da

Please sign in to comment.