@magmamath/students-features 1.0.2-rc.11 → 1.0.2
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/helpers.js +0 -3
- package/dist/commonjs/features/chatbot/helpers.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js +2 -14
- package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ThreadItem.js +13 -47
- package/dist/commonjs/features/chatbot/model/ThreadItem.js.map +1 -1
- package/dist/commonjs/features/chatbot/types/model.types.js.map +1 -1
- package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.js +38 -12
- package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.js.map +1 -1
- package/dist/module/features/chatbot/helpers.js +0 -3
- package/dist/module/features/chatbot/helpers.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatBotThreadManager.js +2 -14
- package/dist/module/features/chatbot/model/ChatBotThreadManager.js.map +1 -1
- package/dist/module/features/chatbot/model/ThreadItem.js +13 -47
- package/dist/module/features/chatbot/model/ThreadItem.js.map +1 -1
- package/dist/module/features/chatbot/types/model.types.js.map +1 -1
- package/dist/module/features/voice/playing/components/VoiceTranscriptionsDropdown.js +39 -13
- package/dist/module/features/voice/playing/components/VoiceTranscriptionsDropdown.js.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ThreadItem.d.ts +12 -47
- package/dist/typescript/commonjs/features/chatbot/model/ThreadItem.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts +2 -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 +2 -5
- 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 -17
- package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/helpers.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ThreadItem.d.ts +12 -47
- package/dist/typescript/module/features/chatbot/model/ThreadItem.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/api.types.d.ts +2 -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 +2 -5
- 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 -17
- package/dist/typescript/module/features/chatbot/types/units.types.d.ts.map +1 -1
- package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionsDropdown.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/features/chatbot/helpers.ts +0 -1
- package/src/features/chatbot/model/ChatBotThreadManager.ts +2 -15
- package/src/features/chatbot/model/ThreadItem.ts +19 -63
- package/src/features/chatbot/types/api.types.ts +2 -11
- package/src/features/chatbot/types/model.types.ts +2 -12
- package/src/features/chatbot/types/units.types.ts +0 -20
- package/src/features/voice/playing/components/VoiceTranscriptionsDropdown.tsx +56 -17
- package/.editorconfig +0 -15
- package/.eslintignore +0 -2
- package/.eslintrc +0 -22
- package/.gitattributes +0 -3
- package/.github/actions/setup/action.yml +0 -37
- package/.github/workflows/ci.yml +0 -73
- package/.gitignore +0 -84
- package/.idea/.gitignore +0 -8
- package/.idea/codeStyles/Project.xml +0 -62
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/copilot.data.migration.agent.xml +0 -6
- package/.idea/copilot.data.migration.ask.xml +0 -6
- package/.idea/copilot.data.migration.ask2agent.xml +0 -6
- package/.idea/copilot.data.migration.edit.xml +0 -6
- package/.idea/inspectionProfiles/Project_Default.xml +0 -8
- package/.idea/jsLinters/eslint.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/prettier.xml +0 -7
- package/.idea/students-features.iml +0 -12
- package/.idea/vcs.xml +0 -6
- package/.idea/workspace.xml +0 -663
- package/.nvmrc +0 -1
- package/.prettierrc +0 -11
- package/.release-it.json +0 -17
- package/.watchmanconfig +0 -1
- package/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +0 -541
- package/.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs +0 -28
- package/.yarn/releases/yarn-3.6.1.cjs +0 -874
- package/babel.config.js +0 -5
- package/bob.config.js +0 -25
- package/example/.expo/README.md +0 -8
- package/example/.expo/devices.json +0 -3
- package/example/.expo/web/cache/production/images/favicon/favicon-24272cdaeff82cc5facdaccd982a6f05b60c4504704bbf94c19a6388659880bb-contain-transparent/favicon-48.png +0 -0
- package/example/app.json +0 -30
- package/example/assets/adaptive-icon.png +0 -0
- package/example/assets/favicon.png +0 -0
- package/example/assets/icon.png +0 -0
- package/example/assets/splash-icon.png +0 -0
- package/example/babel.config.js +0 -28
- package/example/index.js +0 -8
- package/example/metro.config.js +0 -18
- package/example/package.json +0 -25
- package/example/src/App.tsx +0 -8
- package/example/tsconfig.json +0 -6
- package/example/yarn.lock +0 -6552
- package/tsconfig.build.json +0 -4
- package/tsconfig.json +0 -34
- package/yarn.lock +0 -10904
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"units.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/units.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG;IACnB,CAAC,EAAE,MAAM,EAAE,CAAA;IACX,CAAC,EAAE,MAAM,EAAE,CAAA;CACZ,CAAA;
|
|
1
|
+
{"version":3,"file":"units.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/units.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG;IACnB,CAAC,EAAE,MAAM,EAAE,CAAA;IACX,CAAC,EAAE,MAAM,EAAE,CAAA;CACZ,CAAA;AACD,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG;IACpC,EAAE,EAAE,MAAM,CAAA;CACX,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC,OAAO,EAAE,cAAc,EAAE,GAAG,IAAI,CAAA;IAChC,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,eAAe,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,UAAU,EAAE,CAAA;IACrB,YAAY,EAAE,OAAO,CAAA;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,EAAE,mBAAmB,EAAE,CAAA;IAC/B,WAAW,EAAE,OAAO,CAAA;IACpB,aAAa,EAAE,WAAW,GAAG,IAAI,CAAA;IACjC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC/B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VoiceTranscriptionsDropdown.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/voice/playing/components/VoiceTranscriptionsDropdown.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VoiceTranscriptionsDropdown.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/voice/playing/components/VoiceTranscriptionsDropdown.tsx"],"names":[],"mappings":"AASA,OAAO,KAA4D,MAAM,OAAO,CAAA;AAChF,OAAO,EAEL,SAAS,EACT,SAAS,EAMV,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,WAAW,EAA0B,MAAM,aAAa,CAAA;AAEjE,OAAO,EAAE,gBAAgB,EAAe,MAAM,UAAU,CAAA;AASxD,KAAK,gCAAgC,GAAG;IACtC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAC5B,KAAK,EAAE,gBAAgB,CAAA;IACvB,OAAO,EAAE,WAAW,EAAE,CAAA;IACtB,aAAa,EAAE,MAAM,CAAA;IACrB,qBAAqB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/C,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,2BAA2B,+FAQrC,gCAAgC,sBA2MlC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magmamath/students-features",
|
|
3
|
-
"version": "1.0.2
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Magmamath features library",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"expo": ">=52.0.47"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@magmamath/react-native-ui": "0.4.
|
|
35
|
+
"@magmamath/react-native-ui": "0.4.83",
|
|
36
36
|
"@react-native/eslint-config": "^0.73.1",
|
|
37
37
|
"@release-it/conventional-changelog": "^9.0.2",
|
|
38
38
|
"@types/jest": "^29.5.5",
|
|
@@ -103,7 +103,6 @@ export function prepareChatRequestPayload(
|
|
|
103
103
|
...(imageCdnId && { imageCdnId }),
|
|
104
104
|
...(imageAltText && { altText: imageAltText }),
|
|
105
105
|
...(!!problemStandards?.length && { problemStandards }),
|
|
106
|
-
...(!!answerOptions?.length && { answerOptions }),
|
|
107
106
|
},
|
|
108
107
|
}
|
|
109
108
|
}
|
|
@@ -63,20 +63,8 @@ export class ChatBotThreadManager {
|
|
|
63
63
|
const content = await this.drawBoardAdapter.getContent()
|
|
64
64
|
if (!content) return threadItem
|
|
65
65
|
threadItem.setValidationKey(content.validationKey)
|
|
66
|
-
threadItem.
|
|
67
|
-
|
|
68
|
-
if (content.strokes?.length) {
|
|
69
|
-
threadItem.setStrokes(content.strokes)
|
|
70
|
-
}
|
|
71
|
-
if (content.spreadSheetContent?.length) {
|
|
72
|
-
threadItem.setSpreadSheetContent(content.spreadSheetContent)
|
|
73
|
-
}
|
|
74
|
-
if (content.equationWriterContent?.length) {
|
|
75
|
-
threadItem.setEquationWriterContent(content.equationWriterContent)
|
|
76
|
-
}
|
|
77
|
-
if (content.drawBoardImage) {
|
|
78
|
-
threadItem.setDrawBoardImage(content.drawBoardImage)
|
|
79
|
-
}
|
|
66
|
+
if (content.text) return threadItem.setText(content.text)
|
|
67
|
+
if (content.strokes?.length) return threadItem.setStrokes(content.strokes)
|
|
80
68
|
} catch {}
|
|
81
69
|
|
|
82
70
|
return threadItem
|
|
@@ -106,7 +94,6 @@ export class ChatBotThreadManager {
|
|
|
106
94
|
threadItem.history.push(result.message)
|
|
107
95
|
|
|
108
96
|
if ('errorStrokeIds' in result && result?.errorStrokeIds) {
|
|
109
|
-
threadItem.errorStrokesHistory.push(result.errorStrokeIds)
|
|
110
97
|
threadItem.setErrorStrokesIds(result.errorStrokeIds)
|
|
111
98
|
}
|
|
112
99
|
|
|
@@ -1,41 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
EquationItem,
|
|
3
|
-
FullStrokeData,
|
|
4
|
-
IThreadItem,
|
|
5
|
-
SpreadsheetItem,
|
|
6
|
-
} from '../types/units.types'
|
|
1
|
+
import { FullStrokeData, IThreadItem } from '../types/units.types'
|
|
7
2
|
import { generateRandomId } from '../../../lib/helpers/helpers'
|
|
8
3
|
|
|
9
4
|
type ThreadItemProps = {
|
|
10
5
|
strokes?: FullStrokeData[]
|
|
6
|
+
text?: string
|
|
11
7
|
key: string
|
|
12
|
-
spreadSheetContent?: SpreadsheetItem[]
|
|
13
|
-
equationWriterContent?: EquationItem[]
|
|
14
|
-
drawBoardImage?: string
|
|
15
|
-
studentInput?: string
|
|
16
8
|
}
|
|
17
9
|
|
|
18
|
-
const DEFAULT_STUDENT_INPUT = 'none'
|
|
19
|
-
|
|
20
10
|
export class ThreadItem implements IThreadItem {
|
|
21
11
|
public readonly id = generateRandomId()
|
|
22
12
|
public readonly history: string[] = []
|
|
23
|
-
public readonly errorStrokesHistory: string[][] = []
|
|
24
13
|
public strokesValidationKey: string | null = null
|
|
25
14
|
public strokes: FullStrokeData[] | null
|
|
15
|
+
public text: string | null = null
|
|
26
16
|
public errorStrokesIds: string[] | null = null
|
|
27
|
-
public spreadSheetContent?: SpreadsheetItem[]
|
|
28
|
-
public equationWriterContent?: EquationItem[]
|
|
29
|
-
public drawBoardImage?: string
|
|
30
|
-
public studentInput: string
|
|
31
17
|
|
|
32
18
|
public constructor(props?: ThreadItemProps | null) {
|
|
33
19
|
this.strokes = props?.strokes ?? null
|
|
20
|
+
this.text = props?.text ?? null
|
|
34
21
|
this.strokesValidationKey = props?.key ?? null
|
|
35
|
-
this.spreadSheetContent = props?.spreadSheetContent
|
|
36
|
-
this.equationWriterContent = props?.equationWriterContent
|
|
37
|
-
this.drawBoardImage = props?.drawBoardImage
|
|
38
|
-
this.studentInput = props?.studentInput ?? DEFAULT_STUDENT_INPUT
|
|
39
22
|
}
|
|
40
23
|
|
|
41
24
|
public setStrokes(strokes: FullStrokeData[]) {
|
|
@@ -43,6 +26,11 @@ export class ThreadItem implements IThreadItem {
|
|
|
43
26
|
return this
|
|
44
27
|
}
|
|
45
28
|
|
|
29
|
+
public setText(text: string) {
|
|
30
|
+
this.text = text
|
|
31
|
+
return this
|
|
32
|
+
}
|
|
33
|
+
|
|
46
34
|
public setValidationKey(key: string) {
|
|
47
35
|
this.strokesValidationKey = key
|
|
48
36
|
return this
|
|
@@ -53,51 +41,19 @@ export class ThreadItem implements IThreadItem {
|
|
|
53
41
|
return this
|
|
54
42
|
}
|
|
55
43
|
|
|
56
|
-
public
|
|
57
|
-
this.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
public setEquationWriterContent(content: EquationItem[]) {
|
|
62
|
-
this.equationWriterContent = content
|
|
63
|
-
return this
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
public setDrawBoardImage(image: string) {
|
|
67
|
-
this.drawBoardImage = image
|
|
68
|
-
return this
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
public setStudentInput(studentInput: string) {
|
|
72
|
-
this.studentInput = studentInput
|
|
73
|
-
return this
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
private getContentProps() {
|
|
77
|
-
if (this.strokes?.length) {
|
|
78
|
-
return { stroke: this.strokes }
|
|
79
|
-
}
|
|
80
|
-
if (this.spreadSheetContent?.length) {
|
|
81
|
-
return { spreadSheetContent: this.spreadSheetContent }
|
|
82
|
-
}
|
|
83
|
-
if (this.equationWriterContent?.length) {
|
|
84
|
-
return { equationWriterContent: this.equationWriterContent }
|
|
44
|
+
public getNextHintProps() {
|
|
45
|
+
if (this.history.length) {
|
|
46
|
+
return {
|
|
47
|
+
previousHint: this.history[this.history.length - 1],
|
|
48
|
+
}
|
|
85
49
|
}
|
|
86
|
-
return {}
|
|
87
|
-
}
|
|
88
50
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
: undefined
|
|
51
|
+
if (this.text) {
|
|
52
|
+
return { drawBoardText: this.text }
|
|
53
|
+
}
|
|
93
54
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
studentInput: this.studentInput,
|
|
97
|
-
...(this.drawBoardImage && { drawBoardImage: this.drawBoardImage }),
|
|
98
|
-
...this.getContentProps(),
|
|
99
|
-
...(this.history.length && { previousHints: [...this.history] }),
|
|
100
|
-
...(lastErrorStrokeIds?.length && { previousErrorStrokeIds: lastErrorStrokeIds }),
|
|
55
|
+
if (this.strokes && this.strokes.length > 0) {
|
|
56
|
+
return { stroke: this.strokes }
|
|
101
57
|
}
|
|
102
58
|
}
|
|
103
59
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { ChatAnswer, FullStrokeData, Stroke
|
|
2
|
-
SpreadsheetItem,
|
|
3
|
-
} from './units.types'
|
|
1
|
+
import { ChatAnswer, FullStrokeData, Stroke } from './units.types'
|
|
4
2
|
import { ProblemStandard } from './model.types'
|
|
5
3
|
|
|
6
4
|
export type GetAlternativesPayload = {
|
|
@@ -104,18 +102,11 @@ export type ChatHintPayload = {
|
|
|
104
102
|
correctAnswer: string[]
|
|
105
103
|
userAnswer?: string | string[]
|
|
106
104
|
stroke?: Stroke[]
|
|
107
|
-
|
|
108
|
-
previousErrorStrokeIds?: string[]
|
|
105
|
+
previousHint?: string
|
|
109
106
|
language: string
|
|
110
107
|
imageAltText?: string
|
|
111
108
|
imageCdnId?: string
|
|
112
109
|
drawBoardText?: string
|
|
113
|
-
spreadSheetContent?: SpreadsheetItem[]
|
|
114
|
-
equationWriterContent?: EquationItem[]
|
|
115
|
-
drawBoardImage?: string
|
|
116
|
-
hintNumber: number
|
|
117
|
-
studentInput: string
|
|
118
|
-
answerOptions?: string[]
|
|
119
110
|
}
|
|
120
111
|
|
|
121
112
|
export type ChatHintResponse = {
|
|
@@ -16,14 +16,7 @@ import {
|
|
|
16
16
|
SendMessageResponse,
|
|
17
17
|
} from './api.types'
|
|
18
18
|
import { ExtendWithOptional } from '../../../lib/helpers/types'
|
|
19
|
-
import {
|
|
20
|
-
EquationItem,
|
|
21
|
-
ChatAnswer,
|
|
22
|
-
ChatItem,
|
|
23
|
-
ConversationMessage,
|
|
24
|
-
FullStrokeData,
|
|
25
|
-
SpreadsheetItem,
|
|
26
|
-
} from './units.types'
|
|
19
|
+
import { ChatAnswer, ChatItem, ConversationMessage, FullStrokeData } from './units.types'
|
|
27
20
|
import { WithAbortSignal } from '../../../lib/types/requests'
|
|
28
21
|
import { RequestOptionalConfig } from '../../../lib/effector/createControllerEffect'
|
|
29
22
|
|
|
@@ -121,11 +114,8 @@ type GetVisibleStrokesResponse = {
|
|
|
121
114
|
|
|
122
115
|
type GetBoardContentResponse = {
|
|
123
116
|
strokes?: FullStrokeData[]
|
|
117
|
+
text?: string
|
|
124
118
|
validationKey: string
|
|
125
|
-
spreadSheetContent?: SpreadsheetItem[]
|
|
126
|
-
equationWriterContent?: EquationItem[]
|
|
127
|
-
drawBoardImage?: string
|
|
128
|
-
studentInput: string
|
|
129
119
|
}
|
|
130
120
|
|
|
131
121
|
export type IChatDrawBoardAdapter = {
|
|
@@ -2,36 +2,16 @@ export type Stroke = {
|
|
|
2
2
|
x: number[]
|
|
3
3
|
y: number[]
|
|
4
4
|
}
|
|
5
|
-
|
|
6
5
|
export type FullStrokeData = Stroke & {
|
|
7
6
|
id: string
|
|
8
7
|
}
|
|
9
8
|
|
|
10
|
-
export type EquationItem = {
|
|
11
|
-
id: string
|
|
12
|
-
value?: string
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type SpreadsheetItem = {
|
|
16
|
-
id: string
|
|
17
|
-
value?: string
|
|
18
|
-
point: {
|
|
19
|
-
x: number
|
|
20
|
-
y: number
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
9
|
export type IThreadItem = {
|
|
25
10
|
id: string
|
|
26
11
|
strokesValidationKey: string | null
|
|
27
12
|
strokes: FullStrokeData[] | null
|
|
28
13
|
history: string[]
|
|
29
|
-
errorStrokesHistory: string[][]
|
|
30
14
|
errorStrokesIds: string[] | null
|
|
31
|
-
spreadSheetContent?: SpreadsheetItem[]
|
|
32
|
-
equationWriterContent?: EquationItem[]
|
|
33
|
-
drawBoardImage?: string
|
|
34
|
-
studentInput: string
|
|
35
15
|
}
|
|
36
16
|
|
|
37
17
|
export type ChatAnswer = {
|
|
@@ -4,10 +4,20 @@ import {
|
|
|
4
4
|
CaretDownIcon,
|
|
5
5
|
COLORS,
|
|
6
6
|
IS_WEB,
|
|
7
|
+
ScrollableListScrollView,
|
|
7
8
|
} from '@magmamath/react-native-ui'
|
|
8
9
|
import { useUnit } from 'effector-react'
|
|
9
10
|
import React, { useRef, useEffect, useState, useCallback, useMemo } from 'react'
|
|
10
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
TouchableOpacity,
|
|
13
|
+
StyleProp,
|
|
14
|
+
ViewStyle,
|
|
15
|
+
FlatList,
|
|
16
|
+
LayoutChangeEvent,
|
|
17
|
+
ScrollView,
|
|
18
|
+
View,
|
|
19
|
+
StyleSheet,
|
|
20
|
+
} from 'react-native'
|
|
11
21
|
import Animated, { FadeIn, FadeOut } from 'react-native-reanimated'
|
|
12
22
|
import { AnswerAudio, VoiceTranscriptionItem } from '../../types'
|
|
13
23
|
import { useVoiceTranscriptionsDropdown } from '../hooks/useVoiceTranscriptionsDropdown'
|
|
@@ -42,6 +52,8 @@ export const VoiceTranscriptionsDropdown = ({
|
|
|
42
52
|
const [attempts, setAttempts] = useState<VoiceTranscriptionItem[]>([])
|
|
43
53
|
|
|
44
54
|
const scrollRef = useRef<FlatList | null>(null)
|
|
55
|
+
const scrollViewRef = useRef<ScrollView | null>(null)
|
|
56
|
+
const itemLayoutsRef = useRef<Map<string, number>>(new Map())
|
|
45
57
|
const answersRef = useRef(answers)
|
|
46
58
|
answersRef.current = answers
|
|
47
59
|
|
|
@@ -74,11 +86,25 @@ export const VoiceTranscriptionsDropdown = ({
|
|
|
74
86
|
model.dropdown,
|
|
75
87
|
)
|
|
76
88
|
|
|
89
|
+
const handleItemLayout = useCallback((id: string, event: LayoutChangeEvent) => {
|
|
90
|
+
itemLayoutsRef.current.set(id, event.nativeEvent.layout.y)
|
|
91
|
+
}, [])
|
|
92
|
+
|
|
77
93
|
const scrollToAttempt = useCallback(
|
|
78
94
|
(attemptNumber: number) => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
95
|
+
if (IS_WEB) {
|
|
96
|
+
const item = attempts.find((item) => item.attemptNumber === attemptNumber)
|
|
97
|
+
if (item) {
|
|
98
|
+
const y = itemLayoutsRef.current.get(item._id)
|
|
99
|
+
if (y !== undefined) {
|
|
100
|
+
scrollViewRef.current?.scrollTo({ y, animated: true })
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
const index = attempts.findIndex((item) => item.attemptNumber === attemptNumber)
|
|
105
|
+
if (index !== -1) {
|
|
106
|
+
scrollRef.current?.scrollToIndex({ index, animated: true, viewPosition: 0 })
|
|
107
|
+
}
|
|
82
108
|
}
|
|
83
109
|
},
|
|
84
110
|
[attempts],
|
|
@@ -188,19 +214,32 @@ export const VoiceTranscriptionsDropdown = ({
|
|
|
188
214
|
|
|
189
215
|
<Animated.View style={[listAnimatedStyle, { overflow: 'hidden' }]}>
|
|
190
216
|
<View onLayout={onListLayout} style={styles.listContainer}>
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
217
|
+
{IS_WEB ? (
|
|
218
|
+
<ScrollableListScrollView
|
|
219
|
+
bounces={false}
|
|
220
|
+
ref={scrollViewRef}
|
|
221
|
+
hideShadow
|
|
222
|
+
style={styles.list}
|
|
223
|
+
contentContainerStyle={styles.listContent}
|
|
224
|
+
>
|
|
225
|
+
{attempts.map((item) => (
|
|
226
|
+
<View key={item._id} onLayout={(e) => handleItemLayout(item._id, e)}>
|
|
227
|
+
{renderItem({ item })}
|
|
228
|
+
</View>
|
|
229
|
+
))}
|
|
230
|
+
</ScrollableListScrollView>
|
|
231
|
+
) : (
|
|
232
|
+
<ScrollableList
|
|
233
|
+
bounces={false}
|
|
234
|
+
ref={scrollRef}
|
|
235
|
+
hideShadow
|
|
236
|
+
data={attempts}
|
|
237
|
+
keyExtractor={(item) => item._id}
|
|
238
|
+
onScrollToIndexFailed={handleScrollToIndexFailed}
|
|
239
|
+
renderItem={renderItem}
|
|
240
|
+
contentContainerStyle={styles.listContent}
|
|
241
|
+
/>
|
|
242
|
+
)}
|
|
204
243
|
</View>
|
|
205
244
|
</Animated.View>
|
|
206
245
|
|
package/.editorconfig
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# EditorConfig helps developers define and maintain consistent
|
|
2
|
-
# coding styles between different editors and IDEs
|
|
3
|
-
# editorconfig.org
|
|
4
|
-
|
|
5
|
-
root = true
|
|
6
|
-
|
|
7
|
-
[*]
|
|
8
|
-
|
|
9
|
-
indent_style = space
|
|
10
|
-
indent_size = 2
|
|
11
|
-
|
|
12
|
-
end_of_line = lf
|
|
13
|
-
charset = utf-8
|
|
14
|
-
trim_trailing_whitespace = true
|
|
15
|
-
insert_final_newline = true
|
package/.eslintignore
DELETED
package/.eslintrc
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"browser": true,
|
|
4
|
-
"es2020": true
|
|
5
|
-
},
|
|
6
|
-
"extends": [
|
|
7
|
-
"eslint:recommended",
|
|
8
|
-
"plugin:@typescript-eslint/recommended",
|
|
9
|
-
"plugin:react-hooks/recommended",
|
|
10
|
-
"plugin:storybook/recommended",
|
|
11
|
-
"prettier"
|
|
12
|
-
],
|
|
13
|
-
"parser": "@typescript-eslint/parser",
|
|
14
|
-
"parserOptions": {
|
|
15
|
-
"ecmaVersion": "latest",
|
|
16
|
-
"sourceType": "module"
|
|
17
|
-
},
|
|
18
|
-
"plugins": ["react-refresh"],
|
|
19
|
-
"rules": {
|
|
20
|
-
"react-refresh/only-export-components": "warn"
|
|
21
|
-
}
|
|
22
|
-
}
|
package/.gitattributes
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
name: Setup
|
|
2
|
-
description: Setup Node.js and install dependencies
|
|
3
|
-
|
|
4
|
-
inputs:
|
|
5
|
-
npmrc-auth-token:
|
|
6
|
-
required: true
|
|
7
|
-
|
|
8
|
-
runs:
|
|
9
|
-
using: composite
|
|
10
|
-
steps:
|
|
11
|
-
- name: Setup Node.js
|
|
12
|
-
uses: actions/setup-node@v3
|
|
13
|
-
with:
|
|
14
|
-
node-version-file: .nvmrc
|
|
15
|
-
|
|
16
|
-
- name: Create .npmrc
|
|
17
|
-
shell: bash
|
|
18
|
-
run: |
|
|
19
|
-
echo "registry=https://registry.npmjs.org" > .npmrc
|
|
20
|
-
echo "//registry.npmjs.org/:_authToken=${{ inputs.npmrc-auth-token }}" >> .npmrc
|
|
21
|
-
|
|
22
|
-
- name: Cache dependencies
|
|
23
|
-
id: yarn-cache
|
|
24
|
-
uses: actions/cache@v3
|
|
25
|
-
with:
|
|
26
|
-
path: |
|
|
27
|
-
**/node_modules
|
|
28
|
-
.yarn/install-state.gz
|
|
29
|
-
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/package.json', '!node_modules/**') }}
|
|
30
|
-
restore-keys: |
|
|
31
|
-
${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
|
|
32
|
-
${{ runner.os }}-yarn-
|
|
33
|
-
|
|
34
|
-
- name: Install dependencies
|
|
35
|
-
if: steps.yarn-cache.outputs.cache-hit != 'true'
|
|
36
|
-
run: yarn install --immutable
|
|
37
|
-
shell: bash
|
package/.github/workflows/ci.yml
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
pull_request:
|
|
8
|
-
branches:
|
|
9
|
-
- main
|
|
10
|
-
merge_group:
|
|
11
|
-
types:
|
|
12
|
-
- checks_requested
|
|
13
|
-
|
|
14
|
-
jobs:
|
|
15
|
-
lint:
|
|
16
|
-
runs-on: ubuntu-latest
|
|
17
|
-
steps:
|
|
18
|
-
- name: Checkout
|
|
19
|
-
uses: actions/checkout@v3
|
|
20
|
-
|
|
21
|
-
- name: Setup
|
|
22
|
-
uses: ./.github/actions/setup
|
|
23
|
-
with:
|
|
24
|
-
npmrc-auth-token: ${{ secrets.MAGMA_NPMRC_TOKEN }}
|
|
25
|
-
|
|
26
|
-
- name: Lint files
|
|
27
|
-
run: yarn lint
|
|
28
|
-
|
|
29
|
-
- name: Typecheck files
|
|
30
|
-
run: yarn typecheck
|
|
31
|
-
|
|
32
|
-
test:
|
|
33
|
-
runs-on: ubuntu-latest
|
|
34
|
-
steps:
|
|
35
|
-
- name: Checkout
|
|
36
|
-
uses: actions/checkout@v3
|
|
37
|
-
|
|
38
|
-
- name: Setup
|
|
39
|
-
uses: ./.github/actions/setup
|
|
40
|
-
with:
|
|
41
|
-
npmrc-auth-token: ${{ secrets.MAGMA_NPMRC_TOKEN }}
|
|
42
|
-
|
|
43
|
-
- name: Run unit tests
|
|
44
|
-
run: yarn test --maxWorkers=2 --coverage
|
|
45
|
-
|
|
46
|
-
build-library:
|
|
47
|
-
runs-on: ubuntu-latest
|
|
48
|
-
steps:
|
|
49
|
-
- name: Checkout
|
|
50
|
-
uses: actions/checkout@v3
|
|
51
|
-
|
|
52
|
-
- name: Setup
|
|
53
|
-
uses: ./.github/actions/setup
|
|
54
|
-
with:
|
|
55
|
-
npmrc-auth-token: ${{ secrets.MAGMA_NPMRC_TOKEN }}
|
|
56
|
-
|
|
57
|
-
- name: Build package
|
|
58
|
-
run: yarn prepare
|
|
59
|
-
|
|
60
|
-
build-web:
|
|
61
|
-
runs-on: ubuntu-latest
|
|
62
|
-
steps:
|
|
63
|
-
- name: Checkout
|
|
64
|
-
uses: actions/checkout@v3
|
|
65
|
-
|
|
66
|
-
- name: Setup
|
|
67
|
-
uses: ./.github/actions/setup
|
|
68
|
-
with:
|
|
69
|
-
npmrc-auth-token: ${{ secrets.MAGMA_NPMRC_TOKEN }}
|
|
70
|
-
|
|
71
|
-
- name: Build example for Web
|
|
72
|
-
run: |
|
|
73
|
-
yarn example expo export --platform web
|
package/.gitignore
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
# OSX
|
|
2
|
-
#
|
|
3
|
-
.DS_Store
|
|
4
|
-
|
|
5
|
-
# XDE
|
|
6
|
-
.expo/
|
|
7
|
-
|
|
8
|
-
# VSCode
|
|
9
|
-
.vscode/
|
|
10
|
-
jsconfig.json
|
|
11
|
-
|
|
12
|
-
# Xcode
|
|
13
|
-
#
|
|
14
|
-
build/
|
|
15
|
-
*.pbxuser
|
|
16
|
-
!default.pbxuser
|
|
17
|
-
*.mode1v3
|
|
18
|
-
!default.mode1v3
|
|
19
|
-
*.mode2v3
|
|
20
|
-
!default.mode2v3
|
|
21
|
-
*.perspectivev3
|
|
22
|
-
!default.perspectivev3
|
|
23
|
-
xcuserdata
|
|
24
|
-
*.xccheckout
|
|
25
|
-
*.moved-aside
|
|
26
|
-
DerivedData
|
|
27
|
-
*.hmap
|
|
28
|
-
*.ipa
|
|
29
|
-
*.xcuserstate
|
|
30
|
-
project.xcworkspace
|
|
31
|
-
|
|
32
|
-
# Android/IJ
|
|
33
|
-
#
|
|
34
|
-
.classpath
|
|
35
|
-
.cxx
|
|
36
|
-
.gradle
|
|
37
|
-
.idea
|
|
38
|
-
.project
|
|
39
|
-
.settings
|
|
40
|
-
local.properties
|
|
41
|
-
android.iml
|
|
42
|
-
|
|
43
|
-
# Cocoapods
|
|
44
|
-
#
|
|
45
|
-
example/ios/Pods
|
|
46
|
-
|
|
47
|
-
# Ruby
|
|
48
|
-
example/vendor/
|
|
49
|
-
|
|
50
|
-
# node.js
|
|
51
|
-
#
|
|
52
|
-
node_modules/
|
|
53
|
-
npm-debug.log
|
|
54
|
-
yarn-debug.log
|
|
55
|
-
yarn-error.log
|
|
56
|
-
|
|
57
|
-
# BUCK
|
|
58
|
-
buck-out/
|
|
59
|
-
\.buckd/
|
|
60
|
-
android/app/libs
|
|
61
|
-
android/keystores/debug.keystore
|
|
62
|
-
|
|
63
|
-
# Yarn
|
|
64
|
-
.yarn/*
|
|
65
|
-
!.yarn/patches
|
|
66
|
-
!.yarn/plugins
|
|
67
|
-
!.yarn/releases
|
|
68
|
-
!.yarn/sdks
|
|
69
|
-
!.yarn/versions
|
|
70
|
-
|
|
71
|
-
# Expo
|
|
72
|
-
.expo/
|
|
73
|
-
|
|
74
|
-
# Turborepo
|
|
75
|
-
.turbo/
|
|
76
|
-
|
|
77
|
-
# generated by bob
|
|
78
|
-
dist/
|
|
79
|
-
!src/lib/
|
|
80
|
-
|
|
81
|
-
# React Native Codegen
|
|
82
|
-
ios/generated
|
|
83
|
-
android/generated
|
|
84
|
-
.npmrc
|