@magmamath/students-features 1.8.6-rc.4 → 1.8.6-rc.5
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/profile/Profile.js +11 -1
- package/dist/commonjs/features/profile/Profile.js.map +1 -1
- package/dist/commonjs/features/profile/model/ProfileModel.js +19 -5
- package/dist/commonjs/features/profile/model/ProfileModel.js.map +1 -1
- package/dist/module/features/profile/Profile.js +11 -1
- package/dist/module/features/profile/Profile.js.map +1 -1
- package/dist/module/features/profile/model/ProfileModel.js +19 -5
- package/dist/module/features/profile/model/ProfileModel.js.map +1 -1
- package/dist/typescript/commonjs/features/profile/Profile.d.ts +3 -2
- package/dist/typescript/commonjs/features/profile/Profile.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/profile/model/ProfileModel.d.ts +6 -8
- package/dist/typescript/commonjs/features/profile/model/ProfileModel.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/profile/shared/profile.types.d.ts +4 -0
- package/dist/typescript/commonjs/features/profile/shared/profile.types.d.ts.map +1 -1
- package/dist/typescript/module/features/profile/Profile.d.ts +3 -2
- package/dist/typescript/module/features/profile/Profile.d.ts.map +1 -1
- package/dist/typescript/module/features/profile/model/ProfileModel.d.ts +6 -8
- package/dist/typescript/module/features/profile/model/ProfileModel.d.ts.map +1 -1
- package/dist/typescript/module/features/profile/shared/profile.types.d.ts +4 -0
- package/dist/typescript/module/features/profile/shared/profile.types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/features/profile/Profile.tsx +7 -3
- package/src/features/profile/__tests__/ProfileModel.test.ts +8 -3
- package/src/features/profile/model/ProfileModel.ts +20 -10
- package/src/features/profile/shared/profile.types.ts +5 -0
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.Profile = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
+
var _effectorReact = require("effector-react");
|
|
9
10
|
var _reactNativeUi = require("@magmamath/react-native-ui");
|
|
10
11
|
var _commonConstants = require("../../shared/common.constants.js");
|
|
11
12
|
var _ProfileActions = require("./components/actions/ProfileActions.js");
|
|
@@ -18,8 +19,13 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
18
19
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
20
|
const TWO_COLUMN_BREAKPOINT = 768;
|
|
20
21
|
const COLUMN_MAX_WIDTH = 560;
|
|
21
|
-
const Profile =
|
|
22
|
+
const Profile = ({
|
|
23
|
+
user,
|
|
24
|
+
settings,
|
|
25
|
+
...props
|
|
26
|
+
}) => {
|
|
22
27
|
const {
|
|
28
|
+
model,
|
|
23
29
|
showSolveMode,
|
|
24
30
|
versionInfo
|
|
25
31
|
} = props;
|
|
@@ -27,6 +33,10 @@ const Profile = props => {
|
|
|
27
33
|
width
|
|
28
34
|
} = (0, _reactNative.useWindowDimensions)();
|
|
29
35
|
const isTwoColumn = width >= TWO_COLUMN_BREAKPOINT;
|
|
36
|
+
(0, _effectorReact.useGate)(model.gate, {
|
|
37
|
+
user,
|
|
38
|
+
settings
|
|
39
|
+
});
|
|
30
40
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProfileContext.ProfileProvider, {
|
|
31
41
|
value: props,
|
|
32
42
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.ScrollView, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_reactNativeUi","_commonConstants","_ProfileActions","_AccountInfoCard","_LanguageSettingsCard","_PreferencesCard","_TextSettingsCard","_ProfileContext","_jsxRuntime","e","__esModule","default","TWO_COLUMN_BREAKPOINT","COLUMN_MAX_WIDTH","Profile","props","showSolveMode","versionInfo","width","useWindowDimensions","isTwoColumn","jsx","ProfileProvider","value","children","jsxs","ScrollView","style","styles","container","contentContainerStyle","scroll","scrollEnabled","isWeb","showsVerticalScrollIndicator","View","columns","columnsStacked","column","columnWide","columnStacked","LanguageSettingsCard","TextSettingsCard","PreferencesCard","AccountInfoCard","ProfileActions","version","exports","StyleSheet","create","backgroundColor","COLORS","NEUTRAL_3","flex","flexGrow","gap","SPACING","paddingHorizontal","paddingVertical","flexDirection","justifyContent","alignItems","maxWidth","alignSelf","marginTop"],"sourceRoot":"../../../../src","sources":["features/profile/Profile.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_effectorReact","_reactNativeUi","_commonConstants","_ProfileActions","_AccountInfoCard","_LanguageSettingsCard","_PreferencesCard","_TextSettingsCard","_ProfileContext","_jsxRuntime","e","__esModule","default","TWO_COLUMN_BREAKPOINT","COLUMN_MAX_WIDTH","Profile","user","settings","props","model","showSolveMode","versionInfo","width","useWindowDimensions","isTwoColumn","useGate","gate","jsx","ProfileProvider","value","children","jsxs","ScrollView","style","styles","container","contentContainerStyle","scroll","scrollEnabled","isWeb","showsVerticalScrollIndicator","View","columns","columnsStacked","column","columnWide","columnStacked","LanguageSettingsCard","TextSettingsCard","PreferencesCard","AccountInfoCard","ProfileActions","version","exports","StyleSheet","create","backgroundColor","COLORS","NEUTRAL_3","flex","flexGrow","gap","SPACING","paddingHorizontal","paddingVertical","flexDirection","justifyContent","alignItems","maxWidth","alignSelf","marginTop"],"sourceRoot":"../../../../src","sources":["features/profile/Profile.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AAEA,IAAAI,gBAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AACA,I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IACNuB,QAAQ,EAAE,CAAC;IACXC,GAAG,EAAEC,sBAAO,CAAC,KAAK,CAAC;IACnBC,iBAAiB,EAAED,sBAAO,CAAC,KAAK,CAAC;IACjCE,eAAe,EAAEF,sBAAO,CAAC,KAAK;EAChC,CAAC;EACDpB,OAAO,EAAE;IACPuB,aAAa,EAAE,KAAK;IACpBJ,GAAG,EAAEC,sBAAO,CAAC,KAAK,CAAC;IACnBI,cAAc,EAAE,QAAQ;IACxB5C,KAAK,EAAE;EACT,CAAC;EACDqB,cAAc,EAAE;IACdwB,UAAU,EAAE,QAAQ;IACpBF,aAAa,EAAE;EACjB,CAAC;EACDrB,MAAM,EAAE;IACNiB,GAAG,EAAEC,sBAAO,CAAC,KAAK,CAAC;IACnBM,QAAQ,EAAEtD;EACZ,CAAC;EACD+B,UAAU,EAAE;IACVc,IAAI,EAAE;EACR,CAAC;EACDb,aAAa,EAAE;IACbxB,KAAK,EAAE;EACT,CAAC;EACD8B,OAAO,EAAE;IACPiB,SAAS,EAAE,UAAU;IACrBC,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -5,24 +5,38 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.ProfileModel = void 0;
|
|
7
7
|
var _effector = require("effector");
|
|
8
|
+
var _effectorReact = require("effector-react");
|
|
9
|
+
var _profileConstants = require("../shared/profile.constants.js");
|
|
8
10
|
var _ProfileApi = require("./ProfileApi.js");
|
|
9
11
|
var _ProfileJoinClassModel = require("./ProfileJoinClassModel.js");
|
|
10
12
|
var _ProfileLanguageModel = require("./ProfileLanguageModel.js");
|
|
13
|
+
// Shown until the gate opens with the consumer's real values on mount.
|
|
14
|
+
const DEFAULT_SETTINGS = {
|
|
15
|
+
textToSpeech: false,
|
|
16
|
+
textSize: _profileConstants.TEXT_SIZE.MIN,
|
|
17
|
+
translationLanguage: null,
|
|
18
|
+
canvasType: _profileConstants.ProfileCanvasType.DRAWING,
|
|
19
|
+
isTranslationLocked: false
|
|
20
|
+
};
|
|
11
21
|
class ProfileModel {
|
|
22
|
+
gate = (0, _effectorReact.createGate)({
|
|
23
|
+
defaultState: {
|
|
24
|
+
user: null,
|
|
25
|
+
settings: DEFAULT_SETTINGS
|
|
26
|
+
}
|
|
27
|
+
});
|
|
12
28
|
setTextToSpeech = (0, _effector.createEvent)();
|
|
13
29
|
setTextSize = (0, _effector.createEvent)();
|
|
14
30
|
setCanvasType = (0, _effector.createEvent)();
|
|
31
|
+
$user = this.gate.state.map(state => state.user);
|
|
32
|
+
$settings = this.gate.state.map(state => state.settings);
|
|
15
33
|
constructor({
|
|
16
34
|
api,
|
|
17
|
-
notify
|
|
18
|
-
$user,
|
|
19
|
-
$settings
|
|
35
|
+
notify
|
|
20
36
|
}) {
|
|
21
37
|
this.api = new _ProfileApi.ProfileApi(api);
|
|
22
38
|
this.joinClass = new _ProfileJoinClassModel.ProfileJoinClassModel(this.api, notify);
|
|
23
39
|
this.language = new _ProfileLanguageModel.ProfileLanguageModel(this.api);
|
|
24
|
-
this.$user = $user;
|
|
25
|
-
this.$settings = $settings;
|
|
26
40
|
this.init();
|
|
27
41
|
}
|
|
28
42
|
init() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_effector","require","_ProfileApi","_ProfileJoinClassModel","_ProfileLanguageModel","ProfileModel","setTextToSpeech","createEvent","setTextSize","setCanvasType","
|
|
1
|
+
{"version":3,"names":["_effector","require","_effectorReact","_profileConstants","_ProfileApi","_ProfileJoinClassModel","_ProfileLanguageModel","DEFAULT_SETTINGS","textToSpeech","textSize","TEXT_SIZE","MIN","translationLanguage","canvasType","ProfileCanvasType","DRAWING","isTranslationLocked","ProfileModel","gate","createGate","defaultState","user","settings","setTextToSpeech","createEvent","setTextSize","setCanvasType","$user","state","map","$settings","constructor","api","notify","ProfileApi","joinClass","ProfileJoinClassModel","language","ProfileLanguageModel","init","sample","clock","fn","target","updateSettingsFx","exports"],"sourceRoot":"../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ACN,GAAG,CAAC;IAElD,IAAI,CAACO,IAAI,CAAC,CAAC;EACb;EAEQA,IAAIA,CAAA,EAAG;IACb,IAAAC,gBAAM,EAAC;MACLC,KAAK,EAAE,IAAI,CAAClB,eAAe;MAC3BmB,EAAE,EAAGlC,YAAY,KAAM;QAAEA;MAAa,CAAC,CAAC;MACxCmC,MAAM,EAAE,IAAI,CAACX,GAAG,CAACY;IACnB,CAAC,CAAC;IAEF,IAAAJ,gBAAM,EAAC;MACLC,KAAK,EAAE,IAAI,CAAChB,WAAW;MACvBiB,EAAE,EAAGjC,QAAQ,KAAM;QAAEA;MAAS,CAAC,CAAC;MAChCkC,MAAM,EAAE,IAAI,CAACX,GAAG,CAACY;IACnB,CAAC,CAAC;IAEF,IAAAJ,gBAAM,EAAC;MACLC,KAAK,EAAE,IAAI,CAACf,aAAa;MACzBgB,EAAE,EAAG7B,UAAU,KAAM;QAAEA;MAAW,CAAC,CAAC;MACpC8B,MAAM,EAAE,IAAI,CAACX,GAAG,CAACY;IACnB,CAAC,CAAC;EACJ;AACF;AAACC,OAAA,CAAA5B,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { ScrollView, StyleSheet, useWindowDimensions, View } from 'react-native';
|
|
5
|
+
import { useGate } from 'effector-react';
|
|
5
6
|
import { COLORS, SPACING } from '@magmamath/react-native-ui';
|
|
6
7
|
import { isWeb } from "../../shared/common.constants.js";
|
|
7
8
|
import { ProfileActions } from "./components/actions/ProfileActions.js";
|
|
@@ -13,8 +14,13 @@ import { ProfileProvider } from "./context/ProfileContext.js";
|
|
|
13
14
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
15
|
const TWO_COLUMN_BREAKPOINT = 768;
|
|
15
16
|
const COLUMN_MAX_WIDTH = 560;
|
|
16
|
-
export const Profile =
|
|
17
|
+
export const Profile = ({
|
|
18
|
+
user,
|
|
19
|
+
settings,
|
|
20
|
+
...props
|
|
21
|
+
}) => {
|
|
17
22
|
const {
|
|
23
|
+
model,
|
|
18
24
|
showSolveMode,
|
|
19
25
|
versionInfo
|
|
20
26
|
} = props;
|
|
@@ -22,6 +28,10 @@ export const Profile = props => {
|
|
|
22
28
|
width
|
|
23
29
|
} = useWindowDimensions();
|
|
24
30
|
const isTwoColumn = width >= TWO_COLUMN_BREAKPOINT;
|
|
31
|
+
useGate(model.gate, {
|
|
32
|
+
user,
|
|
33
|
+
settings
|
|
34
|
+
});
|
|
25
35
|
return /*#__PURE__*/_jsx(ProfileProvider, {
|
|
26
36
|
value: props,
|
|
27
37
|
children: /*#__PURE__*/_jsxs(ScrollView, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","ScrollView","StyleSheet","useWindowDimensions","View","COLORS","SPACING","isWeb","ProfileActions","AccountInfoCard","LanguageSettingsCard","PreferencesCard","TextSettingsCard","ProfileProvider","jsx","_jsx","jsxs","_jsxs","TWO_COLUMN_BREAKPOINT","COLUMN_MAX_WIDTH","Profile","props","showSolveMode","versionInfo","width","isTwoColumn","value","children","style","styles","container","contentContainerStyle","scroll","scrollEnabled","showsVerticalScrollIndicator","columns","columnsStacked","column","columnWide","columnStacked","version","create","backgroundColor","NEUTRAL_3","flex","flexGrow","gap","paddingHorizontal","paddingVertical","flexDirection","justifyContent","alignItems","maxWidth","alignSelf","marginTop"],"sourceRoot":"../../../../src","sources":["features/profile/Profile.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,EAAEC,UAAU,EAAEC,mBAAmB,EAAEC,IAAI,QAAQ,cAAc;AAChF,SAASC,MAAM,EAAEC,OAAO,QAAQ,4BAA4B;AAE5D,SAASC,KAAK,QAAQ,kCAA+B;AACrD,SAASC,cAAc,QAAQ,wCAAqC;AACpE,SAASC,eAAe,QAAQ,sCAAmC;AACnE,SAASC,oBAAoB,QAAQ,+CAA4C;AACjF,SAASC,eAAe,QAAQ,0CAAuC;AACvE,SAASC,gBAAgB,QAAQ,2CAAwC;AACzE,SAASC,eAAe,QAAkC,6BAA0B;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;
|
|
1
|
+
{"version":3,"names":["React","ScrollView","StyleSheet","useWindowDimensions","View","useGate","COLORS","SPACING","isWeb","ProfileActions","AccountInfoCard","LanguageSettingsCard","PreferencesCard","TextSettingsCard","ProfileProvider","jsx","_jsx","jsxs","_jsxs","TWO_COLUMN_BREAKPOINT","COLUMN_MAX_WIDTH","Profile","user","settings","props","model","showSolveMode","versionInfo","width","isTwoColumn","gate","value","children","style","styles","container","contentContainerStyle","scroll","scrollEnabled","showsVerticalScrollIndicator","columns","columnsStacked","column","columnWide","columnStacked","version","create","backgroundColor","NEUTRAL_3","flex","flexGrow","gap","paddingHorizontal","paddingVertical","flexDirection","justifyContent","alignItems","maxWidth","alignSelf","marginTop"],"sourceRoot":"../../../../src","sources":["features/profile/Profile.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,EAAEC,UAAU,EAAEC,mBAAmB,EAAEC,IAAI,QAAQ,cAAc;AAChF,SAASC,OAAO,QAAQ,gBAAgB;AACxC,SAASC,MAAM,EAAEC,OAAO,QAAQ,4BAA4B;AAE5D,SAASC,KAAK,QAAQ,kCAA+B;AACrD,SAASC,cAAc,QAAQ,wCAAqC;AACpE,SAASC,eAAe,QAAQ,sCAAmC;AACnE,SAASC,oBAAoB,QAAQ,+CAA4C;AACjF,SAASC,eAAe,QAAQ,0CAAuC;AACvE,SAASC,gBAAgB,QAAQ,2CAAwC;AACzE,SAASC,eAAe,QAAkC,6BAA0B;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAKpF,MAAMC,qBAAqB,GAAG,GAAG;AACjC,MAAMC,gBAAgB,GAAG,GAAG;AAE5B,OAAO,MAAMC,OAAO,GAAGA,CAA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MAAA,CACH,CAAC,eACPM,IAAA,CAACP,cAAc,IAAE,CAAC,EACjBkB,WAAW,gBAAGX,IAAA,CAACZ,IAAI;QAAC6B,KAAK,EAAEC,MAAM,CAACW,OAAQ;QAAAb,QAAA,EAAEL;MAAW,CAAO,CAAC,GAAG,IAAI;IAAA,CAC7D;EAAC,CACE,CAAC;AAEtB,CAAC;AAED,MAAMO,MAAM,GAAGhC,UAAU,CAAC4C,MAAM,CAAC;EAC/BX,SAAS,EAAE;IACTY,eAAe,EAAEzC,MAAM,CAAC0C,SAAS;IACjCC,IAAI,EAAE;EACR,CAAC;EACDZ,MAAM,EAAE;IACNa,QAAQ,EAAE,CAAC;IACXC,GAAG,EAAE5C,OAAO,CAAC,KAAK,CAAC;IACnB6C,iBAAiB,EAAE7C,OAAO,CAAC,KAAK,CAAC;IACjC8C,eAAe,EAAE9C,OAAO,CAAC,KAAK;EAChC,CAAC;EACDiC,OAAO,EAAE;IACPc,aAAa,EAAE,KAAK;IACpBH,GAAG,EAAE5C,OAAO,CAAC,KAAK,CAAC;IACnBgD,cAAc,EAAE,QAAQ;IACxB3B,KAAK,EAAE;EACT,CAAC;EACDa,cAAc,EAAE;IACde,UAAU,EAAE,QAAQ;IACpBF,aAAa,EAAE;EACjB,CAAC;EACDZ,MAAM,EAAE;IACNS,GAAG,EAAE5C,OAAO,CAAC,KAAK,CAAC;IACnBkD,QAAQ,EAAErC;EACZ,CAAC;EACDuB,UAAU,EAAE;IACVM,IAAI,EAAE;EACR,CAAC;EACDL,aAAa,EAAE;IACbhB,KAAK,EAAE;EACT,CAAC;EACDiB,OAAO,EAAE;IACPa,SAAS,EAAE,UAAU;IACrBC,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,24 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { createEvent, sample } from 'effector';
|
|
4
|
+
import { createGate } from 'effector-react';
|
|
5
|
+
import { ProfileCanvasType, TEXT_SIZE } from "../shared/profile.constants.js";
|
|
4
6
|
import { ProfileApi } from "./ProfileApi.js";
|
|
5
7
|
import { ProfileJoinClassModel } from "./ProfileJoinClassModel.js";
|
|
6
8
|
import { ProfileLanguageModel } from "./ProfileLanguageModel.js";
|
|
9
|
+
// Shown until the gate opens with the consumer's real values on mount.
|
|
10
|
+
const DEFAULT_SETTINGS = {
|
|
11
|
+
textToSpeech: false,
|
|
12
|
+
textSize: TEXT_SIZE.MIN,
|
|
13
|
+
translationLanguage: null,
|
|
14
|
+
canvasType: ProfileCanvasType.DRAWING,
|
|
15
|
+
isTranslationLocked: false
|
|
16
|
+
};
|
|
7
17
|
export class ProfileModel {
|
|
18
|
+
gate = createGate({
|
|
19
|
+
defaultState: {
|
|
20
|
+
user: null,
|
|
21
|
+
settings: DEFAULT_SETTINGS
|
|
22
|
+
}
|
|
23
|
+
});
|
|
8
24
|
setTextToSpeech = createEvent();
|
|
9
25
|
setTextSize = createEvent();
|
|
10
26
|
setCanvasType = createEvent();
|
|
27
|
+
$user = this.gate.state.map(state => state.user);
|
|
28
|
+
$settings = this.gate.state.map(state => state.settings);
|
|
11
29
|
constructor({
|
|
12
30
|
api,
|
|
13
|
-
notify
|
|
14
|
-
$user,
|
|
15
|
-
$settings
|
|
31
|
+
notify
|
|
16
32
|
}) {
|
|
17
33
|
this.api = new ProfileApi(api);
|
|
18
34
|
this.joinClass = new ProfileJoinClassModel(this.api, notify);
|
|
19
35
|
this.language = new ProfileLanguageModel(this.api);
|
|
20
|
-
this.$user = $user;
|
|
21
|
-
this.$settings = $settings;
|
|
22
36
|
this.init();
|
|
23
37
|
}
|
|
24
38
|
init() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createEvent","sample","ProfileApi","ProfileJoinClassModel","ProfileLanguageModel","ProfileModel","
|
|
1
|
+
{"version":3,"names":["createEvent","sample","createGate","ProfileCanvasType","TEXT_SIZE","ProfileApi","ProfileJoinClassModel","ProfileLanguageModel","DEFAULT_SETTINGS","textToSpeech","textSize","MIN","translationLanguage","canvasType","DRAWING","isTranslationLocked","ProfileModel","gate","defaultState","user","settings","setTextToSpeech","setTextSize","setCanvasType","$user","state","map","$settings","constructor","api","notify","joinClass","language","init","clock","fn","target","updateSettingsFx"],"sourceRoot":"../../../../../src","sources":["features/profile/model/ProfileModel.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,MAAM,QAAQ,UAAU;AAC9C,SAASC,UAAU,QAAQ,gBAAgB;AAE3C,SAASC,iBAAiB,EAAEC,SAAS,QAAQ,gCAA6B;AAE1E,SAASC,UAAU,QAA8B,iBAAc;AAC/D,SAASC,qBAAqB,QAAQ,4BAAyB;AAC/D,SAASC,oBAAoB,QAAQ,2BAAwB;AAO7D;AACA,MAAMC,gBAAiC,GAAG;EACxCC,YAAY,EAAE,KAAK;EACnBC,QAAQ,EAAEN,SAAS,CAACO,GAAG;EACvBC,mBAAmB,EAAE,IAAI;EACzBC,UAAU,EAAEV,iBAAiB,CAACW,OAAO;EACrCC,mBAAmB,EAAE;AACvB,CAAC;AAED,OAAO,MAAMC,YAAY,CAAC;EACRC,IAAI,GAAGf,UAAU,CAAmB;IAClDgB,YAAY,EAAE;MAAEC,IAAI,EAAE,IAAI;MAAEC,QAAQ,EAAEZ;IAAiB;EACzD,CAAC,CAAC;EAMca,eAAe,GAAGrB,WAAW,CAAU,CAAC;EACxCsB,WAAW,GAAGtB,WAAW,CAAS,CAAC;EACnCuB,aAAa,GAAGvB,WAAW,CAAoB,CAAC;EAEhDwB,KAAK,GAAG,IAAI,CAACP,IAAI,CAACQ,KAAK,CAACC,GAAG,CAAED,KAAK,IAAKA,KAAK,CAACN,IAAI,CAAC;EAClDQ,SAAS,GAAG,IAAI,CAACV,IAAI,CAACQ,KAAK,CAACC,GAAG,CAAED,KAAK,IAAKA,KAAK,CAACL,QAAQ,CAAC;EAE1EQ,WAAWA,CAAC;IAAEC,GAAG;IAAEC;EAA0B,CAAC,EAAE;IAC9C,IAAI,CAACD,GAAG,GAAG,IAAIxB,UAAU,CAACwB,GAAG,CAAC;IAC9B,IAAI,CAACE,SAAS,GAAG,IAAIzB,qBAAqB,CAAC,IAAI,CAACuB,GAAG,EAAEC,MAAM,CAAC;IAC5D,IAAI,CAACE,QAAQ,GAAG,IAAIzB,oBAAoB,CAAC,IAAI,CAACsB,GAAG,CAAC;IAElD,IAAI,CAACI,IAAI,CAAC,CAAC;EACb;EAEQA,IAAIA,CAAA,EAAG;IACbhC,MAAM,CAAC;MACLiC,KAAK,EAAE,IAAI,CAACb,eAAe;MAC3Bc,EAAE,EAAG1B,YAAY,KAAM;QAAEA;MAAa,CAAC,CAAC;MACxC2B,MAAM,EAAE,IAAI,CAACP,GAAG,CAACQ;IACnB,CAAC,CAAC;IAEFpC,MAAM,CAAC;MACLiC,KAAK,EAAE,IAAI,CAACZ,WAAW;MACvBa,EAAE,EAAGzB,QAAQ,KAAM;QAAEA;MAAS,CAAC,CAAC;MAChC0B,MAAM,EAAE,IAAI,CAACP,GAAG,CAACQ;IACnB,CAAC,CAAC;IAEFpC,MAAM,CAAC;MACLiC,KAAK,EAAE,IAAI,CAACX,aAAa;MACzBY,EAAE,EAAGtB,UAAU,KAAM;QAAEA;MAAW,CAAC,CAAC;MACpCuB,MAAM,EAAE,IAAI,CAACP,GAAG,CAACQ;IACnB,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type ProfileContextValue } from './context/ProfileContext';
|
|
3
|
-
type
|
|
4
|
-
|
|
3
|
+
import type { ProfileGateProps } from './shared/profile.types';
|
|
4
|
+
type ProfileProps = ProfileContextValue & ProfileGateProps;
|
|
5
|
+
export declare const Profile: ({ user, settings, ...props }: ProfileProps) => React.JSX.Element;
|
|
5
6
|
export {};
|
|
6
7
|
//# sourceMappingURL=Profile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Profile.d.ts","sourceRoot":"","sources":["../../../../../src/features/profile/Profile.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Profile.d.ts","sourceRoot":"","sources":["../../../../../src/features/profile/Profile.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAWzB,OAAO,EAAmB,KAAK,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AACpF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAE9D,KAAK,YAAY,GAAG,mBAAmB,GAAG,gBAAgB,CAAA;AAK1D,eAAO,MAAM,OAAO,iCAAkC,YAAY,sBA8BjE,CAAA"}
|
|
@@ -1,25 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
import type { NotifyJoinClass, ProfileSettings, ProfileUser } from '../shared/profile.types';
|
|
1
|
+
import { ProfileCanvasType } from '../shared/profile.constants';
|
|
2
|
+
import type { NotifyJoinClass, ProfileGateProps, ProfileSettings } from '../shared/profile.types';
|
|
4
3
|
import { ProfileApi, type ProfileApiProps } from './ProfileApi';
|
|
5
4
|
import { ProfileJoinClassModel } from './ProfileJoinClassModel';
|
|
6
5
|
import { ProfileLanguageModel } from './ProfileLanguageModel';
|
|
7
6
|
type ProfileModelProps = {
|
|
8
7
|
api: ProfileApiProps;
|
|
9
8
|
notify: NotifyJoinClass;
|
|
10
|
-
$user: Store<ProfileUser | null>;
|
|
11
|
-
$settings: Store<ProfileSettings>;
|
|
12
9
|
};
|
|
13
10
|
export declare class ProfileModel {
|
|
11
|
+
readonly gate: import("effector-react").Gate<ProfileGateProps>;
|
|
14
12
|
readonly api: ProfileApi;
|
|
15
13
|
readonly joinClass: ProfileJoinClassModel;
|
|
16
14
|
readonly language: ProfileLanguageModel;
|
|
17
15
|
readonly setTextToSpeech: import("effector").EventCallable<boolean>;
|
|
18
16
|
readonly setTextSize: import("effector").EventCallable<number>;
|
|
19
17
|
readonly setCanvasType: import("effector").EventCallable<ProfileCanvasType>;
|
|
20
|
-
readonly $user: Store<ProfileUser | null>;
|
|
21
|
-
readonly $settings: Store<ProfileSettings>;
|
|
22
|
-
constructor({ api, notify
|
|
18
|
+
readonly $user: import("effector").Store<import("../shared/profile.types").ProfileUser | null>;
|
|
19
|
+
readonly $settings: import("effector").Store<ProfileSettings>;
|
|
20
|
+
constructor({ api, notify }: ProfileModelProps);
|
|
23
21
|
private init;
|
|
24
22
|
}
|
|
25
23
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileModel.d.ts","sourceRoot":"","sources":["../../../../../../src/features/profile/model/ProfileModel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ProfileModel.d.ts","sourceRoot":"","sources":["../../../../../../src/features/profile/model/ProfileModel.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAa,MAAM,6BAA6B,CAAA;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACjG,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAE7D,KAAK,iBAAiB,GAAG;IACvB,GAAG,EAAE,eAAe,CAAA;IACpB,MAAM,EAAE,eAAe,CAAA;CACxB,CAAA;AAWD,qBAAa,YAAY;IACvB,SAAgB,IAAI,kDAElB;IAEF,SAAgB,GAAG,EAAE,UAAU,CAAA;IAC/B,SAAgB,SAAS,EAAE,qBAAqB,CAAA;IAChD,SAAgB,QAAQ,EAAE,oBAAoB,CAAA;IAE9C,SAAgB,eAAe,4CAAyB;IACxD,SAAgB,WAAW,2CAAwB;IACnD,SAAgB,aAAa,sDAAmC;IAEhE,SAAgB,KAAK,iFAA6C;IAClE,SAAgB,SAAS,4CAAiD;gBAE9D,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,iBAAiB;IAQ9C,OAAO,CAAC,IAAI;CAmBb"}
|
|
@@ -13,6 +13,10 @@ export type ProfileSettings = {
|
|
|
13
13
|
isTranslationLocked: boolean;
|
|
14
14
|
};
|
|
15
15
|
export type ProfileSettingsUpdate = Partial<ProfileSettings>;
|
|
16
|
+
export type ProfileGateProps = {
|
|
17
|
+
user: ProfileUser | null;
|
|
18
|
+
settings: ProfileSettings;
|
|
19
|
+
};
|
|
16
20
|
export type JoinClassPayload = {
|
|
17
21
|
classCode: string;
|
|
18
22
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/profile/shared/profile.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAE1D,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAE7E,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,EAAE,OAAO,CAAA;IACrB,QAAQ,EAAE,MAAM,CAAA;IAChB,mBAAmB,EAAE,QAAQ,GAAG,IAAI,CAAA;IACpC,UAAU,EAAE,iBAAiB,CAAA;IAC7B,mBAAmB,EAAE,OAAO,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;AAE5D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,YAAY,EAAE,qBAAqB,KAAK,IAAI,CAAA"}
|
|
1
|
+
{"version":3,"file":"profile.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/profile/shared/profile.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAE1D,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAE7E,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,EAAE,OAAO,CAAA;IACrB,QAAQ,EAAE,MAAM,CAAA;IAChB,mBAAmB,EAAE,QAAQ,GAAG,IAAI,CAAA;IACpC,UAAU,EAAE,iBAAiB,CAAA;IAC7B,mBAAmB,EAAE,OAAO,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;AAE5D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,WAAW,GAAG,IAAI,CAAA;IACxB,QAAQ,EAAE,eAAe,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,YAAY,EAAE,qBAAqB,KAAK,IAAI,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type ProfileContextValue } from './context/ProfileContext';
|
|
3
|
-
type
|
|
4
|
-
|
|
3
|
+
import type { ProfileGateProps } from './shared/profile.types';
|
|
4
|
+
type ProfileProps = ProfileContextValue & ProfileGateProps;
|
|
5
|
+
export declare const Profile: ({ user, settings, ...props }: ProfileProps) => React.JSX.Element;
|
|
5
6
|
export {};
|
|
6
7
|
//# sourceMappingURL=Profile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Profile.d.ts","sourceRoot":"","sources":["../../../../../src/features/profile/Profile.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Profile.d.ts","sourceRoot":"","sources":["../../../../../src/features/profile/Profile.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAWzB,OAAO,EAAmB,KAAK,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AACpF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAE9D,KAAK,YAAY,GAAG,mBAAmB,GAAG,gBAAgB,CAAA;AAK1D,eAAO,MAAM,OAAO,iCAAkC,YAAY,sBA8BjE,CAAA"}
|
|
@@ -1,25 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
import type { NotifyJoinClass, ProfileSettings, ProfileUser } from '../shared/profile.types';
|
|
1
|
+
import { ProfileCanvasType } from '../shared/profile.constants';
|
|
2
|
+
import type { NotifyJoinClass, ProfileGateProps, ProfileSettings } from '../shared/profile.types';
|
|
4
3
|
import { ProfileApi, type ProfileApiProps } from './ProfileApi';
|
|
5
4
|
import { ProfileJoinClassModel } from './ProfileJoinClassModel';
|
|
6
5
|
import { ProfileLanguageModel } from './ProfileLanguageModel';
|
|
7
6
|
type ProfileModelProps = {
|
|
8
7
|
api: ProfileApiProps;
|
|
9
8
|
notify: NotifyJoinClass;
|
|
10
|
-
$user: Store<ProfileUser | null>;
|
|
11
|
-
$settings: Store<ProfileSettings>;
|
|
12
9
|
};
|
|
13
10
|
export declare class ProfileModel {
|
|
11
|
+
readonly gate: import("effector-react").Gate<ProfileGateProps>;
|
|
14
12
|
readonly api: ProfileApi;
|
|
15
13
|
readonly joinClass: ProfileJoinClassModel;
|
|
16
14
|
readonly language: ProfileLanguageModel;
|
|
17
15
|
readonly setTextToSpeech: import("effector").EventCallable<boolean>;
|
|
18
16
|
readonly setTextSize: import("effector").EventCallable<number>;
|
|
19
17
|
readonly setCanvasType: import("effector").EventCallable<ProfileCanvasType>;
|
|
20
|
-
readonly $user: Store<ProfileUser | null>;
|
|
21
|
-
readonly $settings: Store<ProfileSettings>;
|
|
22
|
-
constructor({ api, notify
|
|
18
|
+
readonly $user: import("effector").Store<import("../shared/profile.types").ProfileUser | null>;
|
|
19
|
+
readonly $settings: import("effector").Store<ProfileSettings>;
|
|
20
|
+
constructor({ api, notify }: ProfileModelProps);
|
|
23
21
|
private init;
|
|
24
22
|
}
|
|
25
23
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileModel.d.ts","sourceRoot":"","sources":["../../../../../../src/features/profile/model/ProfileModel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ProfileModel.d.ts","sourceRoot":"","sources":["../../../../../../src/features/profile/model/ProfileModel.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAa,MAAM,6BAA6B,CAAA;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACjG,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAE7D,KAAK,iBAAiB,GAAG;IACvB,GAAG,EAAE,eAAe,CAAA;IACpB,MAAM,EAAE,eAAe,CAAA;CACxB,CAAA;AAWD,qBAAa,YAAY;IACvB,SAAgB,IAAI,kDAElB;IAEF,SAAgB,GAAG,EAAE,UAAU,CAAA;IAC/B,SAAgB,SAAS,EAAE,qBAAqB,CAAA;IAChD,SAAgB,QAAQ,EAAE,oBAAoB,CAAA;IAE9C,SAAgB,eAAe,4CAAyB;IACxD,SAAgB,WAAW,2CAAwB;IACnD,SAAgB,aAAa,sDAAmC;IAEhE,SAAgB,KAAK,iFAA6C;IAClE,SAAgB,SAAS,4CAAiD;gBAE9D,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,iBAAiB;IAQ9C,OAAO,CAAC,IAAI;CAmBb"}
|
|
@@ -13,6 +13,10 @@ export type ProfileSettings = {
|
|
|
13
13
|
isTranslationLocked: boolean;
|
|
14
14
|
};
|
|
15
15
|
export type ProfileSettingsUpdate = Partial<ProfileSettings>;
|
|
16
|
+
export type ProfileGateProps = {
|
|
17
|
+
user: ProfileUser | null;
|
|
18
|
+
settings: ProfileSettings;
|
|
19
|
+
};
|
|
16
20
|
export type JoinClassPayload = {
|
|
17
21
|
classCode: string;
|
|
18
22
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/profile/shared/profile.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAE1D,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAE7E,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,EAAE,OAAO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IAAI,EAAE,WAAW,GAAG,IAAI,CAAA;IACxB,QAAQ,EAAE,eAAe,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,YAAY,EAAE,qBAAqB,KAAK,IAAI,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { ScrollView, StyleSheet, useWindowDimensions, View } from 'react-native'
|
|
3
|
+
import { useGate } from 'effector-react'
|
|
3
4
|
import { COLORS, SPACING } from '@magmamath/react-native-ui'
|
|
4
5
|
|
|
5
6
|
import { isWeb } from '../../shared/common.constants'
|
|
@@ -9,17 +10,20 @@ import { LanguageSettingsCard } from './components/settings/LanguageSettingsCard
|
|
|
9
10
|
import { PreferencesCard } from './components/settings/PreferencesCard'
|
|
10
11
|
import { TextSettingsCard } from './components/settings/TextSettingsCard'
|
|
11
12
|
import { ProfileProvider, type ProfileContextValue } from './context/ProfileContext'
|
|
13
|
+
import type { ProfileGateProps } from './shared/profile.types'
|
|
12
14
|
|
|
13
|
-
type ProfileProps = ProfileContextValue
|
|
15
|
+
type ProfileProps = ProfileContextValue & ProfileGateProps
|
|
14
16
|
|
|
15
17
|
const TWO_COLUMN_BREAKPOINT = 768
|
|
16
18
|
const COLUMN_MAX_WIDTH = 560
|
|
17
19
|
|
|
18
|
-
export const Profile = (props: ProfileProps) => {
|
|
19
|
-
const { showSolveMode, versionInfo } = props
|
|
20
|
+
export const Profile = ({ user, settings, ...props }: ProfileProps) => {
|
|
21
|
+
const { model, showSolveMode, versionInfo } = props
|
|
20
22
|
const { width } = useWindowDimensions()
|
|
21
23
|
const isTwoColumn = width >= TWO_COLUMN_BREAKPOINT
|
|
22
24
|
|
|
25
|
+
useGate(model.gate, { user, settings })
|
|
26
|
+
|
|
23
27
|
return (
|
|
24
28
|
<ProfileProvider value={props}>
|
|
25
29
|
<ScrollView
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createStore } from 'effector'
|
|
2
1
|
import { Language } from '@magmamath/frontend-config'
|
|
3
2
|
|
|
4
3
|
import { JoinClassError } from '../shared/JoinClassError'
|
|
@@ -20,8 +19,6 @@ const createModel = (joinClass = jest.fn<Promise<JoinClassResult>, [unknown]>().
|
|
|
20
19
|
const model = new ProfileModel({
|
|
21
20
|
api: { updateSettings, joinClass },
|
|
22
21
|
notify,
|
|
23
|
-
$user: createStore<ProfileUser | null>(null),
|
|
24
|
-
$settings: createStore<ProfileSettings>(baseSettings),
|
|
25
22
|
})
|
|
26
23
|
return { model, updateSettings, joinClass, notify }
|
|
27
24
|
}
|
|
@@ -56,6 +53,14 @@ describe('ProfileModel settings', () => {
|
|
|
56
53
|
model.language.setSearch('french')
|
|
57
54
|
expect(model.language.$languages.getState()).toEqual([Language.FRENCH])
|
|
58
55
|
})
|
|
56
|
+
|
|
57
|
+
it('derives user and settings from the gate', () => {
|
|
58
|
+
const { model } = createModel()
|
|
59
|
+
const user: ProfileUser = { fullName: 'Ada', username: 'ada', schoolName: 'Magma' }
|
|
60
|
+
model.gate.open({ user, settings: baseSettings })
|
|
61
|
+
expect(model.$user.getState()).toEqual(user)
|
|
62
|
+
expect(model.$settings.getState()).toEqual(baseSettings)
|
|
63
|
+
})
|
|
59
64
|
})
|
|
60
65
|
|
|
61
66
|
describe('ProfileModel join class', () => {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { createEvent, sample
|
|
1
|
+
import { createEvent, sample } from 'effector'
|
|
2
|
+
import { createGate } from 'effector-react'
|
|
2
3
|
|
|
3
|
-
import
|
|
4
|
-
import type { NotifyJoinClass,
|
|
4
|
+
import { ProfileCanvasType, TEXT_SIZE } from '../shared/profile.constants'
|
|
5
|
+
import type { NotifyJoinClass, ProfileGateProps, ProfileSettings } from '../shared/profile.types'
|
|
5
6
|
import { ProfileApi, type ProfileApiProps } from './ProfileApi'
|
|
6
7
|
import { ProfileJoinClassModel } from './ProfileJoinClassModel'
|
|
7
8
|
import { ProfileLanguageModel } from './ProfileLanguageModel'
|
|
@@ -9,11 +10,22 @@ import { ProfileLanguageModel } from './ProfileLanguageModel'
|
|
|
9
10
|
type ProfileModelProps = {
|
|
10
11
|
api: ProfileApiProps
|
|
11
12
|
notify: NotifyJoinClass
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Shown until the gate opens with the consumer's real values on mount.
|
|
16
|
+
const DEFAULT_SETTINGS: ProfileSettings = {
|
|
17
|
+
textToSpeech: false,
|
|
18
|
+
textSize: TEXT_SIZE.MIN,
|
|
19
|
+
translationLanguage: null,
|
|
20
|
+
canvasType: ProfileCanvasType.DRAWING,
|
|
21
|
+
isTranslationLocked: false,
|
|
14
22
|
}
|
|
15
23
|
|
|
16
24
|
export class ProfileModel {
|
|
25
|
+
public readonly gate = createGate<ProfileGateProps>({
|
|
26
|
+
defaultState: { user: null, settings: DEFAULT_SETTINGS },
|
|
27
|
+
})
|
|
28
|
+
|
|
17
29
|
public readonly api: ProfileApi
|
|
18
30
|
public readonly joinClass: ProfileJoinClassModel
|
|
19
31
|
public readonly language: ProfileLanguageModel
|
|
@@ -22,15 +34,13 @@ export class ProfileModel {
|
|
|
22
34
|
public readonly setTextSize = createEvent<number>()
|
|
23
35
|
public readonly setCanvasType = createEvent<ProfileCanvasType>()
|
|
24
36
|
|
|
25
|
-
public readonly $user
|
|
26
|
-
public readonly $settings
|
|
37
|
+
public readonly $user = this.gate.state.map((state) => state.user)
|
|
38
|
+
public readonly $settings = this.gate.state.map((state) => state.settings)
|
|
27
39
|
|
|
28
|
-
constructor({ api, notify
|
|
40
|
+
constructor({ api, notify }: ProfileModelProps) {
|
|
29
41
|
this.api = new ProfileApi(api)
|
|
30
42
|
this.joinClass = new ProfileJoinClassModel(this.api, notify)
|
|
31
43
|
this.language = new ProfileLanguageModel(this.api)
|
|
32
|
-
this.$user = $user
|
|
33
|
-
this.$settings = $settings
|
|
34
44
|
|
|
35
45
|
this.init()
|
|
36
46
|
}
|
|
@@ -18,6 +18,11 @@ export type ProfileSettings = {
|
|
|
18
18
|
|
|
19
19
|
export type ProfileSettingsUpdate = Partial<ProfileSettings>
|
|
20
20
|
|
|
21
|
+
export type ProfileGateProps = {
|
|
22
|
+
user: ProfileUser | null
|
|
23
|
+
settings: ProfileSettings
|
|
24
|
+
}
|
|
25
|
+
|
|
21
26
|
export type JoinClassPayload = {
|
|
22
27
|
classCode: string
|
|
23
28
|
}
|