@magmamath/students-features 0.6.14-rc.8 → 0.6.14
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/components/Alternatives/Alternatives.js +59 -0
- package/dist/commonjs/features/chatbot/components/Alternatives/Alternatives.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/Alternatives/HelpRequestOption.js +99 -0
- package/dist/commonjs/features/chatbot/components/Alternatives/HelpRequestOption.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageLoader.js +4 -7
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageLoader.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/{Chat/Chat.js → ChatMessages/ChatbotMessages.js} +9 -12
- package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/Chatbot.js +3 -5
- package/dist/commonjs/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/commonjs/features/chatbot/constants.js +1 -6
- package/dist/commonjs/features/chatbot/constants.js.map +1 -1
- package/dist/commonjs/features/chatbot/index.js +0 -7
- package/dist/commonjs/features/chatbot/index.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js +3 -13
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js +10 -32
- package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatbotApi.js +0 -3
- package/dist/commonjs/features/chatbot/model/ChatbotApi.js.map +1 -1
- package/dist/commonjs/features/chatbot/types/model.types.js.map +1 -1
- package/dist/commonjs/features/chatbot/types/units.types.js +0 -10
- package/dist/commonjs/features/chatbot/types/units.types.js.map +1 -1
- package/dist/commonjs/features/exampleSolution/ExampleSolutionModal.js +1 -3
- package/dist/commonjs/features/exampleSolution/ExampleSolutionModal.js.map +1 -1
- package/dist/commonjs/features/exampleSolution/assets/grid.webp +0 -0
- package/dist/commonjs/features/exampleSolution/components/ExampleSolutionModalContent.js +11 -8
- package/dist/commonjs/features/exampleSolution/components/ExampleSolutionModalContent.js.map +1 -1
- package/dist/commonjs/features/exampleSolution/components/QuestionSection.js +7 -7
- package/dist/commonjs/features/exampleSolution/components/QuestionSection.js.map +1 -1
- package/dist/commonjs/features/exampleSolution/components/SolutionSection.js +48 -28
- package/dist/commonjs/features/exampleSolution/components/SolutionSection.js.map +1 -1
- package/dist/commonjs/features/exampleSolution/model/ExampleSolution.model.js +3 -1
- package/dist/commonjs/features/exampleSolution/model/ExampleSolution.model.js.map +1 -1
- package/dist/commonjs/shared/translation/localization/ca.json +2 -2
- package/dist/commonjs/shared/translation/localization/en.json +2 -2
- package/dist/commonjs/shared/translation/localization/gb.json +2 -2
- package/dist/commonjs/shared/translation/localization/sct.json +2 -2
- package/dist/commonjs/shared/translation/localization/sw.json +3 -3
- package/dist/module/features/chatbot/components/Alternatives/Alternatives.js +53 -0
- package/dist/module/features/chatbot/components/Alternatives/Alternatives.js.map +1 -0
- package/dist/module/features/chatbot/components/Alternatives/HelpRequestOption.js +92 -0
- package/dist/module/features/chatbot/components/Alternatives/HelpRequestOption.js.map +1 -0
- package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.js +4 -7
- package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.js.map +1 -1
- package/dist/module/features/chatbot/components/{Chat/Chat.js → ChatMessages/ChatbotMessages.js} +7 -10
- package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -0
- package/dist/module/features/chatbot/components/Chatbot.js +3 -5
- package/dist/module/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/module/features/chatbot/constants.js +0 -5
- package/dist/module/features/chatbot/constants.js.map +1 -1
- package/dist/module/features/chatbot/index.js +0 -1
- package/dist/module/features/chatbot/index.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatBotModel.js +3 -13
- package/dist/module/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatBotThreadManager.js +10 -32
- package/dist/module/features/chatbot/model/ChatBotThreadManager.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatbotApi.js +0 -3
- package/dist/module/features/chatbot/model/ChatbotApi.js.map +1 -1
- package/dist/module/features/chatbot/types/model.types.js.map +1 -1
- package/dist/module/features/chatbot/types/units.types.js +0 -6
- package/dist/module/features/chatbot/types/units.types.js.map +1 -1
- package/dist/module/features/exampleSolution/ExampleSolutionModal.js +1 -3
- package/dist/module/features/exampleSolution/ExampleSolutionModal.js.map +1 -1
- package/dist/module/features/exampleSolution/assets/grid.webp +0 -0
- package/dist/module/features/exampleSolution/components/ExampleSolutionModalContent.js +11 -8
- package/dist/module/features/exampleSolution/components/ExampleSolutionModalContent.js.map +1 -1
- package/dist/module/features/exampleSolution/components/QuestionSection.js +9 -9
- package/dist/module/features/exampleSolution/components/QuestionSection.js.map +1 -1
- package/dist/module/features/exampleSolution/components/SolutionSection.js +50 -30
- package/dist/module/features/exampleSolution/components/SolutionSection.js.map +1 -1
- package/dist/module/features/exampleSolution/model/ExampleSolution.model.js +3 -1
- package/dist/module/features/exampleSolution/model/ExampleSolution.model.js.map +1 -1
- package/dist/module/shared/translation/localization/ca.json +2 -2
- package/dist/module/shared/translation/localization/en.json +2 -2
- package/dist/module/shared/translation/localization/gb.json +2 -2
- package/dist/module/shared/translation/localization/sct.json +2 -2
- package/dist/module/shared/translation/localization/sw.json +3 -3
- package/dist/typescript/commonjs/features/chatbot/components/Alternatives/Alternatives.d.ts +11 -0
- package/dist/typescript/commonjs/features/chatbot/components/Alternatives/Alternatives.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/Alternatives/HelpRequestOption.d.ts +10 -0
- package/dist/typescript/commonjs/features/chatbot/components/Alternatives/HelpRequestOption.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageLoader.d.ts.map +1 -1
- package/dist/typescript/{module/features/chatbot/components/Chat/Chat.d.ts → commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts} +2 -4
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts +0 -2
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/constants.d.ts +0 -5
- package/dist/typescript/commonjs/features/chatbot/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/index.d.ts +0 -1
- package/dist/typescript/commonjs/features/chatbot/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts +0 -4
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.d.ts +2 -5
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatbotApi.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts +4 -9
- package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts +0 -20
- package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts +0 -18
- package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/exampleSolution/ExampleSolutionModal.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/exampleSolution/components/ExampleSolutionModalContent.d.ts +5 -1
- package/dist/typescript/commonjs/features/exampleSolution/components/ExampleSolutionModalContent.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/exampleSolution/components/QuestionSection.d.ts +2 -1
- package/dist/typescript/commonjs/features/exampleSolution/components/QuestionSection.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/exampleSolution/components/SolutionSection.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/exampleSolution/model/ExampleSolution.model.d.ts +3 -2
- package/dist/typescript/commonjs/features/exampleSolution/model/ExampleSolution.model.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/exampleSolution/types.d.ts +2 -1
- package/dist/typescript/commonjs/features/exampleSolution/types.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/Alternatives/Alternatives.d.ts +11 -0
- package/dist/typescript/module/features/chatbot/components/Alternatives/Alternatives.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/Alternatives/HelpRequestOption.d.ts +10 -0
- package/dist/typescript/module/features/chatbot/components/Alternatives/HelpRequestOption.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageLoader.d.ts.map +1 -1
- package/dist/typescript/{commonjs/features/chatbot/components/Chat/Chat.d.ts → module/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts} +2 -4
- package/dist/typescript/module/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts +0 -2
- package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/constants.d.ts +0 -5
- package/dist/typescript/module/features/chatbot/constants.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/index.d.ts +0 -1
- package/dist/typescript/module/features/chatbot/index.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts +0 -4
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.d.ts +2 -5
- package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatbotApi.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/api.types.d.ts +4 -9
- package/dist/typescript/module/features/chatbot/types/api.types.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/model.types.d.ts +0 -20
- package/dist/typescript/module/features/chatbot/types/model.types.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/units.types.d.ts +0 -18
- package/dist/typescript/module/features/chatbot/types/units.types.d.ts.map +1 -1
- package/dist/typescript/module/features/exampleSolution/ExampleSolutionModal.d.ts.map +1 -1
- package/dist/typescript/module/features/exampleSolution/components/ExampleSolutionModalContent.d.ts +5 -1
- package/dist/typescript/module/features/exampleSolution/components/ExampleSolutionModalContent.d.ts.map +1 -1
- package/dist/typescript/module/features/exampleSolution/components/QuestionSection.d.ts +2 -1
- package/dist/typescript/module/features/exampleSolution/components/QuestionSection.d.ts.map +1 -1
- package/dist/typescript/module/features/exampleSolution/components/SolutionSection.d.ts.map +1 -1
- package/dist/typescript/module/features/exampleSolution/model/ExampleSolution.model.d.ts +3 -2
- package/dist/typescript/module/features/exampleSolution/model/ExampleSolution.model.d.ts.map +1 -1
- package/dist/typescript/module/features/exampleSolution/types.d.ts +2 -1
- package/dist/typescript/module/features/exampleSolution/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/features/chatbot/components/Alternatives/Alternatives.tsx +60 -0
- package/src/features/chatbot/components/Alternatives/HelpRequestOption.tsx +91 -0
- package/src/features/chatbot/components/ChatMessage/MessageLoader.tsx +2 -6
- package/src/features/chatbot/components/{Chat/Chat.tsx → ChatMessages/ChatbotMessages.tsx} +6 -10
- package/src/features/chatbot/components/Chatbot.tsx +2 -6
- package/src/features/chatbot/constants.ts +0 -7
- package/src/features/chatbot/index.ts +0 -2
- package/src/features/chatbot/model/ChatBotModel.ts +26 -44
- package/src/features/chatbot/model/ChatBotThreadManager.ts +9 -38
- package/src/features/chatbot/model/ChatbotApi.ts +0 -2
- package/src/features/chatbot/types/api.types.ts +4 -10
- package/src/features/chatbot/types/model.types.ts +0 -27
- package/src/features/chatbot/types/units.types.ts +0 -22
- package/src/features/exampleSolution/ExampleSolutionModal.tsx +1 -7
- package/src/features/exampleSolution/assets/grid.webp +0 -0
- package/src/features/exampleSolution/components/ExampleSolutionModalContent.tsx +15 -9
- package/src/features/exampleSolution/components/QuestionSection.tsx +11 -7
- package/src/features/exampleSolution/components/SolutionSection.tsx +61 -28
- package/src/features/exampleSolution/model/ExampleSolution.model.ts +5 -2
- package/src/features/exampleSolution/types.ts +2 -1
- package/src/shared/translation/localization/ca.json +2 -2
- package/src/shared/translation/localization/en.json +2 -2
- package/src/shared/translation/localization/gb.json +2 -2
- package/src/shared/translation/localization/sct.json +2 -2
- package/src/shared/translation/localization/sw.json +3 -3
- package/dist/commonjs/features/chatbot/components/Chat/Chat.js.map +0 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/ChatInput.js +0 -53
- package/dist/commonjs/features/chatbot/components/ChatInput/ChatInput.js.map +0 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/InputOption.js +0 -39
- package/dist/commonjs/features/chatbot/components/ChatInput/InputOption.js.map +0 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/InputOptionWithTextArea.js +0 -38
- package/dist/commonjs/features/chatbot/components/ChatInput/InputOptionWithTextArea.js.map +0 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/RequestHintButton.js +0 -140
- package/dist/commonjs/features/chatbot/components/ChatInput/RequestHintButton.js.map +0 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/freeText/ChatTextInput.js +0 -142
- package/dist/commonjs/features/chatbot/components/ChatInput/freeText/ChatTextInput.js.map +0 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.js +0 -44
- package/dist/commonjs/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.js.map +0 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/freeText/SendMessageButton.js +0 -105
- package/dist/commonjs/features/chatbot/components/ChatInput/freeText/SendMessageButton.js.map +0 -1
- package/dist/commonjs/features/exampleSolution/assets/grid.png +0 -0
- package/dist/module/features/chatbot/components/Chat/Chat.js.map +0 -1
- package/dist/module/features/chatbot/components/ChatInput/ChatInput.js +0 -47
- package/dist/module/features/chatbot/components/ChatInput/ChatInput.js.map +0 -1
- package/dist/module/features/chatbot/components/ChatInput/InputOption.js +0 -34
- package/dist/module/features/chatbot/components/ChatInput/InputOption.js.map +0 -1
- package/dist/module/features/chatbot/components/ChatInput/InputOptionWithTextArea.js +0 -32
- package/dist/module/features/chatbot/components/ChatInput/InputOptionWithTextArea.js.map +0 -1
- package/dist/module/features/chatbot/components/ChatInput/RequestHintButton.js +0 -132
- package/dist/module/features/chatbot/components/ChatInput/RequestHintButton.js.map +0 -1
- package/dist/module/features/chatbot/components/ChatInput/freeText/ChatTextInput.js +0 -134
- package/dist/module/features/chatbot/components/ChatInput/freeText/ChatTextInput.js.map +0 -1
- package/dist/module/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.js +0 -38
- package/dist/module/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.js.map +0 -1
- package/dist/module/features/chatbot/components/ChatInput/freeText/SendMessageButton.js +0 -97
- package/dist/module/features/chatbot/components/ChatInput/freeText/SendMessageButton.js.map +0 -1
- package/dist/module/features/exampleSolution/assets/grid.png +0 -0
- package/dist/typescript/commonjs/features/chatbot/components/Chat/Chat.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/ChatInput.d.ts +0 -4
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/ChatInput.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/InputOption.d.ts +0 -4
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/InputOption.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/InputOptionWithTextArea.d.ts +0 -4
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/InputOptionWithTextArea.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/RequestHintButton.d.ts +0 -18
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/RequestHintButton.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/ChatTextInput.d.ts +0 -10
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/ChatTextInput.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.d.ts +0 -11
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/SendMessageButton.d.ts +0 -10
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/SendMessageButton.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/components/Chat/Chat.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/components/ChatInput/ChatInput.d.ts +0 -4
- package/dist/typescript/module/features/chatbot/components/ChatInput/ChatInput.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/components/ChatInput/InputOption.d.ts +0 -4
- package/dist/typescript/module/features/chatbot/components/ChatInput/InputOption.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/components/ChatInput/InputOptionWithTextArea.d.ts +0 -4
- package/dist/typescript/module/features/chatbot/components/ChatInput/InputOptionWithTextArea.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/components/ChatInput/RequestHintButton.d.ts +0 -18
- package/dist/typescript/module/features/chatbot/components/ChatInput/RequestHintButton.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/ChatTextInput.d.ts +0 -10
- package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/ChatTextInput.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.d.ts +0 -11
- package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/SendMessageButton.d.ts +0 -10
- package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/SendMessageButton.d.ts.map +0 -1
- package/src/features/chatbot/components/ChatInput/ChatInput.tsx +0 -56
- package/src/features/chatbot/components/ChatInput/InputOption.tsx +0 -29
- package/src/features/chatbot/components/ChatInput/InputOptionWithTextArea.tsx +0 -27
- package/src/features/chatbot/components/ChatInput/RequestHintButton.tsx +0 -160
- package/src/features/chatbot/components/ChatInput/freeText/ChatTextInput.tsx +0 -133
- package/src/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.tsx +0 -42
- package/src/features/chatbot/components/ChatInput/freeText/SendMessageButton.tsx +0 -110
- package/src/features/exampleSolution/assets/grid.png +0 -0
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ColorScheme } from '../../../types/style.types';
|
|
3
|
-
type FreeTextInputAreaProps = {
|
|
4
|
-
onPress: () => void;
|
|
5
|
-
message: string;
|
|
6
|
-
disabled: boolean;
|
|
7
|
-
colorScheme?: ColorScheme;
|
|
8
|
-
};
|
|
9
|
-
export declare const FreeTextInputBlock: ({ onPress, message, disabled, colorScheme, }: FreeTextInputAreaProps) => React.JSX.Element;
|
|
10
|
-
export {};
|
|
11
|
-
//# sourceMappingURL=FreeTextInputBlock.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FreeTextInputBlock.d.ts","sourceRoot":"","sources":["../../../../../../../../src/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAIxD,KAAK,sBAAsB,GAAG;IAC5B,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,kBAAkB,iDAK5B,sBAAsB,sBAaxB,CAAA"}
|
package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/SendMessageButton.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ColorScheme } from '@magmamath/students-features';
|
|
3
|
-
type HelpRequestOptionProps = {
|
|
4
|
-
onPress: () => void;
|
|
5
|
-
disabled: boolean;
|
|
6
|
-
colorScheme?: ColorScheme;
|
|
7
|
-
};
|
|
8
|
-
export declare const SendMessageButton: ({ onPress, disabled, colorScheme, }: HelpRequestOptionProps) => React.JSX.Element;
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=SendMessageButton.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SendMessageButton.d.ts","sourceRoot":"","sources":["../../../../../../../../src/features/chatbot/components/ChatInput/freeText/SendMessageButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AASzB,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAG1D,KAAK,sBAAsB,GAAG;IAC5B,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,QAAQ,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,iBAAiB,wCAI3B,sBAAsB,sBAwDxB,CAAA"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import React, { ComponentType } from 'react'
|
|
2
|
-
import { useStoreMap, useUnit } from 'effector-react'
|
|
3
|
-
|
|
4
|
-
import { useChatModel } from '../../context/ChatBotModelContext'
|
|
5
|
-
import { ColorScheme } from '../../types/style.types'
|
|
6
|
-
import { ChatInputAreaProps, ChatInputMode, ChatInputProps } from '../../types/units.types'
|
|
7
|
-
import { InputOption } from './InputOption'
|
|
8
|
-
import { InputOptionWithTextArea } from './InputOptionWithTextArea'
|
|
9
|
-
|
|
10
|
-
const chatInputVariant: Record<ChatInputMode, ComponentType<ChatInputProps>> = {
|
|
11
|
-
[ChatInputMode.Option]: InputOption,
|
|
12
|
-
[ChatInputMode.FreeText]: InputOptionWithTextArea,
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const ChatInput = ({
|
|
16
|
-
onPressAlternative,
|
|
17
|
-
hasMessages,
|
|
18
|
-
isHintFeedback,
|
|
19
|
-
inputMode,
|
|
20
|
-
colorScheme = ColorScheme.Blue,
|
|
21
|
-
}: ChatInputAreaProps) => {
|
|
22
|
-
const model = useChatModel()
|
|
23
|
-
const isTranslated = useUnit(model.translation.$isTranslated)
|
|
24
|
-
const alternatives = useUnit(model.$alternatives)
|
|
25
|
-
const isTranslationPending = useUnit(model.translation.translateAllMessagesFx.pending)
|
|
26
|
-
const isHelpRequestPending = useUnit(model.sendHelpRequestFx.pending)
|
|
27
|
-
|
|
28
|
-
const lastMessageOptions = useStoreMap(model.$currentChatData, ({ messages }) => {
|
|
29
|
-
const lastMessage = messages.at(-1)
|
|
30
|
-
return lastMessage?.options ?? []
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
const availableOption = (() => {
|
|
34
|
-
if (hasMessages && lastMessageOptions.length) return lastMessageOptions[0]
|
|
35
|
-
if (isHintFeedback && alternatives?.options.hints) return alternatives?.options.hints[0]
|
|
36
|
-
return alternatives?.options.default[0] ?? null
|
|
37
|
-
})()
|
|
38
|
-
|
|
39
|
-
const buttonLabel =
|
|
40
|
-
(isTranslated && !isTranslationPending
|
|
41
|
-
? availableOption?.translatedText
|
|
42
|
-
: availableOption?.text) ?? ''
|
|
43
|
-
|
|
44
|
-
const Component = chatInputVariant[inputMode]
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
availableOption?.text && (
|
|
48
|
-
<Component
|
|
49
|
-
message={buttonLabel}
|
|
50
|
-
onPress={() => onPressAlternative(availableOption.text, availableOption.translatedText)}
|
|
51
|
-
disabled={isHelpRequestPending || (hasMessages && lastMessageOptions.length === 0)}
|
|
52
|
-
colorScheme={colorScheme}
|
|
53
|
-
/>
|
|
54
|
-
)
|
|
55
|
-
)
|
|
56
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { StyleSheet, View } from 'react-native'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import { ChatInputProps } from '../../types/units.types'
|
|
4
|
-
import { OptionButtonVariant } from './RequestHintButton'
|
|
5
|
-
import { RequestHintButton } from './RequestHintButton'
|
|
6
|
-
|
|
7
|
-
export const InputOption = ({ message, onPress, colorScheme, disabled }: ChatInputProps) => {
|
|
8
|
-
return (
|
|
9
|
-
<View style={styles.container}>
|
|
10
|
-
<RequestHintButton
|
|
11
|
-
onPress={onPress}
|
|
12
|
-
message={message}
|
|
13
|
-
disabled={disabled}
|
|
14
|
-
colorScheme={colorScheme}
|
|
15
|
-
variant={OptionButtonVariant.Default}
|
|
16
|
-
/>
|
|
17
|
-
</View>
|
|
18
|
-
)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const styles = StyleSheet.create({
|
|
22
|
-
container: {
|
|
23
|
-
flex: 1,
|
|
24
|
-
width: 305,
|
|
25
|
-
alignItems: 'center',
|
|
26
|
-
justifyContent: 'center',
|
|
27
|
-
marginVertical: 8,
|
|
28
|
-
},
|
|
29
|
-
})
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { StyleSheet, View } from 'react-native'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import { ChatInputProps } from '../../types/units.types'
|
|
4
|
-
import { FreeTextInputBlock } from './freeText/FreeTextInputBlock'
|
|
5
|
-
|
|
6
|
-
export const InputOptionWithTextArea = ({ message, disabled, onPress, colorScheme }: ChatInputProps) => {
|
|
7
|
-
return (
|
|
8
|
-
<View style={styles.container}>
|
|
9
|
-
<FreeTextInputBlock
|
|
10
|
-
message={message}
|
|
11
|
-
onPress={onPress}
|
|
12
|
-
disabled={disabled}
|
|
13
|
-
colorScheme={colorScheme}
|
|
14
|
-
/>
|
|
15
|
-
</View>
|
|
16
|
-
)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const styles = StyleSheet.create({
|
|
20
|
-
container: {
|
|
21
|
-
flex: 1,
|
|
22
|
-
width: 305,
|
|
23
|
-
alignItems: 'center',
|
|
24
|
-
justifyContent: 'center',
|
|
25
|
-
marginVertical: 8,
|
|
26
|
-
},
|
|
27
|
-
})
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { Pressable, StyleSheet } from 'react-native'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import Animated, {
|
|
4
|
-
useSharedValue,
|
|
5
|
-
withTiming,
|
|
6
|
-
useAnimatedStyle,
|
|
7
|
-
interpolateColor,
|
|
8
|
-
SharedValue,
|
|
9
|
-
} from 'react-native-reanimated'
|
|
10
|
-
import {
|
|
11
|
-
ArrowRightIcon,
|
|
12
|
-
ArrowUpIcon,
|
|
13
|
-
COLORS,
|
|
14
|
-
FONT_FAMILY,
|
|
15
|
-
IS_MOBILE,
|
|
16
|
-
SPACING,
|
|
17
|
-
} from '@magmamath/react-native-ui'
|
|
18
|
-
import { ColorScheme } from '@magmamath/students-features'
|
|
19
|
-
import { MESSAGE_COLORS_MAP } from '../../constants'
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
type HelpRequestOptionProps = {
|
|
23
|
-
onPress: () => void
|
|
24
|
-
message: string
|
|
25
|
-
disabled: boolean
|
|
26
|
-
variant: OptionButtonVariant
|
|
27
|
-
colorScheme?: ColorScheme
|
|
28
|
-
visibleSv?: SharedValue<number>
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export enum OptionButtonVariant {
|
|
32
|
-
Default = 'default',
|
|
33
|
-
Short = 'short',
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const REQUEST_HINT_BUTTON = {
|
|
37
|
-
[OptionButtonVariant.Default]: {
|
|
38
|
-
WIDTH: 305,
|
|
39
|
-
FONT_SIZE: 20,
|
|
40
|
-
},
|
|
41
|
-
[OptionButtonVariant.Short]: { WIDTH: 163, FONT_SIZE: 18 },
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export const RequestHintButton = ({
|
|
45
|
-
onPress,
|
|
46
|
-
message,
|
|
47
|
-
disabled = false,
|
|
48
|
-
colorScheme = ColorScheme.Blue,
|
|
49
|
-
variant = OptionButtonVariant.Default,
|
|
50
|
-
}: HelpRequestOptionProps) => {
|
|
51
|
-
const hoverSv = useSharedValue(0)
|
|
52
|
-
|
|
53
|
-
const onHoverIn = () => {
|
|
54
|
-
if (!disabled) hoverSv.value = withTiming(1, { duration: 200 })
|
|
55
|
-
}
|
|
56
|
-
const onHoverOut = () => {
|
|
57
|
-
if (!disabled) hoverSv.value = withTiming(0, { duration: 200 })
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const animatedTextContainerStyle = useAnimatedStyle(() => {
|
|
61
|
-
if (disabled) {
|
|
62
|
-
return {
|
|
63
|
-
backgroundColor: COLORS.NEUTRAL_2,
|
|
64
|
-
borderColor: COLORS.NEUTRAL_5,
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const defaultBorderColor =
|
|
69
|
-
variant === OptionButtonVariant.Default
|
|
70
|
-
? COLORS.NEUTRAL_1
|
|
71
|
-
: MESSAGE_COLORS_MAP[colorScheme].sent.border
|
|
72
|
-
|
|
73
|
-
return {
|
|
74
|
-
backgroundColor: interpolateColor(
|
|
75
|
-
hoverSv.value,
|
|
76
|
-
[0, 1],
|
|
77
|
-
[COLORS.NEUTRAL_1, MESSAGE_COLORS_MAP[colorScheme].sent.background],
|
|
78
|
-
),
|
|
79
|
-
borderColor: interpolateColor(
|
|
80
|
-
hoverSv.value,
|
|
81
|
-
[0, 1],
|
|
82
|
-
[defaultBorderColor, MESSAGE_COLORS_MAP[colorScheme].sent.border],
|
|
83
|
-
),
|
|
84
|
-
}
|
|
85
|
-
}, [hoverSv, disabled, colorScheme])
|
|
86
|
-
|
|
87
|
-
const animatedTextStyle = useAnimatedStyle(() => {
|
|
88
|
-
if (disabled) return { color: COLORS.NEUTRAL_5 }
|
|
89
|
-
|
|
90
|
-
return { color: interpolateColor(hoverSv.value, [0, 1], [COLORS.NEUTRAL_10, COLORS.NEUTRAL_1]) }
|
|
91
|
-
}, [hoverSv, disabled])
|
|
92
|
-
|
|
93
|
-
return (
|
|
94
|
-
<Pressable
|
|
95
|
-
onHoverIn={onHoverIn}
|
|
96
|
-
onHoverOut={onHoverOut}
|
|
97
|
-
onPress={onPress}
|
|
98
|
-
style={[
|
|
99
|
-
styles.button,
|
|
100
|
-
{ cursor: disabled ? 'auto' : 'pointer', width: REQUEST_HINT_BUTTON[variant].WIDTH },
|
|
101
|
-
]}
|
|
102
|
-
disabled={disabled}
|
|
103
|
-
accessibilityState={{ disabled }}
|
|
104
|
-
accessibilityRole="button"
|
|
105
|
-
>
|
|
106
|
-
<Animated.View style={[styles.content, animatedTextContainerStyle]}>
|
|
107
|
-
<Animated.Text
|
|
108
|
-
numberOfLines={1}
|
|
109
|
-
style={[
|
|
110
|
-
styles.text,
|
|
111
|
-
animatedTextStyle,
|
|
112
|
-
{ fontSize: REQUEST_HINT_BUTTON[variant].FONT_SIZE },
|
|
113
|
-
]}
|
|
114
|
-
>
|
|
115
|
-
{message}
|
|
116
|
-
</Animated.Text>
|
|
117
|
-
|
|
118
|
-
<Animated.Text style={[styles.icon, animatedTextStyle]}>
|
|
119
|
-
{variant === OptionButtonVariant.Default ? (
|
|
120
|
-
<ArrowRightIcon color={disabled ? COLORS.NEUTRAL_5 : 'currentColor'} size={16} />
|
|
121
|
-
) : (
|
|
122
|
-
<ArrowUpIcon color={disabled ? COLORS.NEUTRAL_5 : 'currentColor'} size={16} />
|
|
123
|
-
)}
|
|
124
|
-
</Animated.Text>
|
|
125
|
-
</Animated.View>
|
|
126
|
-
</Pressable>
|
|
127
|
-
)
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
const styles = StyleSheet.create({
|
|
131
|
-
button: {
|
|
132
|
-
flexDirection: 'row',
|
|
133
|
-
justifyContent: 'flex-end',
|
|
134
|
-
},
|
|
135
|
-
text: {
|
|
136
|
-
fontWeight: '400',
|
|
137
|
-
fontFamily: FONT_FAMILY.buenosAires,
|
|
138
|
-
color: COLORS.NEUTRAL_10,
|
|
139
|
-
},
|
|
140
|
-
content: {
|
|
141
|
-
flex: 1,
|
|
142
|
-
flexDirection: 'row',
|
|
143
|
-
alignItems: 'center',
|
|
144
|
-
justifyContent: 'space-between',
|
|
145
|
-
paddingHorizontal: SPACING[400],
|
|
146
|
-
paddingVertical: SPACING[200],
|
|
147
|
-
borderWidth: 1,
|
|
148
|
-
borderRadius: 48,
|
|
149
|
-
elevation: 3,
|
|
150
|
-
shadowColor: '#333',
|
|
151
|
-
shadowOffset: { width: 0, height: 1 },
|
|
152
|
-
shadowOpacity: 0.25,
|
|
153
|
-
shadowRadius: 3,
|
|
154
|
-
backgroundColor: COLORS.PRIMARY_BLUE,
|
|
155
|
-
borderColor: COLORS.PRIMARY_BLUE,
|
|
156
|
-
},
|
|
157
|
-
icon: {
|
|
158
|
-
top: IS_MOBILE ? 3 : 0,
|
|
159
|
-
},
|
|
160
|
-
})
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { useUnit } from 'effector-react'
|
|
3
|
-
import Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated'
|
|
4
|
-
import { Platform, StyleSheet, TextInput } from 'react-native'
|
|
5
|
-
import { COLORS, FONT_FAMILY, SPACING } from '@magmamath/react-native-ui'
|
|
6
|
-
|
|
7
|
-
import { SendMessageButton } from './SendMessageButton'
|
|
8
|
-
import { ColorScheme } from '@magmamath/students-features'
|
|
9
|
-
import { useChatModel } from '../../../context/ChatBotModelContext'
|
|
10
|
-
import { useKeyBoard } from '../../../../../shared/hooks/useKeyboard'
|
|
11
|
-
import { KeyboardKeys } from '../../../../../lib/constants'
|
|
12
|
-
|
|
13
|
-
const COMPACT_WIDTH = 134
|
|
14
|
-
const FULL_WIDTH = 305
|
|
15
|
-
|
|
16
|
-
const ANIMATION_DURATION = 200
|
|
17
|
-
|
|
18
|
-
type ChatTextInputProps = {
|
|
19
|
-
onPress: () => void
|
|
20
|
-
disabled: boolean
|
|
21
|
-
colorScheme?: ColorScheme
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const ChatTextInput = ({ disabled, colorScheme }: ChatTextInputProps) => {
|
|
25
|
-
const model = useChatModel()
|
|
26
|
-
const inputValue = useUnit(model.$textInputValue)
|
|
27
|
-
const { language } = useUnit(model.$context) ?? {}
|
|
28
|
-
|
|
29
|
-
const widthSv = useSharedValue(COMPACT_WIDTH)
|
|
30
|
-
const arrowOpacitySv = useSharedValue(1)
|
|
31
|
-
const hintVisibleSv = useSharedValue(1)
|
|
32
|
-
|
|
33
|
-
const animatedInputStyle = useAnimatedStyle(
|
|
34
|
-
() => ({
|
|
35
|
-
width: widthSv.value,
|
|
36
|
-
}),
|
|
37
|
-
[widthSv],
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
const handleChangeText = (text: string) => {
|
|
41
|
-
if (text.trim().length > 500) return
|
|
42
|
-
|
|
43
|
-
model.setTextInputValue(text)
|
|
44
|
-
const hasText = text.trim().length > 0
|
|
45
|
-
const isExpanded = widthSv.value > COMPACT_WIDTH
|
|
46
|
-
|
|
47
|
-
if (hasText && !isExpanded) {
|
|
48
|
-
widthSv.value = withTiming(FULL_WIDTH, { duration: ANIMATION_DURATION })
|
|
49
|
-
arrowOpacitySv.value = withTiming(0, { duration: ANIMATION_DURATION })
|
|
50
|
-
hintVisibleSv.value = withTiming(0, { duration: ANIMATION_DURATION })
|
|
51
|
-
} else if (!hasText && isExpanded) {
|
|
52
|
-
widthSv.value = withTiming(COMPACT_WIDTH, { duration: ANIMATION_DURATION })
|
|
53
|
-
arrowOpacitySv.value = withTiming(1, { duration: ANIMATION_DURATION })
|
|
54
|
-
hintVisibleSv.value = withTiming(1, { duration: ANIMATION_DURATION })
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const handleOnPress = () => {
|
|
59
|
-
if (disabled || inputValue.trim().length < 1 || inputValue.length > 500) return
|
|
60
|
-
handleChangeText('')
|
|
61
|
-
void model.sendHelpRequestFx({
|
|
62
|
-
message: inputValue,
|
|
63
|
-
translatedMessage: inputValue,
|
|
64
|
-
isFreeText: true,
|
|
65
|
-
})
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
useKeyBoard((event) => {
|
|
69
|
-
if (event.key === KeyboardKeys.ENTER) {
|
|
70
|
-
handleOnPress()
|
|
71
|
-
}
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
return (
|
|
75
|
-
<Animated.View style={[styles.inputWrapper, animatedInputStyle]}>
|
|
76
|
-
<TextInput
|
|
77
|
-
style={styles.input}
|
|
78
|
-
placeholder={language === 'Swedish' ? 'Skriv...' : 'Type...'}
|
|
79
|
-
placeholderTextColor={COLORS.NEUTRAL_6}
|
|
80
|
-
value={inputValue}
|
|
81
|
-
onChangeText={handleChangeText}
|
|
82
|
-
onBlur={() => model.setIsTextInputFocused(false)}
|
|
83
|
-
onFocus={() => model.setIsTextInputFocused(true)}
|
|
84
|
-
/>
|
|
85
|
-
<SendMessageButton
|
|
86
|
-
onPress={handleOnPress}
|
|
87
|
-
disabled={inputValue.trim().length < 1 || disabled}
|
|
88
|
-
colorScheme={colorScheme}
|
|
89
|
-
/>
|
|
90
|
-
</Animated.View>
|
|
91
|
-
)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const styles = StyleSheet.create({
|
|
95
|
-
container: {
|
|
96
|
-
position: 'relative',
|
|
97
|
-
width: '100%',
|
|
98
|
-
alignItems: 'flex-end',
|
|
99
|
-
height: 52,
|
|
100
|
-
justifyContent: 'center',
|
|
101
|
-
},
|
|
102
|
-
inputWrapper: {
|
|
103
|
-
position: 'absolute',
|
|
104
|
-
zIndex: 1,
|
|
105
|
-
left: 0,
|
|
106
|
-
flexDirection: 'row',
|
|
107
|
-
borderWidth: 1,
|
|
108
|
-
borderColor: COLORS.NEUTRAL_5,
|
|
109
|
-
borderRadius: 200,
|
|
110
|
-
backgroundColor: COLORS.NEUTRAL_1,
|
|
111
|
-
paddingHorizontal: SPACING[100],
|
|
112
|
-
paddingVertical: SPACING[100],
|
|
113
|
-
elevation: 3,
|
|
114
|
-
shadowColor: '#333',
|
|
115
|
-
shadowOffset: { width: 0, height: 1 },
|
|
116
|
-
shadowOpacity: 0.25,
|
|
117
|
-
shadowRadius: 3,
|
|
118
|
-
},
|
|
119
|
-
input: {
|
|
120
|
-
flex: 1,
|
|
121
|
-
fontSize: 16,
|
|
122
|
-
minWidth: 60,
|
|
123
|
-
minHeight: 22,
|
|
124
|
-
fontWeight: '400',
|
|
125
|
-
fontFamily: FONT_FAMILY.buenosAires,
|
|
126
|
-
paddingHorizontal: SPACING[200],
|
|
127
|
-
paddingVertical: SPACING[200],
|
|
128
|
-
...(Platform.OS === 'web' && { outlineStyle: 'none' }),
|
|
129
|
-
},
|
|
130
|
-
arrowWrapper: {
|
|
131
|
-
marginLeft: SPACING[200],
|
|
132
|
-
},
|
|
133
|
-
})
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { StyleSheet, View } from 'react-native'
|
|
3
|
-
import { ColorScheme } from '../../../types/style.types'
|
|
4
|
-
import { ChatTextInput } from './ChatTextInput'
|
|
5
|
-
import { OptionButtonVariant, RequestHintButton } from '../RequestHintButton'
|
|
6
|
-
|
|
7
|
-
type FreeTextInputAreaProps = {
|
|
8
|
-
onPress: () => void
|
|
9
|
-
message: string
|
|
10
|
-
disabled: boolean
|
|
11
|
-
colorScheme?: ColorScheme
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const FreeTextInputBlock = ({
|
|
15
|
-
onPress,
|
|
16
|
-
message,
|
|
17
|
-
disabled,
|
|
18
|
-
colorScheme,
|
|
19
|
-
}: FreeTextInputAreaProps) => {
|
|
20
|
-
return (
|
|
21
|
-
<View style={styles.container}>
|
|
22
|
-
<ChatTextInput onPress={onPress} disabled={disabled} colorScheme={colorScheme} />
|
|
23
|
-
<RequestHintButton
|
|
24
|
-
onPress={onPress}
|
|
25
|
-
message={message}
|
|
26
|
-
disabled={disabled}
|
|
27
|
-
colorScheme={colorScheme}
|
|
28
|
-
variant={OptionButtonVariant.Short}
|
|
29
|
-
/>
|
|
30
|
-
</View>
|
|
31
|
-
)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const styles = StyleSheet.create({
|
|
35
|
-
container: {
|
|
36
|
-
position: 'relative',
|
|
37
|
-
width: '100%',
|
|
38
|
-
alignItems: 'flex-end',
|
|
39
|
-
height: 52,
|
|
40
|
-
justifyContent: 'center',
|
|
41
|
-
},
|
|
42
|
-
})
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { Pressable, StyleSheet } from 'react-native'
|
|
3
|
-
import Animated, {
|
|
4
|
-
useSharedValue,
|
|
5
|
-
withTiming,
|
|
6
|
-
useAnimatedStyle,
|
|
7
|
-
interpolateColor,
|
|
8
|
-
} from 'react-native-reanimated'
|
|
9
|
-
import { ArrowUpIcon, COLORS, IS_MOBILE } from '@magmamath/react-native-ui'
|
|
10
|
-
import { ColorScheme } from '@magmamath/students-features'
|
|
11
|
-
import { MESSAGE_COLORS_MAP } from '../../../constants'
|
|
12
|
-
|
|
13
|
-
type HelpRequestOptionProps = {
|
|
14
|
-
onPress: () => void
|
|
15
|
-
disabled: boolean
|
|
16
|
-
colorScheme?: ColorScheme
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const SendMessageButton = ({
|
|
20
|
-
onPress,
|
|
21
|
-
disabled = false,
|
|
22
|
-
colorScheme = ColorScheme.Blue,
|
|
23
|
-
}: HelpRequestOptionProps) => {
|
|
24
|
-
const hoverSv = useSharedValue(0)
|
|
25
|
-
|
|
26
|
-
const onHoverIn = () => {
|
|
27
|
-
if (!disabled) hoverSv.value = withTiming(1, { duration: 200 })
|
|
28
|
-
}
|
|
29
|
-
const onHoverOut = () => {
|
|
30
|
-
if (!disabled) hoverSv.value = withTiming(0, { duration: 200 })
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const animatedIconStyle = useAnimatedStyle(() => {
|
|
34
|
-
const backgroundColor = interpolateColor(
|
|
35
|
-
hoverSv.value,
|
|
36
|
-
[0, 1],
|
|
37
|
-
[COLORS.NEUTRAL_1, MESSAGE_COLORS_MAP[colorScheme].sent.border],
|
|
38
|
-
)
|
|
39
|
-
const color = interpolateColor(hoverSv.value, [0, 1], [COLORS.NEUTRAL_10, COLORS.NEUTRAL_1])
|
|
40
|
-
|
|
41
|
-
return {
|
|
42
|
-
backgroundColor: disabled ? COLORS.NEUTRAL_2 : backgroundColor,
|
|
43
|
-
borderColor: disabled ? COLORS.NEUTRAL_5 : MESSAGE_COLORS_MAP[colorScheme].sent.border,
|
|
44
|
-
color: disabled ? COLORS.NEUTRAL_5 : color,
|
|
45
|
-
}
|
|
46
|
-
}, [hoverSv, disabled])
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<Pressable
|
|
50
|
-
onHoverIn={onHoverIn}
|
|
51
|
-
onHoverOut={onHoverOut}
|
|
52
|
-
onPress={onPress}
|
|
53
|
-
style={[styles.button, disabled && { cursor: 'auto' }]}
|
|
54
|
-
disabled={disabled}
|
|
55
|
-
accessibilityState={{ disabled }}
|
|
56
|
-
accessibilityRole="button"
|
|
57
|
-
>
|
|
58
|
-
{IS_MOBILE ? (
|
|
59
|
-
<Animated.View
|
|
60
|
-
style={[
|
|
61
|
-
styles.iconContainer,
|
|
62
|
-
animatedIconStyle,
|
|
63
|
-
{
|
|
64
|
-
borderColor: disabled
|
|
65
|
-
? COLORS.NEUTRAL_5
|
|
66
|
-
: MESSAGE_COLORS_MAP[colorScheme].sent.border,
|
|
67
|
-
},
|
|
68
|
-
]}
|
|
69
|
-
>
|
|
70
|
-
<ArrowUpIcon color={'currentColor'} size={16} />
|
|
71
|
-
</Animated.View>
|
|
72
|
-
) : (
|
|
73
|
-
<Animated.Text style={[styles.webIconContainer, animatedIconStyle]}>
|
|
74
|
-
<ArrowUpIcon color={'currentColor'} size={16} />
|
|
75
|
-
</Animated.Text>
|
|
76
|
-
)}
|
|
77
|
-
</Pressable>
|
|
78
|
-
)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const styles = StyleSheet.create({
|
|
82
|
-
button: {
|
|
83
|
-
flexDirection: 'row',
|
|
84
|
-
justifyContent: 'flex-end',
|
|
85
|
-
},
|
|
86
|
-
iconContainer: {
|
|
87
|
-
justifyContent: 'center',
|
|
88
|
-
alignItems: 'center',
|
|
89
|
-
padding: 12,
|
|
90
|
-
borderRadius: 21,
|
|
91
|
-
borderWidth: 1,
|
|
92
|
-
},
|
|
93
|
-
webIconContainer: {
|
|
94
|
-
flex: 1,
|
|
95
|
-
flexDirection: 'row',
|
|
96
|
-
alignItems: 'center',
|
|
97
|
-
justifyContent: 'space-between',
|
|
98
|
-
paddingHorizontal: 13,
|
|
99
|
-
paddingVertical: 12,
|
|
100
|
-
borderWidth: 1,
|
|
101
|
-
borderRadius: 48,
|
|
102
|
-
elevation: 3,
|
|
103
|
-
shadowColor: '#333',
|
|
104
|
-
shadowOffset: { width: 0, height: 1 },
|
|
105
|
-
shadowOpacity: 0.25,
|
|
106
|
-
shadowRadius: 3,
|
|
107
|
-
backgroundColor: COLORS.NEUTRAL_1,
|
|
108
|
-
borderColor: COLORS.PRIMARY_BLUE,
|
|
109
|
-
},
|
|
110
|
-
})
|
|
Binary file
|