@magmamath/students-features 0.2.10 → 0.2.11
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/ChatControls/ChatControls.js +2 -2
- package/dist/commonjs/features/chatbot/components/ChatControls/ChatControls.js.map +1 -1
- package/dist/commonjs/features/feedback/components/EmptyComment.js +4 -5
- package/dist/commonjs/features/feedback/components/EmptyComment.js.map +1 -1
- package/dist/commonjs/features/feedback/components/ListCardCommentsCount.js +1 -1
- package/dist/commonjs/features/feedback/components/TeacherFeedback.js +5 -6
- package/dist/commonjs/features/feedback/components/TeacherFeedback.js.map +1 -1
- package/dist/commonjs/features/feedback/components/TeacherFeedbackButton/TeacherFeedbackButton.js +32 -9
- package/dist/commonjs/features/feedback/components/TeacherFeedbackButton/TeacherFeedbackButton.js.map +1 -1
- package/dist/commonjs/features/feedback/components/TeacherFeedbackComments/TeacherComment.js +1 -3
- package/dist/commonjs/features/feedback/components/TeacherFeedbackComments/TeacherComment.js.map +1 -1
- package/dist/commonjs/features/feedback/components/TeacherFeedbackComments/TeacherFeedbackComments.js +1 -8
- package/dist/commonjs/features/feedback/components/TeacherFeedbackComments/TeacherFeedbackComments.js.map +1 -1
- package/dist/commonjs/features/feedback/constants.js +11 -3
- package/dist/commonjs/features/feedback/constants.js.map +1 -1
- package/dist/commonjs/features/feedback/helpers.js +24 -0
- package/dist/commonjs/features/feedback/helpers.js.map +1 -1
- package/dist/commonjs/features/feedback/model/api.js.map +1 -1
- package/dist/commonjs/features/feedback/model/comments.js +17 -33
- package/dist/commonjs/features/feedback/model/comments.js.map +1 -1
- package/dist/commonjs/features/feedback/model/model.js +5 -3
- package/dist/commonjs/features/feedback/model/model.js.map +1 -1
- package/dist/commonjs/features/feedback/types.js.map +1 -1
- package/dist/commonjs/lib/helpers/helpers.js +20 -16
- package/dist/commonjs/lib/helpers/helpers.js.map +1 -1
- package/dist/commonjs/lib/localization/en.json +12 -0
- package/dist/commonjs/lib/localization/gb.json +12 -0
- package/dist/commonjs/lib/localization/sw.json +12 -0
- package/dist/commonjs/shared/icons/MessageBubbleIcon.js.map +1 -0
- package/dist/commonjs/shared/icons/XCloseIcon.js.map +1 -0
- package/dist/commonjs/shared/translation/constants.js +1 -42
- package/dist/commonjs/shared/translation/constants.js.map +1 -1
- package/dist/commonjs/shared/translation/helpers.js.map +1 -1
- package/dist/commonjs/shared/translation/types.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatControls/ChatControls.js +2 -2
- package/dist/module/features/chatbot/components/ChatControls/ChatControls.js.map +1 -1
- package/dist/module/features/feedback/components/EmptyComment.js +5 -6
- package/dist/module/features/feedback/components/EmptyComment.js.map +1 -1
- package/dist/module/features/feedback/components/ListCardCommentsCount.js +1 -1
- package/dist/module/features/feedback/components/ListCardCommentsCount.js.map +1 -1
- package/dist/module/features/feedback/components/TeacherFeedback.js +6 -7
- package/dist/module/features/feedback/components/TeacherFeedback.js.map +1 -1
- package/dist/module/features/feedback/components/TeacherFeedbackButton/TeacherFeedbackButton.js +32 -9
- package/dist/module/features/feedback/components/TeacherFeedbackButton/TeacherFeedbackButton.js.map +1 -1
- package/dist/module/features/feedback/components/TeacherFeedbackComments/TeacherComment.js +1 -3
- package/dist/module/features/feedback/components/TeacherFeedbackComments/TeacherComment.js.map +1 -1
- package/dist/module/features/feedback/components/TeacherFeedbackComments/TeacherFeedbackComments.js +2 -9
- package/dist/module/features/feedback/components/TeacherFeedbackComments/TeacherFeedbackComments.js.map +1 -1
- package/dist/module/features/feedback/constants.js +10 -2
- package/dist/module/features/feedback/constants.js.map +1 -1
- package/dist/module/features/feedback/helpers.js +23 -0
- package/dist/module/features/feedback/helpers.js.map +1 -1
- package/dist/module/features/feedback/model/api.js.map +1 -1
- package/dist/module/features/feedback/model/comments.js +14 -30
- package/dist/module/features/feedback/model/comments.js.map +1 -1
- package/dist/module/features/feedback/model/model.js +6 -4
- package/dist/module/features/feedback/model/model.js.map +1 -1
- package/dist/module/features/feedback/types.js.map +1 -1
- package/dist/module/lib/helpers/helpers.js +20 -16
- package/dist/module/lib/helpers/helpers.js.map +1 -1
- package/dist/module/lib/localization/en.json +12 -0
- package/dist/module/lib/localization/gb.json +12 -0
- package/dist/module/lib/localization/sw.json +12 -0
- package/dist/module/shared/icons/MessageBubbleIcon.js.map +1 -0
- package/dist/module/shared/icons/XCloseIcon.js.map +1 -0
- package/dist/module/shared/translation/constants.js +0 -41
- package/dist/module/shared/translation/constants.js.map +1 -1
- package/dist/module/shared/translation/helpers.js.map +1 -1
- package/dist/module/shared/translation/types.js.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/feedback/components/EmptyComment.d.ts +1 -6
- package/dist/typescript/commonjs/features/feedback/components/EmptyComment.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/feedback/components/TeacherFeedback.d.ts +5 -5
- 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/TeacherFeedbackComments/TeacherComment.d.ts +2 -4
- 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 -4
- package/dist/typescript/commonjs/features/feedback/components/TeacherFeedbackComments/TeacherFeedbackComments.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/feedback/constants.d.ts +2 -2
- package/dist/typescript/commonjs/features/feedback/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/feedback/helpers.d.ts +10 -1
- package/dist/typescript/commonjs/features/feedback/helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/feedback/model/api.d.ts +6 -2
- package/dist/typescript/commonjs/features/feedback/model/api.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/feedback/model/comments.d.ts +10 -12
- package/dist/typescript/commonjs/features/feedback/model/comments.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/feedback/model/model.d.ts +4 -7
- package/dist/typescript/commonjs/features/feedback/model/model.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/feedback/types.d.ts +8 -1
- package/dist/typescript/commonjs/features/feedback/types.d.ts.map +1 -1
- package/dist/typescript/commonjs/lib/helpers/helpers.d.ts +1 -2
- package/dist/typescript/commonjs/lib/helpers/helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/icons/MessageBubbleIcon.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/icons/XCloseIcon.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/translation/constants.d.ts +38 -40
- package/dist/typescript/commonjs/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/types.d.ts +4 -1
- package/dist/typescript/commonjs/shared/translation/types.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/module/features/feedback/components/EmptyComment.d.ts +1 -6
- package/dist/typescript/module/features/feedback/components/EmptyComment.d.ts.map +1 -1
- package/dist/typescript/module/features/feedback/components/TeacherFeedback.d.ts +5 -5
- 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/TeacherFeedbackComments/TeacherComment.d.ts +2 -4
- 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 -4
- package/dist/typescript/module/features/feedback/components/TeacherFeedbackComments/TeacherFeedbackComments.d.ts.map +1 -1
- package/dist/typescript/module/features/feedback/constants.d.ts +2 -2
- package/dist/typescript/module/features/feedback/constants.d.ts.map +1 -1
- package/dist/typescript/module/features/feedback/helpers.d.ts +10 -1
- package/dist/typescript/module/features/feedback/helpers.d.ts.map +1 -1
- package/dist/typescript/module/features/feedback/model/api.d.ts +6 -2
- package/dist/typescript/module/features/feedback/model/api.d.ts.map +1 -1
- package/dist/typescript/module/features/feedback/model/comments.d.ts +10 -12
- package/dist/typescript/module/features/feedback/model/comments.d.ts.map +1 -1
- package/dist/typescript/module/features/feedback/model/model.d.ts +4 -7
- package/dist/typescript/module/features/feedback/model/model.d.ts.map +1 -1
- package/dist/typescript/module/features/feedback/types.d.ts +8 -1
- package/dist/typescript/module/features/feedback/types.d.ts.map +1 -1
- package/dist/typescript/module/lib/helpers/helpers.d.ts +1 -2
- package/dist/typescript/module/lib/helpers/helpers.d.ts.map +1 -1
- package/dist/typescript/module/shared/icons/MessageBubbleIcon.d.ts.map +1 -0
- package/dist/typescript/module/shared/icons/XCloseIcon.d.ts.map +1 -0
- package/dist/typescript/module/shared/translation/constants.d.ts +38 -40
- package/dist/typescript/module/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/helpers.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/types.d.ts +4 -1
- package/dist/typescript/module/shared/translation/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/features/chatbot/components/ChatControls/ChatControls.tsx +2 -2
- package/src/features/chatbot/components/Chatbot.tsx +1 -1
- package/src/features/feedback/components/EmptyComment.tsx +5 -8
- package/src/features/feedback/components/ListCardCommentsCount.tsx +1 -1
- package/src/features/feedback/components/TeacherFeedback.tsx +7 -8
- package/src/features/feedback/components/TeacherFeedbackButton/TeacherFeedbackButton.tsx +30 -16
- package/src/features/feedback/components/TeacherFeedbackComments/TeacherComment.tsx +3 -5
- package/src/features/feedback/components/TeacherFeedbackComments/TeacherFeedbackComments.tsx +2 -10
- package/src/features/feedback/constants.ts +12 -3
- package/src/features/feedback/helpers.ts +31 -0
- package/src/features/feedback/model/api.ts +6 -2
- package/src/features/feedback/model/comments.ts +17 -39
- package/src/features/feedback/model/model.ts +8 -11
- package/src/features/feedback/types.ts +7 -1
- package/src/lib/helpers/helpers.ts +24 -16
- package/src/lib/localization/en.json +12 -0
- package/src/lib/localization/gb.json +12 -0
- package/src/lib/localization/sw.json +12 -0
- package/src/shared/translation/constants.ts +0 -42
- package/src/shared/translation/helpers.ts +17 -17
- package/src/shared/translation/types.ts +12 -4
- package/dist/commonjs/features/feedback/assets/icons/MessageBubbleIcon.js.map +0 -1
- package/dist/commonjs/features/feedback/assets/icons/XCloseIcon.js.map +0 -1
- package/dist/module/features/feedback/assets/icons/MessageBubbleIcon.js.map +0 -1
- package/dist/module/features/feedback/assets/icons/XCloseIcon.js.map +0 -1
- package/dist/typescript/commonjs/features/feedback/assets/icons/MessageBubbleIcon.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/feedback/assets/icons/XCloseIcon.d.ts.map +0 -1
- package/dist/typescript/module/features/feedback/assets/icons/MessageBubbleIcon.d.ts.map +0 -1
- package/dist/typescript/module/features/feedback/assets/icons/XCloseIcon.d.ts.map +0 -1
- /package/dist/commonjs/{features/feedback/assets → shared}/icons/MessageBubbleIcon.js +0 -0
- /package/dist/commonjs/{features/feedback/assets → shared}/icons/XCloseIcon.js +0 -0
- /package/dist/module/{features/feedback/assets → shared}/icons/MessageBubbleIcon.js +0 -0
- /package/dist/module/{features/feedback/assets → shared}/icons/XCloseIcon.js +0 -0
- /package/dist/typescript/commonjs/{features/feedback/assets → shared}/icons/MessageBubbleIcon.d.ts +0 -0
- /package/dist/typescript/commonjs/{features/feedback/assets → shared}/icons/XCloseIcon.d.ts +0 -0
- /package/dist/typescript/module/{features/feedback/assets → shared}/icons/MessageBubbleIcon.d.ts +0 -0
- /package/dist/typescript/module/{features/feedback/assets → shared}/icons/XCloseIcon.d.ts +0 -0
- /package/src/{features/feedback/assets → shared}/icons/MessageBubbleIcon.tsx +0 -0
- /package/src/{features/feedback/assets → shared}/icons/XCloseIcon.tsx +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../../../src/features/feedback/model/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,EAAE,MAAM,UAAU,CAAA;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../../../src/features/feedback/model/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,EAAE,MAAM,UAAU,CAAA;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAEjD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAA;AAGlG,MAAM,MAAM,yBAAyB,GAAG;IACtC,GAAG,EAAE;QACH,WAAW,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAA;QACxE,uBAAuB,EAAE,CAAC,KAAK,EAAE,8BAA8B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;KAClF,CAAA;IACD,MAAM,EAAE,GAAG,CAAA;IACX,OAAO,EAAE;QACP,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;QAC5B,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;KAC1B,CAAA;CACF,CAAA;AAED,qBAAa,oBAAoB;IAC/B,SAAgB,OAAO,EAAE,sBAAsB,CAAA;IAC/C,SAAgB,GAAG,EAAE,kBAAkB,CAAA;IACvC,SAAgB,QAAQ,EAAE,oBAAoB,CAAA;IAC9C,SAAgB,SAAS,4CAAyB;IAClD,SAAgB,OAAO,4CAAiC;IAExD,SAAgB,0BAA0B,4CAAyB;IACnE,SAAgB,wBAAwB,4CAAiD;gBAE7E,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,yBAAyB;CA8FhE"}
|
|
@@ -23,7 +23,7 @@ export type TeacherComment = {
|
|
|
23
23
|
updatedAt: Date;
|
|
24
24
|
__v: number;
|
|
25
25
|
};
|
|
26
|
-
export type NoCommentsMessage = Omit<TeacherComment, '_id' | 'problemId' | 'exerciseId'> & {
|
|
26
|
+
export type NoCommentsMessage = Omit<TeacherComment, '_id' | 'problemId' | 'exerciseId' | 'content'> & {
|
|
27
27
|
_id: typeof EMPTY_COMMENT_ID;
|
|
28
28
|
};
|
|
29
29
|
export type FeedbackEntity = {
|
|
@@ -41,4 +41,11 @@ export declare enum FeedbackSocketEvents {
|
|
|
41
41
|
COMMENT_ADDED = "exerciseCommentCreated",
|
|
42
42
|
COMMENT_DELETED = "exerciseCommentDeleted"
|
|
43
43
|
}
|
|
44
|
+
export type AddCommentProps = Credits & {
|
|
45
|
+
comment: TeacherComment;
|
|
46
|
+
isRead: boolean;
|
|
47
|
+
};
|
|
48
|
+
export type DeleteCommentProps = Credits & {
|
|
49
|
+
commentId: string;
|
|
50
|
+
};
|
|
44
51
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/features/feedback/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE9C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,EAAE,EAAE,MAAM,CAAA;CACX,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,CAAC,SAAS,EAAE,MAAM,GAAG;QAAE,QAAQ,EAAE,cAAc,EAAE,CAAA;KAAE,CAAA;CACpD,CAAA;AAED,MAAM,MAAM,8BAA8B,GAAG;IAC3C,GAAG,EAAE,MAAM,EAAE,CAAA;CACd,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,OAAO,CAAA;IACf,SAAS,EAAE,IAAI,CAAA;IACf,SAAS,EAAE,IAAI,CAAA;IACf,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/features/feedback/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE9C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,EAAE,EAAE,MAAM,CAAA;CACX,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,CAAC,SAAS,EAAE,MAAM,GAAG;QAAE,QAAQ,EAAE,cAAc,EAAE,CAAA;KAAE,CAAA;CACpD,CAAA;AAED,MAAM,MAAM,8BAA8B,GAAG;IAC3C,GAAG,EAAE,MAAM,EAAE,CAAA;CACd,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,OAAO,CAAA;IACf,SAAS,EAAE,IAAI,CAAA;IACf,SAAS,EAAE,IAAI,CAAA;IACf,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAClC,cAAc,EACd,KAAK,GAAG,WAAW,GAAG,YAAY,GAAG,SAAS,CAC/C,GAAG;IACF,GAAG,EAAE,OAAO,gBAAgB,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,cAAc,EAAE,CAAA;IAC1B,mBAAmB,EAAE,MAAM,CAAA;CAC5B,CAAA;AAED,MAAM,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,EAAE;IAAE,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,CAAA;CAAE,CAAC,CAAA;AAE9E,MAAM,MAAM,OAAO,GAAG;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,oBAAY,oBAAoB;IAC9B,aAAa,2BAA2B;IACxC,eAAe,2BAA2B;CAC3C;AAED,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG;IAAE,OAAO,EAAE,cAAc,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAA;AACpF,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAA"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Locale } from '@magmamath/students-features';
|
|
2
1
|
export declare const generateRandomId: () => string;
|
|
3
|
-
export declare const getRelativeTimeText: (date: Date
|
|
2
|
+
export declare const getRelativeTimeText: (date: Date) => string;
|
|
4
3
|
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/lib/helpers/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/lib/helpers/helpers.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,cACsC,CAAA;AASnE,eAAO,MAAM,mBAAmB,SAAU,IAAI,WAuB7C,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageBubbleIcon.d.ts","sourceRoot":"","sources":["../../../../../src/shared/icons/MessageBubbleIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,SAAS,EAAU,MAAM,4BAA4B,CAAA;AAE9D,eAAO,MAAM,iBAAiB,oBAA6C,SAAS,sBAWnF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"XCloseIcon.d.ts","sourceRoot":"","sources":["../../../../../src/shared/icons/XCloseIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,SAAS,EAAU,MAAM,4BAA4B,CAAA;AAE9D,eAAO,MAAM,UAAU,oBAA6C,SAAS,sBAS5E,CAAA"}
|
|
@@ -1,47 +1,45 @@
|
|
|
1
1
|
export declare const LOCALIZATION_CONFIGS: {
|
|
2
|
-
"en-SE": {};
|
|
3
|
-
"en-GB": {};
|
|
4
|
-
"sv-SE": {};
|
|
5
|
-
};
|
|
6
|
-
export declare const RELATIVE_TIME_LABELS: {
|
|
7
2
|
"en-SE": {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"sv-SE": {
|
|
21
|
-
justNow: string;
|
|
22
|
-
minuteAgo: string;
|
|
23
|
-
minutesAgo: string;
|
|
24
|
-
hourAgo: string;
|
|
25
|
-
hoursAgo: string;
|
|
26
|
-
dayAgo: string;
|
|
27
|
-
daysAgo: string;
|
|
28
|
-
monthAgo: string;
|
|
29
|
-
monthsAgo: string;
|
|
30
|
-
yearAgo: string;
|
|
31
|
-
yearsAgo: string;
|
|
3
|
+
"teacherFeedback.noComments": string;
|
|
4
|
+
"time.justNow": string;
|
|
5
|
+
"time.minuteAgo": string;
|
|
6
|
+
"time.minutesAgo": string;
|
|
7
|
+
"time.hourAgo": string;
|
|
8
|
+
"time.hoursAgo": string;
|
|
9
|
+
"time.dayAgo": string;
|
|
10
|
+
"time.daysAgo": string;
|
|
11
|
+
"time.monthAgo": string;
|
|
12
|
+
"time.monthsAgo": string;
|
|
13
|
+
"time.yearAgo": string;
|
|
14
|
+
"time.yearsAgo": string;
|
|
32
15
|
};
|
|
33
16
|
"en-GB": {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
17
|
+
"teacherFeedback.noComments": string;
|
|
18
|
+
"time.justNow": string;
|
|
19
|
+
"time.minuteAgo": string;
|
|
20
|
+
"time.minutesAgo": string;
|
|
21
|
+
"time.hourAgo": string;
|
|
22
|
+
"time.hoursAgo": string;
|
|
23
|
+
"time.dayAgo": string;
|
|
24
|
+
"time.daysAgo": string;
|
|
25
|
+
"time.monthAgo": string;
|
|
26
|
+
"time.monthsAgo": string;
|
|
27
|
+
"time.yearAgo": string;
|
|
28
|
+
"time.yearsAgo": string;
|
|
29
|
+
};
|
|
30
|
+
"sv-SE": {
|
|
31
|
+
"teacherFeedback.noComments": string;
|
|
32
|
+
"time.justNow": string;
|
|
33
|
+
"time.minuteAgo": string;
|
|
34
|
+
"time.minutesAgo": string;
|
|
35
|
+
"time.hourAgo": string;
|
|
36
|
+
"time.hoursAgo": string;
|
|
37
|
+
"time.dayAgo": string;
|
|
38
|
+
"time.daysAgo": string;
|
|
39
|
+
"time.monthAgo": string;
|
|
40
|
+
"time.monthsAgo": string;
|
|
41
|
+
"time.yearAgo": string;
|
|
42
|
+
"time.yearsAgo": string;
|
|
45
43
|
};
|
|
46
44
|
};
|
|
47
45
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/shared/translation/constants.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/shared/translation/constants.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIhC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/shared/translation/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAElD,OAAO,EAAE,OAAO,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/shared/translation/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAElD,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAmB,MAAM,SAAS,CAAA;AAEtE,eAAO,MAAM,oBAAoB,QAAS,MAAM,kBAAiB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,WAWtF,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,OAUrB,CAAA;AAED,eAAO,MAAM,uBAAuB,cACvB,CAAC,CAAC,MAAM,EAAE,OAAO,oBAAoB,KAAK,kBAAkB,CAAC,GAAG,kBAAkB,SAG9F,CAAA"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import enTranslations from '../../lib/localization/en.json';
|
|
2
|
+
export type Translations = typeof enTranslations;
|
|
3
|
+
export type TranslationKeys = keyof Translations;
|
|
4
|
+
export type GetText = <T extends TranslationKeys>(key: T, args?: Record<string, string> | null) => Translations[T];
|
|
2
5
|
export declare enum Locale {
|
|
3
6
|
EN = "en-SE",
|
|
4
7
|
SW = "sv-SE",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/shared/translation/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,CAAC,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/shared/translation/types.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,gCAAgC,CAAA;AAE3D,MAAM,MAAM,YAAY,GAAG,OAAO,cAAc,CAAA;AAChD,MAAM,MAAM,eAAe,GAAG,MAAM,YAAY,CAAA;AAEhD,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,SAAS,eAAe,EAC9C,GAAG,EAAE,CAAC,EACN,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,KACjC,YAAY,CAAC,CAAC,CAAC,CAAA;AAEpB,oBAAY,MAAM;IAChB,EAAE,UAAU;IACZ,EAAE,UAAU;IACZ,EAAE,UAAU;CACb;AAED,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -61,7 +61,7 @@ export const ChatControls = ({
|
|
|
61
61
|
variant={ButtonVariant.PRIMARY}
|
|
62
62
|
size={ButtonSize.LARGE}
|
|
63
63
|
colorScheme={ButtonColor.GRAY}
|
|
64
|
-
raiseLevel={
|
|
64
|
+
raiseLevel={5}
|
|
65
65
|
customColorScheme={{
|
|
66
66
|
[ButtonStates.DEFAULT]: {
|
|
67
67
|
backgroundColor: '#FFF',
|
|
@@ -94,10 +94,10 @@ export const ChatControls = ({
|
|
|
94
94
|
|
|
95
95
|
const styles = StyleSheet.create({
|
|
96
96
|
container: {
|
|
97
|
-
// borderWidth: 1,
|
|
98
97
|
alignItems: 'center',
|
|
99
98
|
justifyContent: 'flex-end',
|
|
100
99
|
flexDirection: 'row',
|
|
100
|
+
height: 60,
|
|
101
101
|
gap: 8,
|
|
102
102
|
},
|
|
103
103
|
buttonClose: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentType, PropsWithChildren, ReactNode } from 'react'
|
|
1
|
+
import { ComponentType, PropsWithChildren, ReactNode, useEffect } from 'react'
|
|
2
2
|
import { useStoreMap, useUnit } from 'effector-react'
|
|
3
3
|
import { ChatbotModel } from '../model/model'
|
|
4
4
|
import { ChatbotMessages } from './ChatMessages/ChatbotMessages'
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { StyleSheet, Text, View } from 'react-native'
|
|
3
3
|
import { COLORS } from '@magmamath/react-native-ui'
|
|
4
|
-
import { BUENOS_AIRES_FONT
|
|
5
|
-
import {
|
|
4
|
+
import { BUENOS_AIRES_FONT } from '../constants'
|
|
5
|
+
import { useText } from '../../../shared/translation'
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const EmptyComment = ({ locale }: EmptyCommentProps) => {
|
|
7
|
+
export const EmptyComment = () => {
|
|
8
|
+
const t = useText()
|
|
12
9
|
return (
|
|
13
10
|
<View style={styles.container}>
|
|
14
|
-
<Text style={styles.text}>{
|
|
11
|
+
<Text style={styles.text}>{t('teacherFeedback.noComments')}</Text>
|
|
15
12
|
</View>
|
|
16
13
|
)
|
|
17
14
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { Text, View, StyleSheet } from 'react-native'
|
|
3
|
-
import { MessageBubbleIcon } from '
|
|
3
|
+
import { MessageBubbleIcon } from '../../../shared/icons/MessageBubbleIcon'
|
|
4
4
|
import { COLORS } from '@magmamath/react-native-ui'
|
|
5
5
|
import { BUENOS_AIRES_FONT } from '../constants'
|
|
6
6
|
|
|
@@ -5,15 +5,15 @@ import { TeacherFeedbackButton } from './TeacherFeedbackButton/TeacherFeedbackBu
|
|
|
5
5
|
import { TeacherFeedbackComments } from './TeacherFeedbackComments/TeacherFeedbackComments'
|
|
6
6
|
import { FeedbackButtonColors, FeedbackButtonSize, FeedbackMode } from '../constants'
|
|
7
7
|
import { TeacherFeedbackModel } from '../model/model'
|
|
8
|
-
import { Locale } from '../../../shared/translation'
|
|
9
8
|
|
|
10
9
|
type TeacherFeedbackProps = {
|
|
11
10
|
model: TeacherFeedbackModel
|
|
12
11
|
mode: FeedbackMode
|
|
13
|
-
locale: Locale
|
|
14
12
|
assignmentId: string
|
|
15
13
|
problemId: string
|
|
16
|
-
color
|
|
14
|
+
color?: FeedbackButtonColors
|
|
15
|
+
size?: FeedbackButtonSize
|
|
16
|
+
heightOffset?: number
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export const TeacherFeedback = ({
|
|
@@ -21,8 +21,9 @@ export const TeacherFeedback = ({
|
|
|
21
21
|
mode,
|
|
22
22
|
assignmentId,
|
|
23
23
|
problemId,
|
|
24
|
-
locale,
|
|
25
24
|
color = FeedbackButtonColors.BLUE,
|
|
25
|
+
size = FeedbackButtonSize.SMALL,
|
|
26
|
+
heightOffset = 0,
|
|
26
27
|
}: TeacherFeedbackProps) => {
|
|
27
28
|
const isOpen = useUnit(model.$isOpen)
|
|
28
29
|
const isLoading = useUnit(model.api.getCommentsFx.pending)
|
|
@@ -31,7 +32,6 @@ export const TeacherFeedback = ({
|
|
|
31
32
|
fn: (feedback, [assignmentId, problemId]) => feedback?.get(assignmentId)?.[problemId] ?? null,
|
|
32
33
|
keys: [assignmentId, problemId],
|
|
33
34
|
})
|
|
34
|
-
const isSimpleMode = mode === FeedbackMode.SIMPLE
|
|
35
35
|
|
|
36
36
|
if (!problemId || !teacherFeedback) return null
|
|
37
37
|
|
|
@@ -40,9 +40,8 @@ export const TeacherFeedback = ({
|
|
|
40
40
|
{isOpen && (
|
|
41
41
|
<TeacherFeedbackComments
|
|
42
42
|
comments={teacherFeedback.comments}
|
|
43
|
-
locale={locale}
|
|
44
43
|
mode={mode}
|
|
45
|
-
maxHeightOffset={
|
|
44
|
+
maxHeightOffset={heightOffset}
|
|
46
45
|
/>
|
|
47
46
|
)}
|
|
48
47
|
<TeacherFeedbackButton
|
|
@@ -50,7 +49,7 @@ export const TeacherFeedback = ({
|
|
|
50
49
|
unreadCommentsCount={teacherFeedback.unreadMessagesCount}
|
|
51
50
|
isOpen={isOpen}
|
|
52
51
|
isLoading={isLoading}
|
|
53
|
-
size={
|
|
52
|
+
size={size}
|
|
54
53
|
color={color}
|
|
55
54
|
/>
|
|
56
55
|
</View>
|
|
@@ -2,8 +2,8 @@ import React from 'react'
|
|
|
2
2
|
import { StyleSheet, View } from 'react-native'
|
|
3
3
|
import { Button, COLORS } from '@magmamath/react-native-ui'
|
|
4
4
|
import { UnreadMessagesBadge } from '../UnreadMessagesBadge'
|
|
5
|
-
import { MessageBubbleIcon } from '
|
|
6
|
-
import { XCloseIcon } from '
|
|
5
|
+
import { MessageBubbleIcon } from '../../../../shared/icons/MessageBubbleIcon'
|
|
6
|
+
import { XCloseIcon } from '../../../../shared/icons/XCloseIcon'
|
|
7
7
|
import { COLOR_SCHEMES } from './colorSchemes'
|
|
8
8
|
import {
|
|
9
9
|
FeedbackButtonColors,
|
|
@@ -16,6 +16,26 @@ const ICON_SIZES = {
|
|
|
16
16
|
[FeedbackButtonSize.SMALL]: 26,
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
const COLOR_PRESETS = {
|
|
20
|
+
[FeedbackButtonColors.PURPLE]: {
|
|
21
|
+
borderColor: COLORS.PURPLE_6,
|
|
22
|
+
schemeColor: COLOR_SCHEMES.PURPLE,
|
|
23
|
+
},
|
|
24
|
+
[FeedbackButtonColors.BLUE]: {
|
|
25
|
+
borderColor: COLORS.BLUE_6,
|
|
26
|
+
schemeColor: COLOR_SCHEMES.BLUE,
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const getVariantStyles = (isUnread: boolean, color: FeedbackButtonColors) => {
|
|
31
|
+
const { borderColor, schemeColor } = COLOR_PRESETS[color]
|
|
32
|
+
return {
|
|
33
|
+
iconColor: isUnread ? COLORS.NEUTRAL_1 : COLORS.NEUTRAL_9,
|
|
34
|
+
customColorScheme: isUnread ? schemeColor : COLOR_SCHEMES.GREY,
|
|
35
|
+
borderColor: isUnread ? borderColor : COLORS.NEUTRAL_5,
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
19
39
|
type TeacherFeedbackButtonProps = {
|
|
20
40
|
isOpen: boolean
|
|
21
41
|
isLoading: boolean
|
|
@@ -34,9 +54,10 @@ export const TeacherFeedbackButton = ({
|
|
|
34
54
|
color = FeedbackButtonColors.BLUE,
|
|
35
55
|
}: TeacherFeedbackButtonProps) => {
|
|
36
56
|
const isLarge = size === FeedbackButtonSize.LARGE
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
57
|
+
const { borderColor, iconColor, customColorScheme } = getVariantStyles(
|
|
58
|
+
!!unreadCommentsCount,
|
|
59
|
+
color,
|
|
60
|
+
)
|
|
40
61
|
|
|
41
62
|
if (isOpen) {
|
|
42
63
|
return (
|
|
@@ -67,20 +88,13 @@ export const TeacherFeedbackButton = ({
|
|
|
67
88
|
isLoading={isLoading}
|
|
68
89
|
style={{
|
|
69
90
|
container: isLarge ? styles.containerLarge : styles.container,
|
|
70
|
-
button: [
|
|
71
|
-
styles.button,
|
|
72
|
-
{ borderColor: !!unreadCommentsCount ? borderColor : COLORS.NEUTRAL_5 },
|
|
73
|
-
styles[size],
|
|
74
|
-
],
|
|
91
|
+
button: [styles.button, { borderColor }, styles[size]],
|
|
75
92
|
}}
|
|
76
|
-
customColorScheme={
|
|
93
|
+
customColorScheme={customColorScheme}
|
|
77
94
|
icon={
|
|
78
95
|
<View style={styles.iconContainer}>
|
|
79
|
-
<MessageBubbleIcon
|
|
80
|
-
|
|
81
|
-
size={ICON_SIZES[size]}
|
|
82
|
-
/>
|
|
83
|
-
{!!unreadCommentsCount && (
|
|
96
|
+
<MessageBubbleIcon color={iconColor} size={ICON_SIZES[size]} />
|
|
97
|
+
{unreadCommentsCount && (
|
|
84
98
|
<View style={isLarge ? styles.badgeContainerLarge : styles.badgeContainer}>
|
|
85
99
|
<UnreadMessagesBadge
|
|
86
100
|
badgeContent={unreadCommentsCount}
|
|
@@ -4,15 +4,13 @@ import { COLORS } from '@magmamath/react-native-ui'
|
|
|
4
4
|
import { BUENOS_AIRES_FONT } from '../../constants'
|
|
5
5
|
import { getRelativeTimeText } from '../../../../lib/helpers/helpers'
|
|
6
6
|
import { TeacherComment as TeacherCommentEntity } from '../../types'
|
|
7
|
-
import { Locale } from '../../../../shared/translation/types'
|
|
8
7
|
|
|
9
8
|
type TeacherCommentProps = {
|
|
10
9
|
comment: TeacherCommentEntity
|
|
11
|
-
|
|
12
|
-
style: StyleProp<ViewStyle>
|
|
10
|
+
style?: StyleProp<ViewStyle>
|
|
13
11
|
}
|
|
14
12
|
|
|
15
|
-
export const TeacherComment = ({ comment,
|
|
13
|
+
export const TeacherComment = ({ comment, style }: TeacherCommentProps) => {
|
|
16
14
|
return (
|
|
17
15
|
<View style={style}>
|
|
18
16
|
<View style={styles.authorInfo}>
|
|
@@ -21,7 +19,7 @@ export const TeacherComment = ({ comment, locale, style }: TeacherCommentProps)
|
|
|
21
19
|
</Text>
|
|
22
20
|
<View style={styles.spacer} />
|
|
23
21
|
<Text style={styles.dateAdded} numberOfLines={1}>
|
|
24
|
-
{getRelativeTimeText(comment.createdAt
|
|
22
|
+
{getRelativeTimeText(comment.createdAt)}
|
|
25
23
|
</Text>
|
|
26
24
|
</View>
|
|
27
25
|
|
package/src/features/feedback/components/TeacherFeedbackComments/TeacherFeedbackComments.tsx
CHANGED
|
@@ -4,7 +4,6 @@ import { TeacherComment } from './TeacherComment'
|
|
|
4
4
|
import { EmptyComment } from '../EmptyComment'
|
|
5
5
|
import { EMPTY_COMMENT_ID, FeedbackMode } from '../../constants'
|
|
6
6
|
import { COLORS } from '@magmamath/react-native-ui'
|
|
7
|
-
import { Locale } from '../../../../shared/translation'
|
|
8
7
|
import { TeacherComment as TeacherCommentEntity } from '../../types'
|
|
9
8
|
|
|
10
9
|
const TOOLBAR_HEIGHT = 140
|
|
@@ -14,29 +13,23 @@ const BOTTOM_OFFSET = Platform.select({
|
|
|
14
13
|
})
|
|
15
14
|
|
|
16
15
|
type TeacherFeedbackCommentsProps = {
|
|
17
|
-
comments: TeacherCommentEntity[]
|
|
18
|
-
locale: Locale | null
|
|
16
|
+
comments: TeacherCommentEntity[]
|
|
19
17
|
mode: FeedbackMode
|
|
20
18
|
maxHeightOffset: number
|
|
21
19
|
}
|
|
22
20
|
|
|
23
21
|
export const TeacherFeedbackComments = ({
|
|
24
22
|
comments,
|
|
25
|
-
locale,
|
|
26
|
-
mode,
|
|
27
23
|
maxHeightOffset,
|
|
28
24
|
}: TeacherFeedbackCommentsProps) => {
|
|
29
25
|
const ref = useRef<ScrollView | null>(null)
|
|
30
26
|
const dimensions = useWindowDimensions()
|
|
31
27
|
const MAX_HEIGHT = dimensions.height - TOOLBAR_HEIGHT - BOTTOM_OFFSET
|
|
32
|
-
const isSimpleMode = mode === FeedbackMode.SIMPLE
|
|
33
28
|
|
|
34
29
|
useEffect(() => {
|
|
35
30
|
ref.current?.scrollToEnd({ animated: false })
|
|
36
31
|
}, [])
|
|
37
32
|
|
|
38
|
-
if (!comments) return null
|
|
39
|
-
|
|
40
33
|
return (
|
|
41
34
|
<View style={[styles.container, { maxHeight: MAX_HEIGHT - maxHeightOffset }]}>
|
|
42
35
|
<ScrollView
|
|
@@ -45,13 +38,12 @@ export const TeacherFeedbackComments = ({
|
|
|
45
38
|
onContentSizeChange={() => ref.current?.scrollToEnd()}
|
|
46
39
|
>
|
|
47
40
|
{comments.length === 1 && comments[0]._id === EMPTY_COMMENT_ID ? (
|
|
48
|
-
<EmptyComment
|
|
41
|
+
<EmptyComment />
|
|
49
42
|
) : (
|
|
50
43
|
comments.map((comment, index) => (
|
|
51
44
|
<TeacherComment
|
|
52
45
|
key={comment._id}
|
|
53
46
|
comment={comment}
|
|
54
|
-
locale={locale}
|
|
55
47
|
style={{ marginBottom: index === comments.length - 1 ? 8 : 0 }}
|
|
56
48
|
/>
|
|
57
49
|
))
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { Platform } from 'react-native'
|
|
2
|
+
import { NoCommentsMessage } from './types'
|
|
2
3
|
|
|
3
4
|
export const BUENOS_AIRES_FONT =
|
|
4
5
|
Platform.OS === 'web' ? 'Buenos Aires, sans-serif' : 'BuenosAires-Regular'
|
|
5
6
|
|
|
6
|
-
export const NO_COMMENTS_ENG = 'No comments yet'
|
|
7
|
-
export const NO_COMMENTS_SWE = 'Inga kommentarer än'
|
|
8
7
|
export const EMPTY_COMMENT_ID = 'empty-comment'
|
|
9
|
-
|
|
10
8
|
export const TEACHER_FEEDBACK_BUTTON_ID = 'teacherFeedbackButton'
|
|
11
9
|
|
|
12
10
|
export enum FeedbackButtonColors {
|
|
@@ -23,3 +21,14 @@ export enum FeedbackMode {
|
|
|
23
21
|
SIMPLE = 'SIMPLE',
|
|
24
22
|
NORMAL = 'NORMAL',
|
|
25
23
|
}
|
|
24
|
+
|
|
25
|
+
export const EMPTY_COMMENT: NoCommentsMessage = {
|
|
26
|
+
__v: 0,
|
|
27
|
+
_id: EMPTY_COMMENT_ID,
|
|
28
|
+
createdAt: new Date(),
|
|
29
|
+
isRead: true,
|
|
30
|
+
studentId: '',
|
|
31
|
+
teacherId: '',
|
|
32
|
+
teacherName: '',
|
|
33
|
+
updatedAt: new Date(),
|
|
34
|
+
} as const
|
|
@@ -31,3 +31,34 @@ export function findCommentsByCredits({
|
|
|
31
31
|
}: FindCommentsByCreditsProps) {
|
|
32
32
|
return data?.get(assignmentId)?.[problemId]?.comments ?? []
|
|
33
33
|
}
|
|
34
|
+
|
|
35
|
+
type UpdateCommentsStateProps = {
|
|
36
|
+
state: CommentsMap | null
|
|
37
|
+
assignmentId: string
|
|
38
|
+
problemId: string
|
|
39
|
+
fn: (data: FeedbackEntity) => FeedbackEntity | undefined
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function updateCommentsState({
|
|
43
|
+
state,
|
|
44
|
+
assignmentId,
|
|
45
|
+
problemId,
|
|
46
|
+
fn,
|
|
47
|
+
}: UpdateCommentsStateProps) {
|
|
48
|
+
if (!state) return state
|
|
49
|
+
|
|
50
|
+
const updatedState = new Map(state)
|
|
51
|
+
const assignmentMap = updatedState.get(assignmentId) || {}
|
|
52
|
+
const currentData = assignmentMap[problemId] || { comments: [], unreadMessagesCount: 0 }
|
|
53
|
+
const updatedData = fn(currentData)
|
|
54
|
+
|
|
55
|
+
if (updatedData === undefined) {
|
|
56
|
+
delete assignmentMap[problemId]
|
|
57
|
+
if (Object.keys(assignmentMap).length === 0) updatedState.delete(assignmentId)
|
|
58
|
+
return updatedState
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
assignmentMap[problemId] = updatedData
|
|
62
|
+
updatedState.set(assignmentId, assignmentMap)
|
|
63
|
+
return updatedState
|
|
64
|
+
}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { createEffect, Effect } from 'effector'
|
|
2
|
-
import { TeacherFeedbackModelProps } from './model'
|
|
3
2
|
import { GetCommentsPayload, GetCommentsResponse, UpdateCommentStatusSeenPayload } from '../types'
|
|
4
3
|
|
|
4
|
+
type TeacherFeedbackAPIProps = {
|
|
5
|
+
getComments: (props: GetCommentsPayload) => Promise<GetCommentsResponse>
|
|
6
|
+
updateCommentStatusSeen: (props: UpdateCommentStatusSeenPayload) => Promise<void>
|
|
7
|
+
}
|
|
8
|
+
|
|
5
9
|
export class TeacherFeedbackAPI {
|
|
6
10
|
public readonly getCommentsFx: Effect<GetCommentsPayload, GetCommentsResponse>
|
|
7
11
|
public readonly updateCommentStatusSeenFx: Effect<UpdateCommentStatusSeenPayload, void>
|
|
8
12
|
|
|
9
|
-
constructor(api:
|
|
13
|
+
constructor(api: TeacherFeedbackAPIProps) {
|
|
10
14
|
this.getCommentsFx = createEffect(api.getComments)
|
|
11
15
|
this.updateCommentStatusSeenFx = createEffect(api.updateCommentStatusSeen)
|
|
12
16
|
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { createEvent, restore, sample, Store } from 'effector'
|
|
2
|
-
import { CommentsMap, Credits,
|
|
2
|
+
import { AddCommentProps, CommentsMap, Credits, DeleteCommentProps, TeacherComment } from '../types'
|
|
3
3
|
import { TeacherFeedbackAPI } from './api'
|
|
4
|
-
import {
|
|
4
|
+
import { updateCommentsState } from '../helpers'
|
|
5
|
+
import { getText } from '../../../shared/translation/helpers'
|
|
6
|
+
import { EMPTY_COMMENT } from '@magmamath/students-features'
|
|
5
7
|
|
|
6
|
-
type
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
problemId: string
|
|
10
|
-
fn: (data: FeedbackEntity) => FeedbackEntity | undefined
|
|
8
|
+
type TeacherCommentsModelProps = {
|
|
9
|
+
api: TeacherFeedbackAPI
|
|
10
|
+
$isOpen: Store<boolean>
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export class
|
|
13
|
+
export class TeacherCommentsModel {
|
|
14
14
|
private readonly setNoCommentsMessage = createEvent<TeacherComment>()
|
|
15
15
|
public readonly setAllCommentsRead = createEvent<Credits>()
|
|
16
|
-
public readonly add = createEvent<
|
|
17
|
-
public readonly delete = createEvent<
|
|
16
|
+
public readonly add = createEvent<AddCommentProps>()
|
|
17
|
+
public readonly delete = createEvent<DeleteCommentProps>()
|
|
18
18
|
|
|
19
19
|
public readonly setData = createEvent<CommentsMap>()
|
|
20
20
|
public readonly $data = restore<CommentsMap | null>(this.setData, null)
|
|
21
21
|
.on(this.setAllCommentsRead, (state, { assignmentId, problemId }) =>
|
|
22
|
-
|
|
22
|
+
updateCommentsState({
|
|
23
23
|
state,
|
|
24
24
|
assignmentId,
|
|
25
25
|
problemId,
|
|
@@ -30,7 +30,7 @@ export class TeacherComments {
|
|
|
30
30
|
}),
|
|
31
31
|
)
|
|
32
32
|
.on(this.add, (state, { assignmentId, problemId, comment, isRead }) =>
|
|
33
|
-
|
|
33
|
+
updateCommentsState({
|
|
34
34
|
state,
|
|
35
35
|
assignmentId,
|
|
36
36
|
problemId,
|
|
@@ -41,7 +41,7 @@ export class TeacherComments {
|
|
|
41
41
|
}),
|
|
42
42
|
)
|
|
43
43
|
.on(this.delete, (state, { assignmentId, problemId, commentId }) =>
|
|
44
|
-
|
|
44
|
+
updateCommentsState({
|
|
45
45
|
state,
|
|
46
46
|
assignmentId,
|
|
47
47
|
problemId,
|
|
@@ -62,7 +62,7 @@ export class TeacherComments {
|
|
|
62
62
|
}),
|
|
63
63
|
)
|
|
64
64
|
.on(this.setNoCommentsMessage, (state, noCommentsMessage) =>
|
|
65
|
-
|
|
65
|
+
updateCommentsState({
|
|
66
66
|
state,
|
|
67
67
|
assignmentId: noCommentsMessage.exerciseId,
|
|
68
68
|
problemId: noCommentsMessage.problemId,
|
|
@@ -73,11 +73,7 @@ export class TeacherComments {
|
|
|
73
73
|
}),
|
|
74
74
|
)
|
|
75
75
|
|
|
76
|
-
constructor(
|
|
77
|
-
api: TeacherFeedbackAPI,
|
|
78
|
-
$isOpen: Store<boolean>,
|
|
79
|
-
EMPTY_COMMENT: TeacherFeedbackModelProps['defaults']['EMPTY_COMMENT'],
|
|
80
|
-
) {
|
|
76
|
+
constructor({ api, $isOpen }: TeacherCommentsModelProps) {
|
|
81
77
|
sample({
|
|
82
78
|
clock: this.add,
|
|
83
79
|
source: { isOpen: $isOpen },
|
|
@@ -97,31 +93,13 @@ export class TeacherComments {
|
|
|
97
93
|
?.comments.length
|
|
98
94
|
return isOpen && hasNoMessages
|
|
99
95
|
},
|
|
100
|
-
fn: (_, { assignmentId, problemId }) => ({
|
|
96
|
+
fn: (_, { assignmentId, problemId }): TeacherComment => ({
|
|
101
97
|
...EMPTY_COMMENT,
|
|
102
98
|
exerciseId: assignmentId,
|
|
103
99
|
problemId,
|
|
100
|
+
content: getText('teacherFeedback.noComments'),
|
|
104
101
|
}),
|
|
105
102
|
target: this.setNoCommentsMessage,
|
|
106
103
|
})
|
|
107
104
|
}
|
|
108
|
-
|
|
109
|
-
private update({ state, assignmentId, problemId, fn }: UpdateProps) {
|
|
110
|
-
if (!state) return state
|
|
111
|
-
|
|
112
|
-
const updatedState = new Map(state)
|
|
113
|
-
const assignmentMap = updatedState.get(assignmentId) || {}
|
|
114
|
-
const currentData = assignmentMap[problemId] || { comments: [], unreadMessagesCount: 0 }
|
|
115
|
-
const updatedData = fn(currentData)
|
|
116
|
-
|
|
117
|
-
if (updatedData === undefined) {
|
|
118
|
-
delete assignmentMap[problemId]
|
|
119
|
-
if (Object.keys(assignmentMap).length === 0) updatedState.delete(assignmentId)
|
|
120
|
-
return updatedState
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
assignmentMap[problemId] = updatedData
|
|
124
|
-
updatedState.set(assignmentId, assignmentMap)
|
|
125
|
-
return updatedState
|
|
126
|
-
}
|
|
127
105
|
}
|