tycho-components 0.28.11 → 0.29.0
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/configs/Localization.d.ts +2 -2
- package/dist/configs/Localization.js +21 -39
- package/dist/configs/index.d.ts +2 -0
- package/dist/configs/index.js +1 -0
- package/dist/configs/types/Document.d.ts +3 -3
- package/dist/configs/types/Document.js +4 -4
- package/dist/features/index.d.ts +15 -32
- package/dist/features/index.js +11 -21
- package/package.json +1 -1
- package/dist/features/DocumentDrawer/Actions/Actions.d.ts +0 -17
- package/dist/features/DocumentDrawer/Actions/Actions.js +0 -121
- package/dist/features/DocumentDrawer/Actions/PageRemoveSentences.d.ts +0 -7
- package/dist/features/DocumentDrawer/Actions/PageRemoveSentences.js +0 -23
- package/dist/features/DocumentDrawer/Actions/index.d.ts +0 -2
- package/dist/features/DocumentDrawer/Actions/index.js +0 -2
- package/dist/features/DocumentDrawer/Actions/style.scss +0 -0
- package/dist/features/DocumentDrawer/AutomaticParser/AutomaticParser.d.ts +0 -8
- package/dist/features/DocumentDrawer/AutomaticParser/AutomaticParser.js +0 -96
- package/dist/features/DocumentDrawer/AutomaticParser/index.d.ts +0 -2
- package/dist/features/DocumentDrawer/AutomaticParser/index.js +0 -2
- package/dist/features/DocumentDrawer/AutomaticParser/style.scss +0 -10
- package/dist/features/DocumentDrawer/DocumentDrawer.d.ts +0 -19
- package/dist/features/DocumentDrawer/DocumentDrawer.js +0 -102
- package/dist/features/DocumentDrawer/DocumentEdit/DocumentEdit.d.ts +0 -35
- package/dist/features/DocumentDrawer/DocumentEdit/DocumentEdit.js +0 -207
- package/dist/features/DocumentDrawer/DocumentEdit/index.d.ts +0 -2
- package/dist/features/DocumentDrawer/DocumentEdit/index.js +0 -1
- package/dist/features/DocumentDrawer/DocumentExport/DocumentExport.d.ts +0 -7
- package/dist/features/DocumentDrawer/DocumentExport/DocumentExport.js +0 -83
- package/dist/features/DocumentDrawer/DocumentExport/ExportInvalidSentences.d.ts +0 -7
- package/dist/features/DocumentDrawer/DocumentExport/ExportInvalidSentences.js +0 -12
- package/dist/features/DocumentDrawer/DocumentExport/ExportTxtTierModal.d.ts +0 -8
- package/dist/features/DocumentDrawer/DocumentExport/ExportTxtTierModal.js +0 -14
- package/dist/features/DocumentDrawer/DocumentExport/index.d.ts +0 -2
- package/dist/features/DocumentDrawer/DocumentExport/index.js +0 -2
- package/dist/features/DocumentDrawer/DocumentExport/style.scss +0 -49
- package/dist/features/DocumentDrawer/DocumentLexicon/DocumentLexicon.d.ts +0 -7
- package/dist/features/DocumentDrawer/DocumentLexicon/DocumentLexicon.js +0 -22
- package/dist/features/DocumentDrawer/DocumentLexicon/index.d.ts +0 -2
- package/dist/features/DocumentDrawer/DocumentLexicon/index.js +0 -2
- package/dist/features/DocumentDrawer/DocumentLexicon/style.scss +0 -38
- package/dist/features/DocumentDrawer/DocumentRemove/DocumentRemove.d.ts +0 -12
- package/dist/features/DocumentDrawer/DocumentRemove/DocumentRemove.js +0 -28
- package/dist/features/DocumentDrawer/DocumentRemove/index.d.ts +0 -2
- package/dist/features/DocumentDrawer/DocumentRemove/index.js +0 -2
- package/dist/features/DocumentDrawer/DocumentRemove/style.scss +0 -0
- package/dist/features/DocumentDrawer/Github/Github.d.ts +0 -8
- package/dist/features/DocumentDrawer/Github/Github.js +0 -11
- package/dist/features/DocumentDrawer/Github/GithubCommit.d.ts +0 -8
- package/dist/features/DocumentDrawer/Github/GithubCommit.js +0 -86
- package/dist/features/DocumentDrawer/Github/index.d.ts +0 -2
- package/dist/features/DocumentDrawer/Github/index.js +0 -2
- package/dist/features/DocumentDrawer/Github/style.scss +0 -31
- package/dist/features/DocumentDrawer/ImageGallery/GalleryImage.d.ts +0 -8
- package/dist/features/DocumentDrawer/ImageGallery/GalleryImage.js +0 -5
- package/dist/features/DocumentDrawer/ImageGallery/GalleryRemoval.d.ts +0 -9
- package/dist/features/DocumentDrawer/ImageGallery/GalleryRemoval.js +0 -14
- package/dist/features/DocumentDrawer/ImageGallery/ImageGallery.d.ts +0 -9
- package/dist/features/DocumentDrawer/ImageGallery/ImageGallery.js +0 -45
- package/dist/features/DocumentDrawer/ImageGallery/index.d.ts +0 -2
- package/dist/features/DocumentDrawer/ImageGallery/index.js +0 -2
- package/dist/features/DocumentDrawer/ImageGallery/style.scss +0 -41
- package/dist/features/DocumentDrawer/Inconsistency/Inconsistency.d.ts +0 -8
- package/dist/features/DocumentDrawer/Inconsistency/Inconsistency.js +0 -18
- package/dist/features/DocumentDrawer/Inconsistency/InconsistencyActions.d.ts +0 -7
- package/dist/features/DocumentDrawer/Inconsistency/InconsistencyActions.js +0 -77
- package/dist/features/DocumentDrawer/Inconsistency/InconsistencyResponse.d.ts +0 -31
- package/dist/features/DocumentDrawer/Inconsistency/InconsistencyResponse.js +0 -39
- package/dist/features/DocumentDrawer/Inconsistency/InconsistencyService.d.ts +0 -6
- package/dist/features/DocumentDrawer/Inconsistency/InconsistencyService.js +0 -8
- package/dist/features/DocumentDrawer/Inconsistency/style.scss +0 -64
- package/dist/features/DocumentDrawer/Info/Info.d.ts +0 -10
- package/dist/features/DocumentDrawer/Info/Info.js +0 -16
- package/dist/features/DocumentDrawer/Info/index.d.ts +0 -2
- package/dist/features/DocumentDrawer/Info/index.js +0 -2
- package/dist/features/DocumentDrawer/Info/style.scss +0 -24
- package/dist/features/DocumentDrawer/Metadata/DocumentMetadata/DocumentMetadata.d.ts +0 -8
- package/dist/features/DocumentDrawer/Metadata/DocumentMetadata/DocumentMetadata.js +0 -60
- package/dist/features/DocumentDrawer/Metadata/DocumentMetadata/index.d.ts +0 -2
- package/dist/features/DocumentDrawer/Metadata/DocumentMetadata/index.js +0 -2
- package/dist/features/DocumentDrawer/Metadata/DocumentMetadata/style.scss +0 -7
- package/dist/features/DocumentDrawer/Metadata/DocumentMetadataEdit/DocumentMetadataEdit.d.ts +0 -11
- package/dist/features/DocumentDrawer/Metadata/DocumentMetadataEdit/DocumentMetadataEdit.js +0 -195
- package/dist/features/DocumentDrawer/Metadata/DocumentMetadataEdit/index.d.ts +0 -2
- package/dist/features/DocumentDrawer/Metadata/DocumentMetadataEdit/index.js +0 -2
- package/dist/features/DocumentDrawer/Metadata/DocumentMetadataEdit/style.scss +0 -58
- package/dist/features/DocumentDrawer/PageStatusComponent/PageStatusComponent.d.ts +0 -9
- package/dist/features/DocumentDrawer/PageStatusComponent/PageStatusComponent.js +0 -30
- package/dist/features/DocumentDrawer/PageStatusComponent/index.d.ts +0 -2
- package/dist/features/DocumentDrawer/PageStatusComponent/index.js +0 -2
- package/dist/features/DocumentDrawer/PageStatusComponent/style.scss +0 -19
- package/dist/features/DocumentDrawer/Pages/BoxRemoval.d.ts +0 -10
- package/dist/features/DocumentDrawer/Pages/BoxRemoval.js +0 -14
- package/dist/features/DocumentDrawer/Pages/Boxes.d.ts +0 -10
- package/dist/features/DocumentDrawer/Pages/Boxes.js +0 -65
- package/dist/features/DocumentDrawer/Pages/PageRemoval.d.ts +0 -10
- package/dist/features/DocumentDrawer/Pages/PageRemoval.js +0 -15
- package/dist/features/DocumentDrawer/Pages/Pages.d.ts +0 -10
- package/dist/features/DocumentDrawer/Pages/Pages.js +0 -67
- package/dist/features/DocumentDrawer/Pages/style.scss +0 -48
- package/dist/features/DocumentDrawer/deps.d.ts +0 -28
- package/dist/features/DocumentDrawer/deps.js +0 -20
- package/dist/features/DocumentDrawer/functions/FileUtils.d.ts +0 -4
- package/dist/features/DocumentDrawer/functions/FileUtils.js +0 -8
- package/dist/features/DocumentDrawer/functions/MetadataUtils.d.ts +0 -41
- package/dist/features/DocumentDrawer/functions/MetadataUtils.js +0 -192
- package/dist/features/DocumentDrawer/index.d.ts +0 -7
- package/dist/features/DocumentDrawer/index.js +0 -4
- package/dist/features/DocumentDrawer/localization/ActionsTexts.d.ts +0 -119
- package/dist/features/DocumentDrawer/localization/ActionsTexts.js +0 -119
- package/dist/features/DocumentDrawer/localization/DocumentTexts.d.ts +0 -137
- package/dist/features/DocumentDrawer/localization/DocumentTexts.js +0 -137
- package/dist/features/DocumentDrawer/localization/ExportTexts.d.ts +0 -74
- package/dist/features/DocumentDrawer/localization/ExportTexts.js +0 -74
- package/dist/features/DocumentDrawer/localization/GithubTexts.d.ts +0 -35
- package/dist/features/DocumentDrawer/localization/GithubTexts.js +0 -35
- package/dist/features/DocumentDrawer/localization/InconsistencyTexts.d.ts +0 -101
- package/dist/features/DocumentDrawer/localization/InconsistencyTexts.js +0 -101
- package/dist/features/DocumentDrawer/localization/PageTexts.d.ts +0 -45
- package/dist/features/DocumentDrawer/localization/PageTexts.js +0 -45
- package/dist/features/DocumentDrawer/localization/ParserTexts.d.ts +0 -30
- package/dist/features/DocumentDrawer/localization/ParserTexts.js +0 -30
- package/dist/features/DocumentDrawer/services/AutomaticParserService.d.ts +0 -8
- package/dist/features/DocumentDrawer/services/AutomaticParserService.js +0 -9
- package/dist/features/DocumentDrawer/services/BoundingBoxService.d.ts +0 -11
- package/dist/features/DocumentDrawer/services/BoundingBoxService.js +0 -20
- package/dist/features/DocumentDrawer/services/DocumentService.d.ts +0 -13
- package/dist/features/DocumentDrawer/services/DocumentService.js +0 -20
- package/dist/features/DocumentDrawer/services/ExportService.d.ts +0 -11
- package/dist/features/DocumentDrawer/services/ExportService.js +0 -22
- package/dist/features/DocumentDrawer/services/GithubService.d.ts +0 -8
- package/dist/features/DocumentDrawer/services/GithubService.js +0 -12
- package/dist/features/DocumentDrawer/services/ImageService.d.ts +0 -8
- package/dist/features/DocumentDrawer/services/ImageService.js +0 -12
- package/dist/features/DocumentDrawer/services/LexiconService.d.ts +0 -7
- package/dist/features/DocumentDrawer/services/LexiconService.js +0 -6
- package/dist/features/DocumentDrawer/services/MetadataService.d.ts +0 -11
- package/dist/features/DocumentDrawer/services/MetadataService.js +0 -18
- package/dist/features/DocumentDrawer/services/PageService.d.ts +0 -13
- package/dist/features/DocumentDrawer/services/PageService.js +0 -19
- package/dist/features/DocumentDrawer/services/SentenceService.d.ts +0 -6
- package/dist/features/DocumentDrawer/services/SentenceService.js +0 -6
- package/dist/features/DocumentDrawer/style.scss +0 -192
- package/dist/features/DocumentDrawer/types/BoundingBox.d.ts +0 -8
- package/dist/features/DocumentDrawer/types/BoundingBox.js +0 -1
- package/dist/features/DocumentDrawer/types/CatalogSearchFilter.d.ts +0 -15
- package/dist/features/DocumentDrawer/types/CatalogSearchFilter.js +0 -16
- package/dist/features/DocumentDrawer/types/Category.d.ts +0 -16
- package/dist/features/DocumentDrawer/types/Category.js +0 -5
- package/dist/features/DocumentDrawer/types/DocumentDrawerActionId.d.ts +0 -3
- package/dist/features/DocumentDrawer/types/DocumentDrawerActionId.js +0 -14
- package/dist/features/DocumentDrawer/types/DocumentStatus.d.ts +0 -7
- package/dist/features/DocumentDrawer/types/DocumentStatus.js +0 -6
- package/dist/features/DocumentDrawer/types/DocumentUpdateRequest.d.ts +0 -13
- package/dist/features/DocumentDrawer/types/DocumentUpdateRequest.js +0 -1
- package/dist/features/DocumentDrawer/types/Export.d.ts +0 -30
- package/dist/features/DocumentDrawer/types/Export.js +0 -46
- package/dist/features/DocumentDrawer/types/Lexicon.d.ts +0 -6
- package/dist/features/DocumentDrawer/types/Lexicon.js +0 -1
- package/dist/features/DocumentDrawer/types/LexiconResponse.d.ts +0 -6
- package/dist/features/DocumentDrawer/types/LexiconResponse.js +0 -1
- package/dist/features/DocumentDrawer/types/Metadata.d.ts +0 -22
- package/dist/features/DocumentDrawer/types/Metadata.js +0 -8
- package/dist/features/DocumentDrawer/types/Page.d.ts +0 -10
- package/dist/features/DocumentDrawer/types/Page.js +0 -1
- package/dist/features/DocumentDrawer/types/PageStatus.d.ts +0 -9
- package/dist/features/DocumentDrawer/types/PageStatus.js +0 -8
- package/dist/features/DocumentDrawer/types/Parser.d.ts +0 -18
- package/dist/features/DocumentDrawer/types/Parser.js +0 -21
- package/dist/features/DocumentDrawer/types/Query.d.ts +0 -6
- package/dist/features/DocumentDrawer/types/Query.js +0 -1
- package/dist/features/DocumentDrawer/types/Sentence.d.ts +0 -4
- package/dist/features/DocumentDrawer/types/Sentence.js +0 -1
- package/dist/features/Participants/ParticipantCreate/ParticipantCreate.d.ts +0 -8
- package/dist/features/Participants/ParticipantCreate/ParticipantCreate.js +0 -44
- package/dist/features/Participants/ParticipantCreate/index.d.ts +0 -2
- package/dist/features/Participants/ParticipantCreate/index.js +0 -2
- package/dist/features/Participants/ParticipantRemove/ParticipantRemove.d.ts +0 -11
- package/dist/features/Participants/ParticipantRemove/ParticipantRemove.js +0 -39
- package/dist/features/Participants/ParticipantRemove/index.d.ts +0 -2
- package/dist/features/Participants/ParticipantRemove/index.js +0 -2
- package/dist/features/Participants/ParticipantRemove/style.scss +0 -15
- package/dist/features/Participants/ParticipantService.d.ts +0 -10
- package/dist/features/Participants/ParticipantService.js +0 -19
- package/dist/features/Participants/Participants.d.ts +0 -10
- package/dist/features/Participants/Participants.js +0 -134
- package/dist/features/Participants/index.d.ts +0 -2
- package/dist/features/Participants/index.js +0 -2
- package/dist/features/Participants/style.scss +0 -51
- package/dist/features/SentenceSplit/SentenceSplit.d.ts +0 -33
- package/dist/features/SentenceSplit/SentenceSplit.js +0 -191
- package/dist/features/SentenceSplit/SentenceSplitAudio/SentenceSplitAudioStep.d.ts +0 -9
- package/dist/features/SentenceSplit/SentenceSplitAudio/SentenceSplitAudioStep.js +0 -38
- package/dist/features/SentenceSplit/SentenceSplitAudio/index.d.ts +0 -2
- package/dist/features/SentenceSplit/SentenceSplitAudio/index.js +0 -2
- package/dist/features/SentenceSplit/SentenceSplitAudio/style.scss +0 -29
- package/dist/features/SentenceSplit/SentenceSplitChoose/SentenceSplitChoose.d.ts +0 -10
- package/dist/features/SentenceSplit/SentenceSplitChoose/SentenceSplitChoose.js +0 -23
- package/dist/features/SentenceSplit/SentenceSplitChoose/index.d.ts +0 -2
- package/dist/features/SentenceSplit/SentenceSplitChoose/index.js +0 -2
- package/dist/features/SentenceSplit/SentenceSplitChoose/style.scss +0 -25
- package/dist/features/SentenceSplit/SentenceSplitCommentUtils.d.ts +0 -21
- package/dist/features/SentenceSplit/SentenceSplitCommentUtils.js +0 -77
- package/dist/features/SentenceSplit/SentenceSplitComments/SentenceSplitCommentBlock.d.ts +0 -7
- package/dist/features/SentenceSplit/SentenceSplitComments/SentenceSplitCommentBlock.js +0 -6
- package/dist/features/SentenceSplit/SentenceSplitComments/SentenceSplitComments.d.ts +0 -8
- package/dist/features/SentenceSplit/SentenceSplitComments/SentenceSplitComments.js +0 -37
- package/dist/features/SentenceSplit/SentenceSplitComments/SentenceSplitCommentsStep.d.ts +0 -11
- package/dist/features/SentenceSplit/SentenceSplitComments/SentenceSplitCommentsStep.js +0 -72
- package/dist/features/SentenceSplit/SentenceSplitComments/SentenceSplitCommentsWords.d.ts +0 -9
- package/dist/features/SentenceSplit/SentenceSplitComments/SentenceSplitCommentsWords.js +0 -15
- package/dist/features/SentenceSplit/SentenceSplitComments/index.d.ts +0 -2
- package/dist/features/SentenceSplit/SentenceSplitComments/index.js +0 -2
- package/dist/features/SentenceSplit/SentenceSplitComments/style.scss +0 -126
- package/dist/features/SentenceSplit/SentenceSplitPreview/SentenceSplitPreview.d.ts +0 -10
- package/dist/features/SentenceSplit/SentenceSplitPreview/SentenceSplitPreview.js +0 -10
- package/dist/features/SentenceSplit/SentenceSplitPreview/SentenceSplitPreviewStep.d.ts +0 -11
- package/dist/features/SentenceSplit/SentenceSplitPreview/SentenceSplitPreviewStep.js +0 -24
- package/dist/features/SentenceSplit/SentenceSplitPreview/index.d.ts +0 -2
- package/dist/features/SentenceSplit/SentenceSplitPreview/index.js +0 -2
- package/dist/features/SentenceSplit/SentenceSplitPreview/style.scss +0 -24
- package/dist/features/SentenceSplit/SentenceSplitService.d.ts +0 -13
- package/dist/features/SentenceSplit/SentenceSplitService.js +0 -13
- package/dist/features/SentenceSplit/SentenceSplitTranslations/SentenceSplitTranslations.d.ts +0 -12
- package/dist/features/SentenceSplit/SentenceSplitTranslations/SentenceSplitTranslations.js +0 -15
- package/dist/features/SentenceSplit/SentenceSplitTranslations/SentenceSplitTranslationsStep.d.ts +0 -10
- package/dist/features/SentenceSplit/SentenceSplitTranslations/SentenceSplitTranslationsStep.js +0 -8
- package/dist/features/SentenceSplit/SentenceSplitTranslations/index.d.ts +0 -2
- package/dist/features/SentenceSplit/SentenceSplitTranslations/index.js +0 -2
- package/dist/features/SentenceSplit/SentenceSplitTranslations/style.scss +0 -23
- package/dist/features/SentenceSplit/SentenceSplitUtils.d.ts +0 -6
- package/dist/features/SentenceSplit/SentenceSplitUtils.js +0 -17
- package/dist/features/SentenceSplit/index.d.ts +0 -2
- package/dist/features/SentenceSplit/index.js +0 -2
- package/dist/features/SentenceSplit/localization/SentenceSplitTexts.d.ts +0 -107
- package/dist/features/SentenceSplit/localization/SentenceSplitTexts.js +0 -107
- package/dist/features/SentenceSplit/style.scss +0 -173
- package/dist/features/SentenceSplit/types/Language.d.ts +0 -6
- package/dist/features/SentenceSplit/types/Language.js +0 -1
- package/dist/features/SentenceSplit/types/SentenceSplitRequest.d.ts +0 -20
- package/dist/features/SentenceSplit/types/SentenceSplitRequest.js +0 -16
- /package/dist/{features/Participants → configs}/types/Participant.d.ts +0 -0
- /package/dist/{features/Participants → configs}/types/Participant.js +0 -0
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import Participant, { ParticipantCreateRequest } from './types/Participant';
|
|
2
|
-
declare function add(uid: string, request: ParticipantCreateRequest): Promise<import("axios").AxiosResponse<Participant, any, {}>>;
|
|
3
|
-
declare function update(uid: string, code: string, participant: Participant): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
4
|
-
declare function remove(document: string, code: string, transfer?: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
5
|
-
declare const ParticipantService: {
|
|
6
|
-
add: typeof add;
|
|
7
|
-
update: typeof update;
|
|
8
|
-
remove: typeof remove;
|
|
9
|
-
};
|
|
10
|
-
export default ParticipantService;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import api, { platformApi } from '../../configs/api';
|
|
2
|
-
function add(uid, request) {
|
|
3
|
-
return api.post(`${platformApi.catalog}/participant/${uid}`, request);
|
|
4
|
-
}
|
|
5
|
-
function update(uid, code, participant) {
|
|
6
|
-
const request = { uid, code, participant };
|
|
7
|
-
return api.patch(`${platformApi.catalog}/participant/update`, request);
|
|
8
|
-
}
|
|
9
|
-
function remove(document, code, transfer) {
|
|
10
|
-
const request = {
|
|
11
|
-
code,
|
|
12
|
-
transfer,
|
|
13
|
-
};
|
|
14
|
-
return api.delete(`${platformApi.catalog}/participant/${document}`, {
|
|
15
|
-
data: request,
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
const ParticipantService = { add, update, remove };
|
|
19
|
-
export default ParticipantService;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import './style.scss';
|
|
2
|
-
import Participant from './types/Participant';
|
|
3
|
-
type Props = {
|
|
4
|
-
document: string;
|
|
5
|
-
onChange: (p: Participant[]) => void;
|
|
6
|
-
participants: Participant[];
|
|
7
|
-
useChat?: boolean;
|
|
8
|
-
};
|
|
9
|
-
export default function Participants({ document, participants, onChange, useChat, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export {};
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { MenuItem, Select } from '@mui/material';
|
|
3
|
-
import { useEffect, useMemo, useState } from 'react';
|
|
4
|
-
import { useForm } from 'react-hook-form';
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import { Button } from 'tycho-storybook';
|
|
7
|
-
import AppForm from '../../common/AppForm/AppForm';
|
|
8
|
-
import { useMessageUtils } from '../../configs/useMessageUtils';
|
|
9
|
-
import ParticipantCreate from './ParticipantCreate';
|
|
10
|
-
import ParticipantRemove from './ParticipantRemove';
|
|
11
|
-
import './style.scss';
|
|
12
|
-
import ParticipantService from './ParticipantService';
|
|
13
|
-
const PARTICIPANT_FIELD_DEFS = [
|
|
14
|
-
{ attr: 'order', type: 'text', required: true },
|
|
15
|
-
{ attr: 'code', type: 'text', required: true },
|
|
16
|
-
{ attr: 'name', type: 'text', required: false },
|
|
17
|
-
{ attr: 'separator', type: 'text', required: false },
|
|
18
|
-
{ attr: 'color', type: 'color', required: false, tooltip: true },
|
|
19
|
-
];
|
|
20
|
-
const CHAT_FIELD_DEFS = [
|
|
21
|
-
{ attr: 'language', type: 'text', required: false },
|
|
22
|
-
{ attr: 'age', type: 'text', required: false },
|
|
23
|
-
{ attr: 'sex', type: 'text', required: false },
|
|
24
|
-
{ attr: 'group', type: 'text', required: false },
|
|
25
|
-
{ attr: 'ses', type: 'text', required: false },
|
|
26
|
-
{ attr: 'role', type: 'text', required: false },
|
|
27
|
-
{ attr: 'education', type: 'text', required: false },
|
|
28
|
-
{ attr: 'custom', type: 'text', required: false },
|
|
29
|
-
];
|
|
30
|
-
const toCoreFormValues = (participant) => ({
|
|
31
|
-
order: participant.order ?? '',
|
|
32
|
-
code: participant.code ?? '',
|
|
33
|
-
name: participant.name ?? '',
|
|
34
|
-
separator: participant.separator ?? '',
|
|
35
|
-
color: participant.color ?? '',
|
|
36
|
-
});
|
|
37
|
-
const toChatFormValues = (participant) => {
|
|
38
|
-
const chat = participant.chat ?? {};
|
|
39
|
-
return {
|
|
40
|
-
language: chat.language ?? '',
|
|
41
|
-
age: chat.age ?? '',
|
|
42
|
-
sex: chat.sex ?? '',
|
|
43
|
-
group: chat.group ?? '',
|
|
44
|
-
ses: chat.ses ?? '',
|
|
45
|
-
role: chat.role ?? '',
|
|
46
|
-
education: chat.education ?? '',
|
|
47
|
-
custom: chat.custom ?? '',
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
export default function Participants({ document, participants, onChange, useChat, }) {
|
|
51
|
-
const { t } = useTranslation('participants');
|
|
52
|
-
const { dispatchMessage } = useMessageUtils();
|
|
53
|
-
const [participant, setParticipant] = useState();
|
|
54
|
-
const [openRemove, setOpenRemove] = useState(false);
|
|
55
|
-
const [openCreate, setOpenCreate] = useState(false);
|
|
56
|
-
const participantForm = useForm({
|
|
57
|
-
defaultValues: toCoreFormValues({ order: 1, code: '', name: '', chat: {} }),
|
|
58
|
-
});
|
|
59
|
-
const chatForm = useForm({
|
|
60
|
-
defaultValues: toChatFormValues({ order: 1, code: '', name: '', chat: {} }),
|
|
61
|
-
});
|
|
62
|
-
const participantFields = useMemo(() => PARTICIPANT_FIELD_DEFS.map((field) => ({
|
|
63
|
-
...field,
|
|
64
|
-
name: t(`participant.field.${field.attr}`),
|
|
65
|
-
...(field.tooltip
|
|
66
|
-
? { tooltipText: t(`participant.field.${field.attr}.tooltip`) }
|
|
67
|
-
: {}),
|
|
68
|
-
})), [t]);
|
|
69
|
-
const chatFields = useMemo(() => CHAT_FIELD_DEFS.map((field) => ({
|
|
70
|
-
...field,
|
|
71
|
-
name: t(`participant.field.${field.attr}`),
|
|
72
|
-
})), [t]);
|
|
73
|
-
const buildParticipantPayload = (current) => {
|
|
74
|
-
const coreValues = participantForm.getValues();
|
|
75
|
-
const chatValues = chatForm.getValues();
|
|
76
|
-
const order = typeof coreValues.order === 'string'
|
|
77
|
-
? Number(coreValues.order) || current.order || 1
|
|
78
|
-
: coreValues.order;
|
|
79
|
-
return {
|
|
80
|
-
...current,
|
|
81
|
-
...coreValues,
|
|
82
|
-
order,
|
|
83
|
-
chat: {
|
|
84
|
-
...current.chat,
|
|
85
|
-
...chatValues,
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
const handleSave = () => {
|
|
90
|
-
if (!participant)
|
|
91
|
-
return;
|
|
92
|
-
const lookupCode = participant.code;
|
|
93
|
-
const payload = buildParticipantPayload(participant);
|
|
94
|
-
ParticipantService.update(document, lookupCode, payload)
|
|
95
|
-
.then(() => {
|
|
96
|
-
dispatchMessage({ key: 'update.success', t });
|
|
97
|
-
const thisParticipants = [...participants];
|
|
98
|
-
const idx = thisParticipants.findIndex((p) => p.code === lookupCode);
|
|
99
|
-
if (idx >= 0) {
|
|
100
|
-
thisParticipants[idx] = payload;
|
|
101
|
-
}
|
|
102
|
-
setParticipant(payload);
|
|
103
|
-
onChange(thisParticipants);
|
|
104
|
-
})
|
|
105
|
-
.catch((err) => {
|
|
106
|
-
console.log(err);
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
useEffect(() => {
|
|
110
|
-
if (participants.length > 0)
|
|
111
|
-
setParticipant(participants[0]);
|
|
112
|
-
}, []);
|
|
113
|
-
useEffect(() => {
|
|
114
|
-
if (!participant)
|
|
115
|
-
return;
|
|
116
|
-
participantForm.reset(toCoreFormValues(participant));
|
|
117
|
-
chatForm.reset(toChatFormValues(participant));
|
|
118
|
-
}, [participant, participantForm, chatForm]);
|
|
119
|
-
return (_jsxs("div", { className: "participants-container", children: [_jsxs("div", { className: "header", children: [_jsx("div", { className: "title", children: t('label.title') }), _jsx("div", { className: "actions", children: _jsx(Button, { icon: "add", text: t('button.label.add'), onClick: () => setOpenCreate(true), size: "small", mode: "outlined" }) })] }), _jsx("div", { className: "body", children: participant && (_jsxs(_Fragment, { children: [_jsx(Select, { onChange: (e) => setParticipant(participants[Number(e.target.value)]), value: participant
|
|
120
|
-
? participants.findIndex((p) => p.code === participant.code)
|
|
121
|
-
: 0, fullWidth: true, className: "select-participant", children: participants.map((el, idx) => (_jsx(MenuItem, { value: idx, children: `${el.code} - ${el.name}` }, idx))) }), _jsxs("div", { className: "fields", children: [_jsx(AppForm, { fields: participantFields, form: participantForm }), useChat && (_jsx(AppForm, { fields: chatFields, form: chatForm })), _jsx(Button, { text: t('common:button.confirm'), onClick: handleSave, size: "small", className: "save-button" })] }), _jsx("div", { className: "footer", children: _jsx(Button, { icon: "delete", text: t('common:button.remove'), size: "small", className: "danger", onClick: () => {
|
|
122
|
-
setParticipant(participant);
|
|
123
|
-
setOpenRemove(true);
|
|
124
|
-
} }) })] })) }), participant && openRemove && (_jsx(ParticipantRemove, { document: document, onChange: (list) => {
|
|
125
|
-
onChange(list);
|
|
126
|
-
setParticipant(list.length > 0 ? list[0] : undefined);
|
|
127
|
-
setOpenRemove(false);
|
|
128
|
-
}, participant: participant, participants: participants, onClose: () => setOpenRemove(false) })), openCreate && (_jsx(ParticipantCreate, { document: document, onCreate: (p) => {
|
|
129
|
-
const thisParticipants = participants ? [...participants, p] : [p];
|
|
130
|
-
onChange(thisParticipants);
|
|
131
|
-
setParticipant(p);
|
|
132
|
-
setOpenCreate(false);
|
|
133
|
-
}, onClose: () => setOpenCreate(false) }))] }));
|
|
134
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
.participants-container {
|
|
2
|
-
.header {
|
|
3
|
-
display: flex;
|
|
4
|
-
@include subtitle-medium-2;
|
|
5
|
-
background-color: var(--layer-hover-2);
|
|
6
|
-
padding: 8px 16px;
|
|
7
|
-
border-bottom: 1px solid var(--border-subtle-2);
|
|
8
|
-
|
|
9
|
-
.actions {
|
|
10
|
-
margin-left: auto;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.body {
|
|
15
|
-
height: 90vh;
|
|
16
|
-
overflow-y: auto;
|
|
17
|
-
padding: var(--spacing-200);
|
|
18
|
-
|
|
19
|
-
> .select-participant {
|
|
20
|
-
margin-bottom: var(--spacing-200);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.fields {
|
|
24
|
-
margin-bottom: var(--spacing-200);
|
|
25
|
-
|
|
26
|
-
.save-button {
|
|
27
|
-
margin-top: var(--spacing-200);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.footer {
|
|
33
|
-
margin-top: 16px;
|
|
34
|
-
padding-top: 16px;
|
|
35
|
-
display: flex;
|
|
36
|
-
justify-content: right;
|
|
37
|
-
border-top: var(--border-default);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.modal-participant {
|
|
42
|
-
width: 40vw !important;
|
|
43
|
-
max-width: 40vw !important;
|
|
44
|
-
|
|
45
|
-
.body {
|
|
46
|
-
.participant-container {
|
|
47
|
-
display: flex;
|
|
48
|
-
gap: 8px;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Parameter } from '../../configs/types/Parameter';
|
|
2
|
-
import { Struct } from '../../configs/types/Struct';
|
|
3
|
-
import { type ButtonDSModes, type ButtonDSSizes, type TooltipPlacements } from 'tycho-storybook';
|
|
4
|
-
import SentenceSplitLanguage from './types/Language';
|
|
5
|
-
import './style.scss';
|
|
6
|
-
export type SentenceSplitTranslationsInput = {
|
|
7
|
-
values: Record<string, string>;
|
|
8
|
-
};
|
|
9
|
-
export type SentenceSplitIconButtonProps = {
|
|
10
|
-
mode?: ButtonDSModes;
|
|
11
|
-
size?: ButtonDSSizes;
|
|
12
|
-
iconSize?: ButtonDSSizes;
|
|
13
|
-
tooltipPlacement?: TooltipPlacements;
|
|
14
|
-
};
|
|
15
|
-
type Props = {
|
|
16
|
-
struct: Struct;
|
|
17
|
-
documentUid: string;
|
|
18
|
-
wordTiers: Parameter[];
|
|
19
|
-
languages: SentenceSplitLanguage[];
|
|
20
|
-
translations: SentenceSplitTranslationsInput;
|
|
21
|
-
sound: string;
|
|
22
|
-
/** When set, pre-selects the split after the word with this token position (`tok.p`). */
|
|
23
|
-
selected?: number;
|
|
24
|
-
onSuccess?: () => void;
|
|
25
|
-
iconButtonProps?: SentenceSplitIconButtonProps;
|
|
26
|
-
/** Controlled modal visibility (use with `onOpenChange`). */
|
|
27
|
-
open?: boolean;
|
|
28
|
-
onOpenChange?: (open: boolean) => void;
|
|
29
|
-
/** When true, only the wizard modal is rendered; parent controls `open`. */
|
|
30
|
-
hideTrigger?: boolean;
|
|
31
|
-
};
|
|
32
|
-
export default function SentenceSplit({ struct, documentUid, wordTiers, languages, translations, sound, selected, onSuccess, iconButtonProps, open: openProp, onOpenChange, hideTrigger, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
33
|
-
export {};
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
-
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import AppModal from '../../common/AppModal/AppModal';
|
|
5
|
-
import SentenceUtils from '../../functions/SentenceUtils';
|
|
6
|
-
import { useCorpusUtils } from '../../configs/useCorpusUtils';
|
|
7
|
-
import { useMessageUtils } from '../../configs/useMessageUtils';
|
|
8
|
-
import { Badge, Button, IconButton, } from 'tycho-storybook';
|
|
9
|
-
import SentenceSplitAudioStep from './SentenceSplitAudio';
|
|
10
|
-
import SentenceSplitChoose from './SentenceSplitChoose';
|
|
11
|
-
import SentenceSplitCommentsStep from './SentenceSplitComments';
|
|
12
|
-
import SentenceSplitPreviewStep from './SentenceSplitPreview';
|
|
13
|
-
import SentenceSplitTranslationsStep from './SentenceSplitTranslations';
|
|
14
|
-
import SentenceSplitService from './SentenceSplitService';
|
|
15
|
-
import SentenceSplitUtils from './SentenceSplitUtils';
|
|
16
|
-
import { emptySentenceSplitRequest, } from './types/SentenceSplitRequest';
|
|
17
|
-
import './style.scss';
|
|
18
|
-
const STEP_CHOOSE = 0;
|
|
19
|
-
const STEP_PREVIEW = 1;
|
|
20
|
-
const STEP_TRANSLATIONS = 2;
|
|
21
|
-
const STEP_AUDIO = 3;
|
|
22
|
-
const STEP_COMMENTS = 4;
|
|
23
|
-
const DEFAULT_ICON_BUTTON_PROPS = {
|
|
24
|
-
mode: 'ghost',
|
|
25
|
-
size: 'medium',
|
|
26
|
-
iconSize: 'medium',
|
|
27
|
-
tooltipPlacement: 'bottom',
|
|
28
|
-
};
|
|
29
|
-
/** Split is after this token's word; must not be the last visible word. */
|
|
30
|
-
function resolveInitialSplitToken(selected, wordTokens) {
|
|
31
|
-
if (selected === undefined)
|
|
32
|
-
return 0;
|
|
33
|
-
const idx = wordTokens.findIndex((tok) => tok.p === selected);
|
|
34
|
-
if (idx === -1 || idx === wordTokens.length - 1)
|
|
35
|
-
return 0;
|
|
36
|
-
return selected;
|
|
37
|
-
}
|
|
38
|
-
export default function SentenceSplit({ struct, documentUid, wordTiers, languages, translations, sound, selected, onSuccess, iconButtonProps, open: openProp, onOpenChange, hideTrigger = false, }) {
|
|
39
|
-
const { t } = useTranslation('sentenceSplit');
|
|
40
|
-
const { getCorpus } = useCorpusUtils();
|
|
41
|
-
const { dispatchError, isLoading, dispatchLoading } = useMessageUtils();
|
|
42
|
-
const [internalOpen, setInternalOpen] = useState(false);
|
|
43
|
-
const isControlled = openProp !== undefined;
|
|
44
|
-
const open = isControlled ? openProp : internalOpen;
|
|
45
|
-
const setOpen = (value) => {
|
|
46
|
-
if (!isControlled) {
|
|
47
|
-
setInternalOpen(value);
|
|
48
|
-
}
|
|
49
|
-
onOpenChange?.(value);
|
|
50
|
-
};
|
|
51
|
-
const [step, setStep] = useState(STEP_CHOOSE);
|
|
52
|
-
const [request, setRequest] = useState(emptySentenceSplitRequest);
|
|
53
|
-
const [hasComments, setHasComments] = useState(null);
|
|
54
|
-
const stepsContentRef = useRef(null);
|
|
55
|
-
const stepItemRefs = useRef({});
|
|
56
|
-
const load = () => {
|
|
57
|
-
if (open) {
|
|
58
|
-
setStep(STEP_CHOOSE);
|
|
59
|
-
const baseValues = { ...(translations?.values || {}) };
|
|
60
|
-
const sorted = SentenceUtils.sort(struct);
|
|
61
|
-
const tokens = sorted.filter((tok) => SentenceUtils.isVisible(tok) && !SentenceSplitUtils.skipToken(tok));
|
|
62
|
-
setRequest({
|
|
63
|
-
uid: struct.uid,
|
|
64
|
-
token: resolveInitialSplitToken(selected, tokens),
|
|
65
|
-
translationsFirst: baseValues,
|
|
66
|
-
translationsSecond: { ...baseValues },
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
const wordTokens = useMemo(() => {
|
|
71
|
-
const sorted = SentenceUtils.sort(struct);
|
|
72
|
-
return sorted.filter((tok) => SentenceUtils.isVisible(tok) && !SentenceSplitUtils.skipToken(tok));
|
|
73
|
-
}, [struct]);
|
|
74
|
-
const canProceedFromChoose = request.token && wordTokens.length >= 2;
|
|
75
|
-
const hasTranslations = useMemo(() => {
|
|
76
|
-
if (!languages?.length)
|
|
77
|
-
return false;
|
|
78
|
-
const values = translations?.values ?? {};
|
|
79
|
-
return Object.values(values).some((v) => String(v ?? '').trim().length > 0);
|
|
80
|
-
}, [languages, translations]);
|
|
81
|
-
const hasAudio = Boolean(sound?.trim());
|
|
82
|
-
const visibleStepIds = useMemo(() => {
|
|
83
|
-
const ids = [STEP_CHOOSE, STEP_PREVIEW];
|
|
84
|
-
if (hasTranslations)
|
|
85
|
-
ids.push(STEP_TRANSLATIONS);
|
|
86
|
-
if (hasAudio)
|
|
87
|
-
ids.push(STEP_AUDIO);
|
|
88
|
-
if (hasComments === true)
|
|
89
|
-
ids.push(STEP_COMMENTS);
|
|
90
|
-
return ids;
|
|
91
|
-
}, [hasTranslations, hasAudio, hasComments]);
|
|
92
|
-
const stepIndex = visibleStepIds.indexOf(step);
|
|
93
|
-
const isLastStep = stepIndex >= 0 && stepIndex === visibleStepIds.length - 1;
|
|
94
|
-
const canGoBack = stepIndex > 0;
|
|
95
|
-
const handleBack = () => {
|
|
96
|
-
if (canGoBack)
|
|
97
|
-
setStep(visibleStepIds[stepIndex - 1]);
|
|
98
|
-
};
|
|
99
|
-
const handleNext = () => {
|
|
100
|
-
if (stepIndex >= 0 && stepIndex < visibleStepIds.length - 1) {
|
|
101
|
-
setStep(visibleStepIds[stepIndex + 1]);
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
const handleFinishSplit = () => {
|
|
105
|
-
if (isLoading())
|
|
106
|
-
return;
|
|
107
|
-
dispatchLoading(true);
|
|
108
|
-
SentenceSplitService.split(struct.uid, request)
|
|
109
|
-
.then(() => {
|
|
110
|
-
setOpen(false);
|
|
111
|
-
onSuccess?.();
|
|
112
|
-
})
|
|
113
|
-
.catch((err) => {
|
|
114
|
-
dispatchLoading(false);
|
|
115
|
-
dispatchError({ err, t });
|
|
116
|
-
});
|
|
117
|
-
};
|
|
118
|
-
const commentsCheckPending = hasComments === null;
|
|
119
|
-
const disablePrimary = (step === STEP_CHOOSE && !canProceedFromChoose) ||
|
|
120
|
-
(step === STEP_PREVIEW && request.token === null) ||
|
|
121
|
-
(step === STEP_COMMENTS && isLoading()) ||
|
|
122
|
-
commentsCheckPending;
|
|
123
|
-
const canOpenSplit = wordTokens.length >= 2;
|
|
124
|
-
const steps = useMemo(() => {
|
|
125
|
-
const definitions = [
|
|
126
|
-
{ id: STEP_CHOOSE, label: t('split.words.title') },
|
|
127
|
-
{ id: STEP_PREVIEW, label: t('split.preview.title') },
|
|
128
|
-
{ id: STEP_TRANSLATIONS, label: t('split.translations.title') },
|
|
129
|
-
{ id: STEP_AUDIO, label: t('split.audio.title') },
|
|
130
|
-
{ id: STEP_COMMENTS, label: t('split.comments.title') },
|
|
131
|
-
];
|
|
132
|
-
return definitions
|
|
133
|
-
.filter((item) => visibleStepIds.includes(item.id))
|
|
134
|
-
.map((item, index) => ({ ...item, displayNumber: index + 1 }));
|
|
135
|
-
}, [visibleStepIds, t]);
|
|
136
|
-
useEffect(() => {
|
|
137
|
-
load();
|
|
138
|
-
}, [open, translations, struct.uid, selected]);
|
|
139
|
-
useEffect(() => {
|
|
140
|
-
if (!open) {
|
|
141
|
-
setHasComments(null);
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
let cancelled = false;
|
|
145
|
-
SentenceSplitService.findComments(getCorpus().uid, {
|
|
146
|
-
sentence: struct.uid,
|
|
147
|
-
document: documentUid,
|
|
148
|
-
page: struct.page,
|
|
149
|
-
})
|
|
150
|
-
.then((r) => {
|
|
151
|
-
if (!cancelled)
|
|
152
|
-
setHasComments(r.data.length > 0);
|
|
153
|
-
})
|
|
154
|
-
.catch((err) => {
|
|
155
|
-
if (!cancelled) {
|
|
156
|
-
setHasComments(false);
|
|
157
|
-
dispatchError({ err, t });
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
return () => {
|
|
161
|
-
cancelled = true;
|
|
162
|
-
};
|
|
163
|
-
}, [open, struct.uid, documentUid, struct.page, getCorpus, dispatchError, t]);
|
|
164
|
-
useEffect(() => {
|
|
165
|
-
if (!open || visibleStepIds.includes(step))
|
|
166
|
-
return;
|
|
167
|
-
setStep(visibleStepIds[0] ?? STEP_CHOOSE);
|
|
168
|
-
}, [open, visibleStepIds, step]);
|
|
169
|
-
useEffect(() => {
|
|
170
|
-
if (!open)
|
|
171
|
-
return;
|
|
172
|
-
const activeStepItem = stepItemRefs.current[step];
|
|
173
|
-
if (activeStepItem) {
|
|
174
|
-
activeStepItem.scrollIntoView({
|
|
175
|
-
behavior: 'smooth',
|
|
176
|
-
block: 'nearest',
|
|
177
|
-
inline: 'center',
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
stepsContentRef.current?.scrollTo({
|
|
181
|
-
top: 0,
|
|
182
|
-
behavior: 'smooth',
|
|
183
|
-
});
|
|
184
|
-
}, [step, open]);
|
|
185
|
-
const mergedIconProps = { ...DEFAULT_ICON_BUTTON_PROPS, ...iconButtonProps };
|
|
186
|
-
return (_jsxs(_Fragment, { children: [!hideTrigger && (_jsx(IconButton, { name: "link_off", onClick: () => setOpen(true), title: canOpenSplit
|
|
187
|
-
? t('button.label.split')
|
|
188
|
-
: t('split.button.disabledTooFewWords'), disabled: !canOpenSplit, ...mergedIconProps })), open && (_jsxs(AppModal, { title: t('modal.split.sentence.title'), className: "sentence-split-modal", close: () => setOpen(false), hideFooter: true, disableEscapeClose: true, disableBackdropClose: true, children: [_jsx("div", { className: "steps-navigation", children: steps.map((stepItem) => (_jsxs("div", { className: `step-item ${step === stepItem.id ? 'active' : ''}`, onClick: () => setStep(stepItem.id), ref: (element) => {
|
|
189
|
-
stepItemRefs.current[stepItem.id] = element;
|
|
190
|
-
}, children: [_jsx(Badge, { text: stepItem.displayNumber.toString(), size: "medium", color: step === stepItem.id ? 'blue' : 'none' }), _jsx("div", { className: "step-label", children: stepItem.label })] }, stepItem.id))) }), _jsxs("div", { className: "steps-content", ref: stepsContentRef, children: [_jsxs("div", { className: "sentence-split-body", children: [step === STEP_CHOOSE && (_jsx(SentenceSplitChoose, { struct: struct, request: request, onChange: setRequest })), step === STEP_PREVIEW && request.token !== null && (_jsx(SentenceSplitPreviewStep, { struct: struct, request: request, wordTiers: wordTiers })), step === STEP_TRANSLATIONS && (_jsx(SentenceSplitTranslationsStep, { languages: languages, request: request, onChange: setRequest })), step === STEP_AUDIO && (_jsx(SentenceSplitAudioStep, { sound: sound, request: request, onChange: setRequest })), step === STEP_COMMENTS && request.token !== null && (_jsx(SentenceSplitCommentsStep, { struct: struct, documentUid: documentUid, request: request, onChange: setRequest }))] }), _jsxs("div", { className: "steps-footer", children: [canGoBack && (_jsx(Button, { text: t('split.button.back'), onClick: handleBack, size: "medium", mode: "ghost" })), _jsx(Button, { text: isLastStep ? t('split.button.finish') : t('split.button.next'), onClick: isLastStep ? handleFinishSplit : handleNext, size: "medium", disabled: disablePrimary })] })] })] }))] }));
|
|
191
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { SentenceSplitRequest } from '../types/SentenceSplitRequest';
|
|
2
|
-
import './style.scss';
|
|
3
|
-
type Props = {
|
|
4
|
-
sound: string;
|
|
5
|
-
request: SentenceSplitRequest;
|
|
6
|
-
onChange: (request: SentenceSplitRequest) => void;
|
|
7
|
-
};
|
|
8
|
-
export default function SentenceSplitAudioStep({ sound, request, onChange, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export {};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useRef, useState } from 'react';
|
|
3
|
-
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import AppPlaceholder from '../../../common/AppPlaceholder/AppPlaceholder';
|
|
5
|
-
import { Button } from 'tycho-storybook';
|
|
6
|
-
import { WaveForm, WaveSurfer } from 'wavesurfer-react';
|
|
7
|
-
const WaveFormTyped = WaveForm;
|
|
8
|
-
import './style.scss';
|
|
9
|
-
export default function SentenceSplitAudioStep({ sound, request, onChange, }) {
|
|
10
|
-
const { t } = useTranslation('sentenceSplit');
|
|
11
|
-
const [simple, setSimple] = useState();
|
|
12
|
-
const [playing, setPlaying] = useState(false);
|
|
13
|
-
const requestRef = useRef(request);
|
|
14
|
-
requestRef.current = request;
|
|
15
|
-
const handlePlayPause = () => {
|
|
16
|
-
setPlaying(!playing);
|
|
17
|
-
simple?.playPause();
|
|
18
|
-
};
|
|
19
|
-
const handleWSMount = useCallback((waveSurfer) => {
|
|
20
|
-
setSimple(waveSurfer);
|
|
21
|
-
if (waveSurfer.markers) {
|
|
22
|
-
waveSurfer.clearMarkers();
|
|
23
|
-
}
|
|
24
|
-
waveSurfer.load(sound);
|
|
25
|
-
const handleSeek = (progress) => {
|
|
26
|
-
const duration = waveSurfer.getDuration();
|
|
27
|
-
if (!duration || !Number.isFinite(duration))
|
|
28
|
-
return;
|
|
29
|
-
onChange({
|
|
30
|
-
...requestRef.current,
|
|
31
|
-
soundSplit: progress * duration,
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
waveSurfer.on('finish', handlePlayPause);
|
|
35
|
-
waveSurfer.on('seek', handleSeek);
|
|
36
|
-
}, [sound, onChange]);
|
|
37
|
-
return (_jsxs("div", { className: "step-content sentence-split-step-audio", children: [_jsxs("div", { className: "header", children: [_jsx("div", { className: "title", children: t('split.audio.title') }), _jsx("div", { className: "subtitle", children: t('split.audio.description') })] }), _jsxs("div", { className: "step-body", children: [!sound && (_jsx(AppPlaceholder, { text: t('split.audio.empty'), icon: "music_cast" })), sound && (_jsxs("div", { className: "sentence-split-audio-wrap", children: [_jsx(WaveSurfer, { onMount: handleWSMount, children: _jsx(WaveFormTyped, { id: "waveform-sentence-split", waveColor: "violet", progressColor: "purple" }) }), _jsxs("div", { className: "buttons", children: [_jsx(Button, { text: playing ? t('split.audio.pause') : t('split.audio.play'), icon: playing ? 'pause' : 'play_arrow', onClick: handlePlayPause, size: "medium" }), _jsxs("span", { className: "time", children: [t('split.audio.cutPoint'), ":", ' ', request.soundSplit?.toFixed(2) || '0.00'] })] })] }))] })] }));
|
|
38
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
.sentence-split-step-audio {
|
|
2
|
-
.sentence-split-audio-wrap {
|
|
3
|
-
margin-top: 24px;
|
|
4
|
-
|
|
5
|
-
#waveform-sentence-split {
|
|
6
|
-
border: 1px solid var(--border-subtle-1);
|
|
7
|
-
|
|
8
|
-
> wave {
|
|
9
|
-
overflow: hidden !important;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
> .buttons {
|
|
14
|
-
display: flex;
|
|
15
|
-
justify-content: center;
|
|
16
|
-
margin-top: 16px;
|
|
17
|
-
|
|
18
|
-
.ds-icon-button {
|
|
19
|
-
margin-left: auto;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.time {
|
|
23
|
-
@include helper-large-1;
|
|
24
|
-
color: var(--text-secondary);
|
|
25
|
-
margin-left: auto;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Struct } from '../../../configs/types/Struct';
|
|
2
|
-
import { SentenceSplitRequest } from '../types/SentenceSplitRequest';
|
|
3
|
-
import './style.scss';
|
|
4
|
-
type Props = {
|
|
5
|
-
struct: Struct;
|
|
6
|
-
request: SentenceSplitRequest;
|
|
7
|
-
onChange: (request: SentenceSplitRequest) => void;
|
|
8
|
-
};
|
|
9
|
-
export default function SentenceSplitChoose({ struct, request, onChange, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import cx from 'classnames';
|
|
3
|
-
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import SentenceUtils from '../../../functions/SentenceUtils';
|
|
5
|
-
import SentenceSplitUtils from '../SentenceSplitUtils';
|
|
6
|
-
import './style.scss';
|
|
7
|
-
export default function SentenceSplitChoose({ struct, request, onChange, }) {
|
|
8
|
-
const { t } = useTranslation('sentenceSplit');
|
|
9
|
-
const sorted = SentenceUtils.sort(struct);
|
|
10
|
-
const wordTokens = sorted.filter((tok) => SentenceUtils.isVisible(tok) && !SentenceSplitUtils.skipToken(tok));
|
|
11
|
-
const handleSelect = (tokenP) => {
|
|
12
|
-
onChange({ ...request, token: tokenP });
|
|
13
|
-
};
|
|
14
|
-
return (_jsxs("div", { className: "step-content", children: [_jsxs("div", { className: "header", children: [_jsx("div", { className: "title", children: t('split.words.title') }), _jsx("div", { className: "subtitle", children: t('split.words.description') })] }), _jsx("div", { className: "step-body", children: _jsx("div", { className: "sentence-split-word-pick", children: wordTokens.map((tok, idx) => {
|
|
15
|
-
const label = SentenceSplitUtils.getOriginalValue(tok);
|
|
16
|
-
const selected = request.token === tok.p;
|
|
17
|
-
const isLastWord = idx === wordTokens.length - 1;
|
|
18
|
-
return (_jsx("button", { type: "button", disabled: isLastWord, title: isLastWord ? t('split.words.cannotSplitAfterLast') : undefined, className: cx('sentence-split-word-chip', {
|
|
19
|
-
selected,
|
|
20
|
-
disabled: isLastWord,
|
|
21
|
-
}), onClick: () => !isLastWord && handleSelect(tok.p), children: label }, tok.p));
|
|
22
|
-
}) }) })] }));
|
|
23
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
.sentence-split-word-pick {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-wrap: wrap;
|
|
4
|
-
gap: 8px;
|
|
5
|
-
margin-top: 24px;
|
|
6
|
-
|
|
7
|
-
.sentence-split-word-chip {
|
|
8
|
-
cursor: pointer;
|
|
9
|
-
border-radius: var(--radius-200);
|
|
10
|
-
padding: 0px 8px;
|
|
11
|
-
background-color: var(--background-default);
|
|
12
|
-
border: 1px dashed var(--border-accent-2);
|
|
13
|
-
|
|
14
|
-
&.selected,
|
|
15
|
-
&:hover {
|
|
16
|
-
background-color: var(--button-secondary-hover);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
&.disabled,
|
|
20
|
-
&:disabled {
|
|
21
|
-
opacity: 0.45;
|
|
22
|
-
cursor: not-allowed;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|