@magmamath/students-features 1.8.4-rc.9 → 1.8.4
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/pmProgress/shared/TreeNormalizer.js +5 -1
- package/dist/commonjs/features/pmProgress/shared/TreeNormalizer.js.map +1 -1
- package/dist/commonjs/features/uiMode/index.js +7 -0
- package/dist/commonjs/features/uiMode/index.js.map +1 -1
- package/dist/commonjs/features/uiMode/uiMode.helpers.js +7 -2
- package/dist/commonjs/features/uiMode/uiMode.helpers.js.map +1 -1
- package/dist/commonjs/index.js +0 -12
- package/dist/commonjs/index.js.map +1 -1
- package/dist/module/features/pmProgress/shared/TreeNormalizer.js +5 -1
- package/dist/module/features/pmProgress/shared/TreeNormalizer.js.map +1 -1
- package/dist/module/features/uiMode/index.js +1 -0
- package/dist/module/features/uiMode/index.js.map +1 -1
- package/dist/module/features/uiMode/uiMode.helpers.js +6 -1
- package/dist/module/features/uiMode/uiMode.helpers.js.map +1 -1
- package/dist/module/index.js +0 -1
- package/dist/module/index.js.map +1 -1
- package/dist/module/shared/icons/ArrowRightIcon.js.map +1 -0
- package/dist/module/shared/icons/CloseIcon.js.map +1 -0
- package/dist/module/shared/icons/ExcitedLavaIcon.js.map +1 -0
- package/dist/typescript/commonjs/features/pmProgress/shared/TreeNormalizer.d.ts +4 -0
- package/dist/typescript/commonjs/features/pmProgress/shared/TreeNormalizer.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/uiMode/index.d.ts +1 -0
- package/dist/typescript/commonjs/features/uiMode/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/uiMode/uiMode.helpers.d.ts +2 -0
- package/dist/typescript/commonjs/features/uiMode/uiMode.helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/index.d.ts +0 -1
- package/dist/typescript/commonjs/index.d.ts.map +1 -1
- package/dist/typescript/module/features/pmProgress/shared/TreeNormalizer.d.ts +4 -0
- package/dist/typescript/module/features/pmProgress/shared/TreeNormalizer.d.ts.map +1 -1
- package/dist/typescript/module/features/uiMode/index.d.ts +1 -0
- package/dist/typescript/module/features/uiMode/index.d.ts.map +1 -1
- package/dist/typescript/module/features/uiMode/uiMode.helpers.d.ts +2 -0
- package/dist/typescript/module/features/uiMode/uiMode.helpers.d.ts.map +1 -1
- package/dist/typescript/module/index.d.ts +0 -1
- package/dist/typescript/module/index.d.ts.map +1 -1
- package/package.json +2 -5
- package/src/features/pmProgress/shared/TreeNormalizer.ts +5 -1
- package/src/features/uiMode/__tests__/getUIMode.test.ts +64 -0
- package/src/features/uiMode/index.ts +1 -0
- package/src/features/uiMode/uiMode.helpers.ts +16 -1
- package/src/i18n/.generated/schema.json +1 -9
- package/src/index.ts +0 -1
- package/dist/commonjs/features/profile/Profile.js +0 -90
- package/dist/commonjs/features/profile/Profile.js.map +0 -1
- package/dist/commonjs/features/profile/components/actions/ProfileActions.js +0 -67
- package/dist/commonjs/features/profile/components/actions/ProfileActions.js.map +0 -1
- package/dist/commonjs/features/profile/components/cards/ProfileCard.js +0 -57
- package/dist/commonjs/features/profile/components/cards/ProfileCard.js.map +0 -1
- package/dist/commonjs/features/profile/components/info/AccountInfoCard.js +0 -90
- package/dist/commonjs/features/profile/components/info/AccountInfoCard.js.map +0 -1
- package/dist/commonjs/features/profile/components/modals/JoinClassModal.js +0 -154
- package/dist/commonjs/features/profile/components/modals/JoinClassModal.js.map +0 -1
- package/dist/commonjs/features/profile/components/modals/LogoutConfirmModal.js +0 -61
- package/dist/commonjs/features/profile/components/modals/LogoutConfirmModal.js.map +0 -1
- package/dist/commonjs/features/profile/components/modals/TranslationLanguageModal.js +0 -126
- package/dist/commonjs/features/profile/components/modals/TranslationLanguageModal.js.map +0 -1
- package/dist/commonjs/features/profile/components/settings/LanguageSettingsCard.js +0 -22
- package/dist/commonjs/features/profile/components/settings/LanguageSettingsCard.js.map +0 -1
- package/dist/commonjs/features/profile/components/settings/PreferencesCard.js +0 -70
- package/dist/commonjs/features/profile/components/settings/PreferencesCard.js.map +0 -1
- package/dist/commonjs/features/profile/components/settings/SettingRow.js +0 -48
- package/dist/commonjs/features/profile/components/settings/SettingRow.js.map +0 -1
- package/dist/commonjs/features/profile/components/settings/TextSettingsCard.js +0 -74
- package/dist/commonjs/features/profile/components/settings/TextSettingsCard.js.map +0 -1
- package/dist/commonjs/features/profile/components/settings/TextSizeSlider.js +0 -116
- package/dist/commonjs/features/profile/components/settings/TextSizeSlider.js.map +0 -1
- package/dist/commonjs/features/profile/components/settings/TextToSpeechRow.js +0 -35
- package/dist/commonjs/features/profile/components/settings/TextToSpeechRow.js.map +0 -1
- package/dist/commonjs/features/profile/components/settings/TranslationLanguageRow.js +0 -60
- package/dist/commonjs/features/profile/components/settings/TranslationLanguageRow.js.map +0 -1
- package/dist/commonjs/features/profile/context/ProfileContext.js +0 -18
- package/dist/commonjs/features/profile/context/ProfileContext.js.map +0 -1
- package/dist/commonjs/features/profile/index.js +0 -80
- package/dist/commonjs/features/profile/index.js.map +0 -1
- package/dist/commonjs/features/profile/model/ProfileApi.js +0 -15
- package/dist/commonjs/features/profile/model/ProfileApi.js.map +0 -1
- package/dist/commonjs/features/profile/model/ProfileJoinClassModel.js +0 -60
- package/dist/commonjs/features/profile/model/ProfileJoinClassModel.js.map +0 -1
- package/dist/commonjs/features/profile/model/ProfileLanguageModel.js +0 -30
- package/dist/commonjs/features/profile/model/ProfileLanguageModel.js.map +0 -1
- package/dist/commonjs/features/profile/model/ProfileModel.js +0 -53
- package/dist/commonjs/features/profile/model/ProfileModel.js.map +0 -1
- package/dist/commonjs/features/profile/model/profileModal.types.js +0 -6
- package/dist/commonjs/features/profile/model/profileModal.types.js.map +0 -1
- package/dist/commonjs/features/profile/shared/JoinClassError.js +0 -16
- package/dist/commonjs/features/profile/shared/JoinClassError.js.map +0 -1
- package/dist/commonjs/features/profile/shared/profile.constants.js +0 -29
- package/dist/commonjs/features/profile/shared/profile.constants.js.map +0 -1
- package/dist/commonjs/features/profile/shared/profile.helpers.js +0 -40
- package/dist/commonjs/features/profile/shared/profile.helpers.js.map +0 -1
- package/dist/commonjs/features/profile/shared/profile.types.js +0 -6
- package/dist/commonjs/features/profile/shared/profile.types.js.map +0 -1
- package/dist/module/features/profile/Profile.js +0 -84
- package/dist/module/features/profile/Profile.js.map +0 -1
- package/dist/module/features/profile/components/actions/ProfileActions.js +0 -61
- package/dist/module/features/profile/components/actions/ProfileActions.js.map +0 -1
- package/dist/module/features/profile/components/cards/ProfileCard.js +0 -51
- package/dist/module/features/profile/components/cards/ProfileCard.js.map +0 -1
- package/dist/module/features/profile/components/info/AccountInfoCard.js +0 -84
- package/dist/module/features/profile/components/info/AccountInfoCard.js.map +0 -1
- package/dist/module/features/profile/components/modals/JoinClassModal.js +0 -147
- package/dist/module/features/profile/components/modals/JoinClassModal.js.map +0 -1
- package/dist/module/features/profile/components/modals/LogoutConfirmModal.js +0 -55
- package/dist/module/features/profile/components/modals/LogoutConfirmModal.js.map +0 -1
- package/dist/module/features/profile/components/modals/TranslationLanguageModal.js +0 -120
- package/dist/module/features/profile/components/modals/TranslationLanguageModal.js.map +0 -1
- package/dist/module/features/profile/components/settings/LanguageSettingsCard.js +0 -16
- package/dist/module/features/profile/components/settings/LanguageSettingsCard.js.map +0 -1
- package/dist/module/features/profile/components/settings/PreferencesCard.js +0 -64
- package/dist/module/features/profile/components/settings/PreferencesCard.js.map +0 -1
- package/dist/module/features/profile/components/settings/SettingRow.js +0 -42
- package/dist/module/features/profile/components/settings/SettingRow.js.map +0 -1
- package/dist/module/features/profile/components/settings/TextSettingsCard.js +0 -68
- package/dist/module/features/profile/components/settings/TextSettingsCard.js.map +0 -1
- package/dist/module/features/profile/components/settings/TextSizeSlider.js +0 -109
- package/dist/module/features/profile/components/settings/TextSizeSlider.js.map +0 -1
- package/dist/module/features/profile/components/settings/TextToSpeechRow.js +0 -29
- package/dist/module/features/profile/components/settings/TextToSpeechRow.js.map +0 -1
- package/dist/module/features/profile/components/settings/TranslationLanguageRow.js +0 -54
- package/dist/module/features/profile/components/settings/TranslationLanguageRow.js.map +0 -1
- package/dist/module/features/profile/context/ProfileContext.js +0 -13
- package/dist/module/features/profile/context/ProfileContext.js.map +0 -1
- package/dist/module/features/profile/index.js +0 -11
- package/dist/module/features/profile/index.js.map +0 -1
- package/dist/module/features/profile/model/ProfileApi.js +0 -10
- package/dist/module/features/profile/model/ProfileApi.js.map +0 -1
- package/dist/module/features/profile/model/ProfileJoinClassModel.js +0 -55
- package/dist/module/features/profile/model/ProfileJoinClassModel.js.map +0 -1
- package/dist/module/features/profile/model/ProfileLanguageModel.js +0 -25
- package/dist/module/features/profile/model/ProfileLanguageModel.js.map +0 -1
- package/dist/module/features/profile/model/ProfileModel.js +0 -48
- package/dist/module/features/profile/model/ProfileModel.js.map +0 -1
- package/dist/module/features/profile/model/profileModal.types.js +0 -4
- package/dist/module/features/profile/model/profileModal.types.js.map +0 -1
- package/dist/module/features/profile/shared/JoinClassError.js +0 -11
- package/dist/module/features/profile/shared/JoinClassError.js.map +0 -1
- package/dist/module/features/profile/shared/profile.constants.js +0 -25
- package/dist/module/features/profile/shared/profile.constants.js.map +0 -1
- package/dist/module/features/profile/shared/profile.helpers.js +0 -32
- package/dist/module/features/profile/shared/profile.helpers.js.map +0 -1
- package/dist/module/features/profile/shared/profile.types.js +0 -4
- package/dist/module/features/profile/shared/profile.types.js.map +0 -1
- package/dist/typescript/commonjs/features/profile/Profile.d.ts +0 -6
- package/dist/typescript/commonjs/features/profile/Profile.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/profile/__tests__/ProfileModel.test.d.ts +0 -2
- package/dist/typescript/commonjs/features/profile/__tests__/ProfileModel.test.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/profile/__tests__/profile.helpers.test.d.ts +0 -2
- package/dist/typescript/commonjs/features/profile/__tests__/profile.helpers.test.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/profile/components/actions/ProfileActions.d.ts +0 -3
- package/dist/typescript/commonjs/features/profile/components/actions/ProfileActions.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/profile/components/cards/ProfileCard.d.ts +0 -10
- package/dist/typescript/commonjs/features/profile/components/cards/ProfileCard.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/profile/components/info/AccountInfoCard.d.ts +0 -3
- package/dist/typescript/commonjs/features/profile/components/info/AccountInfoCard.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/profile/components/modals/JoinClassModal.d.ts +0 -4
- package/dist/typescript/commonjs/features/profile/components/modals/JoinClassModal.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/profile/components/modals/LogoutConfirmModal.d.ts +0 -4
- package/dist/typescript/commonjs/features/profile/components/modals/LogoutConfirmModal.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/profile/components/modals/TranslationLanguageModal.d.ts +0 -4
- package/dist/typescript/commonjs/features/profile/components/modals/TranslationLanguageModal.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/profile/components/settings/LanguageSettingsCard.d.ts +0 -3
- package/dist/typescript/commonjs/features/profile/components/settings/LanguageSettingsCard.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/profile/components/settings/PreferencesCard.d.ts +0 -3
- package/dist/typescript/commonjs/features/profile/components/settings/PreferencesCard.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/profile/components/settings/SettingRow.d.ts +0 -11
- package/dist/typescript/commonjs/features/profile/components/settings/SettingRow.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/profile/components/settings/TextSettingsCard.d.ts +0 -3
- package/dist/typescript/commonjs/features/profile/components/settings/TextSettingsCard.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/profile/components/settings/TextSizeSlider.d.ts +0 -8
- package/dist/typescript/commonjs/features/profile/components/settings/TextSizeSlider.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/profile/components/settings/TextToSpeechRow.d.ts +0 -3
- package/dist/typescript/commonjs/features/profile/components/settings/TextToSpeechRow.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/profile/components/settings/TranslationLanguageRow.d.ts +0 -3
- package/dist/typescript/commonjs/features/profile/components/settings/TranslationLanguageRow.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/profile/context/ProfileContext.d.ts +0 -13
- package/dist/typescript/commonjs/features/profile/context/ProfileContext.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/profile/index.d.ts +0 -12
- package/dist/typescript/commonjs/features/profile/index.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/profile/model/ProfileApi.d.ts +0 -11
- package/dist/typescript/commonjs/features/profile/model/ProfileApi.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/profile/model/ProfileJoinClassModel.d.ts +0 -14
- package/dist/typescript/commonjs/features/profile/model/ProfileJoinClassModel.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/profile/model/ProfileLanguageModel.d.ts +0 -13
- package/dist/typescript/commonjs/features/profile/model/ProfileLanguageModel.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/profile/model/ProfileModel.d.ts +0 -26
- package/dist/typescript/commonjs/features/profile/model/ProfileModel.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/profile/model/profileModal.types.d.ts +0 -14
- package/dist/typescript/commonjs/features/profile/model/profileModal.types.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/profile/shared/JoinClassError.d.ts +0 -5
- package/dist/typescript/commonjs/features/profile/shared/JoinClassError.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/profile/shared/profile.constants.d.ts +0 -20
- package/dist/typescript/commonjs/features/profile/shared/profile.constants.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/profile/shared/profile.helpers.d.ts +0 -6
- package/dist/typescript/commonjs/features/profile/shared/profile.helpers.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/profile/shared/profile.types.d.ts +0 -27
- package/dist/typescript/commonjs/features/profile/shared/profile.types.d.ts.map +0 -1
- package/dist/typescript/module/features/profile/Profile.d.ts +0 -6
- package/dist/typescript/module/features/profile/Profile.d.ts.map +0 -1
- package/dist/typescript/module/features/profile/__tests__/ProfileModel.test.d.ts +0 -2
- package/dist/typescript/module/features/profile/__tests__/ProfileModel.test.d.ts.map +0 -1
- package/dist/typescript/module/features/profile/__tests__/profile.helpers.test.d.ts +0 -2
- package/dist/typescript/module/features/profile/__tests__/profile.helpers.test.d.ts.map +0 -1
- package/dist/typescript/module/features/profile/components/actions/ProfileActions.d.ts +0 -3
- package/dist/typescript/module/features/profile/components/actions/ProfileActions.d.ts.map +0 -1
- package/dist/typescript/module/features/profile/components/cards/ProfileCard.d.ts +0 -10
- package/dist/typescript/module/features/profile/components/cards/ProfileCard.d.ts.map +0 -1
- package/dist/typescript/module/features/profile/components/info/AccountInfoCard.d.ts +0 -3
- package/dist/typescript/module/features/profile/components/info/AccountInfoCard.d.ts.map +0 -1
- package/dist/typescript/module/features/profile/components/modals/JoinClassModal.d.ts +0 -4
- package/dist/typescript/module/features/profile/components/modals/JoinClassModal.d.ts.map +0 -1
- package/dist/typescript/module/features/profile/components/modals/LogoutConfirmModal.d.ts +0 -4
- package/dist/typescript/module/features/profile/components/modals/LogoutConfirmModal.d.ts.map +0 -1
- package/dist/typescript/module/features/profile/components/modals/TranslationLanguageModal.d.ts +0 -4
- package/dist/typescript/module/features/profile/components/modals/TranslationLanguageModal.d.ts.map +0 -1
- package/dist/typescript/module/features/profile/components/settings/LanguageSettingsCard.d.ts +0 -3
- package/dist/typescript/module/features/profile/components/settings/LanguageSettingsCard.d.ts.map +0 -1
- package/dist/typescript/module/features/profile/components/settings/PreferencesCard.d.ts +0 -3
- package/dist/typescript/module/features/profile/components/settings/PreferencesCard.d.ts.map +0 -1
- package/dist/typescript/module/features/profile/components/settings/SettingRow.d.ts +0 -11
- package/dist/typescript/module/features/profile/components/settings/SettingRow.d.ts.map +0 -1
- package/dist/typescript/module/features/profile/components/settings/TextSettingsCard.d.ts +0 -3
- package/dist/typescript/module/features/profile/components/settings/TextSettingsCard.d.ts.map +0 -1
- package/dist/typescript/module/features/profile/components/settings/TextSizeSlider.d.ts +0 -8
- package/dist/typescript/module/features/profile/components/settings/TextSizeSlider.d.ts.map +0 -1
- package/dist/typescript/module/features/profile/components/settings/TextToSpeechRow.d.ts +0 -3
- package/dist/typescript/module/features/profile/components/settings/TextToSpeechRow.d.ts.map +0 -1
- package/dist/typescript/module/features/profile/components/settings/TranslationLanguageRow.d.ts +0 -3
- package/dist/typescript/module/features/profile/components/settings/TranslationLanguageRow.d.ts.map +0 -1
- package/dist/typescript/module/features/profile/context/ProfileContext.d.ts +0 -13
- package/dist/typescript/module/features/profile/context/ProfileContext.d.ts.map +0 -1
- package/dist/typescript/module/features/profile/index.d.ts +0 -12
- package/dist/typescript/module/features/profile/index.d.ts.map +0 -1
- package/dist/typescript/module/features/profile/model/ProfileApi.d.ts +0 -11
- package/dist/typescript/module/features/profile/model/ProfileApi.d.ts.map +0 -1
- package/dist/typescript/module/features/profile/model/ProfileJoinClassModel.d.ts +0 -14
- package/dist/typescript/module/features/profile/model/ProfileJoinClassModel.d.ts.map +0 -1
- package/dist/typescript/module/features/profile/model/ProfileLanguageModel.d.ts +0 -13
- package/dist/typescript/module/features/profile/model/ProfileLanguageModel.d.ts.map +0 -1
- package/dist/typescript/module/features/profile/model/ProfileModel.d.ts +0 -26
- package/dist/typescript/module/features/profile/model/ProfileModel.d.ts.map +0 -1
- package/dist/typescript/module/features/profile/model/profileModal.types.d.ts +0 -14
- package/dist/typescript/module/features/profile/model/profileModal.types.d.ts.map +0 -1
- package/dist/typescript/module/features/profile/shared/JoinClassError.d.ts +0 -5
- package/dist/typescript/module/features/profile/shared/JoinClassError.d.ts.map +0 -1
- package/dist/typescript/module/features/profile/shared/profile.constants.d.ts +0 -20
- package/dist/typescript/module/features/profile/shared/profile.constants.d.ts.map +0 -1
- package/dist/typescript/module/features/profile/shared/profile.helpers.d.ts +0 -6
- package/dist/typescript/module/features/profile/shared/profile.helpers.d.ts.map +0 -1
- package/dist/typescript/module/features/profile/shared/profile.types.d.ts +0 -27
- package/dist/typescript/module/features/profile/shared/profile.types.d.ts.map +0 -1
- package/src/features/profile/Profile.tsx +0 -83
- package/src/features/profile/__tests__/ProfileModel.test.ts +0 -99
- package/src/features/profile/__tests__/profile.helpers.test.ts +0 -57
- package/src/features/profile/components/actions/ProfileActions.tsx +0 -65
- package/src/features/profile/components/cards/ProfileCard.tsx +0 -53
- package/src/features/profile/components/info/AccountInfoCard.tsx +0 -73
- package/src/features/profile/components/modals/JoinClassModal.tsx +0 -145
- package/src/features/profile/components/modals/LogoutConfirmModal.tsx +0 -64
- package/src/features/profile/components/modals/TranslationLanguageModal.tsx +0 -124
- package/src/features/profile/components/settings/LanguageSettingsCard.tsx +0 -16
- package/src/features/profile/components/settings/PreferencesCard.tsx +0 -68
- package/src/features/profile/components/settings/SettingRow.tsx +0 -42
- package/src/features/profile/components/settings/TextSettingsCard.tsx +0 -61
- package/src/features/profile/components/settings/TextSizeSlider.tsx +0 -110
- package/src/features/profile/components/settings/TextToSpeechRow.tsx +0 -24
- package/src/features/profile/components/settings/TranslationLanguageRow.tsx +0 -58
- package/src/features/profile/context/ProfileContext.tsx +0 -24
- package/src/features/profile/index.ts +0 -11
- package/src/features/profile/model/ProfileApi.ts +0 -23
- package/src/features/profile/model/ProfileJoinClassModel.ts +0 -58
- package/src/features/profile/model/ProfileLanguageModel.ts +0 -26
- package/src/features/profile/model/ProfileModel.ts +0 -57
- package/src/features/profile/model/profileModal.types.ts +0 -16
- package/src/features/profile/shared/JoinClassError.ts +0 -7
- package/src/features/profile/shared/profile.constants.ts +0 -23
- package/src/features/profile/shared/profile.helpers.ts +0 -36
- package/src/features/profile/shared/profile.types.ts +0 -34
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { type Store } from 'effector';
|
|
2
|
-
import type { ProfileCanvasType } from '../shared/profile.constants';
|
|
3
|
-
import type { NotifyJoinClass, ProfileSettings, ProfileUser } from '../shared/profile.types';
|
|
4
|
-
import { ProfileApi, type ProfileApiProps } from './ProfileApi';
|
|
5
|
-
import { ProfileJoinClassModel } from './ProfileJoinClassModel';
|
|
6
|
-
import { ProfileLanguageModel } from './ProfileLanguageModel';
|
|
7
|
-
type ProfileModelProps = {
|
|
8
|
-
api: ProfileApiProps;
|
|
9
|
-
notify: NotifyJoinClass;
|
|
10
|
-
$user: Store<ProfileUser | null>;
|
|
11
|
-
$settings: Store<ProfileSettings>;
|
|
12
|
-
};
|
|
13
|
-
export declare class ProfileModel {
|
|
14
|
-
readonly api: ProfileApi;
|
|
15
|
-
readonly joinClass: ProfileJoinClassModel;
|
|
16
|
-
readonly language: ProfileLanguageModel;
|
|
17
|
-
readonly setTextToSpeech: import("effector").EventCallable<boolean>;
|
|
18
|
-
readonly setTextSize: import("effector").EventCallable<number>;
|
|
19
|
-
readonly setCanvasType: import("effector").EventCallable<ProfileCanvasType>;
|
|
20
|
-
readonly $user: Store<ProfileUser | null>;
|
|
21
|
-
readonly $settings: Store<ProfileSettings>;
|
|
22
|
-
constructor({ api, notify, $user, $settings }: ProfileModelProps);
|
|
23
|
-
private init;
|
|
24
|
-
}
|
|
25
|
-
export {};
|
|
26
|
-
//# sourceMappingURL=ProfileModel.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ProfileModel.d.ts","sourceRoot":"","sources":["../../../../../../src/features/profile/model/ProfileModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,KAAK,EAAE,MAAM,UAAU,CAAA;AAE1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC5F,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;IACvB,KAAK,EAAE,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAChC,SAAS,EAAE,KAAK,CAAC,eAAe,CAAC,CAAA;CAClC,CAAA;AAED,qBAAa,YAAY;IACvB,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,EAAE,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAChD,SAAgB,SAAS,EAAE,KAAK,CAAC,eAAe,CAAC,CAAA;gBAErC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,iBAAiB;IAUhE,OAAO,CAAC,IAAI;CAmBb"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { ProfileModel } from './ProfileModel';
|
|
2
|
-
export type ProfileModalParams = {
|
|
3
|
-
model: ProfileModel;
|
|
4
|
-
};
|
|
5
|
-
export type LogoutModalParams = {
|
|
6
|
-
onConfirm: () => void;
|
|
7
|
-
};
|
|
8
|
-
export type ProfileModalProps<Params = ProfileModalParams> = {
|
|
9
|
-
modal: {
|
|
10
|
-
closeModal: () => void;
|
|
11
|
-
params: Params;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=profileModal.types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profileModal.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/profile/model/profileModal.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,YAAY,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,IAAI,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,iBAAiB,CAAC,MAAM,GAAG,kBAAkB,IAAI;IAC3D,KAAK,EAAE;QACL,UAAU,EAAE,MAAM,IAAI,CAAA;QACtB,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;CACF,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JoinClassError.d.ts","sourceRoot":"","sources":["../../../../../../src/features/profile/shared/JoinClassError.ts"],"names":[],"mappings":"AACA,qBAAa,cAAe,SAAQ,KAAK;aACX,IAAI,EAAE,MAAM,GAAG,IAAI;gBAAnB,IAAI,EAAE,MAAM,GAAG,IAAI;CAIhD"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare enum ProfileCanvasType {
|
|
2
|
-
DRAWING = 1,
|
|
3
|
-
SPREADSHEET = 2
|
|
4
|
-
}
|
|
5
|
-
export declare const TEXT_SIZE: {
|
|
6
|
-
readonly MIN: 16;
|
|
7
|
-
readonly MAX: 32;
|
|
8
|
-
readonly STEP: 4;
|
|
9
|
-
};
|
|
10
|
-
export declare const CLASS_CODE_LENGTH = 6;
|
|
11
|
-
export declare enum JoinClassStatus {
|
|
12
|
-
SUCCESS = "success",
|
|
13
|
-
ERROR = "error"
|
|
14
|
-
}
|
|
15
|
-
export declare enum JoinClassErrorCode {
|
|
16
|
-
CLASS_NOT_FOUND = 1021,
|
|
17
|
-
ALREADY_JOINED = 1030,
|
|
18
|
-
OTHER_DISTRICT = 1035
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=profile.constants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profile.constants.d.ts","sourceRoot":"","sources":["../../../../../../src/features/profile/shared/profile.constants.ts"],"names":[],"mappings":"AAAA,oBAAY,iBAAiB;IAC3B,OAAO,IAAI;IACX,WAAW,IAAI;CAChB;AAED,eAAO,MAAM,SAAS;;;;CAIZ,CAAA;AAEV,eAAO,MAAM,iBAAiB,IAAI,CAAA;AAElC,oBAAY,eAAe;IACzB,OAAO,YAAY;IACnB,KAAK,UAAU;CAChB;AAED,oBAAY,kBAAkB;IAC5B,eAAe,OAAO;IACtB,cAAc,OAAO;IACrB,cAAc,OAAO;CACtB"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Language } from '@magmamath/frontend-config';
|
|
2
|
-
export declare const getAvailableLanguages: (search?: string) => Language[];
|
|
3
|
-
export declare const snapTextSize: (value: number) => number;
|
|
4
|
-
export declare const getJoinClassSuccessMessage: (className: string) => string;
|
|
5
|
-
export declare const getJoinClassErrorMessage: (code: number | null) => string;
|
|
6
|
-
//# sourceMappingURL=profile.helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profile.helpers.d.ts","sourceRoot":"","sources":["../../../../../../src/features/profile/shared/profile.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAwC,MAAM,4BAA4B,CAAA;AAK3F,eAAO,MAAM,qBAAqB,YAAa,MAAM,KAAG,QAAQ,EAY/D,CAAA;AAED,eAAO,MAAM,YAAY,UAAW,MAAM,KAAG,MAI5C,CAAA;AAQD,eAAO,MAAM,0BAA0B,cAAe,MAAM,KAAG,MACX,CAAA;AAEpD,eAAO,MAAM,wBAAwB,SAAU,MAAM,GAAG,IAAI,KAAG,MAC6B,CAAA"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { Language } from '@magmamath/frontend-config';
|
|
2
|
-
import type { JoinClassStatus, ProfileCanvasType } from './profile.constants';
|
|
3
|
-
export type ProfileUser = {
|
|
4
|
-
fullName: string;
|
|
5
|
-
username: string;
|
|
6
|
-
schoolName: string;
|
|
7
|
-
};
|
|
8
|
-
export type ProfileSettings = {
|
|
9
|
-
textToSpeech: boolean;
|
|
10
|
-
textSize: number;
|
|
11
|
-
translationLanguage: Language | null;
|
|
12
|
-
canvasType: ProfileCanvasType;
|
|
13
|
-
isTranslationLocked: boolean;
|
|
14
|
-
};
|
|
15
|
-
export type ProfileSettingsUpdate = Partial<ProfileSettings>;
|
|
16
|
-
export type JoinClassPayload = {
|
|
17
|
-
classCode: string;
|
|
18
|
-
};
|
|
19
|
-
export type JoinClassResult = {
|
|
20
|
-
name: string;
|
|
21
|
-
};
|
|
22
|
-
export type JoinClassNotification = {
|
|
23
|
-
status: JoinClassStatus;
|
|
24
|
-
message: string;
|
|
25
|
-
};
|
|
26
|
-
export type NotifyJoinClass = (notification: JoinClassNotification) => void;
|
|
27
|
-
//# sourceMappingURL=profile.types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,83 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { ScrollView, StyleSheet, useWindowDimensions, View } from 'react-native'
|
|
3
|
-
import { COLORS, SPACING } from '@magmamath/react-native-ui'
|
|
4
|
-
|
|
5
|
-
import { isWeb } from '../../shared/common.constants'
|
|
6
|
-
import { ProfileActions } from './components/actions/ProfileActions'
|
|
7
|
-
import { AccountInfoCard } from './components/info/AccountInfoCard'
|
|
8
|
-
import { LanguageSettingsCard } from './components/settings/LanguageSettingsCard'
|
|
9
|
-
import { PreferencesCard } from './components/settings/PreferencesCard'
|
|
10
|
-
import { TextSettingsCard } from './components/settings/TextSettingsCard'
|
|
11
|
-
import { ProfileProvider, type ProfileContextValue } from './context/ProfileContext'
|
|
12
|
-
|
|
13
|
-
type ProfileProps = ProfileContextValue
|
|
14
|
-
|
|
15
|
-
const TWO_COLUMN_BREAKPOINT = 768
|
|
16
|
-
const COLUMN_MAX_WIDTH = 560
|
|
17
|
-
|
|
18
|
-
export const Profile = (props: ProfileProps) => {
|
|
19
|
-
const { showSolveMode, versionInfo } = props
|
|
20
|
-
const { width } = useWindowDimensions()
|
|
21
|
-
const isTwoColumn = width >= TWO_COLUMN_BREAKPOINT
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<ProfileProvider value={props}>
|
|
25
|
-
<ScrollView
|
|
26
|
-
style={styles.container}
|
|
27
|
-
contentContainerStyle={styles.scroll}
|
|
28
|
-
scrollEnabled={isWeb}
|
|
29
|
-
showsVerticalScrollIndicator={isWeb}
|
|
30
|
-
>
|
|
31
|
-
<View style={[styles.columns, !isTwoColumn && styles.columnsStacked]}>
|
|
32
|
-
<View style={[styles.column, isTwoColumn ? styles.columnWide : styles.columnStacked]}>
|
|
33
|
-
<LanguageSettingsCard />
|
|
34
|
-
<TextSettingsCard />
|
|
35
|
-
</View>
|
|
36
|
-
<View style={[styles.column, isTwoColumn ? styles.columnWide : styles.columnStacked]}>
|
|
37
|
-
{showSolveMode && <PreferencesCard />}
|
|
38
|
-
<AccountInfoCard />
|
|
39
|
-
</View>
|
|
40
|
-
</View>
|
|
41
|
-
<ProfileActions />
|
|
42
|
-
{versionInfo ? <View style={styles.version}>{versionInfo}</View> : null}
|
|
43
|
-
</ScrollView>
|
|
44
|
-
</ProfileProvider>
|
|
45
|
-
)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const styles = StyleSheet.create({
|
|
49
|
-
container: {
|
|
50
|
-
backgroundColor: COLORS.NEUTRAL_3,
|
|
51
|
-
flex: 1,
|
|
52
|
-
},
|
|
53
|
-
scroll: {
|
|
54
|
-
flexGrow: 1,
|
|
55
|
-
gap: SPACING['800'],
|
|
56
|
-
paddingHorizontal: SPACING['800'],
|
|
57
|
-
paddingVertical: SPACING['600'],
|
|
58
|
-
},
|
|
59
|
-
columns: {
|
|
60
|
-
flexDirection: 'row',
|
|
61
|
-
gap: SPACING['600'],
|
|
62
|
-
justifyContent: 'center',
|
|
63
|
-
width: '100%',
|
|
64
|
-
},
|
|
65
|
-
columnsStacked: {
|
|
66
|
-
alignItems: 'center',
|
|
67
|
-
flexDirection: 'column',
|
|
68
|
-
},
|
|
69
|
-
column: {
|
|
70
|
-
gap: SPACING['600'],
|
|
71
|
-
maxWidth: COLUMN_MAX_WIDTH,
|
|
72
|
-
},
|
|
73
|
-
columnWide: {
|
|
74
|
-
flex: 1,
|
|
75
|
-
},
|
|
76
|
-
columnStacked: {
|
|
77
|
-
width: '100%',
|
|
78
|
-
},
|
|
79
|
-
version: {
|
|
80
|
-
alignSelf: 'flex-end',
|
|
81
|
-
marginTop: 'auto',
|
|
82
|
-
},
|
|
83
|
-
})
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { createStore } from 'effector'
|
|
2
|
-
import { Language } from '@magmamath/frontend-config'
|
|
3
|
-
|
|
4
|
-
import { JoinClassError } from '../shared/JoinClassError'
|
|
5
|
-
import { ProfileModel } from '../model/ProfileModel'
|
|
6
|
-
import { JoinClassStatus, ProfileCanvasType } from '../shared/profile.constants'
|
|
7
|
-
import type { JoinClassResult, ProfileSettings, ProfileUser } from '../shared/profile.types'
|
|
8
|
-
|
|
9
|
-
const baseSettings: ProfileSettings = {
|
|
10
|
-
textToSpeech: false,
|
|
11
|
-
textSize: 16,
|
|
12
|
-
translationLanguage: null,
|
|
13
|
-
canvasType: ProfileCanvasType.DRAWING,
|
|
14
|
-
isTranslationLocked: false,
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const createModel = (joinClass = jest.fn<Promise<JoinClassResult>, [unknown]>().mockResolvedValue({ name: 'Math' })) => {
|
|
18
|
-
const updateSettings = jest.fn().mockResolvedValue(undefined)
|
|
19
|
-
const notify = jest.fn()
|
|
20
|
-
const model = new ProfileModel({
|
|
21
|
-
api: { updateSettings, joinClass },
|
|
22
|
-
notify,
|
|
23
|
-
$user: createStore<ProfileUser | null>(null),
|
|
24
|
-
$settings: createStore<ProfileSettings>(baseSettings),
|
|
25
|
-
})
|
|
26
|
-
return { model, updateSettings, joinClass, notify }
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
describe('ProfileModel settings', () => {
|
|
30
|
-
it('persists text-to-speech changes', () => {
|
|
31
|
-
const { model, updateSettings } = createModel()
|
|
32
|
-
model.setTextToSpeech(true)
|
|
33
|
-
expect(updateSettings).toHaveBeenCalledWith({ textToSpeech: true })
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
it('persists text size changes', () => {
|
|
37
|
-
const { model, updateSettings } = createModel()
|
|
38
|
-
model.setTextSize(24)
|
|
39
|
-
expect(updateSettings).toHaveBeenCalledWith({ textSize: 24 })
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
it('persists canvas type changes', () => {
|
|
43
|
-
const { model, updateSettings } = createModel()
|
|
44
|
-
model.setCanvasType(ProfileCanvasType.SPREADSHEET)
|
|
45
|
-
expect(updateSettings).toHaveBeenCalledWith({ canvasType: ProfileCanvasType.SPREADSHEET })
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
it('persists translation language selection', () => {
|
|
49
|
-
const { model, updateSettings } = createModel()
|
|
50
|
-
model.language.selectLanguage(Language.FRENCH)
|
|
51
|
-
expect(updateSettings).toHaveBeenCalledWith({ translationLanguage: Language.FRENCH })
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
it('filters the language list by search', () => {
|
|
55
|
-
const { model } = createModel()
|
|
56
|
-
model.language.setSearch('french')
|
|
57
|
-
expect(model.language.$languages.getState()).toEqual([Language.FRENCH])
|
|
58
|
-
})
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
describe('ProfileModel join class', () => {
|
|
62
|
-
it('ignores incomplete codes', () => {
|
|
63
|
-
const { model, joinClass } = createModel()
|
|
64
|
-
model.joinClass.setCode('ABC')
|
|
65
|
-
expect(model.joinClass.$isComplete.getState()).toBe(false)
|
|
66
|
-
model.joinClass.submit()
|
|
67
|
-
expect(joinClass).not.toHaveBeenCalled()
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
it('submits a complete code, notifies success and resets', async () => {
|
|
71
|
-
const { model, joinClass, notify } = createModel()
|
|
72
|
-
model.joinClass.setCode('ABCDEF')
|
|
73
|
-
expect(model.joinClass.$isComplete.getState()).toBe(true)
|
|
74
|
-
|
|
75
|
-
model.joinClass.submit()
|
|
76
|
-
expect(joinClass).toHaveBeenCalledWith({ classCode: 'ABCDEF' })
|
|
77
|
-
|
|
78
|
-
await new Promise((resolve) => setTimeout(resolve, 0))
|
|
79
|
-
expect(notify).toHaveBeenCalledWith(
|
|
80
|
-
expect.objectContaining({ status: JoinClassStatus.SUCCESS })
|
|
81
|
-
)
|
|
82
|
-
expect(model.joinClass.$code.getState()).toBe('')
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
it('notifies an error when the request fails', async () => {
|
|
86
|
-
const joinClass = jest
|
|
87
|
-
.fn<Promise<JoinClassResult>, [unknown]>()
|
|
88
|
-
.mockRejectedValue(new JoinClassError(1021))
|
|
89
|
-
const { model, notify } = createModel(joinClass)
|
|
90
|
-
|
|
91
|
-
model.joinClass.setCode('ABCDEF')
|
|
92
|
-
model.joinClass.submit()
|
|
93
|
-
|
|
94
|
-
await new Promise((resolve) => setTimeout(resolve, 0))
|
|
95
|
-
expect(notify).toHaveBeenCalledWith(
|
|
96
|
-
expect.objectContaining({ status: JoinClassStatus.ERROR })
|
|
97
|
-
)
|
|
98
|
-
})
|
|
99
|
-
})
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { Language } from '@magmamath/frontend-config'
|
|
2
|
-
|
|
3
|
-
import { JoinClassErrorCode } from '../shared/profile.constants'
|
|
4
|
-
import {
|
|
5
|
-
getAvailableLanguages,
|
|
6
|
-
getJoinClassErrorMessage,
|
|
7
|
-
snapTextSize,
|
|
8
|
-
} from '../shared/profile.helpers'
|
|
9
|
-
|
|
10
|
-
// Echo the key so the error-code → key mapping is observable (i18next is not
|
|
11
|
-
// initialised under jest, so the real getText returns undefined).
|
|
12
|
-
jest.mock('../../../i18n/i18n', () => ({
|
|
13
|
-
getText: (key: string) => key,
|
|
14
|
-
}))
|
|
15
|
-
|
|
16
|
-
describe('profile.helpers', () => {
|
|
17
|
-
describe('snapTextSize', () => {
|
|
18
|
-
it('snaps to the nearest step and clamps to range', () => {
|
|
19
|
-
expect(snapTextSize(16)).toBe(16)
|
|
20
|
-
expect(snapTextSize(17)).toBe(16)
|
|
21
|
-
expect(snapTextSize(18)).toBe(20)
|
|
22
|
-
expect(snapTextSize(33)).toBe(32)
|
|
23
|
-
expect(snapTextSize(10)).toBe(16)
|
|
24
|
-
})
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
describe('getJoinClassErrorMessage', () => {
|
|
28
|
-
it('maps each known backend code to a distinct message', () => {
|
|
29
|
-
const messages = [
|
|
30
|
-
getJoinClassErrorMessage(JoinClassErrorCode.CLASS_NOT_FOUND),
|
|
31
|
-
getJoinClassErrorMessage(JoinClassErrorCode.ALREADY_JOINED),
|
|
32
|
-
getJoinClassErrorMessage(JoinClassErrorCode.OTHER_DISTRICT),
|
|
33
|
-
]
|
|
34
|
-
expect(new Set(messages).size).toBe(messages.length)
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
it('falls back to the default message for unknown codes and null', () => {
|
|
38
|
-
const fallback = getJoinClassErrorMessage(null)
|
|
39
|
-
expect(getJoinClassErrorMessage(9999)).toBe(fallback)
|
|
40
|
-
expect(getJoinClassErrorMessage(JoinClassErrorCode.CLASS_NOT_FOUND)).not.toBe(fallback)
|
|
41
|
-
})
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
describe('getAvailableLanguages', () => {
|
|
45
|
-
it('lists priority languages first', () => {
|
|
46
|
-
const languages = getAvailableLanguages()
|
|
47
|
-
expect(languages[0]).toBe(Language.SPANISH)
|
|
48
|
-
expect(languages.length).toBeGreaterThan(5)
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
it('filters by search query', () => {
|
|
52
|
-
const languages = getAvailableLanguages('span')
|
|
53
|
-
expect(languages).toContain(Language.SPANISH)
|
|
54
|
-
expect(languages.every((language) => language.toLowerCase().includes('span'))).toBe(true)
|
|
55
|
-
})
|
|
56
|
-
})
|
|
57
|
-
})
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { StyleSheet, View } from 'react-native'
|
|
3
|
-
import {
|
|
4
|
-
ButtonColor,
|
|
5
|
-
ButtonSize,
|
|
6
|
-
ButtonVariant,
|
|
7
|
-
ReanimatedButton,
|
|
8
|
-
SPACING,
|
|
9
|
-
} from '@magmamath/react-native-ui'
|
|
10
|
-
|
|
11
|
-
import { useText } from '../../../../i18n/i18n'
|
|
12
|
-
import { useProfile } from '../../context/ProfileContext'
|
|
13
|
-
|
|
14
|
-
export const ProfileActions = () => {
|
|
15
|
-
const t = useText()
|
|
16
|
-
const { onLogout, onOpenJoinClass } = useProfile()
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<View style={styles.container}>
|
|
20
|
-
<View style={styles.leftHalf}>
|
|
21
|
-
<ReanimatedButton
|
|
22
|
-
variant={ButtonVariant.SECONDARY}
|
|
23
|
-
colorScheme={ButtonColor.WHITE}
|
|
24
|
-
size={ButtonSize.LARGE}
|
|
25
|
-
onPress={onOpenJoinClass}
|
|
26
|
-
style={buttonStyle}
|
|
27
|
-
>
|
|
28
|
-
{t('profile.joinNewClass')}
|
|
29
|
-
</ReanimatedButton>
|
|
30
|
-
</View>
|
|
31
|
-
<View style={styles.rightHalf}>
|
|
32
|
-
<ReanimatedButton
|
|
33
|
-
variant={ButtonVariant.PRIMARY}
|
|
34
|
-
colorScheme={ButtonColor.ORANGE}
|
|
35
|
-
size={ButtonSize.LARGE}
|
|
36
|
-
onPress={onLogout}
|
|
37
|
-
style={buttonStyle}
|
|
38
|
-
>
|
|
39
|
-
{t('profile.logOut')}
|
|
40
|
-
</ReanimatedButton>
|
|
41
|
-
</View>
|
|
42
|
-
</View>
|
|
43
|
-
)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const styles = StyleSheet.create({
|
|
47
|
-
container: {
|
|
48
|
-
flexDirection: 'row',
|
|
49
|
-
gap: SPACING['600'],
|
|
50
|
-
width: '100%',
|
|
51
|
-
},
|
|
52
|
-
leftHalf: {
|
|
53
|
-
alignItems: 'flex-end',
|
|
54
|
-
flex: 1,
|
|
55
|
-
},
|
|
56
|
-
rightHalf: {
|
|
57
|
-
alignItems: 'flex-start',
|
|
58
|
-
flex: 1,
|
|
59
|
-
},
|
|
60
|
-
text: {
|
|
61
|
-
textTransform: 'uppercase',
|
|
62
|
-
},
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
const buttonStyle = { text: styles.text }
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react'
|
|
2
|
-
import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native'
|
|
3
|
-
import {
|
|
4
|
-
BORDER_RADIUS,
|
|
5
|
-
COLORS,
|
|
6
|
-
HeadingVariants,
|
|
7
|
-
SHADOWS,
|
|
8
|
-
SPACING,
|
|
9
|
-
Typography,
|
|
10
|
-
} from '@magmamath/react-native-ui'
|
|
11
|
-
|
|
12
|
-
type ProfileCardProps = {
|
|
13
|
-
title: string
|
|
14
|
-
children: ReactNode
|
|
15
|
-
style?: StyleProp<ViewStyle>
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const ProfileCard = ({ title, children, style }: ProfileCardProps) => (
|
|
19
|
-
<View style={[styles.card, style]}>
|
|
20
|
-
<View style={styles.header}>
|
|
21
|
-
<Typography variant={HeadingVariants.H9} style={styles.title}>
|
|
22
|
-
{title}
|
|
23
|
-
</Typography>
|
|
24
|
-
</View>
|
|
25
|
-
<View style={styles.divider} />
|
|
26
|
-
<View style={styles.body}>{children}</View>
|
|
27
|
-
</View>
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
const styles = StyleSheet.create({
|
|
31
|
-
card: {
|
|
32
|
-
backgroundColor: COLORS.NEUTRAL_1,
|
|
33
|
-
borderRadius: BORDER_RADIUS['400'],
|
|
34
|
-
padding: SPACING['400'],
|
|
35
|
-
...SHADOWS['1'],
|
|
36
|
-
},
|
|
37
|
-
header: {
|
|
38
|
-
paddingLeft: SPACING['200'],
|
|
39
|
-
},
|
|
40
|
-
title: {
|
|
41
|
-
color: COLORS.NEUTRAL_7,
|
|
42
|
-
},
|
|
43
|
-
divider: {
|
|
44
|
-
backgroundColor: COLORS.NEUTRAL_3,
|
|
45
|
-
height: 1,
|
|
46
|
-
marginHorizontal: SPACING['100'],
|
|
47
|
-
marginVertical: SPACING['200'],
|
|
48
|
-
},
|
|
49
|
-
body: {
|
|
50
|
-
gap: SPACING['400'],
|
|
51
|
-
justifyContent: 'center',
|
|
52
|
-
},
|
|
53
|
-
})
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { useUnit } from 'effector-react'
|
|
3
|
-
import { StyleSheet, View } from 'react-native'
|
|
4
|
-
import { COLORS, HeadingVariants, InfoIcon, SPACING, Typography } from '@magmamath/react-native-ui'
|
|
5
|
-
|
|
6
|
-
import { useText } from '../../../../i18n/i18n'
|
|
7
|
-
import { useProfile } from '../../context/ProfileContext'
|
|
8
|
-
import { ProfileCard } from '../cards/ProfileCard'
|
|
9
|
-
|
|
10
|
-
const NOTE_ICON_SIZE = 20
|
|
11
|
-
|
|
12
|
-
type InfoFieldProps = {
|
|
13
|
-
label: string
|
|
14
|
-
value: string
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const InfoField = ({ label, value }: InfoFieldProps) => (
|
|
18
|
-
<View style={styles.field}>
|
|
19
|
-
<Typography variant={HeadingVariants.H8} style={styles.label}>
|
|
20
|
-
{label}
|
|
21
|
-
</Typography>
|
|
22
|
-
<Typography variant={HeadingVariants.H6} style={styles.value}>
|
|
23
|
-
{value}
|
|
24
|
-
</Typography>
|
|
25
|
-
</View>
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
export const AccountInfoCard = () => {
|
|
29
|
-
const t = useText()
|
|
30
|
-
const { model } = useProfile()
|
|
31
|
-
const user = useUnit(model.$user)
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<ProfileCard title={t('profile.accountInfo')}>
|
|
35
|
-
<InfoField label={t('profile.fullName')} value={user?.fullName ?? ''} />
|
|
36
|
-
<InfoField label={t('profile.username')} value={user?.username ?? ''} />
|
|
37
|
-
<InfoField label={t('profile.school')} value={user?.schoolName ?? ''} />
|
|
38
|
-
<View style={styles.noteDivider} />
|
|
39
|
-
<View style={styles.note}>
|
|
40
|
-
<InfoIcon size={NOTE_ICON_SIZE} color={COLORS.NEUTRAL_7} />
|
|
41
|
-
<Typography variant={HeadingVariants.H8} style={styles.noteText}>
|
|
42
|
-
{t('profile.changePasswordNote')}
|
|
43
|
-
</Typography>
|
|
44
|
-
</View>
|
|
45
|
-
</ProfileCard>
|
|
46
|
-
)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const styles = StyleSheet.create({
|
|
50
|
-
field: {
|
|
51
|
-
gap: SPACING['100'],
|
|
52
|
-
},
|
|
53
|
-
label: {
|
|
54
|
-
color: COLORS.NEUTRAL_7,
|
|
55
|
-
},
|
|
56
|
-
value: {
|
|
57
|
-
color: COLORS.NEUTRAL_9,
|
|
58
|
-
},
|
|
59
|
-
noteDivider: {
|
|
60
|
-
backgroundColor: COLORS.NEUTRAL_3,
|
|
61
|
-
height: 1,
|
|
62
|
-
marginHorizontal: SPACING['100'],
|
|
63
|
-
},
|
|
64
|
-
note: {
|
|
65
|
-
alignItems: 'center',
|
|
66
|
-
flexDirection: 'row',
|
|
67
|
-
gap: SPACING['200'],
|
|
68
|
-
},
|
|
69
|
-
noteText: {
|
|
70
|
-
color: COLORS.NEUTRAL_7,
|
|
71
|
-
flexShrink: 1,
|
|
72
|
-
},
|
|
73
|
-
})
|