@magmamath/students-features 0.6.5-rc-21 → 0.6.5-rc.1
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/chatbot/model/ChatBotModel.js +3 -3
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatBoxTextManager.js +1 -3
- package/dist/commonjs/features/chatbot/model/ChatBoxTextManager.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/DefaultMessageCreator.js +2 -4
- package/dist/commonjs/features/chatbot/model/DefaultMessageCreator.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/constants.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/translation.js +0 -7
- package/dist/commonjs/features/chatbot/model/translation.js.map +1 -1
- package/dist/commonjs/features/endOfAssignment/components/Modal/ModalBackground.js +3 -17
- package/dist/commonjs/features/endOfAssignment/components/Modal/ModalBackground.js.map +1 -1
- package/dist/commonjs/features/feedback/model/comments.js +3 -5
- package/dist/commonjs/features/feedback/model/comments.js.map +1 -1
- package/dist/commonjs/features/feedback/model/model.js +9 -7
- package/dist/commonjs/features/feedback/model/model.js.map +1 -1
- package/dist/commonjs/features/gifCelebrations/GifCelebrations.js +65 -0
- package/dist/commonjs/features/gifCelebrations/GifCelebrations.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/assets/confetti.webp +0 -0
- package/dist/commonjs/features/gifCelebrations/components/Backdrop.js +44 -0
- package/dist/commonjs/features/gifCelebrations/components/Backdrop.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/components/ContentContainer.js +46 -0
- package/dist/commonjs/features/gifCelebrations/components/ContentContainer.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/components/Gif.js +63 -0
- package/dist/commonjs/features/gifCelebrations/components/Gif.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/components/Progress.js +102 -0
- package/dist/commonjs/features/gifCelebrations/components/Progress.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/constants.js +18 -0
- package/dist/commonjs/features/gifCelebrations/constants.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/helpers.js +67 -0
- package/dist/commonjs/features/gifCelebrations/helpers.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/index.js +20 -0
- package/dist/commonjs/features/gifCelebrations/index.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/model/GifCelebrations.cache.js +19 -0
- package/dist/commonjs/features/gifCelebrations/model/GifCelebrations.cache.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/model/GifCelebrations.model.js +151 -0
- package/dist/commonjs/features/gifCelebrations/model/GifCelebrations.model.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/model/GifCelebrationsApi.js +14 -0
- package/dist/commonjs/features/gifCelebrations/model/GifCelebrationsApi.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/types/model.types.js +6 -0
- package/dist/commonjs/features/gifCelebrations/types/model.types.js.map +1 -0
- package/dist/commonjs/index.js +12 -0
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/shared/hooks/useImagePreloader.js +20 -0
- package/dist/commonjs/shared/hooks/useImagePreloader.js.map +1 -0
- package/dist/commonjs/shared/translation/localization/en.json +1 -2
- package/dist/commonjs/shared/translation/localization/gb.json +1 -2
- package/dist/commonjs/shared/translation/localization/sw.json +1 -2
- package/dist/module/features/chatbot/model/ChatBotModel.js +3 -3
- package/dist/module/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatBoxTextManager.js +1 -3
- package/dist/module/features/chatbot/model/ChatBoxTextManager.js.map +1 -1
- package/dist/module/features/chatbot/model/DefaultMessageCreator.js +2 -4
- package/dist/module/features/chatbot/model/DefaultMessageCreator.js.map +1 -1
- package/dist/module/features/chatbot/model/constants.js.map +1 -1
- package/dist/module/features/chatbot/model/translation.js +0 -7
- package/dist/module/features/chatbot/model/translation.js.map +1 -1
- package/dist/module/features/endOfAssignment/components/Modal/ModalBackground.js +4 -19
- package/dist/module/features/endOfAssignment/components/Modal/ModalBackground.js.map +1 -1
- package/dist/module/features/feedback/model/comments.js +3 -5
- package/dist/module/features/feedback/model/comments.js.map +1 -1
- package/dist/module/features/feedback/model/model.js +9 -7
- package/dist/module/features/feedback/model/model.js.map +1 -1
- package/dist/module/features/gifCelebrations/GifCelebrations.js +58 -0
- package/dist/module/features/gifCelebrations/GifCelebrations.js.map +1 -0
- package/dist/module/features/gifCelebrations/assets/confetti.webp +0 -0
- package/dist/module/features/gifCelebrations/components/Backdrop.js +36 -0
- package/dist/module/features/gifCelebrations/components/Backdrop.js.map +1 -0
- package/dist/module/features/gifCelebrations/components/ContentContainer.js +38 -0
- package/dist/module/features/gifCelebrations/components/ContentContainer.js.map +1 -0
- package/dist/module/features/gifCelebrations/components/Gif.js +56 -0
- package/dist/module/features/gifCelebrations/components/Gif.js.map +1 -0
- package/dist/module/features/gifCelebrations/components/Progress.js +94 -0
- package/dist/module/features/gifCelebrations/components/Progress.js.map +1 -0
- package/dist/module/features/gifCelebrations/constants.js +14 -0
- package/dist/module/features/gifCelebrations/constants.js.map +1 -0
- package/dist/module/features/gifCelebrations/helpers.js +61 -0
- package/dist/module/features/gifCelebrations/helpers.js.map +1 -0
- package/dist/module/features/gifCelebrations/index.js +5 -0
- package/dist/module/features/gifCelebrations/index.js.map +1 -0
- package/dist/module/features/gifCelebrations/model/GifCelebrations.cache.js +14 -0
- package/dist/module/features/gifCelebrations/model/GifCelebrations.cache.js.map +1 -0
- package/dist/module/features/gifCelebrations/model/GifCelebrations.model.js +146 -0
- package/dist/module/features/gifCelebrations/model/GifCelebrations.model.js.map +1 -0
- package/dist/module/features/gifCelebrations/model/GifCelebrationsApi.js +9 -0
- package/dist/module/features/gifCelebrations/model/GifCelebrationsApi.js.map +1 -0
- package/dist/module/features/gifCelebrations/types/model.types.js +4 -0
- package/dist/module/features/gifCelebrations/types/model.types.js.map +1 -0
- package/dist/module/index.js +1 -0
- package/dist/module/index.js.map +1 -1
- package/dist/module/shared/hooks/useImagePreloader.js +15 -0
- package/dist/module/shared/hooks/useImagePreloader.js.map +1 -0
- package/dist/module/shared/translation/localization/en.json +1 -2
- package/dist/module/shared/translation/localization/gb.json +1 -2
- package/dist/module/shared/translation/localization/sw.json +1 -2
- package/dist/typescript/commonjs/features/chatbot/model/ChatBoxTextManager.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/DefaultMessageCreator.d.ts +1 -2
- package/dist/typescript/commonjs/features/chatbot/model/DefaultMessageCreator.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/translation.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/endOfAssignment/components/Modal/ModalBackground.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/gifCelebrations/GifCelebrations.d.ts +8 -0
- package/dist/typescript/commonjs/features/gifCelebrations/GifCelebrations.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/components/Backdrop.d.ts +9 -0
- package/dist/typescript/commonjs/features/gifCelebrations/components/Backdrop.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/components/ContentContainer.d.ts +9 -0
- package/dist/typescript/commonjs/features/gifCelebrations/components/ContentContainer.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/components/Gif.d.ts +7 -0
- package/dist/typescript/commonjs/features/gifCelebrations/components/Gif.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/components/Progress.d.ts +9 -0
- package/dist/typescript/commonjs/features/gifCelebrations/components/Progress.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/constants.d.ts +12 -0
- package/dist/typescript/commonjs/features/gifCelebrations/constants.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/helpers.d.ts +75 -0
- package/dist/typescript/commonjs/features/gifCelebrations/helpers.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/index.d.ts +3 -0
- package/dist/typescript/commonjs/features/gifCelebrations/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/model/GifCelebrations.cache.d.ts +8 -0
- package/dist/typescript/commonjs/features/gifCelebrations/model/GifCelebrations.cache.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/model/GifCelebrations.model.d.ts +23 -0
- package/dist/typescript/commonjs/features/gifCelebrations/model/GifCelebrations.model.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/model/GifCelebrationsApi.d.ts +6 -0
- package/dist/typescript/commonjs/features/gifCelebrations/model/GifCelebrationsApi.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/types/model.types.d.ts +32 -0
- package/dist/typescript/commonjs/features/gifCelebrations/types/model.types.d.ts.map +1 -0
- package/dist/typescript/commonjs/index.d.ts +1 -0
- package/dist/typescript/commonjs/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/hooks/useImagePreloader.d.ts +4 -0
- package/dist/typescript/commonjs/shared/hooks/useImagePreloader.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/translation/constants.d.ts +0 -3
- package/dist/typescript/commonjs/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/model.d.ts +0 -2
- package/dist/typescript/commonjs/shared/translation/model.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatBoxTextManager.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/DefaultMessageCreator.d.ts +1 -2
- package/dist/typescript/module/features/chatbot/model/DefaultMessageCreator.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/constants.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/translation.d.ts.map +1 -1
- package/dist/typescript/module/features/endOfAssignment/components/Modal/ModalBackground.d.ts.map +1 -1
- package/dist/typescript/module/features/gifCelebrations/GifCelebrations.d.ts +8 -0
- package/dist/typescript/module/features/gifCelebrations/GifCelebrations.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/components/Backdrop.d.ts +9 -0
- package/dist/typescript/module/features/gifCelebrations/components/Backdrop.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/components/ContentContainer.d.ts +9 -0
- package/dist/typescript/module/features/gifCelebrations/components/ContentContainer.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/components/Gif.d.ts +7 -0
- package/dist/typescript/module/features/gifCelebrations/components/Gif.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/components/Progress.d.ts +9 -0
- package/dist/typescript/module/features/gifCelebrations/components/Progress.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/constants.d.ts +12 -0
- package/dist/typescript/module/features/gifCelebrations/constants.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/helpers.d.ts +75 -0
- package/dist/typescript/module/features/gifCelebrations/helpers.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/index.d.ts +3 -0
- package/dist/typescript/module/features/gifCelebrations/index.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/model/GifCelebrations.cache.d.ts +8 -0
- package/dist/typescript/module/features/gifCelebrations/model/GifCelebrations.cache.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/model/GifCelebrations.model.d.ts +23 -0
- package/dist/typescript/module/features/gifCelebrations/model/GifCelebrations.model.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/model/GifCelebrationsApi.d.ts +6 -0
- package/dist/typescript/module/features/gifCelebrations/model/GifCelebrationsApi.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/types/model.types.d.ts +32 -0
- package/dist/typescript/module/features/gifCelebrations/types/model.types.d.ts.map +1 -0
- package/dist/typescript/module/index.d.ts +1 -0
- package/dist/typescript/module/index.d.ts.map +1 -1
- package/dist/typescript/module/shared/hooks/useImagePreloader.d.ts +4 -0
- package/dist/typescript/module/shared/hooks/useImagePreloader.d.ts.map +1 -0
- package/dist/typescript/module/shared/translation/constants.d.ts +0 -3
- package/dist/typescript/module/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/model.d.ts +0 -2
- package/dist/typescript/module/shared/translation/model.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/features/chatbot/model/ChatBotModel.ts +1 -1
- package/src/features/chatbot/model/ChatBoxTextManager.ts +1 -3
- package/src/features/chatbot/model/DefaultMessageCreator.ts +2 -4
- package/src/features/chatbot/model/constants.ts +2 -0
- package/src/features/chatbot/model/translation.ts +0 -9
- package/src/features/endOfAssignment/components/Modal/ModalBackground.tsx +3 -14
- package/src/features/feedback/model/comments.ts +7 -7
- package/src/features/feedback/model/model.ts +6 -6
- package/src/features/gifCelebrations/GifCelebrations.tsx +75 -0
- package/src/features/gifCelebrations/assets/confetti.webp +0 -0
- package/src/features/gifCelebrations/components/Backdrop.tsx +40 -0
- package/src/features/gifCelebrations/components/ContentContainer.tsx +43 -0
- package/src/features/gifCelebrations/components/Gif.tsx +61 -0
- package/src/features/gifCelebrations/components/Progress.tsx +108 -0
- package/src/features/gifCelebrations/constants.ts +13 -0
- package/src/features/gifCelebrations/helpers.ts +68 -0
- package/src/features/gifCelebrations/index.ts +2 -0
- package/src/features/gifCelebrations/model/GifCelebrations.cache.ts +24 -0
- package/src/features/gifCelebrations/model/GifCelebrations.model.ts +177 -0
- package/src/features/gifCelebrations/model/GifCelebrationsApi.ts +10 -0
- package/src/features/gifCelebrations/types/model.types.ts +36 -0
- package/src/index.ts +1 -0
- package/src/shared/hooks/useImagePreloader.ts +15 -0
- package/src/shared/translation/localization/en.json +1 -2
- package/src/shared/translation/localization/gb.json +1 -2
- package/src/shared/translation/localization/sw.json +1 -2
- package/src/types/types.d.ts +0 -5
- package/dist/commonjs/features/endOfAssignment/components/Modal/assets/goblet-bg.webp +0 -0
- package/dist/module/features/endOfAssignment/components/Modal/assets/goblet-bg.webp +0 -0
- package/src/features/endOfAssignment/components/Modal/assets/goblet-bg.webp +0 -0
|
@@ -14,7 +14,6 @@ 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;
|
|
@@ -36,7 +35,6 @@ export declare const LOCALIZATION_CONFIGS: {
|
|
|
36
35
|
"time.yearsAgo": string;
|
|
37
36
|
chat: {
|
|
38
37
|
anotherHint: string;
|
|
39
|
-
giveHint: string;
|
|
40
38
|
answerAgain: string;
|
|
41
39
|
errorMessage: string;
|
|
42
40
|
howCanIHelp: string;
|
|
@@ -58,7 +56,6 @@ export declare const LOCALIZATION_CONFIGS: {
|
|
|
58
56
|
"time.yearsAgo": string;
|
|
59
57
|
chat: {
|
|
60
58
|
anotherHint: string;
|
|
61
|
-
giveHint: string;
|
|
62
59
|
answerAgain: string;
|
|
63
60
|
errorMessage: string;
|
|
64
61
|
howCanIHelp: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/shared/translation/constants.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/shared/translation/constants.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIhC,CAAA"}
|
|
@@ -15,7 +15,6 @@ 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;
|
|
@@ -37,7 +36,6 @@ export declare const $localization: import("effector").StoreWritable<{
|
|
|
37
36
|
"time.yearsAgo": string;
|
|
38
37
|
chat: {
|
|
39
38
|
anotherHint: string;
|
|
40
|
-
giveHint: string;
|
|
41
39
|
answerAgain: string;
|
|
42
40
|
errorMessage: string;
|
|
43
41
|
howCanIHelp: string;
|
|
@@ -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
|
|
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
|
@@ -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
|
|
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)
|
|
@@ -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
|
|
@@ -1,25 +1,14 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { View, StyleSheet
|
|
2
|
+
import { View, StyleSheet } from 'react-native'
|
|
3
3
|
import { BORDER_RADIUS } from '@magmamath/react-native-ui'
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import { TrophyIcon } from './assets/TrophyIcon'
|
|
6
6
|
import { SunrisingIcon } from './assets/SunrisingIcon'
|
|
7
|
-
import ModalBg from './assets/goblet-bg.webp'
|
|
8
|
-
|
|
9
|
-
// force TS to see ModalBg as string on web
|
|
10
|
-
const webUri = ModalBg as string
|
|
11
|
-
|
|
12
|
-
// force TS to see ModalBg as number on native
|
|
13
|
-
const nativeModuleId = ModalBg as number
|
|
14
7
|
|
|
15
8
|
export const ModalBackground = () => (
|
|
16
9
|
<View style={[StyleSheet.absoluteFill, styles.backgroundContainer]}>
|
|
17
10
|
<View style={styles.bgImageLeft}>
|
|
18
|
-
<
|
|
19
|
-
source={Platform.OS === 'web' ? { uri: webUri } : nativeModuleId}
|
|
20
|
-
style={{ width: 300, height: 300, resizeMode: 'cover' }}
|
|
21
|
-
/>
|
|
22
|
-
{/* <TrophyIcon size={466} /> */}
|
|
11
|
+
<TrophyIcon size={466} />
|
|
23
12
|
</View>
|
|
24
13
|
<View style={styles.bgImageRight}>
|
|
25
14
|
<SunrisingIcon size={909} />
|
|
@@ -23,18 +23,18 @@ export class TeacherCommentsModel {
|
|
|
23
23
|
state,
|
|
24
24
|
assignmentId,
|
|
25
25
|
problemId,
|
|
26
|
-
fn:
|
|
27
|
-
comments: data.comments.map(
|
|
26
|
+
fn: data => ({
|
|
27
|
+
comments: data.comments.map(comment => ({ ...comment, isRead: true })),
|
|
28
28
|
unreadMessagesCount: 0,
|
|
29
29
|
}),
|
|
30
30
|
}),
|
|
31
31
|
)
|
|
32
|
-
.on(this.add, (state, { assignmentId, comment, isRead }) =>
|
|
32
|
+
.on(this.add, (state, { assignmentId, problemId, comment, isRead }) =>
|
|
33
33
|
updateCommentsState({
|
|
34
34
|
state,
|
|
35
35
|
assignmentId,
|
|
36
|
-
problemId
|
|
37
|
-
fn:
|
|
36
|
+
problemId,
|
|
37
|
+
fn: data => ({
|
|
38
38
|
comments: [...data.comments, comment],
|
|
39
39
|
unreadMessagesCount: isRead ? data.unreadMessagesCount : data.unreadMessagesCount + 1,
|
|
40
40
|
}),
|
|
@@ -45,7 +45,7 @@ export class TeacherCommentsModel {
|
|
|
45
45
|
state,
|
|
46
46
|
assignmentId,
|
|
47
47
|
problemId,
|
|
48
|
-
fn:
|
|
48
|
+
fn: data => {
|
|
49
49
|
const commentToDelete = data.comments.find(({ _id }) => _id === commentId)
|
|
50
50
|
if (!commentToDelete) return data
|
|
51
51
|
|
|
@@ -77,7 +77,7 @@ export class TeacherCommentsModel {
|
|
|
77
77
|
sample({
|
|
78
78
|
clock: this.add,
|
|
79
79
|
source: { isOpen: $isOpen },
|
|
80
|
-
filter: ({ isOpen }
|
|
80
|
+
filter: ({ isOpen }) => isOpen,
|
|
81
81
|
fn: (_, { comment }) => ({
|
|
82
82
|
ids: [comment._id],
|
|
83
83
|
}),
|
|
@@ -56,7 +56,7 @@ export class TeacherFeedbackModel {
|
|
|
56
56
|
comments?.length === 1 && comments[0]._id === EMPTY_COMMENT_ID
|
|
57
57
|
return !isOpen && isOnlyNoCommentsMessage
|
|
58
58
|
},
|
|
59
|
-
fn: ({ assignmentId, problemId }) => ({
|
|
59
|
+
fn: ({ assignmentId, problemId }, comment) => ({
|
|
60
60
|
assignmentId,
|
|
61
61
|
problemId,
|
|
62
62
|
commentId: EMPTY_COMMENT_ID,
|
|
@@ -76,7 +76,7 @@ export class TeacherFeedbackModel {
|
|
|
76
76
|
const hasUnreadComments = comments.some(({ isRead }) => !isRead)
|
|
77
77
|
return isOpen && hasUnreadComments
|
|
78
78
|
},
|
|
79
|
-
fn:
|
|
79
|
+
fn: source => {
|
|
80
80
|
const comments = findCommentsByCredits(source)
|
|
81
81
|
return { ids: comments.map(({ _id }) => _id) }
|
|
82
82
|
},
|
|
@@ -97,8 +97,9 @@ export class TeacherFeedbackModel {
|
|
|
97
97
|
|
|
98
98
|
sample({
|
|
99
99
|
clock: this.sockets.commentDeleted,
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
source: { assignmentId: credits.$assignmentId },
|
|
101
|
+
fn: ({ assignmentId }, comment) => ({
|
|
102
|
+
assignmentId,
|
|
102
103
|
problemId: comment.problemId,
|
|
103
104
|
commentId: comment._id,
|
|
104
105
|
}),
|
|
@@ -112,11 +113,10 @@ export class TeacherFeedbackModel {
|
|
|
112
113
|
problemId: credits.$problemId,
|
|
113
114
|
isOpen: this.$isOpen,
|
|
114
115
|
},
|
|
115
|
-
filter: ({ assignmentId }, comment) => assignmentId === comment.exerciseId,
|
|
116
116
|
fn: ({ assignmentId, problemId, isOpen }, comment) => ({
|
|
117
117
|
comment,
|
|
118
118
|
assignmentId,
|
|
119
|
-
problemId,
|
|
119
|
+
problemId: comment.problemId,
|
|
120
120
|
isRead: isOpen && comment.problemId === problemId,
|
|
121
121
|
}),
|
|
122
122
|
target: this.comments.add,
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
|
+
import { Gif } from './components/Gif'
|
|
3
|
+
import { Progress } from './components/Progress'
|
|
4
|
+
import { ContentContainer } from './components/ContentContainer'
|
|
5
|
+
import { Backdrop } from './components/Backdrop'
|
|
6
|
+
import { Easing, runOnJS, useSharedValue, withSequence, withTiming } from 'react-native-reanimated'
|
|
7
|
+
import { useUnit } from 'effector-react'
|
|
8
|
+
import { ANIMATION_DURATION } from './constants'
|
|
9
|
+
import { GifCelebrationsModel } from './model/GifCelebrations.model'
|
|
10
|
+
|
|
11
|
+
type GifCelebrationsProps = {
|
|
12
|
+
model: GifCelebrationsModel
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const GifCelebrations = ({ model }: GifCelebrationsProps) => {
|
|
16
|
+
const [totalProblems, resolvedProblems, activeGif] = useUnit([
|
|
17
|
+
model.$totalProblems,
|
|
18
|
+
model.$resolvedProblems,
|
|
19
|
+
model.$activeGif,
|
|
20
|
+
])
|
|
21
|
+
console.log('totalProblems: ', totalProblems)
|
|
22
|
+
|
|
23
|
+
console.log('activeGif: ', activeGif)
|
|
24
|
+
console.log('resolvedProblems: ', resolvedProblems)
|
|
25
|
+
|
|
26
|
+
const completedPercent =
|
|
27
|
+
resolvedProblems && totalProblems && Math.round((resolvedProblems / totalProblems) * 100)
|
|
28
|
+
|
|
29
|
+
const progress = useSharedValue(0)
|
|
30
|
+
|
|
31
|
+
const stopAnimation = () => {
|
|
32
|
+
model.stop()
|
|
33
|
+
progress.value = 0
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const playAnimation = () => {
|
|
37
|
+
progress.value = withSequence(
|
|
38
|
+
withTiming(1, {
|
|
39
|
+
duration: ANIMATION_DURATION,
|
|
40
|
+
easing: Easing.bezier(0.52, 0.16, 0.26, 0.77),
|
|
41
|
+
}),
|
|
42
|
+
withTiming(
|
|
43
|
+
2,
|
|
44
|
+
{
|
|
45
|
+
duration: ANIMATION_DURATION,
|
|
46
|
+
easing: Easing.bezier(0.71, 0.09, 0.49, 0.89),
|
|
47
|
+
},
|
|
48
|
+
() => runOnJS(stopAnimation)(),
|
|
49
|
+
),
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
model.initialize()
|
|
55
|
+
}, [])
|
|
56
|
+
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
if (activeGif) {
|
|
59
|
+
playAnimation()
|
|
60
|
+
}
|
|
61
|
+
}, [activeGif])
|
|
62
|
+
|
|
63
|
+
if (!activeGif) {
|
|
64
|
+
return null
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<Backdrop progress={progress}>
|
|
69
|
+
<ContentContainer progress={progress}>
|
|
70
|
+
<Gif uri={activeGif.url} />
|
|
71
|
+
<Progress progress={progress} completedPercent={completedPercent} />
|
|
72
|
+
</ContentContainer>
|
|
73
|
+
</Backdrop>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { StyleSheet, useWindowDimensions } from 'react-native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import Animated, { useAnimatedStyle, interpolateColor, SharedValue } from 'react-native-reanimated'
|
|
4
|
+
import { BACKDROP_COLOR } from '../constants'
|
|
5
|
+
|
|
6
|
+
type BackdropProps = {
|
|
7
|
+
children: React.ReactNode
|
|
8
|
+
progress: SharedValue<number>
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const Backdrop = ({ children, progress }: BackdropProps) => {
|
|
12
|
+
const { width, height } = useWindowDimensions()
|
|
13
|
+
|
|
14
|
+
const backdropAnimatedStyle = useAnimatedStyle(
|
|
15
|
+
() => ({
|
|
16
|
+
backgroundColor: interpolateColor(
|
|
17
|
+
progress.value,
|
|
18
|
+
[0, 1, 2],
|
|
19
|
+
[BACKDROP_COLOR.INITIAL, BACKDROP_COLOR.FINAL, BACKDROP_COLOR.INITIAL],
|
|
20
|
+
),
|
|
21
|
+
}),
|
|
22
|
+
[progress],
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Animated.View style={[styles.backdrop, { width, height }, backdropAnimatedStyle]}>
|
|
27
|
+
{children}
|
|
28
|
+
</Animated.View>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const styles = StyleSheet.create({
|
|
33
|
+
backdrop: {
|
|
34
|
+
position: 'absolute',
|
|
35
|
+
zIndex: 1100,
|
|
36
|
+
justifyContent: 'center',
|
|
37
|
+
alignItems: 'center',
|
|
38
|
+
backgroundColor: 'rgba(51, 51, 51, 0.33);',
|
|
39
|
+
},
|
|
40
|
+
})
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { StyleSheet, useWindowDimensions } from 'react-native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { SPACING } from '@magmamath/react-native-ui'
|
|
4
|
+
import Animated, { useAnimatedStyle, interpolate, SharedValue } from 'react-native-reanimated'
|
|
5
|
+
import { CONTENT_CONTAINER } from '../constants'
|
|
6
|
+
|
|
7
|
+
type ContentContainerProps = {
|
|
8
|
+
children: React.ReactNode
|
|
9
|
+
progress: SharedValue<number>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const ContentContainer = ({ children, progress }: ContentContainerProps) => {
|
|
13
|
+
const { width } = useWindowDimensions()
|
|
14
|
+
|
|
15
|
+
const RIGHT_POSITION =
|
|
16
|
+
width / 2 + CONTENT_CONTAINER.CONTAINER_WIDTH / 2 + CONTENT_CONTAINER.SAFE_AREA
|
|
17
|
+
const LEFT_POSITION = -RIGHT_POSITION - CONTENT_CONTAINER.SAFE_AREA
|
|
18
|
+
|
|
19
|
+
const animatedStyles = useAnimatedStyle(
|
|
20
|
+
() => ({
|
|
21
|
+
transform: [
|
|
22
|
+
{
|
|
23
|
+
translateX: interpolate(progress.value, [0, 1, 2], [LEFT_POSITION, 0, RIGHT_POSITION]),
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
rotate: `${interpolate(progress.value, [0, 1, 2], [-CONTENT_CONTAINER.ANGLE, 0, CONTENT_CONTAINER.ANGLE])}deg`,
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
}),
|
|
30
|
+
[progress, RIGHT_POSITION, LEFT_POSITION],
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
return <Animated.View style={[styles.container, animatedStyles]}>{children}</Animated.View>
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const styles = StyleSheet.create({
|
|
37
|
+
container: {
|
|
38
|
+
width: CONTENT_CONTAINER.CONTAINER_WIDTH,
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
gap: SPACING[800],
|
|
41
|
+
position: 'absolute',
|
|
42
|
+
},
|
|
43
|
+
})
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { StyleSheet, View, Image } from 'react-native'
|
|
2
|
+
import React, { useLayoutEffect, useState } from 'react'
|
|
3
|
+
import { BORDER_RADIUS, COLORS, SPACING } from '@magmamath/react-native-ui'
|
|
4
|
+
|
|
5
|
+
const mock =
|
|
6
|
+
'https://media3.giphy.com/media/v1.Y2lkPWZhYjgxNWZhN3lucHRuYjZtMzRiNTZkeXo3NTBrNzIwejcwdXp0Y3g1c2k2ODA2eiZlcD12MV9naWZzX3NlYXJjaCZjdD1n/lCSABZRhMw6pW/giphy.gif'
|
|
7
|
+
|
|
8
|
+
type GifProps = {
|
|
9
|
+
uri: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
type Size = {
|
|
13
|
+
width: number
|
|
14
|
+
height: number
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const Gif = ({ uri }: GifProps) => {
|
|
18
|
+
const [size, setSize] = useState<Size | null>(null)
|
|
19
|
+
console.log('size: ', size)
|
|
20
|
+
|
|
21
|
+
useLayoutEffect(() => {
|
|
22
|
+
Image.getSize(uri, (width, height) => {
|
|
23
|
+
setSize({ width: width > 480 ? 480 : width, height: height > 300 ? 300 : height })
|
|
24
|
+
})
|
|
25
|
+
}, [uri])
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<View style={styles.backgroundContainer}>
|
|
29
|
+
<View style={styles.container}>
|
|
30
|
+
{size && (
|
|
31
|
+
<Image
|
|
32
|
+
alt="Celebration GIF"
|
|
33
|
+
source={{
|
|
34
|
+
uri,
|
|
35
|
+
}}
|
|
36
|
+
width={size.width}
|
|
37
|
+
height={size.height}
|
|
38
|
+
style={[styles.image, { width: size.width, height: size.height }]} //this sizes duplication is needed for compatibility with web and rn
|
|
39
|
+
/>
|
|
40
|
+
)}
|
|
41
|
+
</View>
|
|
42
|
+
</View>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const styles = StyleSheet.create({
|
|
47
|
+
backgroundContainer: {
|
|
48
|
+
backgroundColor: 'rgba(255, 255, 255, 0.6)',
|
|
49
|
+
borderRadius: 23,
|
|
50
|
+
padding: SPACING[200],
|
|
51
|
+
},
|
|
52
|
+
container: {
|
|
53
|
+
padding: SPACING[1600],
|
|
54
|
+
borderRadius: BORDER_RADIUS[400],
|
|
55
|
+
backgroundColor: COLORS.NEUTRAL_1,
|
|
56
|
+
},
|
|
57
|
+
image: {
|
|
58
|
+
borderRadius: BORDER_RADIUS[100],
|
|
59
|
+
backgroundColor: 'orange',
|
|
60
|
+
},
|
|
61
|
+
})
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { StyleSheet, View } from 'react-native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import {
|
|
4
|
+
BORDER_RADIUS,
|
|
5
|
+
COLORS,
|
|
6
|
+
HeadingVariants,
|
|
7
|
+
SPACING,
|
|
8
|
+
Typography,
|
|
9
|
+
} from '@magmamath/react-native-ui'
|
|
10
|
+
import Animated, { useAnimatedStyle, SharedValue, interpolate } from 'react-native-reanimated'
|
|
11
|
+
import { Image } from 'react-native'
|
|
12
|
+
|
|
13
|
+
const MIN_WIDTH_FOR_ONE_DIGIT = 12
|
|
14
|
+
const MIN_WIDTH_FOR_TWO_DIGITS = 15
|
|
15
|
+
const ADJUSTMENT_FOR_HUNDRED_PERCENT = 1.8
|
|
16
|
+
|
|
17
|
+
type ProgressProps = {
|
|
18
|
+
progress: SharedValue<number>
|
|
19
|
+
completedPercent: number
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const Progress = ({ progress, completedPercent }: ProgressProps) => {
|
|
23
|
+
const progressLineWidth = (() => {
|
|
24
|
+
if (completedPercent === 100) {
|
|
25
|
+
return completedPercent + ADJUSTMENT_FOR_HUNDRED_PERCENT
|
|
26
|
+
}
|
|
27
|
+
if (completedPercent <= 9) {
|
|
28
|
+
return MIN_WIDTH_FOR_ONE_DIGIT
|
|
29
|
+
}
|
|
30
|
+
if (completedPercent <= 15) {
|
|
31
|
+
return MIN_WIDTH_FOR_TWO_DIGITS
|
|
32
|
+
}
|
|
33
|
+
return completedPercent
|
|
34
|
+
})()
|
|
35
|
+
|
|
36
|
+
const animatedStyles = useAnimatedStyle(
|
|
37
|
+
() => ({
|
|
38
|
+
width: `${interpolate(
|
|
39
|
+
progress.value,
|
|
40
|
+
[0, 1, 2],
|
|
41
|
+
[0, progressLineWidth, progressLineWidth],
|
|
42
|
+
)}%`,
|
|
43
|
+
}),
|
|
44
|
+
[progress, progressLineWidth],
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<View style={styles.backgroundContainer}>
|
|
49
|
+
<View style={styles.container}>
|
|
50
|
+
<View style={styles.progressContainer}>
|
|
51
|
+
<Animated.View style={[styles.progress, animatedStyles]}>
|
|
52
|
+
<Typography variant={HeadingVariants.H1} style={styles.percent}>
|
|
53
|
+
{`${completedPercent}%`}
|
|
54
|
+
</Typography>
|
|
55
|
+
</Animated.View>
|
|
56
|
+
</View>
|
|
57
|
+
{/* <Image source={require('../assets/confetti.webp')} style={styles.confetti} /> */}
|
|
58
|
+
</View>
|
|
59
|
+
</View>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const styles = StyleSheet.create({
|
|
64
|
+
backgroundContainer: {
|
|
65
|
+
backgroundColor: 'rgba(255, 255, 255, 0.6)',
|
|
66
|
+
borderRadius: 23,
|
|
67
|
+
padding: SPACING[200],
|
|
68
|
+
width: '100%',
|
|
69
|
+
},
|
|
70
|
+
container: {
|
|
71
|
+
width: '100%',
|
|
72
|
+
height: 116,
|
|
73
|
+
flexDirection: 'row',
|
|
74
|
+
alignItems: 'center',
|
|
75
|
+
borderRadius: BORDER_RADIUS[400],
|
|
76
|
+
backgroundColor: COLORS.NEUTRAL_1,
|
|
77
|
+
paddingLeft: SPACING[400],
|
|
78
|
+
paddingRight: SPACING[200],
|
|
79
|
+
gap: SPACING[100],
|
|
80
|
+
},
|
|
81
|
+
progressContainer: {
|
|
82
|
+
height: 50,
|
|
83
|
+
flexGrow: 1,
|
|
84
|
+
backgroundColor: COLORS.NEUTRAL_5,
|
|
85
|
+
borderRadius: 90,
|
|
86
|
+
overflow: 'hidden',
|
|
87
|
+
},
|
|
88
|
+
progress: {
|
|
89
|
+
position: 'absolute',
|
|
90
|
+
left: -12,
|
|
91
|
+
height: '100%',
|
|
92
|
+
backgroundColor: COLORS.PRIMARY_BLUE,
|
|
93
|
+
borderRadius: BORDER_RADIUS[200],
|
|
94
|
+
justifyContent: 'center',
|
|
95
|
+
alignItems: 'flex-end',
|
|
96
|
+
paddingRight: 10.6,
|
|
97
|
+
overflow: 'hidden',
|
|
98
|
+
},
|
|
99
|
+
confetti: {
|
|
100
|
+
width: 75,
|
|
101
|
+
height: 70,
|
|
102
|
+
marginHorizontal: SPACING[200],
|
|
103
|
+
},
|
|
104
|
+
percent: {
|
|
105
|
+
color: COLORS.NEUTRAL_1,
|
|
106
|
+
fontWeight: '700',
|
|
107
|
+
},
|
|
108
|
+
})
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const BACKDROP_COLOR = {
|
|
2
|
+
INITIAL: 'rgba(51, 51, 51, 0)',
|
|
3
|
+
FINAL: 'rgba(51, 51, 51, 0.66)',
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export const CONTENT_CONTAINER = {
|
|
7
|
+
ANGLE: 5,
|
|
8
|
+
CONTAINER_WIDTH: 769,
|
|
9
|
+
SAFE_AREA: 44, // to be sure that the content is not cut off on the edges because of rotate transform
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const ANIMATION_DURATION = 1750
|
|
13
|
+
export const MIN_PROBLEMS_TO_SHOW_GIF = 6
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { GifsGroups } from './types/model.types'
|
|
2
|
+
|
|
3
|
+
type GifSelectProps = {
|
|
4
|
+
gifsGroups: GifsGroups
|
|
5
|
+
resolvedProblem: number
|
|
6
|
+
totalProblems: number
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// Number of problems When we show gif
|
|
10
|
+
// <6 Never
|
|
11
|
+
// 7-12 50% completion
|
|
12
|
+
// 13-18 33%, 66% completion
|
|
13
|
+
// 19-24 25%, 50%, 75 completion
|
|
14
|
+
// 25-30 20%, 40%, 60%, 80% completion
|
|
15
|
+
// .>30 15%, 30%, 45%, 60%, 75% completion
|
|
16
|
+
|
|
17
|
+
// We are also going to have different buckets with different gifs. The logic is as follows:
|
|
18
|
+
// Group 1: 15%, 20%, 25%, 30% - Early celebrations
|
|
19
|
+
// Group 2: 33%, 40%, 45%, 50% - Mid celebrations
|
|
20
|
+
// Group 3: 60%, 66%, 75%, 80% - Party
|
|
21
|
+
|
|
22
|
+
export const gifSelect = ({ gifsGroups, resolvedProblem, totalProblems }: GifSelectProps) => {
|
|
23
|
+
if (totalProblems < 7) return null
|
|
24
|
+
|
|
25
|
+
const group = Math.ceil((resolvedProblem / totalProblems) * 100)
|
|
26
|
+
|
|
27
|
+
if (group <= 20) return gifsGroups.group1[Math.floor(Math.random() * gifsGroups.group1.length)]
|
|
28
|
+
if (group <= 40) return gifsGroups.group2[Math.floor(Math.random() * gifsGroups.group2.length)]
|
|
29
|
+
if (group <= 60) return gifsGroups.group3[Math.floor(Math.random() * gifsGroups.group3.length)]
|
|
30
|
+
|
|
31
|
+
return null
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const calculatePercentageTable = (totalProblems: number) => {
|
|
35
|
+
if (totalProblems <= 12) return { 50: Math.ceil(totalProblems * 0.5) }
|
|
36
|
+
|
|
37
|
+
if (totalProblems <= 18) {
|
|
38
|
+
return {
|
|
39
|
+
33: Math.ceil(totalProblems * 0.33),
|
|
40
|
+
66: Math.ceil(totalProblems * 0.66),
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (totalProblems <= 24) {
|
|
45
|
+
return {
|
|
46
|
+
25: Math.ceil(totalProblems * 0.25),
|
|
47
|
+
50: Math.ceil(totalProblems * 0.5),
|
|
48
|
+
75: Math.ceil(totalProblems * 0.75),
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (totalProblems <= 30) {
|
|
53
|
+
return {
|
|
54
|
+
20: Math.ceil(totalProblems * 0.2),
|
|
55
|
+
40: Math.ceil(totalProblems * 0.4),
|
|
56
|
+
60: Math.ceil(totalProblems * 0.6),
|
|
57
|
+
80: Math.ceil(totalProblems * 0.8),
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
15: Math.ceil(totalProblems * 0.15),
|
|
63
|
+
30: Math.ceil(totalProblems * 0.3),
|
|
64
|
+
45: Math.ceil(totalProblems * 0.45),
|
|
65
|
+
60: Math.ceil(totalProblems * 0.6),
|
|
66
|
+
75: Math.ceil(totalProblems * 0.75),
|
|
67
|
+
}
|
|
68
|
+
}
|