@magmamath/students-features 0.2.6 → 0.2.8
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/ChatMessages/ChatbotMessages.js +4 -1
- package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/Chatbot.js +1 -1
- package/dist/commonjs/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/commonjs/features/feedback/components/TeacherFeedback.js +6 -4
- package/dist/commonjs/features/feedback/components/TeacherFeedback.js.map +1 -1
- package/dist/commonjs/features/feedback/components/TeacherFeedbackButton/TeacherFeedbackButton.js +4 -2
- package/dist/commonjs/features/feedback/components/TeacherFeedbackButton/TeacherFeedbackButton.js.map +1 -1
- package/dist/commonjs/features/feedback/components/TeacherFeedbackButton/colorSchemes.js.map +1 -1
- package/dist/commonjs/features/feedback/components/TeacherFeedbackComments/TeacherComment.js +7 -11
- package/dist/commonjs/features/feedback/components/TeacherFeedbackComments/TeacherComment.js.map +1 -1
- package/dist/commonjs/features/feedback/components/TeacherFeedbackComments/TeacherFeedbackComments.js +11 -8
- package/dist/commonjs/features/feedback/components/TeacherFeedbackComments/TeacherFeedbackComments.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js +4 -1
- package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -1
- package/dist/module/features/chatbot/components/Chatbot.js +1 -1
- package/dist/module/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/module/features/feedback/components/TeacherFeedback.js +7 -5
- package/dist/module/features/feedback/components/TeacherFeedback.js.map +1 -1
- package/dist/module/features/feedback/components/TeacherFeedbackButton/TeacherFeedbackButton.js +4 -2
- package/dist/module/features/feedback/components/TeacherFeedbackButton/TeacherFeedbackButton.js.map +1 -1
- package/dist/module/features/feedback/components/TeacherFeedbackButton/colorSchemes.js.map +1 -1
- package/dist/module/features/feedback/components/TeacherFeedbackComments/TeacherComment.js +7 -11
- package/dist/module/features/feedback/components/TeacherFeedbackComments/TeacherComment.js.map +1 -1
- package/dist/module/features/feedback/components/TeacherFeedbackComments/TeacherFeedbackComments.js +11 -8
- package/dist/module/features/feedback/components/TeacherFeedbackComments/TeacherFeedbackComments.js.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts +1 -0
- package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/feedback/components/TeacherFeedback.d.ts +3 -3
- package/dist/typescript/commonjs/features/feedback/components/TeacherFeedback.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/feedback/components/TeacherFeedbackButton/TeacherFeedbackButton.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/feedback/components/TeacherFeedbackButton/colorSchemes.d.ts +2 -53
- package/dist/typescript/commonjs/features/feedback/components/TeacherFeedbackButton/colorSchemes.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/feedback/components/TeacherFeedbackComments/TeacherComment.d.ts +6 -6
- package/dist/typescript/commonjs/features/feedback/components/TeacherFeedbackComments/TeacherComment.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/feedback/components/TeacherFeedbackComments/TeacherFeedbackComments.d.ts +2 -1
- package/dist/typescript/commonjs/features/feedback/components/TeacherFeedbackComments/TeacherFeedbackComments.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/api.types.d.ts +1 -0
- package/dist/typescript/module/features/chatbot/types/api.types.d.ts.map +1 -1
- package/dist/typescript/module/features/feedback/components/TeacherFeedback.d.ts +3 -3
- package/dist/typescript/module/features/feedback/components/TeacherFeedback.d.ts.map +1 -1
- package/dist/typescript/module/features/feedback/components/TeacherFeedbackButton/TeacherFeedbackButton.d.ts.map +1 -1
- package/dist/typescript/module/features/feedback/components/TeacherFeedbackButton/colorSchemes.d.ts +2 -53
- package/dist/typescript/module/features/feedback/components/TeacherFeedbackButton/colorSchemes.d.ts.map +1 -1
- package/dist/typescript/module/features/feedback/components/TeacherFeedbackComments/TeacherComment.d.ts +6 -6
- package/dist/typescript/module/features/feedback/components/TeacherFeedbackComments/TeacherComment.d.ts.map +1 -1
- package/dist/typescript/module/features/feedback/components/TeacherFeedbackComments/TeacherFeedbackComments.d.ts +2 -1
- package/dist/typescript/module/features/feedback/components/TeacherFeedbackComments/TeacherFeedbackComments.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/features/chatbot/components/ChatMessages/ChatbotMessages.tsx +4 -1
- package/src/features/chatbot/components/Chatbot.tsx +2 -2
- package/src/features/chatbot/types/api.types.ts +38 -37
- package/src/features/feedback/components/TeacherFeedback.tsx +12 -6
- package/src/features/feedback/components/TeacherFeedbackButton/TeacherFeedbackButton.tsx +4 -14
- package/src/features/feedback/components/TeacherFeedbackButton/colorSchemes.ts +2 -2
- package/src/features/feedback/components/TeacherFeedbackComments/TeacherComment.tsx +10 -17
- package/src/features/feedback/components/TeacherFeedbackComments/TeacherFeedbackComments.tsx +9 -12
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { useStoreMap, useUnit } from 'effector-react'
|
|
3
|
-
import {
|
|
3
|
+
import { StyleSheet, View } from 'react-native'
|
|
4
4
|
import { TeacherFeedbackButton } from './TeacherFeedbackButton/TeacherFeedbackButton'
|
|
5
5
|
import { TeacherFeedbackComments } from './TeacherFeedbackComments/TeacherFeedbackComments'
|
|
6
6
|
import { FeedbackButtonColors, FeedbackButtonSize, FeedbackMode } from '../constants'
|
|
@@ -13,7 +13,7 @@ type TeacherFeedbackProps = {
|
|
|
13
13
|
locale: Locale
|
|
14
14
|
assignmentId: string
|
|
15
15
|
problemId: string
|
|
16
|
-
|
|
16
|
+
color: FeedbackButtonColors
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export const TeacherFeedback = ({
|
|
@@ -22,7 +22,7 @@ export const TeacherFeedback = ({
|
|
|
22
22
|
assignmentId,
|
|
23
23
|
problemId,
|
|
24
24
|
locale,
|
|
25
|
-
|
|
25
|
+
color = FeedbackButtonColors.BLUE,
|
|
26
26
|
}: TeacherFeedbackProps) => {
|
|
27
27
|
const isOpen = useUnit(model.$isOpen)
|
|
28
28
|
const isLoading = useUnit(model.api.getCommentsFx.pending)
|
|
@@ -31,21 +31,27 @@ export const TeacherFeedback = ({
|
|
|
31
31
|
fn: (feedback, [assignmentId, problemId]) => feedback?.get(assignmentId)?.[problemId] ?? null,
|
|
32
32
|
keys: [assignmentId, problemId],
|
|
33
33
|
})
|
|
34
|
+
const isSimpleMode = mode === FeedbackMode.SIMPLE
|
|
34
35
|
|
|
35
36
|
if (!problemId || !teacherFeedback) return null
|
|
36
37
|
|
|
37
38
|
return (
|
|
38
39
|
<View style={styles.container}>
|
|
39
40
|
{isOpen && (
|
|
40
|
-
<TeacherFeedbackComments
|
|
41
|
+
<TeacherFeedbackComments
|
|
42
|
+
comments={teacherFeedback.comments}
|
|
43
|
+
locale={locale}
|
|
44
|
+
mode={mode}
|
|
45
|
+
maxHeightOffset={isSimpleMode ? 70 : 0}
|
|
46
|
+
/>
|
|
41
47
|
)}
|
|
42
48
|
<TeacherFeedbackButton
|
|
43
49
|
onPress={() => model.setIsOpen(!isOpen)}
|
|
44
50
|
unreadCommentsCount={teacherFeedback.unreadMessagesCount}
|
|
45
51
|
isOpen={isOpen}
|
|
46
52
|
isLoading={isLoading}
|
|
47
|
-
size={
|
|
48
|
-
color={
|
|
53
|
+
size={isSimpleMode ? FeedbackButtonSize.LARGE : FeedbackButtonSize.SMALL}
|
|
54
|
+
color={color}
|
|
49
55
|
/>
|
|
50
56
|
</View>
|
|
51
57
|
)
|
|
@@ -35,6 +35,8 @@ export const TeacherFeedbackButton = ({
|
|
|
35
35
|
}: TeacherFeedbackButtonProps) => {
|
|
36
36
|
const isLarge = size === FeedbackButtonSize.LARGE
|
|
37
37
|
const isPurpleColor = color === FeedbackButtonColors.PURPLE
|
|
38
|
+
const borderColor = isPurpleColor ? COLORS.PURPLE_6 : COLORS.BLUE_6
|
|
39
|
+
const schemeColor = isPurpleColor ? COLOR_SCHEMES.PURPLE : COLOR_SCHEMES.BLUE
|
|
38
40
|
|
|
39
41
|
if (isOpen) {
|
|
40
42
|
return (
|
|
@@ -67,23 +69,11 @@ export const TeacherFeedbackButton = ({
|
|
|
67
69
|
container: isLarge ? styles.containerLarge : styles.container,
|
|
68
70
|
button: [
|
|
69
71
|
styles.button,
|
|
70
|
-
{
|
|
71
|
-
borderColor: !!unreadCommentsCount
|
|
72
|
-
? isPurpleColor
|
|
73
|
-
? COLORS.PURPLE_6
|
|
74
|
-
: COLORS.BLUE_6
|
|
75
|
-
: COLORS.NEUTRAL_5,
|
|
76
|
-
},
|
|
72
|
+
{ borderColor: !!unreadCommentsCount ? borderColor : COLORS.NEUTRAL_5 },
|
|
77
73
|
styles[size],
|
|
78
74
|
],
|
|
79
75
|
}}
|
|
80
|
-
customColorScheme={
|
|
81
|
-
!!unreadCommentsCount
|
|
82
|
-
? isPurpleColor
|
|
83
|
-
? COLOR_SCHEMES.PURPLE
|
|
84
|
-
: COLOR_SCHEMES.BLUE
|
|
85
|
-
: COLOR_SCHEMES.GREY
|
|
86
|
-
}
|
|
76
|
+
customColorScheme={!!unreadCommentsCount ? schemeColor : COLOR_SCHEMES.GREY}
|
|
87
77
|
icon={
|
|
88
78
|
<View style={styles.iconContainer}>
|
|
89
79
|
<MessageBubbleIcon
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ButtonStates, COLORS } from '@magmamath/react-native-ui'
|
|
1
|
+
import { ButtonElements, ButtonStates, COLORS } from '@magmamath/react-native-ui'
|
|
2
2
|
|
|
3
|
-
export const COLOR_SCHEMES = {
|
|
3
|
+
export const COLOR_SCHEMES: Record<string, Partial<Record<ButtonStates, ButtonElements>>> = {
|
|
4
4
|
PURPLE: {
|
|
5
5
|
[ButtonStates.DEFAULT]: {
|
|
6
6
|
borderColor: COLORS.PURPLE_6,
|
|
@@ -1,39 +1,32 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { View, Text, StyleSheet } from 'react-native'
|
|
2
|
+
import { View, Text, StyleSheet, StyleProp, ViewStyle } from 'react-native'
|
|
3
3
|
import { COLORS } from '@magmamath/react-native-ui'
|
|
4
4
|
import { BUENOS_AIRES_FONT } from '../../constants'
|
|
5
5
|
import { getRelativeTimeText } from '../../../../lib/helpers/helpers'
|
|
6
|
-
import {
|
|
6
|
+
import { TeacherComment as TeacherCommentEntity } from '../../types'
|
|
7
|
+
import { Locale } from '../../../../shared/translation/types'
|
|
7
8
|
|
|
8
9
|
type TeacherCommentProps = {
|
|
9
|
-
|
|
10
|
-
teacherName: string
|
|
11
|
-
createdAt: Date
|
|
10
|
+
comment: TeacherCommentEntity
|
|
12
11
|
locale: Locale | null
|
|
13
|
-
|
|
12
|
+
style: StyleProp<ViewStyle>
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
export const TeacherComment = ({
|
|
17
|
-
content,
|
|
18
|
-
teacherName,
|
|
19
|
-
createdAt,
|
|
20
|
-
locale,
|
|
21
|
-
isLastComment,
|
|
22
|
-
}: TeacherCommentProps) => {
|
|
15
|
+
export const TeacherComment = ({ comment, locale, style }: TeacherCommentProps) => {
|
|
23
16
|
return (
|
|
24
|
-
<View style={
|
|
17
|
+
<View style={style}>
|
|
25
18
|
<View style={styles.authorInfo}>
|
|
26
19
|
<Text style={styles.teacherName} numberOfLines={1}>
|
|
27
|
-
{teacherName}
|
|
20
|
+
{comment.teacherName}
|
|
28
21
|
</Text>
|
|
29
22
|
<View style={styles.spacer} />
|
|
30
23
|
<Text style={styles.dateAdded} numberOfLines={1}>
|
|
31
|
-
{getRelativeTimeText(createdAt, locale ?? Locale.EN)}
|
|
24
|
+
{getRelativeTimeText(comment.createdAt, locale ?? Locale.EN)}
|
|
32
25
|
</Text>
|
|
33
26
|
</View>
|
|
34
27
|
|
|
35
28
|
<View style={styles.container}>
|
|
36
|
-
<Text style={styles.text}>{content}</Text>
|
|
29
|
+
<Text style={styles.text}>{comment.content}</Text>
|
|
37
30
|
</View>
|
|
38
31
|
</View>
|
|
39
32
|
)
|
package/src/features/feedback/components/TeacherFeedbackComments/TeacherFeedbackComments.tsx
CHANGED
|
@@ -8,19 +8,23 @@ import { Locale } from '../../../../shared/translation'
|
|
|
8
8
|
import { TeacherComment as TeacherCommentEntity } from '../../types'
|
|
9
9
|
|
|
10
10
|
const TOOLBAR_HEIGHT = 140
|
|
11
|
-
const BOTTOM_OFFSET = Platform.
|
|
12
|
-
|
|
11
|
+
const BOTTOM_OFFSET = Platform.select({
|
|
12
|
+
web: 270,
|
|
13
|
+
default: 304,
|
|
14
|
+
})
|
|
13
15
|
|
|
14
16
|
type TeacherFeedbackCommentsProps = {
|
|
15
17
|
comments: TeacherCommentEntity[] | null
|
|
16
18
|
locale: Locale | null
|
|
17
19
|
mode: FeedbackMode
|
|
20
|
+
maxHeightOffset: number
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
export const TeacherFeedbackComments = ({
|
|
21
24
|
comments,
|
|
22
25
|
locale,
|
|
23
26
|
mode,
|
|
27
|
+
maxHeightOffset,
|
|
24
28
|
}: TeacherFeedbackCommentsProps) => {
|
|
25
29
|
const ref = useRef<ScrollView | null>(null)
|
|
26
30
|
const dimensions = useWindowDimensions()
|
|
@@ -34,12 +38,7 @@ export const TeacherFeedbackComments = ({
|
|
|
34
38
|
if (!comments) return null
|
|
35
39
|
|
|
36
40
|
return (
|
|
37
|
-
<View
|
|
38
|
-
style={[
|
|
39
|
-
styles.container,
|
|
40
|
-
{ maxHeight: MAX_HEIGHT - (isSimpleMode ? SIMPLE_MODE_OFFSET : 0) },
|
|
41
|
-
]}
|
|
42
|
-
>
|
|
41
|
+
<View style={[styles.container, { maxHeight: MAX_HEIGHT - maxHeightOffset }]}>
|
|
43
42
|
<ScrollView
|
|
44
43
|
ref={ref}
|
|
45
44
|
contentContainerStyle={styles.commentsList}
|
|
@@ -51,11 +50,9 @@ export const TeacherFeedbackComments = ({
|
|
|
51
50
|
comments.map((comment, index) => (
|
|
52
51
|
<TeacherComment
|
|
53
52
|
key={comment._id}
|
|
54
|
-
|
|
55
|
-
content={comment.content}
|
|
56
|
-
createdAt={comment.createdAt}
|
|
53
|
+
comment={comment}
|
|
57
54
|
locale={locale}
|
|
58
|
-
|
|
55
|
+
style={{ marginBottom: index === comments.length - 1 ? 8 : 0 }}
|
|
59
56
|
/>
|
|
60
57
|
))
|
|
61
58
|
)}
|