@magmamath/students-features 0.6.5-rc.13 → 0.6.5-rc.2

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.
Files changed (144) hide show
  1. package/dist/commonjs/features/chatbot/model/ChatBotModel.js +3 -3
  2. package/dist/commonjs/features/chatbot/model/ChatBotModel.js.map +1 -1
  3. package/dist/commonjs/features/chatbot/model/ChatBoxTextManager.js +1 -3
  4. package/dist/commonjs/features/chatbot/model/ChatBoxTextManager.js.map +1 -1
  5. package/dist/commonjs/features/chatbot/model/DefaultMessageCreator.js +2 -4
  6. package/dist/commonjs/features/chatbot/model/DefaultMessageCreator.js.map +1 -1
  7. package/dist/commonjs/features/chatbot/model/constants.js.map +1 -1
  8. package/dist/commonjs/features/chatbot/model/translation.js +0 -7
  9. package/dist/commonjs/features/chatbot/model/translation.js.map +1 -1
  10. package/dist/commonjs/features/gifCelebrations/GifCelebrations.js +2 -5
  11. package/dist/commonjs/features/gifCelebrations/GifCelebrations.js.map +1 -1
  12. package/dist/commonjs/features/gifCelebrations/components/Backdrop.js +1 -1
  13. package/dist/commonjs/features/gifCelebrations/components/Backdrop.js.map +1 -1
  14. package/dist/commonjs/features/gifCelebrations/components/ContentContainer.js.map +1 -1
  15. package/dist/commonjs/features/gifCelebrations/components/Gif.js +16 -33
  16. package/dist/commonjs/features/gifCelebrations/components/Gif.js.map +1 -1
  17. package/dist/commonjs/features/gifCelebrations/components/Progress.js +8 -12
  18. package/dist/commonjs/features/gifCelebrations/components/Progress.js.map +1 -1
  19. package/dist/commonjs/features/gifCelebrations/constants.js +1 -13
  20. package/dist/commonjs/features/gifCelebrations/constants.js.map +1 -1
  21. package/dist/commonjs/features/gifCelebrations/helpers.js +27 -31
  22. package/dist/commonjs/features/gifCelebrations/helpers.js.map +1 -1
  23. package/dist/commonjs/features/gifCelebrations/model/GifCelebrations.cache.js +5 -18
  24. package/dist/commonjs/features/gifCelebrations/model/GifCelebrations.cache.js.map +1 -1
  25. package/dist/commonjs/features/gifCelebrations/model/GifCelebrations.model.js +42 -18
  26. package/dist/commonjs/features/gifCelebrations/model/GifCelebrations.model.js.map +1 -1
  27. package/dist/commonjs/lib/helpers/helpers.js.map +1 -1
  28. package/dist/commonjs/shared/translation/localization/en.json +1 -7
  29. package/dist/commonjs/shared/translation/localization/gb.json +1 -7
  30. package/dist/commonjs/shared/translation/localization/sw.json +1 -7
  31. package/dist/module/features/chatbot/model/ChatBotModel.js +3 -3
  32. package/dist/module/features/chatbot/model/ChatBotModel.js.map +1 -1
  33. package/dist/module/features/chatbot/model/ChatBoxTextManager.js +1 -3
  34. package/dist/module/features/chatbot/model/ChatBoxTextManager.js.map +1 -1
  35. package/dist/module/features/chatbot/model/DefaultMessageCreator.js +2 -4
  36. package/dist/module/features/chatbot/model/DefaultMessageCreator.js.map +1 -1
  37. package/dist/module/features/chatbot/model/constants.js.map +1 -1
  38. package/dist/module/features/chatbot/model/translation.js +0 -7
  39. package/dist/module/features/chatbot/model/translation.js.map +1 -1
  40. package/dist/module/features/gifCelebrations/GifCelebrations.js +2 -5
  41. package/dist/module/features/gifCelebrations/GifCelebrations.js.map +1 -1
  42. package/dist/module/features/gifCelebrations/components/Backdrop.js +1 -1
  43. package/dist/module/features/gifCelebrations/components/Backdrop.js.map +1 -1
  44. package/dist/module/features/gifCelebrations/components/ContentContainer.js.map +1 -1
  45. package/dist/module/features/gifCelebrations/components/Gif.js +17 -34
  46. package/dist/module/features/gifCelebrations/components/Gif.js.map +1 -1
  47. package/dist/module/features/gifCelebrations/components/Progress.js +10 -14
  48. package/dist/module/features/gifCelebrations/components/Progress.js.map +1 -1
  49. package/dist/module/features/gifCelebrations/constants.js +0 -12
  50. package/dist/module/features/gifCelebrations/constants.js.map +1 -1
  51. package/dist/module/features/gifCelebrations/helpers.js +25 -28
  52. package/dist/module/features/gifCelebrations/helpers.js.map +1 -1
  53. package/dist/module/features/gifCelebrations/model/GifCelebrations.cache.js +6 -19
  54. package/dist/module/features/gifCelebrations/model/GifCelebrations.cache.js.map +1 -1
  55. package/dist/module/features/gifCelebrations/model/GifCelebrations.model.js +42 -18
  56. package/dist/module/features/gifCelebrations/model/GifCelebrations.model.js.map +1 -1
  57. package/dist/module/shared/translation/localization/en.json +1 -7
  58. package/dist/module/shared/translation/localization/gb.json +1 -7
  59. package/dist/module/shared/translation/localization/sw.json +1 -7
  60. package/dist/typescript/commonjs/features/chatbot/model/ChatBoxTextManager.d.ts.map +1 -1
  61. package/dist/typescript/commonjs/features/chatbot/model/DefaultMessageCreator.d.ts +1 -2
  62. package/dist/typescript/commonjs/features/chatbot/model/DefaultMessageCreator.d.ts.map +1 -1
  63. package/dist/typescript/commonjs/features/chatbot/model/constants.d.ts.map +1 -1
  64. package/dist/typescript/commonjs/features/chatbot/model/translation.d.ts.map +1 -1
  65. package/dist/typescript/commonjs/features/gifCelebrations/GifCelebrations.d.ts +1 -3
  66. package/dist/typescript/commonjs/features/gifCelebrations/GifCelebrations.d.ts.map +1 -1
  67. package/dist/typescript/commonjs/features/gifCelebrations/components/Backdrop.d.ts +1 -2
  68. package/dist/typescript/commonjs/features/gifCelebrations/components/Backdrop.d.ts.map +1 -1
  69. package/dist/typescript/commonjs/features/gifCelebrations/components/ContentContainer.d.ts +1 -2
  70. package/dist/typescript/commonjs/features/gifCelebrations/components/ContentContainer.d.ts.map +1 -1
  71. package/dist/typescript/commonjs/features/gifCelebrations/components/Gif.d.ts +2 -5
  72. package/dist/typescript/commonjs/features/gifCelebrations/components/Gif.d.ts.map +1 -1
  73. package/dist/typescript/commonjs/features/gifCelebrations/components/Progress.d.ts +1 -2
  74. package/dist/typescript/commonjs/features/gifCelebrations/components/Progress.d.ts.map +1 -1
  75. package/dist/typescript/commonjs/features/gifCelebrations/constants.d.ts +0 -10
  76. package/dist/typescript/commonjs/features/gifCelebrations/constants.d.ts.map +1 -1
  77. package/dist/typescript/commonjs/features/gifCelebrations/helpers.d.ts +8 -18
  78. package/dist/typescript/commonjs/features/gifCelebrations/helpers.d.ts.map +1 -1
  79. package/dist/typescript/commonjs/features/gifCelebrations/model/GifCelebrations.cache.d.ts +1 -11
  80. package/dist/typescript/commonjs/features/gifCelebrations/model/GifCelebrations.cache.d.ts.map +1 -1
  81. package/dist/typescript/commonjs/features/gifCelebrations/model/GifCelebrations.model.d.ts +1 -4
  82. package/dist/typescript/commonjs/features/gifCelebrations/model/GifCelebrations.model.d.ts.map +1 -1
  83. package/dist/typescript/commonjs/features/gifCelebrations/types/model.types.d.ts +3 -13
  84. package/dist/typescript/commonjs/features/gifCelebrations/types/model.types.d.ts.map +1 -1
  85. package/dist/typescript/commonjs/lib/helpers/helpers.d.ts.map +1 -1
  86. package/dist/typescript/commonjs/shared/translation/constants.d.ts +0 -18
  87. package/dist/typescript/commonjs/shared/translation/constants.d.ts.map +1 -1
  88. package/dist/typescript/commonjs/shared/translation/model.d.ts +0 -12
  89. package/dist/typescript/commonjs/shared/translation/model.d.ts.map +1 -1
  90. package/dist/typescript/module/features/chatbot/model/ChatBoxTextManager.d.ts.map +1 -1
  91. package/dist/typescript/module/features/chatbot/model/DefaultMessageCreator.d.ts +1 -2
  92. package/dist/typescript/module/features/chatbot/model/DefaultMessageCreator.d.ts.map +1 -1
  93. package/dist/typescript/module/features/chatbot/model/constants.d.ts.map +1 -1
  94. package/dist/typescript/module/features/chatbot/model/translation.d.ts.map +1 -1
  95. package/dist/typescript/module/features/gifCelebrations/GifCelebrations.d.ts +1 -3
  96. package/dist/typescript/module/features/gifCelebrations/GifCelebrations.d.ts.map +1 -1
  97. package/dist/typescript/module/features/gifCelebrations/components/Backdrop.d.ts +1 -2
  98. package/dist/typescript/module/features/gifCelebrations/components/Backdrop.d.ts.map +1 -1
  99. package/dist/typescript/module/features/gifCelebrations/components/ContentContainer.d.ts +1 -2
  100. package/dist/typescript/module/features/gifCelebrations/components/ContentContainer.d.ts.map +1 -1
  101. package/dist/typescript/module/features/gifCelebrations/components/Gif.d.ts +2 -5
  102. package/dist/typescript/module/features/gifCelebrations/components/Gif.d.ts.map +1 -1
  103. package/dist/typescript/module/features/gifCelebrations/components/Progress.d.ts +1 -2
  104. package/dist/typescript/module/features/gifCelebrations/components/Progress.d.ts.map +1 -1
  105. package/dist/typescript/module/features/gifCelebrations/constants.d.ts +0 -10
  106. package/dist/typescript/module/features/gifCelebrations/constants.d.ts.map +1 -1
  107. package/dist/typescript/module/features/gifCelebrations/helpers.d.ts +8 -18
  108. package/dist/typescript/module/features/gifCelebrations/helpers.d.ts.map +1 -1
  109. package/dist/typescript/module/features/gifCelebrations/model/GifCelebrations.cache.d.ts +1 -11
  110. package/dist/typescript/module/features/gifCelebrations/model/GifCelebrations.cache.d.ts.map +1 -1
  111. package/dist/typescript/module/features/gifCelebrations/model/GifCelebrations.model.d.ts +1 -4
  112. package/dist/typescript/module/features/gifCelebrations/model/GifCelebrations.model.d.ts.map +1 -1
  113. package/dist/typescript/module/features/gifCelebrations/types/model.types.d.ts +3 -13
  114. package/dist/typescript/module/features/gifCelebrations/types/model.types.d.ts.map +1 -1
  115. package/dist/typescript/module/lib/helpers/helpers.d.ts.map +1 -1
  116. package/dist/typescript/module/shared/translation/constants.d.ts +0 -18
  117. package/dist/typescript/module/shared/translation/constants.d.ts.map +1 -1
  118. package/dist/typescript/module/shared/translation/model.d.ts +0 -12
  119. package/dist/typescript/module/shared/translation/model.d.ts.map +1 -1
  120. package/package.json +1 -1
  121. package/src/features/chatbot/model/ChatBotModel.ts +1 -1
  122. package/src/features/chatbot/model/ChatBoxTextManager.ts +1 -3
  123. package/src/features/chatbot/model/DefaultMessageCreator.ts +2 -4
  124. package/src/features/chatbot/model/constants.ts +2 -0
  125. package/src/features/chatbot/model/translation.ts +0 -9
  126. package/src/features/gifCelebrations/GifCelebrations.tsx +3 -9
  127. package/src/features/gifCelebrations/components/Backdrop.tsx +2 -3
  128. package/src/features/gifCelebrations/components/ContentContainer.tsx +1 -2
  129. package/src/features/gifCelebrations/components/Gif.tsx +14 -39
  130. package/src/features/gifCelebrations/components/Progress.tsx +9 -17
  131. package/src/features/gifCelebrations/constants.ts +0 -12
  132. package/src/features/gifCelebrations/helpers.ts +32 -39
  133. package/src/features/gifCelebrations/model/GifCelebrations.cache.ts +14 -33
  134. package/src/features/gifCelebrations/model/GifCelebrations.model.ts +41 -39
  135. package/src/features/gifCelebrations/types/model.types.ts +3 -17
  136. package/src/lib/helpers/helpers.ts +1 -1
  137. package/src/shared/translation/localization/en.json +1 -7
  138. package/src/shared/translation/localization/gb.json +1 -7
  139. package/src/shared/translation/localization/sw.json +1 -7
  140. package/dist/commonjs/react-app-env.d.js +0 -2
  141. package/dist/commonjs/react-app-env.d.js.map +0 -1
  142. package/dist/module/react-app-env.d.js +0 -2
  143. package/dist/module/react-app-env.d.js.map +0 -1
  144. package/src/react-app-env.d.ts +0 -5
@@ -1,19 +1,10 @@
1
- import { TranslationKeys } from 'src/shared/translation/types';
2
- import { GifsGroups, GifsStructure, GroupNumber } from './types/model.types';
3
- /**
4
- * Number of problems When we show gif
5
- * <6 Never
6
- * 7-12 50% completion
7
- * 13-18 33%, 66% completion
8
- * 19-24 25%, 50%, 75 completion
9
- * 25-30 20%, 40%, 60%, 80% completion
10
- * .>30 15%, 30%, 45%, 60%, 75% completion
11
- *
12
- * We are also going to have different buckets with different gifs. The logic is as follows:
13
- * Group 1: 15%, 20%, 25%, 30% - Early celebrations
14
- * Group 2: 33%, 40%, 45%, 50% - Mid celebrations
15
- * Group 3: 60%, 66%, 75%, 80% - Party
16
- */
1
+ import { GifsGroups } from './types/model.types';
2
+ type GifSelectProps = {
3
+ gifsGroups: GifsGroups;
4
+ resolvedProblem: number;
5
+ totalProblems: number;
6
+ };
7
+ export declare const gifSelect: ({ gifsGroups, resolvedProblem, totalProblems }: GifSelectProps) => string | null;
17
8
  export declare const calculatePercentageTable: (totalProblems: number) => {
18
9
  50: number;
19
10
  33?: undefined;
@@ -80,6 +71,5 @@ export declare const calculatePercentageTable: (totalProblems: number) => {
80
71
  40?: undefined;
81
72
  80?: undefined;
82
73
  };
83
- export declare const generateGifsStructure: (gifs: GifsGroups) => GifsStructure;
84
- export declare const getGifLabel: (relatedGroup: GroupNumber) => TranslationKeys;
74
+ export {};
85
75
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/features/gifCelebrations/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAC9D,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAE5E;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,wBAAwB,kBAAmB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkC7D,CAAA;AAED,eAAO,MAAM,qBAAqB,SAAU,UAAU,KAAG,aAUtD,CAAA;AAEH,eAAO,MAAM,WAAW,iBAAkB,WAAW,KAAG,eASvD,CAAA"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/features/gifCelebrations/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAEhD,KAAK,cAAc,GAAG;IACpB,UAAU,EAAE,UAAU,CAAA;IACtB,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;CACtB,CAAA;AAeD,eAAO,MAAM,SAAS,mDAAoD,cAAc,kBAUvF,CAAA;AAED,eAAO,MAAM,wBAAwB,kBAAmB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkC7D,CAAA"}
@@ -1,18 +1,8 @@
1
- import { GifsGroups, GifsStructure, CustomPrefetchMethod, CustomGetCachePathMethod } from '../types/model.types';
2
- import { Image } from 'react-native';
3
- type GifCelebrationsCacheProps = {
4
- customPrefetchMethod?: CustomPrefetchMethod;
5
- customGetCachePathMethod?: CustomGetCachePathMethod;
6
- };
1
+ import { GifsGroups, GifsStructure } from '../types/model.types';
7
2
  export declare class GifCelebrationsCache {
8
3
  readonly initialSet: import("effector").EventCallable<GifsGroups>;
9
4
  readonly set: import("effector").EventCallable<GifsStructure>;
10
5
  readonly reset: import("effector").EventCallable<void>;
11
- readonly prefetchMethod: CustomPrefetchMethod | typeof Image.prefetch;
12
- readonly getCachePathMethod?: CustomGetCachePathMethod;
13
- readonly prefetchGifs: import("effector").Effect<GifsGroups, void, Error>;
14
6
  readonly $gifs: import("effector").StoreWritable<GifsStructure | null>;
15
- constructor({ customPrefetchMethod, customGetCachePathMethod }: GifCelebrationsCacheProps);
16
7
  }
17
- export {};
18
8
  //# sourceMappingURL=GifCelebrations.cache.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GifCelebrations.cache.d.ts","sourceRoot":"","sources":["../../../../../../src/features/gifCelebrations/model/GifCelebrations.cache.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,aAAa,EACb,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAEpC,KAAK,yBAAyB,GAAG;IAC/B,oBAAoB,CAAC,EAAE,oBAAoB,CAAA;IAC3C,wBAAwB,CAAC,EAAE,wBAAwB,CAAA;CACpD,CAAA;AAED,qBAAa,oBAAoB;IAC/B,SAAgB,UAAU,+CAA4B;IACtD,SAAgB,GAAG,kDAA+B;IAClD,SAAgB,KAAK,yCAAgB;IAErC,SAAgB,cAAc,EAAE,oBAAoB,GAAG,OAAO,KAAK,CAAC,QAAQ,CAAA;IAC5E,SAAgB,kBAAkB,CAAC,EAAE,wBAAwB,CAAA;IAE7D,SAAgB,YAAY,qDAQ1B;IAEF,SAAgB,KAAK,yDAGa;gBAEtB,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,EAAE,yBAAyB;CAI1F"}
1
+ {"version":3,"file":"GifCelebrations.cache.d.ts","sourceRoot":"","sources":["../../../../../../src/features/gifCelebrations/model/GifCelebrations.cache.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEhE,qBAAa,oBAAoB;IAC/B,SAAgB,UAAU,+CAA4B;IACtD,SAAgB,GAAG,kDAA+B;IAClD,SAAgB,KAAK,yCAAgB;IAErC,SAAgB,KAAK,yDAca;CACnC"}
@@ -9,16 +9,13 @@ export declare class GifCelebrationsModel {
9
9
  readonly $resolvedProblems: Store<number>;
10
10
  readonly triggerPlay: import("effector").EventCallable<void>;
11
11
  readonly stop: import("effector").EventCallable<void>;
12
- readonly resetIsGifCelebrationMayBeTriggered: import("effector").EventCallable<void>;
13
- readonly setIsGifCelebrationMayBeTriggered: import("effector").EventCallable<boolean>;
14
- readonly $isGifCelebrationMayBeTriggered: import("effector").StoreWritable<boolean>;
15
12
  readonly resetPercentageTable: import("effector").EventCallable<void>;
16
13
  readonly $problemsPercentageTable: import("effector").StoreWritable<ProblemsPercentageTable | null>;
17
14
  readonly setActiveGif: import("effector").EventCallable<GifObject>;
18
15
  readonly $activeGif: import("effector").StoreWritable<GifObject | null>;
19
16
  readonly initialize: import("effector").EventCallable<void>;
20
17
  readonly resetGroupGifs: import("effector").EventCallable<string>;
21
- constructor({ api, totalProblems, resolvedProblems, customPrefetchMethod, customGetCachePathMethod, }: GifCelebrationsModelProps);
18
+ constructor({ api, totalProblems, resolvedProblems }: GifCelebrationsModelProps);
22
19
  private setupEventHandlers;
23
20
  private readonly handleGifSelection;
24
21
  private findGroupForPercentage;
@@ -1 +1 @@
1
- {"version":3,"file":"GifCelebrations.model.d.ts","sourceRoot":"","sources":["../../../../../../src/features/gifCelebrations/model/GifCelebrations.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkD,KAAK,EAAE,MAAM,UAAU,CAAA;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EACL,yBAAyB,EACzB,SAAS,EAGT,uBAAuB,EACxB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAU9D,qBAAa,oBAAoB;IAC/B,SAAgB,GAAG,EAAE,kBAAkB,CAAA;IACvC,SAAgB,KAAK,EAAE,oBAAoB,CAAA;IAE3C,SAAgB,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IAC7C,SAAgB,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IAEhD,SAAgB,WAAW,yCAAgB;IAC3C,SAAgB,IAAI,yCAAgB;IAEpC,SAAgB,mCAAmC,yCAAgB;IACnE,SAAgB,iCAAiC,4CAAyB;IAC1E,SAAgB,+BAA+B,4CAM5C;IAEH,SAAgB,oBAAoB,yCAAgB;IACpD,SAAgB,wBAAwB,mEAEN;IAElC,SAAgB,YAAY,8CAA2B;IACvD,SAAgB,UAAU,qDAEe;IAEzC,SAAgB,UAAU,yCAAgB;IAC1C,SAAgB,cAAc,2CAAwB;gBAE1C,EACV,GAAG,EACH,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,GACzB,EAAE,yBAAyB;IAU5B,OAAO,CAAC,kBAAkB;IAkD1B,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CA+ClC;IAED,OAAO,CAAC,sBAAsB;CAK/B"}
1
+ {"version":3,"file":"GifCelebrations.model.d.ts","sourceRoot":"","sources":["../../../../../../src/features/gifCelebrations/model/GifCelebrations.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkD,KAAK,EAAE,MAAM,UAAU,CAAA;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EACL,yBAAyB,EACzB,SAAS,EAGT,uBAAuB,EACxB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAiB9D,qBAAa,oBAAoB;IAC/B,SAAgB,GAAG,EAAE,kBAAkB,CAAA;IACvC,SAAgB,KAAK,EAAE,oBAAoB,CAAA;IAE3C,SAAgB,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IAC7C,SAAgB,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IAEhD,SAAgB,WAAW,yCAAgB;IAC3C,SAAgB,IAAI,yCAAgB;IAEpC,SAAgB,oBAAoB,yCAAgB;IACpD,SAAgB,wBAAwB,mEAEN;IAElC,SAAgB,YAAY,8CAA2B;IACvD,SAAgB,UAAU,qDAEe;IAEzC,SAAgB,UAAU,yCAAgB;IAC1C,SAAgB,cAAc,2CAAwB;gBAE1C,EAAE,GAAG,EAAE,aAAa,EAAE,gBAAgB,EAAE,EAAE,yBAAyB;IAU/E,OAAO,CAAC,kBAAkB;IAmD1B,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAyDlC;IAED,OAAO,CAAC,sBAAsB;CAK/B"}
@@ -1,28 +1,20 @@
1
1
  import { Store } from 'effector';
2
- export type CustomPrefetchMethod = (gifs: string[] | string) => Promise<unknown>;
3
- export type CustomGetCachePathMethod = (uri: string) => Promise<string | null>;
4
- export type GroupNumber = number;
5
2
  export type GifCelebrationApiRequests = {
6
3
  getGifs: () => Promise<GifResponse>;
7
4
  };
8
- export type GifCelebrationCache = {
9
- prefetchMethod?: CustomPrefetchMethod;
10
- };
11
5
  export type GifCelebrationsModelProps = {
12
6
  api: GifCelebrationApiRequests;
13
7
  totalProblems: Store<number>;
14
8
  resolvedProblems: Store<number>;
15
- customPrefetchMethod?: CustomPrefetchMethod;
16
- customGetCachePathMethod?: CustomGetCachePathMethod;
17
9
  };
18
10
  export type GifsGroup = string[];
19
- export type GifsGroups = Record<`group${GroupNumber}`, GifsGroup>;
11
+ export type GifsGroups = Record<`group${number}`, GifsGroup>;
20
12
  export type GifObject = {
21
13
  url: string;
22
14
  isShown: boolean;
23
- group: `group${GroupNumber}`;
15
+ group: `group${number}`;
24
16
  };
25
- export type GifsStructure = Record<`group${GroupNumber}`, GifObject[]>;
17
+ export type GifsStructure = Record<`group${number}`, GifObject[]>;
26
18
  /**
27
19
  * Usually, the response contains 3 groups of gifs:
28
20
  * - group1: early celebrations
@@ -37,6 +29,4 @@ export type GifsPayload = {
37
29
  group: number;
38
30
  };
39
31
  export type ProblemsPercentageTable = Record<number, number>;
40
- export type ProgressValue = 0 | 1 | 2;
41
- export type TextComponentType = (text: string) => React.ReactNode;
42
32
  //# sourceMappingURL=model.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"model.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/gifCelebrations/types/model.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAEhC,MAAM,MAAM,oBAAoB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;AAChF,MAAM,MAAM,wBAAwB,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;AAE9E,MAAM,MAAM,WAAW,GAAG,MAAM,CAAA;AAEhC,MAAM,MAAM,yBAAyB,GAAG;IACtC,OAAO,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAA;CACpC,CAAA;AACD,MAAM,MAAM,mBAAmB,GAAG;IAChC,cAAc,CAAC,EAAE,oBAAoB,CAAA;CACtC,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG;IACtC,GAAG,EAAE,yBAAyB,CAAA;IAC9B,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IAC5B,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IAC/B,oBAAoB,CAAC,EAAE,oBAAoB,CAAA;IAC3C,wBAAwB,CAAC,EAAE,wBAAwB,CAAA;CACpD,CAAA;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,EAAE,CAAA;AAChC,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,WAAW,EAAE,EAAE,SAAS,CAAC,CAAA;AAEjE,MAAM,MAAM,SAAS,GAAG;IACtB,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,QAAQ,WAAW,EAAE,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,QAAQ,WAAW,EAAE,EAAE,SAAS,EAAE,CAAC,CAAA;AACtE;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,UAAU,CAAA;IAChB,EAAE,EAAE,OAAO,CAAA;CACZ,CAAA;AACD,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAC5D,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAErC,MAAM,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAA"}
1
+ {"version":3,"file":"model.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/gifCelebrations/types/model.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAEhC,MAAM,MAAM,yBAAyB,GAAG;IACtC,OAAO,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAA;CACpC,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG;IACtC,GAAG,EAAE,yBAAyB,CAAA;IAC9B,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IAC5B,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;CAChC,CAAA;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,EAAE,CAAA;AAChC,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,MAAM,EAAE,EAAE,SAAS,CAAC,CAAA;AAE5D,MAAM,MAAM,SAAS,GAAG;IACtB,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,QAAQ,MAAM,EAAE,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,QAAQ,MAAM,EAAE,EAAE,SAAS,EAAE,CAAC,CAAA;AACjE;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,UAAU,CAAA;IAChB,EAAE,EAAE,OAAO,CAAA;CACZ,CAAA;AACD,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AACD,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/lib/helpers/helpers.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI,YAAW,CAAA;AAE5B,eAAO,MAAM,gBAAgB,cACsC,CAAA;AASnE,eAAO,MAAM,mBAAmB,SAAU,IAAI,WAuB7C,CAAA"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/lib/helpers/helpers.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI,YAAW,CAAC;AAE7B,eAAO,MAAM,gBAAgB,cACsC,CAAA;AASnE,eAAO,MAAM,mBAAmB,SAAU,IAAI,WAuB7C,CAAA"}
@@ -14,17 +14,11 @@ export declare const LOCALIZATION_CONFIGS: {
14
14
  "time.yearsAgo": string;
15
15
  chat: {
16
16
  anotherHint: string;
17
- giveHint: string;
18
17
  answerAgain: string;
19
18
  errorMessage: string;
20
19
  howCanIHelp: string;
21
20
  showError: string;
22
21
  };
23
- gifCelebrations: {
24
- greatStart: string;
25
- onTheWay: string;
26
- almostThere: string;
27
- };
28
22
  };
29
23
  "en-GB": {
30
24
  "teacherFeedback.noComments": string;
@@ -41,17 +35,11 @@ export declare const LOCALIZATION_CONFIGS: {
41
35
  "time.yearsAgo": string;
42
36
  chat: {
43
37
  anotherHint: string;
44
- giveHint: string;
45
38
  answerAgain: string;
46
39
  errorMessage: string;
47
40
  howCanIHelp: string;
48
41
  showError: string;
49
42
  };
50
- gifCelebrations: {
51
- greatStart: string;
52
- onTheWay: string;
53
- almostThere: string;
54
- };
55
43
  };
56
44
  "sv-SE": {
57
45
  "teacherFeedback.noComments": string;
@@ -68,17 +56,11 @@ export declare const LOCALIZATION_CONFIGS: {
68
56
  "time.yearsAgo": string;
69
57
  chat: {
70
58
  anotherHint: string;
71
- giveHint: string;
72
59
  answerAgain: string;
73
60
  errorMessage: string;
74
61
  howCanIHelp: string;
75
62
  showError: string;
76
63
  };
77
- gifCelebrations: {
78
- greatStart: string;
79
- onTheWay: string;
80
- almostThere: string;
81
- };
82
64
  };
83
65
  };
84
66
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/shared/translation/constants.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIhC,CAAA"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/shared/translation/constants.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIhC,CAAA"}
@@ -15,17 +15,11 @@ export declare const setLocalization: import("effector").EventCallable<{
15
15
  "time.yearsAgo": string;
16
16
  chat: {
17
17
  anotherHint: string;
18
- giveHint: string;
19
18
  answerAgain: string;
20
19
  errorMessage: string;
21
20
  howCanIHelp: string;
22
21
  showError: string;
23
22
  };
24
- gifCelebrations: {
25
- greatStart: string;
26
- onTheWay: string;
27
- almostThere: string;
28
- };
29
23
  } | ((config: typeof LOCALIZATION_CONFIGS) => Translations)>;
30
24
  export declare const $localization: import("effector").StoreWritable<{
31
25
  "teacherFeedback.noComments": string;
@@ -42,16 +36,10 @@ export declare const $localization: import("effector").StoreWritable<{
42
36
  "time.yearsAgo": string;
43
37
  chat: {
44
38
  anotherHint: string;
45
- giveHint: string;
46
39
  answerAgain: string;
47
40
  errorMessage: string;
48
41
  howCanIHelp: string;
49
42
  showError: string;
50
43
  };
51
- gifCelebrations: {
52
- greatStart: string;
53
- onTheWay: string;
54
- almostThere: string;
55
- };
56
44
  }>;
57
45
  //# sourceMappingURL=model.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../../src/shared/translation/model.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,YAAY,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAElD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;cACD,OAAO,oBAAoB,KAAK,YAAY,EACpE,CAAA;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;EAMzB,CAAA"}
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../../src/shared/translation/model.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,YAAY,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAElD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;cACD,OAAO,oBAAoB,KAAK,YAAY,EACpE,CAAA;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;EAMzB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magmamath/students-features",
3
- "version": "0.6.5-rc.13",
3
+ "version": "0.6.5-rc.2",
4
4
  "description": "Magmamath features library",
5
5
  "source": "src/index.ts",
6
6
  "main": "src/index.ts",
@@ -174,11 +174,11 @@ export class ChatbotModel {
174
174
  sample({
175
175
  clock: effect.fail,
176
176
  source: this.$currentChatData,
177
- filter: (_, { error }) => error.message !== 'Request aborted manually',
178
177
  fn: ({ key, messages }) => ({
179
178
  key,
180
179
  data: { messages: [...messages, this.defaultMessages.error] },
181
180
  }),
181
+ filter: (_, { error }) => error.message !== 'Request aborted manually',
182
182
  target: this.cache.update,
183
183
  })
184
184
 
@@ -10,9 +10,7 @@ export class ChatBotTextManager {
10
10
  }).bindToLanguageChanged($localization.updates)
11
11
 
12
12
  public readonly messages: ChatbotMessages = {
13
- error: this.messagesCreator.createMessage('chat.errorMessage', {
14
- options: [this.messagesCreator.createOption('chat.giveHint')],
15
- }),
13
+ error: this.messagesCreator.createMessage('chat.errorMessage'),
16
14
  start: this.messagesCreator.createMessage('chat.howCanIHelp'),
17
15
  endMessage: this.messagesCreator.createMessage('chat.answerAgain'),
18
16
  anotherHintOption: this.messagesCreator.createOption('chat.anotherHint'),
@@ -8,7 +8,6 @@ type ChatMessage = Omit<PostMessageResponse, 'threadId'> & {
8
8
  }
9
9
 
10
10
  type DefaultMessageSettings = {
11
- options?: ChatAnswer[]
12
11
  isOwn?: boolean
13
12
  }
14
13
 
@@ -24,11 +23,11 @@ export class DefaultMessagesCreator<K extends string> {
24
23
  this.getter = textGetter
25
24
  }
26
25
 
27
- public createMessage(key: K, { isOwn = false, options = [] }: DefaultMessageSettings = {}) {
26
+ public createMessage(key: K, { isOwn = false }: DefaultMessageSettings = {}) {
28
27
  const message: ChatMessage = {
29
28
  id: this.list.size.toString(),
30
29
  message: this.getter(key),
31
- options,
30
+ options: [],
32
31
  isOwnMessage: isOwn,
33
32
  }
34
33
  this.list.set(message, key)
@@ -38,7 +37,6 @@ export class DefaultMessagesCreator<K extends string> {
38
37
  public createOption(key: K) {
39
38
  const option: ChatAnswer = {
40
39
  text: this.getter(key),
41
- translatedText: '',
42
40
  promptKey: '',
43
41
  }
44
42
  this.list.set(option, key)
@@ -1,3 +1,5 @@
1
+ import { ChatbotMessages } from '../types/model.types'
2
+
1
3
  export const CHAT_BOT_MODEL_DEFAULTS = {
2
4
  THREAD_MESSAGES_LIMIT: 3,
3
5
  }
@@ -129,9 +129,6 @@ export class ChatbotTranslation {
129
129
  textList: {
130
130
  messages: messages.map(({ message }) => message),
131
131
  defaultMessages: defaultMessages.map(({ message }) => message),
132
- defaultMessagesOptions: defaultMessages.flatMap((message) =>
133
- message.options.map((option) => option.text),
134
- ),
135
132
  defaultOptions: defaultOptions.map(({ text }) => text),
136
133
  lastMessage: options.lastMessage || [],
137
134
  alternativesHints: options.alternatives?.hints || [],
@@ -142,12 +139,6 @@ export class ChatbotTranslation {
142
139
 
143
140
  translatedTextsList.defaultMessages.forEach((message, index) => {
144
141
  defaultMessages[index].translatedMessage = message
145
- defaultMessages[index].options = defaultMessages[index].options.map((option) => {
146
- return {
147
- ...option,
148
- translatedText: translatedTextsList.defaultMessagesOptions[index],
149
- }
150
- })
151
142
  })
152
143
  translatedTextsList.defaultOptions.forEach((message, index) => {
153
144
  defaultOptions[index].translatedText = message
@@ -7,14 +7,12 @@ import { Easing, runOnJS, useSharedValue, withSequence, withTiming } from 'react
7
7
  import { useUnit } from 'effector-react'
8
8
  import { ANIMATION_DURATION } from './constants'
9
9
  import { GifCelebrationsModel } from './model/GifCelebrations.model'
10
- import { ProgressValue, TextComponentType } from './types/model.types'
11
10
 
12
11
  type GifCelebrationsProps = {
13
12
  model: GifCelebrationsModel
14
- TextComponent: TextComponentType
15
13
  }
16
14
 
17
- export const GifCelebrations = ({ model, TextComponent }: GifCelebrationsProps) => {
15
+ export const GifCelebrations = ({ model }: GifCelebrationsProps) => {
18
16
  const [totalProblems, resolvedProblems, activeGif] = useUnit([
19
17
  model.$totalProblems,
20
18
  model.$resolvedProblems,
@@ -24,7 +22,7 @@ export const GifCelebrations = ({ model, TextComponent }: GifCelebrationsProps)
24
22
  const completedPercent =
25
23
  resolvedProblems && totalProblems && Math.round((resolvedProblems / totalProblems) * 100)
26
24
 
27
- const progress = useSharedValue<ProgressValue>(0)
25
+ const progress = useSharedValue(0)
28
26
 
29
27
  const stopAnimation = () => {
30
28
  model.stop()
@@ -65,11 +63,7 @@ export const GifCelebrations = ({ model, TextComponent }: GifCelebrationsProps)
65
63
  return (
66
64
  <Backdrop progress={progress}>
67
65
  <ContentContainer progress={progress}>
68
- <Gif
69
- gifObject={activeGif}
70
- getCachePathMethod={model.cache.getCachePathMethod}
71
- TextComponent={TextComponent}
72
- />
66
+ <Gif uri={activeGif.url} />
73
67
  <Progress progress={progress} completedPercent={completedPercent} />
74
68
  </ContentContainer>
75
69
  </Backdrop>
@@ -2,11 +2,10 @@ import { StyleSheet, useWindowDimensions } from 'react-native'
2
2
  import React from 'react'
3
3
  import Animated, { useAnimatedStyle, interpolateColor, SharedValue } from 'react-native-reanimated'
4
4
  import { BACKDROP_COLOR } from '../constants'
5
- import { ProgressValue } from '../types/model.types'
6
5
 
7
6
  type BackdropProps = {
8
7
  children: React.ReactNode
9
- progress: SharedValue<ProgressValue>
8
+ progress: SharedValue<number>
10
9
  }
11
10
 
12
11
  export const Backdrop = ({ children, progress }: BackdropProps) => {
@@ -33,7 +32,7 @@ export const Backdrop = ({ children, progress }: BackdropProps) => {
33
32
  const styles = StyleSheet.create({
34
33
  backdrop: {
35
34
  position: 'absolute',
36
- zIndex: 10100,
35
+ zIndex: 1100,
37
36
  justifyContent: 'center',
38
37
  alignItems: 'center',
39
38
  backgroundColor: 'rgba(51, 51, 51, 0.33);',
@@ -3,11 +3,10 @@ import React from 'react'
3
3
  import { SPACING } from '@magmamath/react-native-ui'
4
4
  import Animated, { useAnimatedStyle, interpolate, SharedValue } from 'react-native-reanimated'
5
5
  import { CONTENT_CONTAINER } from '../constants'
6
- import { ProgressValue } from '../types/model.types'
7
6
 
8
7
  type ContentContainerProps = {
9
8
  children: React.ReactNode
10
- progress: SharedValue<ProgressValue>
9
+ progress: SharedValue<number>
11
10
  }
12
11
 
13
12
  export const ContentContainer = ({ children, progress }: ContentContainerProps) => {
@@ -1,15 +1,12 @@
1
1
  import { StyleSheet, View, Image } from 'react-native'
2
2
  import React, { useLayoutEffect, useState } from 'react'
3
3
  import { BORDER_RADIUS, COLORS, SPACING } from '@magmamath/react-native-ui'
4
- import { CustomGetCachePathMethod, GifObject, TextComponentType } from '../types/model.types'
5
- import { MAX_GIF_SIZE, MIN_GIF_SIZE } from '../constants'
6
- import { useText } from '../../../shared/translation'
7
- import { getGifLabel } from '../helpers'
4
+
5
+ const mock =
6
+ 'https://media3.giphy.com/media/v1.Y2lkPWZhYjgxNWZhN3lucHRuYjZtMzRiNTZkeXo3NTBrNzIwejcwdXp0Y3g1c2k2ODA2eiZlcD12MV9naWZzX3NlYXJjaCZjdD1n/lCSABZRhMw6pW/giphy.gif'
8
7
 
9
8
  type GifProps = {
10
- gifObject: GifObject
11
- getCachePathMethod?: CustomGetCachePathMethod
12
- TextComponent: TextComponentType
9
+ uri: string
13
10
  }
14
11
 
15
12
  type Size = {
@@ -17,48 +14,30 @@ type Size = {
17
14
  height: number
18
15
  }
19
16
 
20
- export const Gif = ({ gifObject, getCachePathMethod, TextComponent }: GifProps) => {
17
+ export const Gif = ({ uri }: GifProps) => {
21
18
  const [size, setSize] = useState<Size | null>(null)
22
- const [pathOrUri, setPathOrUri] = useState<string>('')
23
-
24
- const t = useText()
19
+ console.log('size: ', size)
25
20
 
26
21
  useLayoutEffect(() => {
27
- const loadImageSize = async () => {
28
- const path = getCachePathMethod
29
- ? (await getCachePathMethod(gifObject.url)) || gifObject.url
30
- : gifObject.url
31
-
32
- Image.getSize(path, (width, height) => {
33
- setSize({
34
- width: Math.max(MIN_GIF_SIZE, Math.min(MAX_GIF_SIZE.WIDTH, width)),
35
- height: Math.max(MIN_GIF_SIZE, Math.min(MAX_GIF_SIZE.HEIGHT, height)),
36
- })
37
-
38
- setPathOrUri(path)
39
- })
40
- }
41
-
42
- loadImageSize()
43
- }, [gifObject.url])
22
+ Image.getSize(uri, (width, height) => {
23
+ setSize({ width: width > 480 ? 480 : width, height: height > 300 ? 300 : height })
24
+ })
25
+ }, [uri])
44
26
 
45
27
  return (
46
28
  <View style={styles.backgroundContainer}>
47
29
  <View style={styles.container}>
48
- {size && pathOrUri && (
30
+ {size && (
49
31
  <Image
50
- alt="Funny celebration animated image"
32
+ alt="Celebration GIF"
51
33
  source={{
52
- uri: pathOrUri,
34
+ uri,
53
35
  }}
54
36
  width={size.width}
55
37
  height={size.height}
56
38
  style={[styles.image, { width: size.width, height: size.height }]} //this sizes duplication is needed for compatibility with web and rn
57
39
  />
58
40
  )}
59
- <View style={styles.textContainer}>
60
- {TextComponent(t(getGifLabel(Number(gifObject.group.replace('group', '')))))}
61
- </View>
62
41
  </View>
63
42
  </View>
64
43
  )
@@ -77,10 +56,6 @@ const styles = StyleSheet.create({
77
56
  },
78
57
  image: {
79
58
  borderRadius: BORDER_RADIUS[100],
80
- },
81
- textContainer: {
82
- position: 'absolute',
83
- bottom: 74,
84
- alignSelf: 'center',
59
+ backgroundColor: 'orange',
85
60
  },
86
61
  })
@@ -1,4 +1,4 @@
1
- import { StyleSheet, View, Image, Platform } from 'react-native'
1
+ import { StyleSheet, View } from 'react-native'
2
2
  import React from 'react'
3
3
  import {
4
4
  BORDER_RADIUS,
@@ -8,20 +8,22 @@ import {
8
8
  Typography,
9
9
  } from '@magmamath/react-native-ui'
10
10
  import Animated, { useAnimatedStyle, SharedValue, interpolate } from 'react-native-reanimated'
11
- import confettiImage from '../assets/confetti.webp'
12
- import { ProgressValue } from '../types/model.types'
11
+ import { Image } from 'react-native'
13
12
 
14
13
  const MIN_WIDTH_FOR_ONE_DIGIT = 12
15
14
  const MIN_WIDTH_FOR_TWO_DIGITS = 15
16
- const IS_WEB = Platform.OS === 'web'
15
+ const ADJUSTMENT_FOR_HUNDRED_PERCENT = 1.8
17
16
 
18
17
  type ProgressProps = {
19
- progress: SharedValue<ProgressValue>
18
+ progress: SharedValue<number>
20
19
  completedPercent: number
21
20
  }
22
21
 
23
22
  export const Progress = ({ progress, completedPercent }: ProgressProps) => {
24
23
  const progressLineWidth = (() => {
24
+ if (completedPercent === 100) {
25
+ return completedPercent + ADJUSTMENT_FOR_HUNDRED_PERCENT
26
+ }
25
27
  if (completedPercent <= 9) {
26
28
  return MIN_WIDTH_FOR_ONE_DIGIT
27
29
  }
@@ -52,16 +54,7 @@ export const Progress = ({ progress, completedPercent }: ProgressProps) => {
52
54
  </Typography>
53
55
  </Animated.View>
54
56
  </View>
55
- <Image
56
- source={
57
- IS_WEB
58
- ? {
59
- uri: confettiImage,
60
- }
61
- : require('../assets/confetti.webp')
62
- }
63
- style={styles.confetti}
64
- />
57
+ {/* <Image source={require('../assets/confetti.webp')} style={styles.confetti} /> */}
65
58
  </View>
66
59
  </View>
67
60
  )
@@ -94,6 +87,7 @@ const styles = StyleSheet.create({
94
87
  },
95
88
  progress: {
96
89
  position: 'absolute',
90
+ left: -12,
97
91
  height: '100%',
98
92
  backgroundColor: COLORS.PRIMARY_BLUE,
99
93
  borderRadius: BORDER_RADIUS[200],
@@ -108,8 +102,6 @@ const styles = StyleSheet.create({
108
102
  marginHorizontal: SPACING[200],
109
103
  },
110
104
  percent: {
111
- position: 'absolute',
112
- paddingRight: 10,
113
105
  color: COLORS.NEUTRAL_1,
114
106
  fontWeight: '700',
115
107
  },
@@ -11,15 +11,3 @@ export const CONTENT_CONTAINER = {
11
11
 
12
12
  export const ANIMATION_DURATION = 1750
13
13
  export const MIN_PROBLEMS_TO_SHOW_GIF = 6
14
-
15
- export const MAX_GIF_SIZE = {
16
- WIDTH: 480,
17
- HEIGHT: 300,
18
- }
19
- export const MIN_GIF_SIZE = 300
20
-
21
- export const GROUPS_PERCENTAGES = {
22
- group1: [15, 20, 25, 30], // Early celebrations
23
- group2: [33, 40, 45, 50], // Mid celebrations
24
- group3: [60, 66, 75, 80], // Party
25
- }