@magmamath/students-features 1.8.0-rc.0-fluency-visuals → 1.8.1-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/features/fluency/index.js +0 -8
- package/dist/commonjs/features/fluency/index.js.map +1 -1
- package/dist/module/features/fluency/index.js +0 -1
- package/dist/module/features/fluency/index.js.map +1 -1
- package/dist/typescript/commonjs/features/fluency/index.d.ts +0 -1
- package/dist/typescript/commonjs/features/fluency/index.d.ts.map +1 -1
- package/dist/typescript/module/features/fluency/index.d.ts +0 -1
- package/dist/typescript/module/features/fluency/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/features/fluency/index.ts +0 -1
- package/dist/commonjs/features/fluency/components/FluencyVisualPlayground.js +0 -386
- package/dist/commonjs/features/fluency/components/FluencyVisualPlayground.js.map +0 -1
- package/dist/module/features/fluency/components/FluencyVisualPlayground.js +0 -379
- package/dist/module/features/fluency/components/FluencyVisualPlayground.js.map +0 -1
- package/dist/typescript/commonjs/features/fluency/components/FluencyVisualPlayground.d.ts +0 -8
- package/dist/typescript/commonjs/features/fluency/components/FluencyVisualPlayground.d.ts.map +0 -1
- package/dist/typescript/module/features/fluency/components/FluencyVisualPlayground.d.ts +0 -8
- package/dist/typescript/module/features/fluency/components/FluencyVisualPlayground.d.ts.map +0 -1
- package/src/features/fluency/components/FluencyVisualPlayground.tsx +0 -272
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
var _exportNames = {
|
|
7
7
|
Fluency: true,
|
|
8
8
|
FluencySolving: true,
|
|
9
|
-
FluencyVisualPlayground: true,
|
|
10
9
|
FluencyModel: true
|
|
11
10
|
};
|
|
12
11
|
Object.defineProperty(exports, "Fluency", {
|
|
@@ -27,12 +26,6 @@ Object.defineProperty(exports, "FluencySolving", {
|
|
|
27
26
|
return _FluencySolving.FluencySolving;
|
|
28
27
|
}
|
|
29
28
|
});
|
|
30
|
-
Object.defineProperty(exports, "FluencyVisualPlayground", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return _FluencyVisualPlayground.FluencyVisualPlayground;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
29
|
var _fluencyConstants = require("./shared/fluency.constants.js");
|
|
37
30
|
Object.keys(_fluencyConstants).forEach(function (key) {
|
|
38
31
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -83,6 +76,5 @@ Object.keys(_index).forEach(function (key) {
|
|
|
83
76
|
});
|
|
84
77
|
var _Fluency = require("./components/Fluency.js");
|
|
85
78
|
var _FluencySolving = require("./components/FluencySolving.js");
|
|
86
|
-
var _FluencyVisualPlayground = require("./components/FluencyVisualPlayground.js");
|
|
87
79
|
var _FluencyModel = require("./model/FluencyModel.js");
|
|
88
80
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_fluencyConstants","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_fluencyTypes","_fluencyHelpers","_index","_Fluency","_FluencySolving","
|
|
1
|
+
{"version":3,"names":["_fluencyConstants","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_fluencyTypes","_fluencyHelpers","_index","_Fluency","_FluencySolving","_FluencyModel"],"sourceRoot":"../../../../src","sources":["features/fluency/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,iBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,iBAAA,CAAAK,GAAA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AAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAW,MAAA,CAAAX,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,MAAA,CAAAX,GAAA;IAAA;EAAA;AAAA;AACA,IAAAY,QAAA,GAAAhB,OAAA;AACA,IAAAiB,eAAA,GAAAjB,OAAA;AACA,IAAAkB,aAAA,GAAAlB,OAAA","ignoreList":[]}
|
|
@@ -6,6 +6,5 @@ export * from "./shared/fluency.helpers.js";
|
|
|
6
6
|
export * from "./visual-scaffolding/index.js";
|
|
7
7
|
export { Fluency } from "./components/Fluency.js";
|
|
8
8
|
export { FluencySolving } from "./components/FluencySolving.js";
|
|
9
|
-
export { FluencyVisualPlayground } from "./components/FluencyVisualPlayground.js";
|
|
10
9
|
export { FluencyModel } from "./model/FluencyModel.js";
|
|
11
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Fluency","FluencySolving","
|
|
1
|
+
{"version":3,"names":["Fluency","FluencySolving","FluencyModel"],"sourceRoot":"../../../../src","sources":["features/fluency/index.ts"],"mappings":";;AAAA,cAAc,+BAA4B;AAC1C,cAAc,2BAAwB;AACtC,cAAc,6BAA0B;AACxC,cAAc,+BAAsB;AACpC,SAASA,OAAO,QAAQ,yBAAsB;AAC9C,SAASC,cAAc,QAAQ,gCAA6B;AAC5D,SAASC,YAAY,QAAQ,yBAAsB","ignoreList":[]}
|
|
@@ -4,6 +4,5 @@ export * from './shared/fluency.helpers';
|
|
|
4
4
|
export * from './visual-scaffolding';
|
|
5
5
|
export { Fluency } from './components/Fluency';
|
|
6
6
|
export { FluencySolving } from './components/FluencySolving';
|
|
7
|
-
export { FluencyVisualPlayground } from './components/FluencyVisualPlayground';
|
|
8
7
|
export { FluencyModel } from './model/FluencyModel';
|
|
9
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/fluency/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/fluency/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA"}
|
|
@@ -4,6 +4,5 @@ export * from './shared/fluency.helpers';
|
|
|
4
4
|
export * from './visual-scaffolding';
|
|
5
5
|
export { Fluency } from './components/Fluency';
|
|
6
6
|
export { FluencySolving } from './components/FluencySolving';
|
|
7
|
-
export { FluencyVisualPlayground } from './components/FluencyVisualPlayground';
|
|
8
7
|
export { FluencyModel } from './model/FluencyModel';
|
|
9
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/fluency/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/fluency/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA"}
|
package/package.json
CHANGED
|
@@ -4,5 +4,4 @@ export * from './shared/fluency.helpers'
|
|
|
4
4
|
export * from './visual-scaffolding'
|
|
5
5
|
export { Fluency } from './components/Fluency'
|
|
6
6
|
export { FluencySolving } from './components/FluencySolving'
|
|
7
|
-
export { FluencyVisualPlayground } from './components/FluencyVisualPlayground'
|
|
8
7
|
export { FluencyModel } from './model/FluencyModel'
|
|
@@ -1,386 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.FluencyVisualPlayground = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _reactNativeUi = require("@magmamath/react-native-ui");
|
|
10
|
-
var _FluencyContext = require("../context/FluencyContext.js");
|
|
11
|
-
var _FluencyCardDeck = require("./fluency-solving/components/FluencyCardDeck.js");
|
|
12
|
-
var _useFluencyCardDeckAnimation = require("../hooks/useFluencyCardDeckAnimation.js");
|
|
13
|
-
var _useSuccessSound = require("../hooks/useSuccessSound.js");
|
|
14
|
-
var _fluencyConstants = require("../shared/fluency.constants.js");
|
|
15
|
-
var _index = require("../visual-scaffolding/index.js");
|
|
16
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
18
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
|
-
const OPERATIONS = [{
|
|
20
|
-
value: 'addition',
|
|
21
|
-
mode: _fluencyConstants.FluencyMode.ADDITION,
|
|
22
|
-
symbol: '+',
|
|
23
|
-
label: 'Addition'
|
|
24
|
-
}, {
|
|
25
|
-
value: 'subtraction',
|
|
26
|
-
mode: _fluencyConstants.FluencyMode.SUBTRACTION,
|
|
27
|
-
symbol: '−',
|
|
28
|
-
label: 'Subtraction'
|
|
29
|
-
}, {
|
|
30
|
-
value: 'multiplication',
|
|
31
|
-
mode: _fluencyConstants.FluencyMode.MULTIPLICATION,
|
|
32
|
-
symbol: '×',
|
|
33
|
-
label: 'Multiplication'
|
|
34
|
-
}, {
|
|
35
|
-
value: 'division',
|
|
36
|
-
mode: _fluencyConstants.FluencyMode.DIVISION,
|
|
37
|
-
symbol: '÷',
|
|
38
|
-
label: 'Division'
|
|
39
|
-
}];
|
|
40
|
-
const BOXES = [0, 1, 2, 3, 4];
|
|
41
|
-
|
|
42
|
-
// Defaults per operation that exercise the more interesting layouts (ten-bridging
|
|
43
|
-
// addition, regrouping subtraction, a clean array / grouping).
|
|
44
|
-
const DEFAULT_OPERANDS = {
|
|
45
|
-
addition: [7, 8],
|
|
46
|
-
subtraction: [13, 5],
|
|
47
|
-
multiplication: [3, 4],
|
|
48
|
-
division: [12, 4]
|
|
49
|
-
};
|
|
50
|
-
const OPERAND_MIN = 0;
|
|
51
|
-
const OPERAND_MAX = 20;
|
|
52
|
-
const answerFor = (operation, left, right) => {
|
|
53
|
-
switch (operation) {
|
|
54
|
-
case 'addition':
|
|
55
|
-
return left + right;
|
|
56
|
-
case 'subtraction':
|
|
57
|
-
return left - right;
|
|
58
|
-
case 'multiplication':
|
|
59
|
-
return left * right;
|
|
60
|
-
case 'division':
|
|
61
|
-
return right > 0 ? Math.floor(left / right) : 0;
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
const Chip = ({
|
|
65
|
-
label,
|
|
66
|
-
sublabel,
|
|
67
|
-
isActive,
|
|
68
|
-
activeColor,
|
|
69
|
-
onPress
|
|
70
|
-
}) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
|
|
71
|
-
onPress: onPress,
|
|
72
|
-
style: [styles.chip, isActive && {
|
|
73
|
-
backgroundColor: activeColor,
|
|
74
|
-
borderColor: activeColor
|
|
75
|
-
}],
|
|
76
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
77
|
-
style: [styles.chipLabel, isActive && styles.chipLabelActive],
|
|
78
|
-
children: label
|
|
79
|
-
}), sublabel && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
80
|
-
style: [styles.chipSub, isActive && styles.chipLabelActive],
|
|
81
|
-
children: sublabel
|
|
82
|
-
})]
|
|
83
|
-
});
|
|
84
|
-
const Stepper = ({
|
|
85
|
-
label,
|
|
86
|
-
value,
|
|
87
|
-
onChange
|
|
88
|
-
}) => {
|
|
89
|
-
const clamp = n => Math.max(OPERAND_MIN, Math.min(OPERAND_MAX, n));
|
|
90
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
91
|
-
style: styles.stepper,
|
|
92
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
93
|
-
style: styles.stepperLabel,
|
|
94
|
-
children: label
|
|
95
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
96
|
-
style: styles.stepperRow,
|
|
97
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
98
|
-
style: styles.stepperBtn,
|
|
99
|
-
onPress: () => onChange(clamp(value - 1)),
|
|
100
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
101
|
-
style: styles.stepperBtnText,
|
|
102
|
-
children: "\u2212"
|
|
103
|
-
})
|
|
104
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
105
|
-
style: styles.stepperValue,
|
|
106
|
-
children: value
|
|
107
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
108
|
-
style: styles.stepperBtn,
|
|
109
|
-
onPress: () => onChange(clamp(value + 1)),
|
|
110
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
111
|
-
style: styles.stepperBtnText,
|
|
112
|
-
children: "+"
|
|
113
|
-
})
|
|
114
|
-
})]
|
|
115
|
-
})]
|
|
116
|
-
});
|
|
117
|
-
};
|
|
118
|
-
const FluencyVisualPlayground = ({
|
|
119
|
-
model
|
|
120
|
-
}) => {
|
|
121
|
-
const [operation, setOperation] = (0, _react.useState)('addition');
|
|
122
|
-
const [box, setBox] = (0, _react.useState)(0);
|
|
123
|
-
const [left, setLeft] = (0, _react.useState)(DEFAULT_OPERANDS.addition[0]);
|
|
124
|
-
const [right, setRight] = (0, _react.useState)(DEFAULT_OPERANDS.addition[1]);
|
|
125
|
-
const deck = (0, _useFluencyCardDeckAnimation.useFluencyCardDeckAnimation)();
|
|
126
|
-
const successSound = (0, _useSuccessSound.useSuccessSound)();
|
|
127
|
-
const selectOperation = next => {
|
|
128
|
-
setOperation(next.value);
|
|
129
|
-
const [l, r] = DEFAULT_OPERANDS[next.value];
|
|
130
|
-
setLeft(l);
|
|
131
|
-
setRight(r);
|
|
132
|
-
};
|
|
133
|
-
const mode = OPERATIONS.find(o => o.value === operation)?.mode ?? _fluencyConstants.FluencyMode.ADDITION;
|
|
134
|
-
const fact = {
|
|
135
|
-
id: 'playground',
|
|
136
|
-
mode,
|
|
137
|
-
numbers: [left, right],
|
|
138
|
-
answer: answerFor(operation, left, right),
|
|
139
|
-
difficulty: 0,
|
|
140
|
-
box,
|
|
141
|
-
lastSeenMs: null,
|
|
142
|
-
sessionStartBox: box,
|
|
143
|
-
hasFailedThisSession: false,
|
|
144
|
-
attemptsCount: 0,
|
|
145
|
-
correctCount: 0
|
|
146
|
-
};
|
|
147
|
-
const spec = (0, _index.renderFact)({
|
|
148
|
-
operation,
|
|
149
|
-
left,
|
|
150
|
-
right,
|
|
151
|
-
box
|
|
152
|
-
});
|
|
153
|
-
const accent = _index.VISUAL_COLORS[operation].accent;
|
|
154
|
-
const playOutcome = isCorrect => {
|
|
155
|
-
const started = deck.startCardExit({
|
|
156
|
-
// The exiting card shows the filled-in answer + the correct/incorrect label.
|
|
157
|
-
cardContent: {
|
|
158
|
-
fact,
|
|
159
|
-
answer: String(fact.answer)
|
|
160
|
-
},
|
|
161
|
-
direction: isCorrect ? 'right' : 'left',
|
|
162
|
-
status: isCorrect ? _fluencyConstants.AttemptStatus.CORRECT : _fluencyConstants.AttemptStatus.INCORRECT
|
|
163
|
-
});
|
|
164
|
-
if (started && isCorrect) successSound.play();
|
|
165
|
-
};
|
|
166
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_FluencyContext.FluencyProvider, {
|
|
167
|
-
value: {
|
|
168
|
-
model
|
|
169
|
-
},
|
|
170
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.ScrollView, {
|
|
171
|
-
style: styles.screen,
|
|
172
|
-
contentContainerStyle: styles.content,
|
|
173
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
174
|
-
style: styles.title,
|
|
175
|
-
children: "Fluency Visual Playground"
|
|
176
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
177
|
-
style: styles.caption,
|
|
178
|
-
children: "Real solving deck across operations and boxes 0\u20134 (L1\u2013L5). Dev only."
|
|
179
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
180
|
-
style: styles.sectionLabel,
|
|
181
|
-
children: "Operation"
|
|
182
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
183
|
-
style: styles.row,
|
|
184
|
-
children: OPERATIONS.map(op => /*#__PURE__*/(0, _jsxRuntime.jsx)(Chip, {
|
|
185
|
-
label: `${op.symbol} ${op.label}`,
|
|
186
|
-
isActive: op.value === operation,
|
|
187
|
-
activeColor: _index.VISUAL_COLORS[op.value].accent,
|
|
188
|
-
onPress: () => selectOperation(op)
|
|
189
|
-
}, op.value))
|
|
190
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
191
|
-
style: styles.sectionLabel,
|
|
192
|
-
children: "Box \u2192 Level"
|
|
193
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
194
|
-
style: styles.row,
|
|
195
|
-
children: BOXES.map(b => /*#__PURE__*/(0, _jsxRuntime.jsx)(Chip, {
|
|
196
|
-
label: `Box ${b}`,
|
|
197
|
-
sublabel: (0, _index.levelForBox)(b),
|
|
198
|
-
isActive: b === box,
|
|
199
|
-
activeColor: accent,
|
|
200
|
-
onPress: () => setBox(b)
|
|
201
|
-
}, b))
|
|
202
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
203
|
-
style: styles.row,
|
|
204
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Stepper, {
|
|
205
|
-
label: "Left",
|
|
206
|
-
value: left,
|
|
207
|
-
onChange: setLeft
|
|
208
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Stepper, {
|
|
209
|
-
label: "Right",
|
|
210
|
-
value: right,
|
|
211
|
-
onChange: setRight
|
|
212
|
-
})]
|
|
213
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
214
|
-
style: styles.deckWrapper,
|
|
215
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FluencyCardDeck.FluencyCardDeck, {
|
|
216
|
-
currentCardContent: {
|
|
217
|
-
fact,
|
|
218
|
-
answer: ''
|
|
219
|
-
},
|
|
220
|
-
exitingCardContent: deck.exitingCardContent,
|
|
221
|
-
exitingCardStatus: deck.exitingCardStatus,
|
|
222
|
-
snapStyles: deck.snapStyles,
|
|
223
|
-
onAnswerChange: () => undefined
|
|
224
|
-
})
|
|
225
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
226
|
-
style: styles.row,
|
|
227
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
228
|
-
style: [styles.outcomeBtn, {
|
|
229
|
-
backgroundColor: _reactNativeUi.COLORS.PRIMARY_RED
|
|
230
|
-
}],
|
|
231
|
-
onPress: () => playOutcome(false),
|
|
232
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
233
|
-
style: styles.outcomeText,
|
|
234
|
-
children: "\u25B6 Incorrect"
|
|
235
|
-
})
|
|
236
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
237
|
-
style: [styles.outcomeBtn, {
|
|
238
|
-
backgroundColor: _reactNativeUi.COLORS.PRIMARY_GREEN
|
|
239
|
-
}],
|
|
240
|
-
onPress: () => playOutcome(true),
|
|
241
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
242
|
-
style: styles.outcomeText,
|
|
243
|
-
children: "\u25B6 Correct"
|
|
244
|
-
})
|
|
245
|
-
})]
|
|
246
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
247
|
-
style: styles.sectionLabel,
|
|
248
|
-
children: ["Spec (", spec.kind, ")"]
|
|
249
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
250
|
-
style: styles.specBox,
|
|
251
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
252
|
-
style: styles.specText,
|
|
253
|
-
children: JSON.stringify(spec, null, 2)
|
|
254
|
-
})
|
|
255
|
-
})]
|
|
256
|
-
})
|
|
257
|
-
});
|
|
258
|
-
};
|
|
259
|
-
exports.FluencyVisualPlayground = FluencyVisualPlayground;
|
|
260
|
-
const styles = _reactNative.StyleSheet.create({
|
|
261
|
-
screen: {
|
|
262
|
-
flex: 1,
|
|
263
|
-
backgroundColor: _reactNativeUi.COLORS.NEUTRAL_3
|
|
264
|
-
},
|
|
265
|
-
content: {
|
|
266
|
-
padding: _reactNativeUi.SPACING[400],
|
|
267
|
-
gap: _reactNativeUi.SPACING[300],
|
|
268
|
-
maxWidth: 640,
|
|
269
|
-
alignSelf: 'center',
|
|
270
|
-
width: '100%'
|
|
271
|
-
},
|
|
272
|
-
title: {
|
|
273
|
-
fontSize: 22,
|
|
274
|
-
fontWeight: '700',
|
|
275
|
-
color: _reactNativeUi.COLORS.NEUTRAL_10,
|
|
276
|
-
fontFamily: _reactNativeUi.FONT_FAMILY.buenosAires
|
|
277
|
-
},
|
|
278
|
-
caption: {
|
|
279
|
-
fontSize: 13,
|
|
280
|
-
color: _reactNativeUi.COLORS.NEUTRAL_7,
|
|
281
|
-
fontFamily: _reactNativeUi.FONT_FAMILY.buenosAires
|
|
282
|
-
},
|
|
283
|
-
sectionLabel: {
|
|
284
|
-
fontSize: 12,
|
|
285
|
-
fontWeight: '700',
|
|
286
|
-
color: _reactNativeUi.COLORS.NEUTRAL_7,
|
|
287
|
-
textTransform: 'uppercase',
|
|
288
|
-
marginTop: _reactNativeUi.SPACING[200],
|
|
289
|
-
fontFamily: _reactNativeUi.FONT_FAMILY.buenosAires
|
|
290
|
-
},
|
|
291
|
-
row: {
|
|
292
|
-
flexDirection: 'row',
|
|
293
|
-
flexWrap: 'wrap',
|
|
294
|
-
gap: _reactNativeUi.SPACING[200]
|
|
295
|
-
},
|
|
296
|
-
chip: {
|
|
297
|
-
paddingVertical: _reactNativeUi.SPACING[150],
|
|
298
|
-
paddingHorizontal: _reactNativeUi.SPACING[300],
|
|
299
|
-
borderRadius: _reactNativeUi.BORDER_RADIUS[200],
|
|
300
|
-
borderWidth: 1,
|
|
301
|
-
borderColor: _reactNativeUi.COLORS.NEUTRAL_4,
|
|
302
|
-
backgroundColor: _reactNativeUi.COLORS.NEUTRAL_1,
|
|
303
|
-
alignItems: 'center'
|
|
304
|
-
},
|
|
305
|
-
chipLabel: {
|
|
306
|
-
fontSize: 14,
|
|
307
|
-
fontWeight: '600',
|
|
308
|
-
color: _reactNativeUi.COLORS.NEUTRAL_10,
|
|
309
|
-
fontFamily: _reactNativeUi.FONT_FAMILY.buenosAires
|
|
310
|
-
},
|
|
311
|
-
chipSub: {
|
|
312
|
-
fontSize: 11,
|
|
313
|
-
color: _reactNativeUi.COLORS.NEUTRAL_7,
|
|
314
|
-
fontFamily: _reactNativeUi.FONT_FAMILY.buenosAires
|
|
315
|
-
},
|
|
316
|
-
chipLabelActive: {
|
|
317
|
-
color: _reactNativeUi.COLORS.NEUTRAL_1
|
|
318
|
-
},
|
|
319
|
-
stepper: {
|
|
320
|
-
flex: 1,
|
|
321
|
-
gap: _reactNativeUi.SPACING[100]
|
|
322
|
-
},
|
|
323
|
-
stepperLabel: {
|
|
324
|
-
fontSize: 12,
|
|
325
|
-
fontWeight: '700',
|
|
326
|
-
color: _reactNativeUi.COLORS.NEUTRAL_7,
|
|
327
|
-
fontFamily: _reactNativeUi.FONT_FAMILY.buenosAires
|
|
328
|
-
},
|
|
329
|
-
stepperRow: {
|
|
330
|
-
flexDirection: 'row',
|
|
331
|
-
alignItems: 'center',
|
|
332
|
-
gap: _reactNativeUi.SPACING[200]
|
|
333
|
-
},
|
|
334
|
-
stepperBtn: {
|
|
335
|
-
width: 36,
|
|
336
|
-
height: 36,
|
|
337
|
-
borderRadius: _reactNativeUi.BORDER_RADIUS[200],
|
|
338
|
-
backgroundColor: _reactNativeUi.COLORS.NEUTRAL_1,
|
|
339
|
-
borderWidth: 1,
|
|
340
|
-
borderColor: _reactNativeUi.COLORS.NEUTRAL_4,
|
|
341
|
-
alignItems: 'center',
|
|
342
|
-
justifyContent: 'center'
|
|
343
|
-
},
|
|
344
|
-
stepperBtnText: {
|
|
345
|
-
fontSize: 20,
|
|
346
|
-
fontWeight: '700',
|
|
347
|
-
color: _reactNativeUi.COLORS.NEUTRAL_10
|
|
348
|
-
},
|
|
349
|
-
stepperValue: {
|
|
350
|
-
minWidth: 32,
|
|
351
|
-
textAlign: 'center',
|
|
352
|
-
fontSize: 18,
|
|
353
|
-
fontWeight: '700',
|
|
354
|
-
color: _reactNativeUi.COLORS.NEUTRAL_10,
|
|
355
|
-
fontFamily: _reactNativeUi.FONT_FAMILY.buenosAires
|
|
356
|
-
},
|
|
357
|
-
// FluencyCardDeck positions backing cards with absolute top offsets up to ~36px;
|
|
358
|
-
// the vertical padding gives them room and matches FluencySolvingCard's wrapper.
|
|
359
|
-
deckWrapper: {
|
|
360
|
-
alignItems: 'center',
|
|
361
|
-
paddingVertical: _reactNativeUi.SPACING[400]
|
|
362
|
-
},
|
|
363
|
-
outcomeBtn: {
|
|
364
|
-
flex: 1,
|
|
365
|
-
paddingVertical: _reactNativeUi.SPACING[300],
|
|
366
|
-
borderRadius: _reactNativeUi.BORDER_RADIUS[200],
|
|
367
|
-
alignItems: 'center'
|
|
368
|
-
},
|
|
369
|
-
outcomeText: {
|
|
370
|
-
fontSize: 15,
|
|
371
|
-
fontWeight: '700',
|
|
372
|
-
color: _reactNativeUi.COLORS.NEUTRAL_1,
|
|
373
|
-
fontFamily: _reactNativeUi.FONT_FAMILY.buenosAires
|
|
374
|
-
},
|
|
375
|
-
specBox: {
|
|
376
|
-
backgroundColor: _reactNativeUi.COLORS.NEUTRAL_10,
|
|
377
|
-
borderRadius: _reactNativeUi.BORDER_RADIUS[200],
|
|
378
|
-
padding: _reactNativeUi.SPACING[300]
|
|
379
|
-
},
|
|
380
|
-
specText: {
|
|
381
|
-
fontSize: 12,
|
|
382
|
-
color: _reactNativeUi.COLORS.GREEN_3,
|
|
383
|
-
fontFamily: 'monospace'
|
|
384
|
-
}
|
|
385
|
-
});
|
|
386
|
-
//# sourceMappingURL=FluencyVisualPlayground.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeUi","_FluencyContext","_FluencyCardDeck","_useFluencyCardDeckAnimation","_useSuccessSound","_fluencyConstants","_index","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","OPERATIONS","value","mode","FluencyMode","ADDITION","symbol","label","SUBTRACTION","MULTIPLICATION","DIVISION","BOXES","DEFAULT_OPERANDS","addition","subtraction","multiplication","division","OPERAND_MIN","OPERAND_MAX","answerFor","operation","left","right","Math","floor","Chip","sublabel","isActive","activeColor","onPress","jsxs","Pressable","style","styles","chip","backgroundColor","borderColor","children","jsx","Text","chipLabel","chipLabelActive","chipSub","Stepper","onChange","clamp","max","min","View","stepper","stepperLabel","stepperRow","stepperBtn","stepperBtnText","stepperValue","FluencyVisualPlayground","model","setOperation","useState","box","setBox","setLeft","setRight","deck","useFluencyCardDeckAnimation","successSound","useSuccessSound","selectOperation","next","l","find","o","fact","id","numbers","answer","difficulty","lastSeenMs","sessionStartBox","hasFailedThisSession","attemptsCount","correctCount","spec","renderFact","accent","VISUAL_COLORS","playOutcome","isCorrect","started","startCardExit","cardContent","String","direction","status","AttemptStatus","CORRECT","INCORRECT","play","FluencyProvider","ScrollView","screen","contentContainerStyle","content","title","caption","sectionLabel","row","map","op","b","levelForBox","deckWrapper","FluencyCardDeck","currentCardContent","exitingCardContent","exitingCardStatus","snapStyles","onAnswerChange","undefined","outcomeBtn","COLORS","PRIMARY_RED","outcomeText","PRIMARY_GREEN","kind","specBox","specText","JSON","stringify","exports","StyleSheet","create","flex","NEUTRAL_3","padding","SPACING","gap","maxWidth","alignSelf","width","fontSize","fontWeight","color","NEUTRAL_10","fontFamily","FONT_FAMILY","buenosAires","NEUTRAL_7","textTransform","marginTop","flexDirection","flexWrap","paddingVertical","paddingHorizontal","borderRadius","BORDER_RADIUS","borderWidth","NEUTRAL_4","NEUTRAL_1","alignItems","height","justifyContent","minWidth","textAlign","GREEN_3"],"sourceRoot":"../../../../../src","sources":["features/fluency/components/FluencyVisualPlayground.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAEA,IAAAG,eAAA,GAAAH,OAAA;AAEA,IAAAI,gBAAA,GAAAJ,OAAA;AACA,IAAAK,4BAAA,GAAAL,OAAA;AACA,IAAAM,gBAAA,GAAAN,OAAA;AACA,IAAAO,iBAAA,GAAAP,OAAA;AAEA,IAAAQ,MAAA,GAAAR,OAAA;AAA8E,IAAAS,WAAA,GAAAT,OAAA;AAAA,SAAAU,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAZ,wBAAAY,CAAA,EAAAE,CAAA,SA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G,CAAC;IAC7BmB,YAAY,EAAEC,4BAAa,CAAC,GAAG,CAAC;IAChCI,UAAU,EAAE;EACd,CAAC;EACDrC,WAAW,EAAE;IAAEkB,QAAQ,EAAE,EAAE;IAAEC,UAAU,EAAE,KAAK;IAAEC,KAAK,EAAEtB,qBAAM,CAACsC,SAAS;IAAEd,UAAU,EAAEC,0BAAW,CAACC;EAAY,CAAC;EAC9GrB,OAAO,EAAE;IAAE1F,eAAe,EAAEqF,qBAAM,CAACuB,UAAU;IAAEW,YAAY,EAAEC,4BAAa,CAAC,GAAG,CAAC;IAAErB,OAAO,EAAEC,sBAAO,CAAC,GAAG;EAAE,CAAC;EACxGT,QAAQ,EAAE;IAAEc,QAAQ,EAAE,EAAE;IAAEE,KAAK,EAAEtB,qBAAM,CAAC4C,OAAO;IAAEpB,UAAU,EAAE;EAAY;AAC3E,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,379 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import React, { useState } from 'react';
|
|
4
|
-
import { View, Text, Pressable, ScrollView, StyleSheet } from 'react-native';
|
|
5
|
-
import { BORDER_RADIUS, COLORS, FONT_FAMILY, SPACING } from '@magmamath/react-native-ui';
|
|
6
|
-
import { FluencyProvider } from "../context/FluencyContext.js";
|
|
7
|
-
import { FluencyCardDeck } from "./fluency-solving/components/FluencyCardDeck.js";
|
|
8
|
-
import { useFluencyCardDeckAnimation } from "../hooks/useFluencyCardDeckAnimation.js";
|
|
9
|
-
import { useSuccessSound } from "../hooks/useSuccessSound.js";
|
|
10
|
-
import { AttemptStatus, FluencyMode } from "../shared/fluency.constants.js";
|
|
11
|
-
import { levelForBox, renderFact, VISUAL_COLORS } from "../visual-scaffolding/index.js";
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
const OPERATIONS = [{
|
|
14
|
-
value: 'addition',
|
|
15
|
-
mode: FluencyMode.ADDITION,
|
|
16
|
-
symbol: '+',
|
|
17
|
-
label: 'Addition'
|
|
18
|
-
}, {
|
|
19
|
-
value: 'subtraction',
|
|
20
|
-
mode: FluencyMode.SUBTRACTION,
|
|
21
|
-
symbol: '−',
|
|
22
|
-
label: 'Subtraction'
|
|
23
|
-
}, {
|
|
24
|
-
value: 'multiplication',
|
|
25
|
-
mode: FluencyMode.MULTIPLICATION,
|
|
26
|
-
symbol: '×',
|
|
27
|
-
label: 'Multiplication'
|
|
28
|
-
}, {
|
|
29
|
-
value: 'division',
|
|
30
|
-
mode: FluencyMode.DIVISION,
|
|
31
|
-
symbol: '÷',
|
|
32
|
-
label: 'Division'
|
|
33
|
-
}];
|
|
34
|
-
const BOXES = [0, 1, 2, 3, 4];
|
|
35
|
-
|
|
36
|
-
// Defaults per operation that exercise the more interesting layouts (ten-bridging
|
|
37
|
-
// addition, regrouping subtraction, a clean array / grouping).
|
|
38
|
-
const DEFAULT_OPERANDS = {
|
|
39
|
-
addition: [7, 8],
|
|
40
|
-
subtraction: [13, 5],
|
|
41
|
-
multiplication: [3, 4],
|
|
42
|
-
division: [12, 4]
|
|
43
|
-
};
|
|
44
|
-
const OPERAND_MIN = 0;
|
|
45
|
-
const OPERAND_MAX = 20;
|
|
46
|
-
const answerFor = (operation, left, right) => {
|
|
47
|
-
switch (operation) {
|
|
48
|
-
case 'addition':
|
|
49
|
-
return left + right;
|
|
50
|
-
case 'subtraction':
|
|
51
|
-
return left - right;
|
|
52
|
-
case 'multiplication':
|
|
53
|
-
return left * right;
|
|
54
|
-
case 'division':
|
|
55
|
-
return right > 0 ? Math.floor(left / right) : 0;
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
const Chip = ({
|
|
59
|
-
label,
|
|
60
|
-
sublabel,
|
|
61
|
-
isActive,
|
|
62
|
-
activeColor,
|
|
63
|
-
onPress
|
|
64
|
-
}) => /*#__PURE__*/_jsxs(Pressable, {
|
|
65
|
-
onPress: onPress,
|
|
66
|
-
style: [styles.chip, isActive && {
|
|
67
|
-
backgroundColor: activeColor,
|
|
68
|
-
borderColor: activeColor
|
|
69
|
-
}],
|
|
70
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
71
|
-
style: [styles.chipLabel, isActive && styles.chipLabelActive],
|
|
72
|
-
children: label
|
|
73
|
-
}), sublabel && /*#__PURE__*/_jsx(Text, {
|
|
74
|
-
style: [styles.chipSub, isActive && styles.chipLabelActive],
|
|
75
|
-
children: sublabel
|
|
76
|
-
})]
|
|
77
|
-
});
|
|
78
|
-
const Stepper = ({
|
|
79
|
-
label,
|
|
80
|
-
value,
|
|
81
|
-
onChange
|
|
82
|
-
}) => {
|
|
83
|
-
const clamp = n => Math.max(OPERAND_MIN, Math.min(OPERAND_MAX, n));
|
|
84
|
-
return /*#__PURE__*/_jsxs(View, {
|
|
85
|
-
style: styles.stepper,
|
|
86
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
87
|
-
style: styles.stepperLabel,
|
|
88
|
-
children: label
|
|
89
|
-
}), /*#__PURE__*/_jsxs(View, {
|
|
90
|
-
style: styles.stepperRow,
|
|
91
|
-
children: [/*#__PURE__*/_jsx(Pressable, {
|
|
92
|
-
style: styles.stepperBtn,
|
|
93
|
-
onPress: () => onChange(clamp(value - 1)),
|
|
94
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
95
|
-
style: styles.stepperBtnText,
|
|
96
|
-
children: "\u2212"
|
|
97
|
-
})
|
|
98
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
99
|
-
style: styles.stepperValue,
|
|
100
|
-
children: value
|
|
101
|
-
}), /*#__PURE__*/_jsx(Pressable, {
|
|
102
|
-
style: styles.stepperBtn,
|
|
103
|
-
onPress: () => onChange(clamp(value + 1)),
|
|
104
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
105
|
-
style: styles.stepperBtnText,
|
|
106
|
-
children: "+"
|
|
107
|
-
})
|
|
108
|
-
})]
|
|
109
|
-
})]
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
|
-
export const FluencyVisualPlayground = ({
|
|
113
|
-
model
|
|
114
|
-
}) => {
|
|
115
|
-
const [operation, setOperation] = useState('addition');
|
|
116
|
-
const [box, setBox] = useState(0);
|
|
117
|
-
const [left, setLeft] = useState(DEFAULT_OPERANDS.addition[0]);
|
|
118
|
-
const [right, setRight] = useState(DEFAULT_OPERANDS.addition[1]);
|
|
119
|
-
const deck = useFluencyCardDeckAnimation();
|
|
120
|
-
const successSound = useSuccessSound();
|
|
121
|
-
const selectOperation = next => {
|
|
122
|
-
setOperation(next.value);
|
|
123
|
-
const [l, r] = DEFAULT_OPERANDS[next.value];
|
|
124
|
-
setLeft(l);
|
|
125
|
-
setRight(r);
|
|
126
|
-
};
|
|
127
|
-
const mode = OPERATIONS.find(o => o.value === operation)?.mode ?? FluencyMode.ADDITION;
|
|
128
|
-
const fact = {
|
|
129
|
-
id: 'playground',
|
|
130
|
-
mode,
|
|
131
|
-
numbers: [left, right],
|
|
132
|
-
answer: answerFor(operation, left, right),
|
|
133
|
-
difficulty: 0,
|
|
134
|
-
box,
|
|
135
|
-
lastSeenMs: null,
|
|
136
|
-
sessionStartBox: box,
|
|
137
|
-
hasFailedThisSession: false,
|
|
138
|
-
attemptsCount: 0,
|
|
139
|
-
correctCount: 0
|
|
140
|
-
};
|
|
141
|
-
const spec = renderFact({
|
|
142
|
-
operation,
|
|
143
|
-
left,
|
|
144
|
-
right,
|
|
145
|
-
box
|
|
146
|
-
});
|
|
147
|
-
const accent = VISUAL_COLORS[operation].accent;
|
|
148
|
-
const playOutcome = isCorrect => {
|
|
149
|
-
const started = deck.startCardExit({
|
|
150
|
-
// The exiting card shows the filled-in answer + the correct/incorrect label.
|
|
151
|
-
cardContent: {
|
|
152
|
-
fact,
|
|
153
|
-
answer: String(fact.answer)
|
|
154
|
-
},
|
|
155
|
-
direction: isCorrect ? 'right' : 'left',
|
|
156
|
-
status: isCorrect ? AttemptStatus.CORRECT : AttemptStatus.INCORRECT
|
|
157
|
-
});
|
|
158
|
-
if (started && isCorrect) successSound.play();
|
|
159
|
-
};
|
|
160
|
-
return /*#__PURE__*/_jsx(FluencyProvider, {
|
|
161
|
-
value: {
|
|
162
|
-
model
|
|
163
|
-
},
|
|
164
|
-
children: /*#__PURE__*/_jsxs(ScrollView, {
|
|
165
|
-
style: styles.screen,
|
|
166
|
-
contentContainerStyle: styles.content,
|
|
167
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
168
|
-
style: styles.title,
|
|
169
|
-
children: "Fluency Visual Playground"
|
|
170
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
171
|
-
style: styles.caption,
|
|
172
|
-
children: "Real solving deck across operations and boxes 0\u20134 (L1\u2013L5). Dev only."
|
|
173
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
174
|
-
style: styles.sectionLabel,
|
|
175
|
-
children: "Operation"
|
|
176
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
177
|
-
style: styles.row,
|
|
178
|
-
children: OPERATIONS.map(op => /*#__PURE__*/_jsx(Chip, {
|
|
179
|
-
label: `${op.symbol} ${op.label}`,
|
|
180
|
-
isActive: op.value === operation,
|
|
181
|
-
activeColor: VISUAL_COLORS[op.value].accent,
|
|
182
|
-
onPress: () => selectOperation(op)
|
|
183
|
-
}, op.value))
|
|
184
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
185
|
-
style: styles.sectionLabel,
|
|
186
|
-
children: "Box \u2192 Level"
|
|
187
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
188
|
-
style: styles.row,
|
|
189
|
-
children: BOXES.map(b => /*#__PURE__*/_jsx(Chip, {
|
|
190
|
-
label: `Box ${b}`,
|
|
191
|
-
sublabel: levelForBox(b),
|
|
192
|
-
isActive: b === box,
|
|
193
|
-
activeColor: accent,
|
|
194
|
-
onPress: () => setBox(b)
|
|
195
|
-
}, b))
|
|
196
|
-
}), /*#__PURE__*/_jsxs(View, {
|
|
197
|
-
style: styles.row,
|
|
198
|
-
children: [/*#__PURE__*/_jsx(Stepper, {
|
|
199
|
-
label: "Left",
|
|
200
|
-
value: left,
|
|
201
|
-
onChange: setLeft
|
|
202
|
-
}), /*#__PURE__*/_jsx(Stepper, {
|
|
203
|
-
label: "Right",
|
|
204
|
-
value: right,
|
|
205
|
-
onChange: setRight
|
|
206
|
-
})]
|
|
207
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
208
|
-
style: styles.deckWrapper,
|
|
209
|
-
children: /*#__PURE__*/_jsx(FluencyCardDeck, {
|
|
210
|
-
currentCardContent: {
|
|
211
|
-
fact,
|
|
212
|
-
answer: ''
|
|
213
|
-
},
|
|
214
|
-
exitingCardContent: deck.exitingCardContent,
|
|
215
|
-
exitingCardStatus: deck.exitingCardStatus,
|
|
216
|
-
snapStyles: deck.snapStyles,
|
|
217
|
-
onAnswerChange: () => undefined
|
|
218
|
-
})
|
|
219
|
-
}), /*#__PURE__*/_jsxs(View, {
|
|
220
|
-
style: styles.row,
|
|
221
|
-
children: [/*#__PURE__*/_jsx(Pressable, {
|
|
222
|
-
style: [styles.outcomeBtn, {
|
|
223
|
-
backgroundColor: COLORS.PRIMARY_RED
|
|
224
|
-
}],
|
|
225
|
-
onPress: () => playOutcome(false),
|
|
226
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
227
|
-
style: styles.outcomeText,
|
|
228
|
-
children: "\u25B6 Incorrect"
|
|
229
|
-
})
|
|
230
|
-
}), /*#__PURE__*/_jsx(Pressable, {
|
|
231
|
-
style: [styles.outcomeBtn, {
|
|
232
|
-
backgroundColor: COLORS.PRIMARY_GREEN
|
|
233
|
-
}],
|
|
234
|
-
onPress: () => playOutcome(true),
|
|
235
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
236
|
-
style: styles.outcomeText,
|
|
237
|
-
children: "\u25B6 Correct"
|
|
238
|
-
})
|
|
239
|
-
})]
|
|
240
|
-
}), /*#__PURE__*/_jsxs(Text, {
|
|
241
|
-
style: styles.sectionLabel,
|
|
242
|
-
children: ["Spec (", spec.kind, ")"]
|
|
243
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
244
|
-
style: styles.specBox,
|
|
245
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
246
|
-
style: styles.specText,
|
|
247
|
-
children: JSON.stringify(spec, null, 2)
|
|
248
|
-
})
|
|
249
|
-
})]
|
|
250
|
-
})
|
|
251
|
-
});
|
|
252
|
-
};
|
|
253
|
-
const styles = StyleSheet.create({
|
|
254
|
-
screen: {
|
|
255
|
-
flex: 1,
|
|
256
|
-
backgroundColor: COLORS.NEUTRAL_3
|
|
257
|
-
},
|
|
258
|
-
content: {
|
|
259
|
-
padding: SPACING[400],
|
|
260
|
-
gap: SPACING[300],
|
|
261
|
-
maxWidth: 640,
|
|
262
|
-
alignSelf: 'center',
|
|
263
|
-
width: '100%'
|
|
264
|
-
},
|
|
265
|
-
title: {
|
|
266
|
-
fontSize: 22,
|
|
267
|
-
fontWeight: '700',
|
|
268
|
-
color: COLORS.NEUTRAL_10,
|
|
269
|
-
fontFamily: FONT_FAMILY.buenosAires
|
|
270
|
-
},
|
|
271
|
-
caption: {
|
|
272
|
-
fontSize: 13,
|
|
273
|
-
color: COLORS.NEUTRAL_7,
|
|
274
|
-
fontFamily: FONT_FAMILY.buenosAires
|
|
275
|
-
},
|
|
276
|
-
sectionLabel: {
|
|
277
|
-
fontSize: 12,
|
|
278
|
-
fontWeight: '700',
|
|
279
|
-
color: COLORS.NEUTRAL_7,
|
|
280
|
-
textTransform: 'uppercase',
|
|
281
|
-
marginTop: SPACING[200],
|
|
282
|
-
fontFamily: FONT_FAMILY.buenosAires
|
|
283
|
-
},
|
|
284
|
-
row: {
|
|
285
|
-
flexDirection: 'row',
|
|
286
|
-
flexWrap: 'wrap',
|
|
287
|
-
gap: SPACING[200]
|
|
288
|
-
},
|
|
289
|
-
chip: {
|
|
290
|
-
paddingVertical: SPACING[150],
|
|
291
|
-
paddingHorizontal: SPACING[300],
|
|
292
|
-
borderRadius: BORDER_RADIUS[200],
|
|
293
|
-
borderWidth: 1,
|
|
294
|
-
borderColor: COLORS.NEUTRAL_4,
|
|
295
|
-
backgroundColor: COLORS.NEUTRAL_1,
|
|
296
|
-
alignItems: 'center'
|
|
297
|
-
},
|
|
298
|
-
chipLabel: {
|
|
299
|
-
fontSize: 14,
|
|
300
|
-
fontWeight: '600',
|
|
301
|
-
color: COLORS.NEUTRAL_10,
|
|
302
|
-
fontFamily: FONT_FAMILY.buenosAires
|
|
303
|
-
},
|
|
304
|
-
chipSub: {
|
|
305
|
-
fontSize: 11,
|
|
306
|
-
color: COLORS.NEUTRAL_7,
|
|
307
|
-
fontFamily: FONT_FAMILY.buenosAires
|
|
308
|
-
},
|
|
309
|
-
chipLabelActive: {
|
|
310
|
-
color: COLORS.NEUTRAL_1
|
|
311
|
-
},
|
|
312
|
-
stepper: {
|
|
313
|
-
flex: 1,
|
|
314
|
-
gap: SPACING[100]
|
|
315
|
-
},
|
|
316
|
-
stepperLabel: {
|
|
317
|
-
fontSize: 12,
|
|
318
|
-
fontWeight: '700',
|
|
319
|
-
color: COLORS.NEUTRAL_7,
|
|
320
|
-
fontFamily: FONT_FAMILY.buenosAires
|
|
321
|
-
},
|
|
322
|
-
stepperRow: {
|
|
323
|
-
flexDirection: 'row',
|
|
324
|
-
alignItems: 'center',
|
|
325
|
-
gap: SPACING[200]
|
|
326
|
-
},
|
|
327
|
-
stepperBtn: {
|
|
328
|
-
width: 36,
|
|
329
|
-
height: 36,
|
|
330
|
-
borderRadius: BORDER_RADIUS[200],
|
|
331
|
-
backgroundColor: COLORS.NEUTRAL_1,
|
|
332
|
-
borderWidth: 1,
|
|
333
|
-
borderColor: COLORS.NEUTRAL_4,
|
|
334
|
-
alignItems: 'center',
|
|
335
|
-
justifyContent: 'center'
|
|
336
|
-
},
|
|
337
|
-
stepperBtnText: {
|
|
338
|
-
fontSize: 20,
|
|
339
|
-
fontWeight: '700',
|
|
340
|
-
color: COLORS.NEUTRAL_10
|
|
341
|
-
},
|
|
342
|
-
stepperValue: {
|
|
343
|
-
minWidth: 32,
|
|
344
|
-
textAlign: 'center',
|
|
345
|
-
fontSize: 18,
|
|
346
|
-
fontWeight: '700',
|
|
347
|
-
color: COLORS.NEUTRAL_10,
|
|
348
|
-
fontFamily: FONT_FAMILY.buenosAires
|
|
349
|
-
},
|
|
350
|
-
// FluencyCardDeck positions backing cards with absolute top offsets up to ~36px;
|
|
351
|
-
// the vertical padding gives them room and matches FluencySolvingCard's wrapper.
|
|
352
|
-
deckWrapper: {
|
|
353
|
-
alignItems: 'center',
|
|
354
|
-
paddingVertical: SPACING[400]
|
|
355
|
-
},
|
|
356
|
-
outcomeBtn: {
|
|
357
|
-
flex: 1,
|
|
358
|
-
paddingVertical: SPACING[300],
|
|
359
|
-
borderRadius: BORDER_RADIUS[200],
|
|
360
|
-
alignItems: 'center'
|
|
361
|
-
},
|
|
362
|
-
outcomeText: {
|
|
363
|
-
fontSize: 15,
|
|
364
|
-
fontWeight: '700',
|
|
365
|
-
color: COLORS.NEUTRAL_1,
|
|
366
|
-
fontFamily: FONT_FAMILY.buenosAires
|
|
367
|
-
},
|
|
368
|
-
specBox: {
|
|
369
|
-
backgroundColor: COLORS.NEUTRAL_10,
|
|
370
|
-
borderRadius: BORDER_RADIUS[200],
|
|
371
|
-
padding: SPACING[300]
|
|
372
|
-
},
|
|
373
|
-
specText: {
|
|
374
|
-
fontSize: 12,
|
|
375
|
-
color: COLORS.GREEN_3,
|
|
376
|
-
fontFamily: 'monospace'
|
|
377
|
-
}
|
|
378
|
-
});
|
|
379
|
-
//# sourceMappingURL=FluencyVisualPlayground.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","useState","View","Text","Pressable","ScrollView","StyleSheet","BORDER_RADIUS","COLORS","FONT_FAMILY","SPACING","FluencyProvider","FluencyCardDeck","useFluencyCardDeckAnimation","useSuccessSound","AttemptStatus","FluencyMode","levelForBox","renderFact","VISUAL_COLORS","jsx","_jsx","jsxs","_jsxs","OPERATIONS","value","mode","ADDITION","symbol","label","SUBTRACTION","MULTIPLICATION","DIVISION","BOXES","DEFAULT_OPERANDS","addition","subtraction","multiplication","division","OPERAND_MIN","OPERAND_MAX","answerFor","operation","left","right","Math","floor","Chip","sublabel","isActive","activeColor","onPress","style","styles","chip","backgroundColor","borderColor","children","chipLabel","chipLabelActive","chipSub","Stepper","onChange","clamp","n","max","min","stepper","stepperLabel","stepperRow","stepperBtn","stepperBtnText","stepperValue","FluencyVisualPlayground","model","setOperation","box","setBox","setLeft","setRight","deck","successSound","selectOperation","next","l","r","find","o","fact","id","numbers","answer","difficulty","lastSeenMs","sessionStartBox","hasFailedThisSession","attemptsCount","correctCount","spec","accent","playOutcome","isCorrect","started","startCardExit","cardContent","String","direction","status","CORRECT","INCORRECT","play","screen","contentContainerStyle","content","title","caption","sectionLabel","row","map","op","b","deckWrapper","currentCardContent","exitingCardContent","exitingCardStatus","snapStyles","onAnswerChange","undefined","outcomeBtn","PRIMARY_RED","outcomeText","PRIMARY_GREEN","kind","specBox","specText","JSON","stringify","create","flex","NEUTRAL_3","padding","gap","maxWidth","alignSelf","width","fontSize","fontWeight","color","NEUTRAL_10","fontFamily","buenosAires","NEUTRAL_7","textTransform","marginTop","flexDirection","flexWrap","paddingVertical","paddingHorizontal","borderRadius","borderWidth","NEUTRAL_4","NEUTRAL_1","alignItems","height","justifyContent","minWidth","textAlign","GREEN_3"],"sourceRoot":"../../../../../src","sources":["features/fluency/components/FluencyVisualPlayground.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,IAAI,EAAEC,IAAI,EAAEC,SAAS,EAAEC,UAAU,EAAEC,UAAU,QAAQ,cAAc;AAC5E,SAASC,aAAa,EAAEC,MAAM,EAAEC,WAAW,EAAEC,OAAO,QAAQ,4BAA4B;AAExF,SAASC,eAAe,QAAQ,8BAA2B;AAE3D,SAASC,eAAe,QAAQ,iDAA8C;AAC9E,SAASC,2BAA2B,QAAQ,y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":[]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { FluencyModel } from '../model/FluencyModel';
|
|
3
|
-
type FluencyVisualPlaygroundProps = {
|
|
4
|
-
model: FluencyModel;
|
|
5
|
-
};
|
|
6
|
-
export declare const FluencyVisualPlayground: ({ model }: FluencyVisualPlaygroundProps) => React.JSX.Element;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=FluencyVisualPlayground.d.ts.map
|
package/dist/typescript/commonjs/features/fluency/components/FluencyVisualPlayground.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FluencyVisualPlayground.d.ts","sourceRoot":"","sources":["../../../../../../src/features/fluency/components/FluencyVisualPlayground.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAKvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAuFzD,KAAK,4BAA4B,GAAG;IAClC,KAAK,EAAE,YAAY,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,uBAAuB,cAAe,4BAA4B,sBAiH9E,CAAA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { FluencyModel } from '../model/FluencyModel';
|
|
3
|
-
type FluencyVisualPlaygroundProps = {
|
|
4
|
-
model: FluencyModel;
|
|
5
|
-
};
|
|
6
|
-
export declare const FluencyVisualPlayground: ({ model }: FluencyVisualPlaygroundProps) => React.JSX.Element;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=FluencyVisualPlayground.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FluencyVisualPlayground.d.ts","sourceRoot":"","sources":["../../../../../../src/features/fluency/components/FluencyVisualPlayground.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAKvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAuFzD,KAAK,4BAA4B,GAAG;IAClC,KAAK,EAAE,YAAY,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,uBAAuB,cAAe,4BAA4B,sBAiH9E,CAAA"}
|
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
2
|
-
import { View, Text, Pressable, ScrollView, StyleSheet } from 'react-native'
|
|
3
|
-
import { BORDER_RADIUS, COLORS, FONT_FAMILY, SPACING } from '@magmamath/react-native-ui'
|
|
4
|
-
|
|
5
|
-
import { FluencyProvider } from '../context/FluencyContext'
|
|
6
|
-
import type { FluencyModel } from '../model/FluencyModel'
|
|
7
|
-
import { FluencyCardDeck } from './fluency-solving/components/FluencyCardDeck'
|
|
8
|
-
import { useFluencyCardDeckAnimation } from '../hooks/useFluencyCardDeckAnimation'
|
|
9
|
-
import { useSuccessSound } from '../hooks/useSuccessSound'
|
|
10
|
-
import { AttemptStatus, FluencyMode } from '../shared/fluency.constants'
|
|
11
|
-
import type { SolvingFact } from '../shared/fluencySolving.types'
|
|
12
|
-
import { levelForBox, renderFact, VISUAL_COLORS } from '../visual-scaffolding'
|
|
13
|
-
import type { FactPresentation, Operation } from '../visual-scaffolding'
|
|
14
|
-
|
|
15
|
-
type OperationOption = { value: Operation; mode: FluencyMode; symbol: string; label: string }
|
|
16
|
-
|
|
17
|
-
const OPERATIONS: OperationOption[] = [
|
|
18
|
-
{ value: 'addition', mode: FluencyMode.ADDITION, symbol: '+', label: 'Addition' },
|
|
19
|
-
{ value: 'subtraction', mode: FluencyMode.SUBTRACTION, symbol: '−', label: 'Subtraction' },
|
|
20
|
-
{ value: 'multiplication', mode: FluencyMode.MULTIPLICATION, symbol: '×', label: 'Multiplication' },
|
|
21
|
-
{ value: 'division', mode: FluencyMode.DIVISION, symbol: '÷', label: 'Division' },
|
|
22
|
-
]
|
|
23
|
-
|
|
24
|
-
const BOXES: FactPresentation['box'][] = [0, 1, 2, 3, 4]
|
|
25
|
-
|
|
26
|
-
// Defaults per operation that exercise the more interesting layouts (ten-bridging
|
|
27
|
-
// addition, regrouping subtraction, a clean array / grouping).
|
|
28
|
-
const DEFAULT_OPERANDS: Record<Operation, [number, number]> = {
|
|
29
|
-
addition: [7, 8],
|
|
30
|
-
subtraction: [13, 5],
|
|
31
|
-
multiplication: [3, 4],
|
|
32
|
-
division: [12, 4],
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const OPERAND_MIN = 0
|
|
36
|
-
const OPERAND_MAX = 20
|
|
37
|
-
|
|
38
|
-
const answerFor = (operation: Operation, left: number, right: number): number => {
|
|
39
|
-
switch (operation) {
|
|
40
|
-
case 'addition':
|
|
41
|
-
return left + right
|
|
42
|
-
case 'subtraction':
|
|
43
|
-
return left - right
|
|
44
|
-
case 'multiplication':
|
|
45
|
-
return left * right
|
|
46
|
-
case 'division':
|
|
47
|
-
return right > 0 ? Math.floor(left / right) : 0
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
type ChipProps = {
|
|
52
|
-
label: string
|
|
53
|
-
sublabel?: string
|
|
54
|
-
isActive: boolean
|
|
55
|
-
activeColor: string
|
|
56
|
-
onPress: () => void
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const Chip = ({ label, sublabel, isActive, activeColor, onPress }: ChipProps) => (
|
|
60
|
-
<Pressable
|
|
61
|
-
onPress={onPress}
|
|
62
|
-
style={[styles.chip, isActive && { backgroundColor: activeColor, borderColor: activeColor }]}
|
|
63
|
-
>
|
|
64
|
-
<Text style={[styles.chipLabel, isActive && styles.chipLabelActive]}>{label}</Text>
|
|
65
|
-
{sublabel && <Text style={[styles.chipSub, isActive && styles.chipLabelActive]}>{sublabel}</Text>}
|
|
66
|
-
</Pressable>
|
|
67
|
-
)
|
|
68
|
-
|
|
69
|
-
type StepperProps = {
|
|
70
|
-
label: string
|
|
71
|
-
value: number
|
|
72
|
-
onChange: (next: number) => void
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const Stepper = ({ label, value, onChange }: StepperProps) => {
|
|
76
|
-
const clamp = (n: number) => Math.max(OPERAND_MIN, Math.min(OPERAND_MAX, n))
|
|
77
|
-
return (
|
|
78
|
-
<View style={styles.stepper}>
|
|
79
|
-
<Text style={styles.stepperLabel}>{label}</Text>
|
|
80
|
-
<View style={styles.stepperRow}>
|
|
81
|
-
<Pressable style={styles.stepperBtn} onPress={() => onChange(clamp(value - 1))}>
|
|
82
|
-
<Text style={styles.stepperBtnText}>−</Text>
|
|
83
|
-
</Pressable>
|
|
84
|
-
<Text style={styles.stepperValue}>{value}</Text>
|
|
85
|
-
<Pressable style={styles.stepperBtn} onPress={() => onChange(clamp(value + 1))}>
|
|
86
|
-
<Text style={styles.stepperBtnText}>+</Text>
|
|
87
|
-
</Pressable>
|
|
88
|
-
</View>
|
|
89
|
-
</View>
|
|
90
|
-
)
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
type FluencyVisualPlaygroundProps = {
|
|
94
|
-
model: FluencyModel
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export const FluencyVisualPlayground = ({ model }: FluencyVisualPlaygroundProps) => {
|
|
98
|
-
const [operation, setOperation] = useState<Operation>('addition')
|
|
99
|
-
const [box, setBox] = useState<FactPresentation['box']>(0)
|
|
100
|
-
const [left, setLeft] = useState(DEFAULT_OPERANDS.addition[0])
|
|
101
|
-
const [right, setRight] = useState(DEFAULT_OPERANDS.addition[1])
|
|
102
|
-
|
|
103
|
-
const deck = useFluencyCardDeckAnimation()
|
|
104
|
-
const successSound = useSuccessSound()
|
|
105
|
-
|
|
106
|
-
const selectOperation = (next: OperationOption) => {
|
|
107
|
-
setOperation(next.value)
|
|
108
|
-
const [l, r] = DEFAULT_OPERANDS[next.value]
|
|
109
|
-
setLeft(l)
|
|
110
|
-
setRight(r)
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const mode = OPERATIONS.find((o) => o.value === operation)?.mode ?? FluencyMode.ADDITION
|
|
114
|
-
const fact: SolvingFact = {
|
|
115
|
-
id: 'playground',
|
|
116
|
-
mode,
|
|
117
|
-
numbers: [left, right],
|
|
118
|
-
answer: answerFor(operation, left, right),
|
|
119
|
-
difficulty: 0,
|
|
120
|
-
box,
|
|
121
|
-
lastSeenMs: null,
|
|
122
|
-
sessionStartBox: box,
|
|
123
|
-
hasFailedThisSession: false,
|
|
124
|
-
attemptsCount: 0,
|
|
125
|
-
correctCount: 0,
|
|
126
|
-
}
|
|
127
|
-
const spec = renderFact({ operation, left, right, box })
|
|
128
|
-
const accent = VISUAL_COLORS[operation].accent
|
|
129
|
-
|
|
130
|
-
const playOutcome = (isCorrect: boolean) => {
|
|
131
|
-
const started = deck.startCardExit({
|
|
132
|
-
// The exiting card shows the filled-in answer + the correct/incorrect label.
|
|
133
|
-
cardContent: { fact, answer: String(fact.answer) },
|
|
134
|
-
direction: isCorrect ? 'right' : 'left',
|
|
135
|
-
status: isCorrect ? AttemptStatus.CORRECT : AttemptStatus.INCORRECT,
|
|
136
|
-
})
|
|
137
|
-
if (started && isCorrect) successSound.play()
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
return (
|
|
141
|
-
<FluencyProvider value={{ model }}>
|
|
142
|
-
<ScrollView style={styles.screen} contentContainerStyle={styles.content}>
|
|
143
|
-
<Text style={styles.title}>Fluency Visual Playground</Text>
|
|
144
|
-
<Text style={styles.caption}>Real solving deck across operations and boxes 0–4 (L1–L5). Dev only.</Text>
|
|
145
|
-
|
|
146
|
-
<Text style={styles.sectionLabel}>Operation</Text>
|
|
147
|
-
<View style={styles.row}>
|
|
148
|
-
{OPERATIONS.map((op) => (
|
|
149
|
-
<Chip
|
|
150
|
-
key={op.value}
|
|
151
|
-
label={`${op.symbol} ${op.label}`}
|
|
152
|
-
isActive={op.value === operation}
|
|
153
|
-
activeColor={VISUAL_COLORS[op.value].accent}
|
|
154
|
-
onPress={() => selectOperation(op)}
|
|
155
|
-
/>
|
|
156
|
-
))}
|
|
157
|
-
</View>
|
|
158
|
-
|
|
159
|
-
<Text style={styles.sectionLabel}>Box → Level</Text>
|
|
160
|
-
<View style={styles.row}>
|
|
161
|
-
{BOXES.map((b) => (
|
|
162
|
-
<Chip
|
|
163
|
-
key={b}
|
|
164
|
-
label={`Box ${b}`}
|
|
165
|
-
sublabel={levelForBox(b)}
|
|
166
|
-
isActive={b === box}
|
|
167
|
-
activeColor={accent}
|
|
168
|
-
onPress={() => setBox(b)}
|
|
169
|
-
/>
|
|
170
|
-
))}
|
|
171
|
-
</View>
|
|
172
|
-
|
|
173
|
-
<View style={styles.row}>
|
|
174
|
-
<Stepper label="Left" value={left} onChange={setLeft} />
|
|
175
|
-
<Stepper label="Right" value={right} onChange={setRight} />
|
|
176
|
-
</View>
|
|
177
|
-
|
|
178
|
-
<View style={styles.deckWrapper}>
|
|
179
|
-
<FluencyCardDeck
|
|
180
|
-
currentCardContent={{ fact, answer: '' }}
|
|
181
|
-
exitingCardContent={deck.exitingCardContent}
|
|
182
|
-
exitingCardStatus={deck.exitingCardStatus}
|
|
183
|
-
snapStyles={deck.snapStyles}
|
|
184
|
-
onAnswerChange={() => undefined}
|
|
185
|
-
/>
|
|
186
|
-
</View>
|
|
187
|
-
|
|
188
|
-
<View style={styles.row}>
|
|
189
|
-
<Pressable
|
|
190
|
-
style={[styles.outcomeBtn, { backgroundColor: COLORS.PRIMARY_RED }]}
|
|
191
|
-
onPress={() => playOutcome(false)}
|
|
192
|
-
>
|
|
193
|
-
<Text style={styles.outcomeText}>▶ Incorrect</Text>
|
|
194
|
-
</Pressable>
|
|
195
|
-
<Pressable
|
|
196
|
-
style={[styles.outcomeBtn, { backgroundColor: COLORS.PRIMARY_GREEN }]}
|
|
197
|
-
onPress={() => playOutcome(true)}
|
|
198
|
-
>
|
|
199
|
-
<Text style={styles.outcomeText}>▶ Correct</Text>
|
|
200
|
-
</Pressable>
|
|
201
|
-
</View>
|
|
202
|
-
|
|
203
|
-
<Text style={styles.sectionLabel}>Spec ({spec.kind})</Text>
|
|
204
|
-
<View style={styles.specBox}>
|
|
205
|
-
<Text style={styles.specText}>{JSON.stringify(spec, null, 2)}</Text>
|
|
206
|
-
</View>
|
|
207
|
-
</ScrollView>
|
|
208
|
-
</FluencyProvider>
|
|
209
|
-
)
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
const styles = StyleSheet.create({
|
|
213
|
-
screen: { flex: 1, backgroundColor: COLORS.NEUTRAL_3 },
|
|
214
|
-
content: { padding: SPACING[400], gap: SPACING[300], maxWidth: 640, alignSelf: 'center', width: '100%' },
|
|
215
|
-
title: { fontSize: 22, fontWeight: '700', color: COLORS.NEUTRAL_10, fontFamily: FONT_FAMILY.buenosAires },
|
|
216
|
-
caption: { fontSize: 13, color: COLORS.NEUTRAL_7, fontFamily: FONT_FAMILY.buenosAires },
|
|
217
|
-
sectionLabel: {
|
|
218
|
-
fontSize: 12,
|
|
219
|
-
fontWeight: '700',
|
|
220
|
-
color: COLORS.NEUTRAL_7,
|
|
221
|
-
textTransform: 'uppercase',
|
|
222
|
-
marginTop: SPACING[200],
|
|
223
|
-
fontFamily: FONT_FAMILY.buenosAires,
|
|
224
|
-
},
|
|
225
|
-
row: { flexDirection: 'row', flexWrap: 'wrap', gap: SPACING[200] },
|
|
226
|
-
chip: {
|
|
227
|
-
paddingVertical: SPACING[150],
|
|
228
|
-
paddingHorizontal: SPACING[300],
|
|
229
|
-
borderRadius: BORDER_RADIUS[200],
|
|
230
|
-
borderWidth: 1,
|
|
231
|
-
borderColor: COLORS.NEUTRAL_4,
|
|
232
|
-
backgroundColor: COLORS.NEUTRAL_1,
|
|
233
|
-
alignItems: 'center',
|
|
234
|
-
},
|
|
235
|
-
chipLabel: { fontSize: 14, fontWeight: '600', color: COLORS.NEUTRAL_10, fontFamily: FONT_FAMILY.buenosAires },
|
|
236
|
-
chipSub: { fontSize: 11, color: COLORS.NEUTRAL_7, fontFamily: FONT_FAMILY.buenosAires },
|
|
237
|
-
chipLabelActive: { color: COLORS.NEUTRAL_1 },
|
|
238
|
-
stepper: { flex: 1, gap: SPACING[100] },
|
|
239
|
-
stepperLabel: { fontSize: 12, fontWeight: '700', color: COLORS.NEUTRAL_7, fontFamily: FONT_FAMILY.buenosAires },
|
|
240
|
-
stepperRow: { flexDirection: 'row', alignItems: 'center', gap: SPACING[200] },
|
|
241
|
-
stepperBtn: {
|
|
242
|
-
width: 36,
|
|
243
|
-
height: 36,
|
|
244
|
-
borderRadius: BORDER_RADIUS[200],
|
|
245
|
-
backgroundColor: COLORS.NEUTRAL_1,
|
|
246
|
-
borderWidth: 1,
|
|
247
|
-
borderColor: COLORS.NEUTRAL_4,
|
|
248
|
-
alignItems: 'center',
|
|
249
|
-
justifyContent: 'center',
|
|
250
|
-
},
|
|
251
|
-
stepperBtnText: { fontSize: 20, fontWeight: '700', color: COLORS.NEUTRAL_10 },
|
|
252
|
-
stepperValue: {
|
|
253
|
-
minWidth: 32,
|
|
254
|
-
textAlign: 'center',
|
|
255
|
-
fontSize: 18,
|
|
256
|
-
fontWeight: '700',
|
|
257
|
-
color: COLORS.NEUTRAL_10,
|
|
258
|
-
fontFamily: FONT_FAMILY.buenosAires,
|
|
259
|
-
},
|
|
260
|
-
// FluencyCardDeck positions backing cards with absolute top offsets up to ~36px;
|
|
261
|
-
// the vertical padding gives them room and matches FluencySolvingCard's wrapper.
|
|
262
|
-
deckWrapper: { alignItems: 'center', paddingVertical: SPACING[400] },
|
|
263
|
-
outcomeBtn: {
|
|
264
|
-
flex: 1,
|
|
265
|
-
paddingVertical: SPACING[300],
|
|
266
|
-
borderRadius: BORDER_RADIUS[200],
|
|
267
|
-
alignItems: 'center',
|
|
268
|
-
},
|
|
269
|
-
outcomeText: { fontSize: 15, fontWeight: '700', color: COLORS.NEUTRAL_1, fontFamily: FONT_FAMILY.buenosAires },
|
|
270
|
-
specBox: { backgroundColor: COLORS.NEUTRAL_10, borderRadius: BORDER_RADIUS[200], padding: SPACING[300] },
|
|
271
|
-
specText: { fontSize: 12, color: COLORS.GREEN_3, fontFamily: 'monospace' },
|
|
272
|
-
})
|