@magmamath/students-features 0.5.5 → 0.5.6

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 (171) hide show
  1. package/dist/commonjs/features/celebrations/components/ParticleBatch.js.map +1 -1
  2. package/dist/commonjs/features/celebrations/components/Spark.js.map +1 -1
  3. package/dist/commonjs/features/endOfAssignment/components/Modal/assets/SunrisingIcon.js.map +1 -1
  4. package/dist/commonjs/features/endOfAssignment/components/Modal/assets/TrophyIcon.js.map +1 -1
  5. package/dist/commonjs/features/endOfAssignment/components/NoAnswer/NoAnswer.js +42 -21
  6. package/dist/commonjs/features/endOfAssignment/components/NoAnswer/NoAnswer.js.map +1 -1
  7. package/dist/commonjs/features/endOfAssignment/ui/SparkIcon.js.map +1 -1
  8. package/dist/commonjs/features/endOfAssignment/ui/ThumbUpIcon.js.map +1 -1
  9. package/dist/commonjs/index.js +0 -12
  10. package/dist/commonjs/index.js.map +1 -1
  11. package/dist/commonjs/shared/icons/Halloween.js.map +1 -1
  12. package/dist/commonjs/shared/icons/MessageBubbleIcon.js.map +1 -1
  13. package/dist/commonjs/shared/icons/Pi.js.map +1 -1
  14. package/dist/commonjs/shared/icons/Star.js.map +1 -1
  15. package/dist/commonjs/shared/icons/Valentine.js.map +1 -1
  16. package/dist/commonjs/shared/icons/Winter.js.map +1 -1
  17. package/dist/commonjs/shared/icons/XCloseIcon.js.map +1 -1
  18. package/dist/module/features/celebrations/components/ParticleBatch.js.map +1 -1
  19. package/dist/module/features/celebrations/components/Spark.js.map +1 -1
  20. package/dist/module/features/endOfAssignment/components/Modal/assets/SunrisingIcon.js.map +1 -1
  21. package/dist/module/features/endOfAssignment/components/Modal/assets/TrophyIcon.js.map +1 -1
  22. package/dist/module/features/endOfAssignment/components/NoAnswer/NoAnswer.js +43 -22
  23. package/dist/module/features/endOfAssignment/components/NoAnswer/NoAnswer.js.map +1 -1
  24. package/dist/module/features/endOfAssignment/ui/SparkIcon.js.map +1 -1
  25. package/dist/module/features/endOfAssignment/ui/ThumbUpIcon.js.map +1 -1
  26. package/dist/module/index.js +0 -1
  27. package/dist/module/index.js.map +1 -1
  28. package/dist/module/shared/icons/Halloween.js.map +1 -1
  29. package/dist/module/shared/icons/MessageBubbleIcon.js.map +1 -1
  30. package/dist/module/shared/icons/Pi.js.map +1 -1
  31. package/dist/module/shared/icons/Star.js.map +1 -1
  32. package/dist/module/shared/icons/Valentine.js.map +1 -1
  33. package/dist/module/shared/icons/Winter.js.map +1 -1
  34. package/dist/module/shared/icons/XCloseIcon.js.map +1 -1
  35. package/dist/typescript/commonjs/features/celebrations/components/ParticleBatch.d.ts +1 -1
  36. package/dist/typescript/commonjs/features/celebrations/components/ParticleBatch.d.ts.map +1 -1
  37. package/dist/typescript/commonjs/features/celebrations/components/Spark.d.ts +1 -1
  38. package/dist/typescript/commonjs/features/celebrations/components/Spark.d.ts.map +1 -1
  39. package/dist/typescript/commonjs/features/endOfAssignment/components/Modal/assets/SunrisingIcon.d.ts +1 -1
  40. package/dist/typescript/commonjs/features/endOfAssignment/components/Modal/assets/SunrisingIcon.d.ts.map +1 -1
  41. package/dist/typescript/commonjs/features/endOfAssignment/components/Modal/assets/TrophyIcon.d.ts +1 -1
  42. package/dist/typescript/commonjs/features/endOfAssignment/components/Modal/assets/TrophyIcon.d.ts.map +1 -1
  43. package/dist/typescript/commonjs/features/endOfAssignment/components/NoAnswer/NoAnswer.d.ts.map +1 -1
  44. package/dist/typescript/commonjs/features/endOfAssignment/ui/SparkIcon.d.ts +1 -1
  45. package/dist/typescript/commonjs/features/endOfAssignment/ui/SparkIcon.d.ts.map +1 -1
  46. package/dist/typescript/commonjs/features/endOfAssignment/ui/ThumbUpIcon.d.ts +1 -1
  47. package/dist/typescript/commonjs/features/endOfAssignment/ui/ThumbUpIcon.d.ts.map +1 -1
  48. package/dist/typescript/commonjs/index.d.ts +0 -1
  49. package/dist/typescript/commonjs/index.d.ts.map +1 -1
  50. package/dist/typescript/commonjs/shared/icons/Halloween.d.ts +1 -1
  51. package/dist/typescript/commonjs/shared/icons/Halloween.d.ts.map +1 -1
  52. package/dist/typescript/commonjs/shared/icons/MessageBubbleIcon.d.ts +1 -1
  53. package/dist/typescript/commonjs/shared/icons/MessageBubbleIcon.d.ts.map +1 -1
  54. package/dist/typescript/commonjs/shared/icons/Pi.d.ts +1 -1
  55. package/dist/typescript/commonjs/shared/icons/Pi.d.ts.map +1 -1
  56. package/dist/typescript/commonjs/shared/icons/Star.d.ts +1 -1
  57. package/dist/typescript/commonjs/shared/icons/Star.d.ts.map +1 -1
  58. package/dist/typescript/commonjs/shared/icons/Valentine.d.ts +1 -1
  59. package/dist/typescript/commonjs/shared/icons/Valentine.d.ts.map +1 -1
  60. package/dist/typescript/commonjs/shared/icons/Winter.d.ts +1 -1
  61. package/dist/typescript/commonjs/shared/icons/Winter.d.ts.map +1 -1
  62. package/dist/typescript/commonjs/shared/icons/XCloseIcon.d.ts +1 -1
  63. package/dist/typescript/commonjs/shared/icons/XCloseIcon.d.ts.map +1 -1
  64. package/dist/typescript/module/features/celebrations/components/ParticleBatch.d.ts +1 -1
  65. package/dist/typescript/module/features/celebrations/components/ParticleBatch.d.ts.map +1 -1
  66. package/dist/typescript/module/features/celebrations/components/Spark.d.ts +1 -1
  67. package/dist/typescript/module/features/celebrations/components/Spark.d.ts.map +1 -1
  68. package/dist/typescript/module/features/endOfAssignment/components/Modal/assets/SunrisingIcon.d.ts +1 -1
  69. package/dist/typescript/module/features/endOfAssignment/components/Modal/assets/SunrisingIcon.d.ts.map +1 -1
  70. package/dist/typescript/module/features/endOfAssignment/components/Modal/assets/TrophyIcon.d.ts +1 -1
  71. package/dist/typescript/module/features/endOfAssignment/components/Modal/assets/TrophyIcon.d.ts.map +1 -1
  72. package/dist/typescript/module/features/endOfAssignment/components/NoAnswer/NoAnswer.d.ts.map +1 -1
  73. package/dist/typescript/module/features/endOfAssignment/ui/SparkIcon.d.ts +1 -1
  74. package/dist/typescript/module/features/endOfAssignment/ui/SparkIcon.d.ts.map +1 -1
  75. package/dist/typescript/module/features/endOfAssignment/ui/ThumbUpIcon.d.ts +1 -1
  76. package/dist/typescript/module/features/endOfAssignment/ui/ThumbUpIcon.d.ts.map +1 -1
  77. package/dist/typescript/module/index.d.ts +0 -1
  78. package/dist/typescript/module/index.d.ts.map +1 -1
  79. package/dist/typescript/module/shared/icons/Halloween.d.ts +1 -1
  80. package/dist/typescript/module/shared/icons/Halloween.d.ts.map +1 -1
  81. package/dist/typescript/module/shared/icons/MessageBubbleIcon.d.ts +1 -1
  82. package/dist/typescript/module/shared/icons/MessageBubbleIcon.d.ts.map +1 -1
  83. package/dist/typescript/module/shared/icons/Pi.d.ts +1 -1
  84. package/dist/typescript/module/shared/icons/Pi.d.ts.map +1 -1
  85. package/dist/typescript/module/shared/icons/Star.d.ts +1 -1
  86. package/dist/typescript/module/shared/icons/Star.d.ts.map +1 -1
  87. package/dist/typescript/module/shared/icons/Valentine.d.ts +1 -1
  88. package/dist/typescript/module/shared/icons/Valentine.d.ts.map +1 -1
  89. package/dist/typescript/module/shared/icons/Winter.d.ts +1 -1
  90. package/dist/typescript/module/shared/icons/Winter.d.ts.map +1 -1
  91. package/dist/typescript/module/shared/icons/XCloseIcon.d.ts +1 -1
  92. package/dist/typescript/module/shared/icons/XCloseIcon.d.ts.map +1 -1
  93. package/package.json +2 -2
  94. package/src/features/celebrations/components/ParticleBatch.tsx +1 -1
  95. package/src/features/celebrations/components/Spark.tsx +4 -4
  96. package/src/features/endOfAssignment/components/Modal/assets/SunrisingIcon.tsx +74 -74
  97. package/src/features/endOfAssignment/components/Modal/assets/TrophyIcon.tsx +24 -24
  98. package/src/features/endOfAssignment/components/NoAnswer/NoAnswer.tsx +52 -25
  99. package/src/features/endOfAssignment/ui/SparkIcon.tsx +2 -1
  100. package/src/features/endOfAssignment/ui/ThumbUpIcon.tsx +2 -2
  101. package/src/index.ts +0 -1
  102. package/src/shared/icons/Halloween.tsx +2 -2
  103. package/src/shared/icons/MessageBubbleIcon.tsx +5 -6
  104. package/src/shared/icons/Pi.tsx +1 -2
  105. package/src/shared/icons/Star.tsx +1 -2
  106. package/src/shared/icons/Valentine.tsx +1 -2
  107. package/src/shared/icons/Winter.tsx +2 -2
  108. package/src/shared/icons/XCloseIcon.tsx +3 -4
  109. package/dist/commonjs/features/formulaSheet/components/FormulaSheet.js +0 -52
  110. package/dist/commonjs/features/formulaSheet/components/FormulaSheet.js.map +0 -1
  111. package/dist/commonjs/features/formulaSheet/components/FormulaSheetModal.js +0 -64
  112. package/dist/commonjs/features/formulaSheet/components/FormulaSheetModal.js.map +0 -1
  113. package/dist/commonjs/features/formulaSheet/index.js +0 -20
  114. package/dist/commonjs/features/formulaSheet/index.js.map +0 -1
  115. package/dist/commonjs/features/formulaSheet/model/api.model.js +0 -15
  116. package/dist/commonjs/features/formulaSheet/model/api.model.js.map +0 -1
  117. package/dist/commonjs/features/formulaSheet/model/file.model.js +0 -19
  118. package/dist/commonjs/features/formulaSheet/model/file.model.js.map +0 -1
  119. package/dist/commonjs/features/formulaSheet/model/modal.model.js +0 -15
  120. package/dist/commonjs/features/formulaSheet/model/modal.model.js.map +0 -1
  121. package/dist/commonjs/features/formulaSheet/model/model.js +0 -35
  122. package/dist/commonjs/features/formulaSheet/model/model.js.map +0 -1
  123. package/dist/module/features/formulaSheet/components/FormulaSheet.js +0 -46
  124. package/dist/module/features/formulaSheet/components/FormulaSheet.js.map +0 -1
  125. package/dist/module/features/formulaSheet/components/FormulaSheetModal.js +0 -58
  126. package/dist/module/features/formulaSheet/components/FormulaSheetModal.js.map +0 -1
  127. package/dist/module/features/formulaSheet/index.js +0 -5
  128. package/dist/module/features/formulaSheet/index.js.map +0 -1
  129. package/dist/module/features/formulaSheet/model/api.model.js +0 -10
  130. package/dist/module/features/formulaSheet/model/api.model.js.map +0 -1
  131. package/dist/module/features/formulaSheet/model/file.model.js +0 -14
  132. package/dist/module/features/formulaSheet/model/file.model.js.map +0 -1
  133. package/dist/module/features/formulaSheet/model/modal.model.js +0 -10
  134. package/dist/module/features/formulaSheet/model/modal.model.js.map +0 -1
  135. package/dist/module/features/formulaSheet/model/model.js +0 -30
  136. package/dist/module/features/formulaSheet/model/model.js.map +0 -1
  137. package/dist/typescript/commonjs/features/formulaSheet/components/FormulaSheet.d.ts +0 -15
  138. package/dist/typescript/commonjs/features/formulaSheet/components/FormulaSheet.d.ts.map +0 -1
  139. package/dist/typescript/commonjs/features/formulaSheet/components/FormulaSheetModal.d.ts +0 -10
  140. package/dist/typescript/commonjs/features/formulaSheet/components/FormulaSheetModal.d.ts.map +0 -1
  141. package/dist/typescript/commonjs/features/formulaSheet/index.d.ts +0 -3
  142. package/dist/typescript/commonjs/features/formulaSheet/index.d.ts.map +0 -1
  143. package/dist/typescript/commonjs/features/formulaSheet/model/api.model.d.ts +0 -9
  144. package/dist/typescript/commonjs/features/formulaSheet/model/api.model.d.ts.map +0 -1
  145. package/dist/typescript/commonjs/features/formulaSheet/model/file.model.d.ts +0 -14
  146. package/dist/typescript/commonjs/features/formulaSheet/model/file.model.d.ts.map +0 -1
  147. package/dist/typescript/commonjs/features/formulaSheet/model/modal.model.d.ts +0 -7
  148. package/dist/typescript/commonjs/features/formulaSheet/model/modal.model.d.ts.map +0 -1
  149. package/dist/typescript/commonjs/features/formulaSheet/model/model.d.ts +0 -14
  150. package/dist/typescript/commonjs/features/formulaSheet/model/model.d.ts.map +0 -1
  151. package/dist/typescript/module/features/formulaSheet/components/FormulaSheet.d.ts +0 -15
  152. package/dist/typescript/module/features/formulaSheet/components/FormulaSheet.d.ts.map +0 -1
  153. package/dist/typescript/module/features/formulaSheet/components/FormulaSheetModal.d.ts +0 -10
  154. package/dist/typescript/module/features/formulaSheet/components/FormulaSheetModal.d.ts.map +0 -1
  155. package/dist/typescript/module/features/formulaSheet/index.d.ts +0 -3
  156. package/dist/typescript/module/features/formulaSheet/index.d.ts.map +0 -1
  157. package/dist/typescript/module/features/formulaSheet/model/api.model.d.ts +0 -9
  158. package/dist/typescript/module/features/formulaSheet/model/api.model.d.ts.map +0 -1
  159. package/dist/typescript/module/features/formulaSheet/model/file.model.d.ts +0 -14
  160. package/dist/typescript/module/features/formulaSheet/model/file.model.d.ts.map +0 -1
  161. package/dist/typescript/module/features/formulaSheet/model/modal.model.d.ts +0 -7
  162. package/dist/typescript/module/features/formulaSheet/model/modal.model.d.ts.map +0 -1
  163. package/dist/typescript/module/features/formulaSheet/model/model.d.ts +0 -14
  164. package/dist/typescript/module/features/formulaSheet/model/model.d.ts.map +0 -1
  165. package/src/features/formulaSheet/components/FormulaSheet.tsx +0 -74
  166. package/src/features/formulaSheet/components/FormulaSheetModal.tsx +0 -64
  167. package/src/features/formulaSheet/index.ts +0 -2
  168. package/src/features/formulaSheet/model/api.model.ts +0 -13
  169. package/src/features/formulaSheet/model/file.model.ts +0 -18
  170. package/src/features/formulaSheet/model/modal.model.ts +0 -10
  171. package/src/features/formulaSheet/model/model.ts +0 -31
@@ -1,10 +0,0 @@
1
- import React, { PropsWithChildren } from 'react';
2
- import { LoaderColor } from '@magmamath/react-native-ui';
3
- type FormulaSheetModalProps = {
4
- isLoading: boolean;
5
- loaderColor: LoaderColor;
6
- onClose: () => void;
7
- };
8
- export declare const FormulaSheetModal: ({ children, loaderColor, isLoading, onClose, }: PropsWithChildren<FormulaSheetModalProps>) => React.JSX.Element;
9
- export {};
10
- //# sourceMappingURL=FormulaSheetModal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FormulaSheetModal.d.ts","sourceRoot":"","sources":["../../../../../../src/features/formulaSheet/components/FormulaSheetModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAEhD,OAAO,EAIL,WAAW,EAIZ,MAAM,4BAA4B,CAAA;AAEnC,KAAK,sBAAsB,GAAG;IAC5B,SAAS,EAAE,OAAO,CAAA;IAClB,WAAW,EAAE,WAAW,CAAA;IACxB,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,iBAAiB,mDAK3B,iBAAiB,CAAC,sBAAsB,CAAC,sBAkB3C,CAAA"}
@@ -1,3 +0,0 @@
1
- export { FormulaSheet } from './components/FormulaSheet';
2
- export { FormulaSheetModel } from './model/model';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/formulaSheet/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA"}
@@ -1,9 +0,0 @@
1
- import { Effect } from 'effector';
2
- export type FormulaSheetApiProps = {
3
- getPDFFileBlob: (id: string) => Promise<string>;
4
- };
5
- export declare class FormulaSheetAPI {
6
- readonly getPDFFileBlobFx: Effect<string, string>;
7
- setupRequests(api: FormulaSheetApiProps): void;
8
- }
9
- //# sourceMappingURL=api.model.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.model.d.ts","sourceRoot":"","sources":["../../../../../../src/features/formulaSheet/model/api.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,MAAM,EAAE,MAAM,UAAU,CAAA;AAE/C,MAAM,MAAM,oBAAoB,GAAG;IACjC,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;CAChD,CAAA;AAED,qBAAa,eAAe;IAC1B,SAAgB,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAiB;IAElE,aAAa,CAAC,GAAG,EAAE,oBAAoB;CAG/C"}
@@ -1,14 +0,0 @@
1
- import { StoreWritable } from 'effector';
2
- import { FormulaSheetAPI } from './api.model';
3
- type FormulaSheetFileProps = {
4
- api: FormulaSheetAPI;
5
- };
6
- export declare class FormulaSheetFile {
7
- readonly reset: import("effector").EventCallable<void>;
8
- readonly $blob: StoreWritable<string | null>;
9
- readonly setId: import("effector").EventCallable<string>;
10
- readonly $id: StoreWritable<string | null>;
11
- constructor({ api }: FormulaSheetFileProps);
12
- }
13
- export {};
14
- //# sourceMappingURL=file.model.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file.model.d.ts","sourceRoot":"","sources":["../../../../../../src/features/formulaSheet/model/file.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,aAAa,EAAE,MAAM,UAAU,CAAA;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7C,KAAK,qBAAqB,GAAG;IAC3B,GAAG,EAAE,eAAe,CAAA;CACrB,CAAA;AAED,qBAAa,gBAAgB;IAC3B,SAAgB,KAAK,yCAAgB;IACrC,SAAgB,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;IAEnD,SAAgB,KAAK,2CAAwB;IAC7C,SAAgB,GAAG,+BAA4B;gBAEnC,EAAE,GAAG,EAAE,EAAE,qBAAqB;CAG3C"}
@@ -1,7 +0,0 @@
1
- export declare class FormulaSheetModal {
2
- readonly reset: import("effector").EventCallable<void>;
3
- readonly toggle: import("effector").EventCallable<void>;
4
- readonly setIsOpen: import("effector").EventCallable<boolean>;
5
- readonly $isOpen: import("effector").StoreWritable<boolean>;
6
- }
7
- //# sourceMappingURL=modal.model.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"modal.model.d.ts","sourceRoot":"","sources":["../../../../../../src/features/formulaSheet/model/modal.model.ts"],"names":[],"mappings":"AAEA,qBAAa,iBAAiB;IAC5B,SAAgB,KAAK,yCAAgB;IACrC,SAAgB,MAAM,yCAAgB;IACtC,SAAgB,SAAS,4CAAyB;IAClD,SAAgB,OAAO,4CAEH;CACrB"}
@@ -1,14 +0,0 @@
1
- import { FormulaSheetAPI, type FormulaSheetApiProps } from './api.model';
2
- import { FormulaSheetModal } from './modal.model';
3
- import { FormulaSheetFile } from './file.model';
4
- type FormulaSheetModelProps = {
5
- api: FormulaSheetApiProps;
6
- };
7
- export declare class FormulaSheetModel {
8
- readonly api: FormulaSheetAPI;
9
- readonly modal: FormulaSheetModal;
10
- readonly file: FormulaSheetFile;
11
- constructor({ api }: FormulaSheetModelProps);
12
- }
13
- export {};
14
- //# sourceMappingURL=model.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../../../src/features/formulaSheet/model/model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAA;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAE/C,KAAK,sBAAsB,GAAG;IAC5B,GAAG,EAAE,oBAAoB,CAAA;CAC1B,CAAA;AAED,qBAAa,iBAAiB;IAC5B,SAAgB,GAAG,kBAAwB;IAC3C,SAAgB,KAAK,oBAA0B;IAC/C,SAAgB,IAAI,mBAA0C;gBAElD,EAAE,GAAG,EAAE,EAAE,sBAAsB;CAgB5C"}
@@ -1,74 +0,0 @@
1
- import React, { forwardRef, ReactNode, useEffect } from 'react'
2
- import { useUnit } from 'effector-react'
3
- import {
4
- Button,
5
- ButtonColor,
6
- ButtonSize,
7
- ButtonVariant,
8
- COLORS,
9
- TheoryIcon,
10
- ButtonRef,
11
- LoaderColor,
12
- } from '@magmamath/react-native-ui'
13
- import { FormulaSheetModel } from '../model/model'
14
- import { FormulaSheetModal } from './FormulaSheetModal'
15
-
16
- type FormulaSheetProps = {
17
- model: FormulaSheetModel
18
- fileId: string
19
- renderer: (fileBlob: string) => ReactNode
20
- buttonSize: ButtonSize
21
- buttonColor: ButtonColor
22
- loaderColor: LoaderColor
23
- onPress?: () => void
24
- }
25
-
26
- export const FormulaSheet = forwardRef<ButtonRef | null, FormulaSheetProps>(
27
- (
28
- {
29
- model,
30
- fileId,
31
- renderer,
32
- buttonSize = ButtonSize.MEDIUM,
33
- buttonColor = ButtonColor.BLUE,
34
- loaderColor = LoaderColor.BLUE,
35
- onPress,
36
- },
37
- ref,
38
- ) => {
39
- const isOpen = useUnit(model.modal.$isOpen)
40
- const sheetFileBlob = useUnit(model.file.$blob)
41
- const isRequestPending = useUnit(model.api.getPDFFileBlobFx.pending)
42
-
43
- useEffect(() => {
44
- model.file.setId(fileId ?? null)
45
- }, [fileId])
46
-
47
- return (
48
- <>
49
- <Button
50
- ref={ref}
51
- size={buttonSize}
52
- variant={ButtonVariant.SECONDARY}
53
- colorScheme={buttonColor}
54
- isActive={isOpen}
55
- onPress={() => {
56
- model.modal.toggle()
57
- onPress?.()
58
- }}
59
- icon={<TheoryIcon color={isOpen ? COLORS.NEUTRAL_1 : undefined} size={20} />}
60
- />
61
-
62
- {isOpen && (
63
- <FormulaSheetModal
64
- isLoading={isRequestPending}
65
- loaderColor={loaderColor}
66
- onClose={() => model.modal.setIsOpen(false)}
67
- >
68
- {renderer(sheetFileBlob ?? '')}
69
- </FormulaSheetModal>
70
- )}
71
- </>
72
- )
73
- },
74
- )
@@ -1,64 +0,0 @@
1
- import React, { PropsWithChildren } from 'react'
2
- import { View, Modal, StyleSheet, TouchableWithoutFeedback } from 'react-native'
3
- import {
4
- BORDER_RADIUS,
5
- COLORS,
6
- Loader,
7
- LoaderColor,
8
- LoaderSize,
9
- LoaderType,
10
- SPACING,
11
- } from '@magmamath/react-native-ui'
12
-
13
- type FormulaSheetModalProps = {
14
- isLoading: boolean
15
- loaderColor: LoaderColor
16
- onClose: () => void
17
- }
18
-
19
- export const FormulaSheetModal = ({
20
- children,
21
- loaderColor,
22
- isLoading,
23
- onClose,
24
- }: PropsWithChildren<FormulaSheetModalProps>) => {
25
- return (
26
- <Modal visible transparent animationType="none" onRequestClose={onClose}>
27
- <TouchableWithoutFeedback onPress={onClose}>
28
- <View style={styles.container}>
29
- <TouchableWithoutFeedback onPress={(event) => event.stopPropagation()}>
30
- <View style={styles.content}>
31
- {isLoading ? (
32
- <Loader type={LoaderType.PRIMARY} color={loaderColor} size={LoaderSize.LARGE} />
33
- ) : (
34
- children
35
- )}
36
- </View>
37
- </TouchableWithoutFeedback>
38
- </View>
39
- </TouchableWithoutFeedback>
40
- </Modal>
41
- )
42
- }
43
-
44
- const styles = StyleSheet.create({
45
- container: {
46
- width: '100%',
47
- height: '100%',
48
- alignItems: 'center',
49
- justifyContent: 'center',
50
- backgroundColor: 'rgba(0, 0, 0, 0.25)',
51
- },
52
- content: {
53
- width: '100%',
54
- maxWidth: 720,
55
- height: '100%',
56
- maxHeight: '80%',
57
- alignItems: 'center',
58
- justifyContent: 'center',
59
- paddingHorizontal: SPACING['800'],
60
- paddingVertical: SPACING['400'],
61
- borderRadius: BORDER_RADIUS['400'],
62
- backgroundColor: COLORS.NEUTRAL_1,
63
- },
64
- })
@@ -1,2 +0,0 @@
1
- export { FormulaSheet } from './components/FormulaSheet'
2
- export { FormulaSheetModel } from './model/model'
@@ -1,13 +0,0 @@
1
- import { createEffect, Effect } from 'effector'
2
-
3
- export type FormulaSheetApiProps = {
4
- getPDFFileBlob: (id: string) => Promise<string>
5
- }
6
-
7
- export class FormulaSheetAPI {
8
- public readonly getPDFFileBlobFx: Effect<string, string> = createEffect()
9
-
10
- public setupRequests(api: FormulaSheetApiProps) {
11
- this.getPDFFileBlobFx.use(api.getPDFFileBlob)
12
- }
13
- }
@@ -1,18 +0,0 @@
1
- import { createEvent, restore, StoreWritable } from 'effector'
2
- import { FormulaSheetAPI } from './api.model'
3
-
4
- type FormulaSheetFileProps = {
5
- api: FormulaSheetAPI
6
- }
7
-
8
- export class FormulaSheetFile {
9
- public readonly reset = createEvent()
10
- public readonly $blob: StoreWritable<string | null>
11
-
12
- public readonly setId = createEvent<string>()
13
- public readonly $id = restore(this.setId, null)
14
-
15
- constructor({ api }: FormulaSheetFileProps) {
16
- this.$blob = restore(api.getPDFFileBlobFx.doneData, null).reset(this.reset)
17
- }
18
- }
@@ -1,10 +0,0 @@
1
- import { createEvent, restore } from 'effector'
2
-
3
- export class FormulaSheetModal {
4
- public readonly reset = createEvent()
5
- public readonly toggle = createEvent()
6
- public readonly setIsOpen = createEvent<boolean>()
7
- public readonly $isOpen = restore(this.setIsOpen, false)
8
- .on(this.toggle, (state) => !state)
9
- .reset(this.reset)
10
- }
@@ -1,31 +0,0 @@
1
- import { sample } from 'effector'
2
- import { FormulaSheetAPI, type FormulaSheetApiProps } from './api.model'
3
- import { FormulaSheetModal } from './modal.model'
4
- import { FormulaSheetFile } from './file.model'
5
-
6
- type FormulaSheetModelProps = {
7
- api: FormulaSheetApiProps
8
- }
9
-
10
- export class FormulaSheetModel {
11
- public readonly api = new FormulaSheetAPI()
12
- public readonly modal = new FormulaSheetModal()
13
- public readonly file = new FormulaSheetFile({ api: this.api })
14
-
15
- constructor({ api }: FormulaSheetModelProps) {
16
- this.api.setupRequests(api)
17
-
18
- sample({
19
- clock: this.modal.$isOpen,
20
- source: [this.file.$id, this.file.$blob],
21
- filter: ([fileId, blob], isOpen) => !!(isOpen && fileId && !blob),
22
- fn: ([fileId]) => fileId as string,
23
- target: this.api.getPDFFileBlobFx,
24
- })
25
-
26
- sample({
27
- clock: this.file.$id,
28
- target: [this.file.reset, this.modal.reset],
29
- })
30
- }
31
- }