@magmamath/students-features 1.3.23-rc.11 → 1.3.23-rc.12
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/voice/playing/hooks/useVoiceTranscriptionEffects.js +11 -3
- package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionEffects.js.map +1 -1
- package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionEffects.js +11 -3
- package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionEffects.js.map +1 -1
- package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionEffects.d.ts.map +1 -1
- package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionEffects.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/features/voice/playing/hooks/useVoiceTranscriptionEffects.ts +12 -3
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useVoiceTranscriptionEffects = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
+
var _effectorReact = require("effector-react");
|
|
9
|
+
var _constants = require("../../constants.js");
|
|
8
10
|
const useVoiceTranscriptionEffects = ({
|
|
9
11
|
model,
|
|
10
12
|
answers,
|
|
@@ -21,11 +23,17 @@ const useVoiceTranscriptionEffects = ({
|
|
|
21
23
|
(0, _react.useEffect)(() => {
|
|
22
24
|
model.resetPlayer();
|
|
23
25
|
}, [problemId]);
|
|
26
|
+
const transcriptsLoaded = (0, _effectorReact.useUnit)(model.loader.$transcriptsLoaded);
|
|
24
27
|
(0, _react.useEffect)(() => {
|
|
25
28
|
if (activeAttempt === null) return;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
if (!transcriptsLoaded) {
|
|
30
|
+
model.dropdown.setExpanded(false);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const transcript = model.loader.getTranscript(activeAttempt);
|
|
34
|
+
const hasRealTranscript = !!transcript && transcript !== _constants.NO_AUDIO_BE_MESSAGE;
|
|
35
|
+
model.dropdown.setExpanded(hasRealTranscript);
|
|
36
|
+
}, [activeAttempt, transcriptsLoaded, model]);
|
|
29
37
|
(0, _react.useEffect)(() => {
|
|
30
38
|
if (answersRef.current.some(answer => answer.audioFileId)) {
|
|
31
39
|
model.initializeWithAudios(answersRef.current);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","useVoiceTranscriptionEffects","model","answers","answersKey","problemId","activeAttempt","answersRef","useRef","current","useEffect","reinitializePlayer","cleanup","resetPlayer","
|
|
1
|
+
{"version":3,"names":["_react","require","_effectorReact","_constants","useVoiceTranscriptionEffects","model","answers","answersKey","problemId","activeAttempt","answersRef","useRef","current","useEffect","reinitializePlayer","cleanup","resetPlayer","transcriptsLoaded","useUnit","loader","$transcriptsLoaded","dropdown","setExpanded","transcript","getTranscript","hasRealTranscript","NO_AUDIO_BE_MESSAGE","some","answer","audioFileId","initializeWithAudios","loadAllTranscripts","stopAudio","exports"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/hooks/useVoiceTranscriptionEffects.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAGA,IAAAE,UAAA,GAAAF,OAAA;AAUO,MAAMG,4BAA4B,GAAGA,CAAC;EAC3CC,KAAK;EACLC,OAAO;EACPC,UAAU;EACVC,SAAS;EACTC;AACM,CAAC,KAAK;EACZ,MAAMC,UAAU,GAAG,IAAAC,aAAM,EAACL,OAAO,CAAC;EAClCI,UAAU,CAACE,OAAO,GAAGN,OAAO;EAE5B,IAAAO,gBAAS,EAAC,MAAM;IACdR,KAAK,CAACS,kBAAkB,CAAC,CAAC;IAC1B,OAAO,MAAMT,KAAK,CAACU,OAAO,CAAC,CAAC;EAC9B,CAAC,EAAE,CAACV,KAAK,CAAC,CAAC;EAEX,IAAAQ,gBAAS,EAAC,MAAM;IACdR,KAAK,CAACW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
+
import { NO_AUDIO_BE_MESSAGE } from "../../constants.js";
|
|
4
6
|
export const useVoiceTranscriptionEffects = ({
|
|
5
7
|
model,
|
|
6
8
|
answers,
|
|
@@ -17,11 +19,17 @@ export const useVoiceTranscriptionEffects = ({
|
|
|
17
19
|
useEffect(() => {
|
|
18
20
|
model.resetPlayer();
|
|
19
21
|
}, [problemId]);
|
|
22
|
+
const transcriptsLoaded = useUnit(model.loader.$transcriptsLoaded);
|
|
20
23
|
useEffect(() => {
|
|
21
24
|
if (activeAttempt === null) return;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
if (!transcriptsLoaded) {
|
|
26
|
+
model.dropdown.setExpanded(false);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const transcript = model.loader.getTranscript(activeAttempt);
|
|
30
|
+
const hasRealTranscript = !!transcript && transcript !== NO_AUDIO_BE_MESSAGE;
|
|
31
|
+
model.dropdown.setExpanded(hasRealTranscript);
|
|
32
|
+
}, [activeAttempt, transcriptsLoaded, model]);
|
|
25
33
|
useEffect(() => {
|
|
26
34
|
if (answersRef.current.some(answer => answer.audioFileId)) {
|
|
27
35
|
model.initializeWithAudios(answersRef.current);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useRef","useVoiceTranscriptionEffects","model","answers","answersKey","problemId","activeAttempt","answersRef","current","reinitializePlayer","cleanup","resetPlayer","
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","useUnit","NO_AUDIO_BE_MESSAGE","useVoiceTranscriptionEffects","model","answers","answersKey","problemId","activeAttempt","answersRef","current","reinitializePlayer","cleanup","resetPlayer","transcriptsLoaded","loader","$transcriptsLoaded","dropdown","setExpanded","transcript","getTranscript","hasRealTranscript","some","answer","audioFileId","initializeWithAudios","loadAllTranscripts","stopAudio"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/hooks/useVoiceTranscriptionEffects.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,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AChB,UAAU,CAACC,OAAO,CAAC;MAC9CN,KAAK,CAACW,MAAM,CAACW,kBAAkB,CAAC,CAAC;IACnC;EACF,CAAC,EAAE,CAACtB,KAAK,EAAEE,UAAU,CAAC,CAAC;EAEvBP,SAAS,CAAC,MAAM;IACdK,KAAK,CAACuB,SAAS,CAAC,CAAC;EACnB,CAAC,EAAE,CAACnB,aAAa,CAAC,CAAC;AACrB,CAAC","ignoreList":[]}
|
package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionEffects.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useVoiceTranscriptionEffects.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/voice/playing/hooks/useVoiceTranscriptionEffects.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useVoiceTranscriptionEffects.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/voice/playing/hooks/useVoiceTranscriptionEffects.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAG3C,KAAK,MAAM,GAAG;IACZ,KAAK,EAAE,gBAAgB,CAAA;IACvB,OAAO,EAAE,WAAW,EAAE,CAAA;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;CAC7B,CAAA;AAED,eAAO,MAAM,4BAA4B,8DAMtC,MAAM,SAoCR,CAAA"}
|
package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionEffects.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useVoiceTranscriptionEffects.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/voice/playing/hooks/useVoiceTranscriptionEffects.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useVoiceTranscriptionEffects.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/voice/playing/hooks/useVoiceTranscriptionEffects.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAG3C,KAAK,MAAM,GAAG;IACZ,KAAK,EAAE,gBAAgB,CAAA;IACvB,OAAO,EAAE,WAAW,EAAE,CAAA;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;CAC7B,CAAA;AAED,eAAO,MAAM,4BAA4B,8DAMtC,MAAM,SAoCR,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { useEffect, useRef } from 'react'
|
|
2
|
+
import { useUnit } from 'effector-react'
|
|
2
3
|
import { AnswerAudio } from '../../types'
|
|
3
4
|
import { VoicePlayerModel } from '../model'
|
|
5
|
+
import { NO_AUDIO_BE_MESSAGE } from '../../constants'
|
|
4
6
|
|
|
5
7
|
type Params = {
|
|
6
8
|
model: VoicePlayerModel
|
|
@@ -29,11 +31,18 @@ export const useVoiceTranscriptionEffects = ({
|
|
|
29
31
|
model.resetPlayer()
|
|
30
32
|
}, [problemId])
|
|
31
33
|
|
|
34
|
+
const transcriptsLoaded = useUnit(model.loader.$transcriptsLoaded)
|
|
35
|
+
|
|
32
36
|
useEffect(() => {
|
|
33
37
|
if (activeAttempt === null) return
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
if (!transcriptsLoaded) {
|
|
39
|
+
model.dropdown.setExpanded(false)
|
|
40
|
+
return
|
|
41
|
+
}
|
|
42
|
+
const transcript = model.loader.getTranscript(activeAttempt)
|
|
43
|
+
const hasRealTranscript = !!transcript && transcript !== NO_AUDIO_BE_MESSAGE
|
|
44
|
+
model.dropdown.setExpanded(hasRealTranscript)
|
|
45
|
+
}, [activeAttempt, transcriptsLoaded, model])
|
|
37
46
|
|
|
38
47
|
useEffect(() => {
|
|
39
48
|
if (answersRef.current.some((answer) => answer.audioFileId)) {
|