tycho-components 0.22.4 → 0.22.6

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.
@@ -1,7 +1,7 @@
1
- import CatalogSearchFilter from '../types/CatalogSearchFilter';
2
- import type { DocumentDrawerActionId } from '../types/DocumentDrawerActionId';
3
- import { Document } from '../deps';
4
- import './style.scss';
1
+ import CatalogSearchFilter from "../types/CatalogSearchFilter";
2
+ import type { DocumentDrawerActionId } from "../types/DocumentDrawerActionId";
3
+ import { Document } from "../deps";
4
+ import "./style.scss";
5
5
  type Props = {
6
6
  document: Document;
7
7
  setOpenFile: (b: boolean) => void;
@@ -1,17 +1,17 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import AutomaticParser from '../AutomaticParser';
3
- import DocumentRemove from '../DocumentRemove';
4
- import InconsistencyActions from '../Inconsistency/InconsistencyActions';
5
- import DocumentService from '../services/DocumentService';
6
- import SentenceService from '../services/SentenceService';
7
- import PageRemoveSentences from './PageRemoveSentences';
8
- import { useMemo, useState } from 'react';
9
- import { useTranslation } from 'react-i18next';
10
- import { ToolsUtils, useCorpusUtils, useMessageUtils } from '../deps';
11
- import { Icon } from 'tycho-storybook';
12
- import './style.scss';
2
+ import AutomaticParser from "../AutomaticParser";
3
+ import DocumentRemove from "../DocumentRemove";
4
+ import InconsistencyActions from "../Inconsistency/InconsistencyActions";
5
+ import DocumentService from "../services/DocumentService";
6
+ import SentenceService from "../services/SentenceService";
7
+ import PageRemoveSentences from "./PageRemoveSentences";
8
+ import { useMemo, useState } from "react";
9
+ import { useTranslation } from "react-i18next";
10
+ import { ToolsUtils, useCorpusUtils, useMessageUtils } from "../deps";
11
+ import { Icon } from "tycho-storybook";
12
+ import "./style.scss";
13
13
  export default function Actions({ document, setOpenFile, setFilter, handleClickDocument, useGrid, pageUid, pageOrder, onPageReload, hiddenActions = [], }) {
14
- const { t } = useTranslation(['actions', 'main']);
14
+ const { t } = useTranslation("actions");
15
15
  const { getCorpus } = useCorpusUtils();
16
16
  const [openRemove, setOpenRemove] = useState(false);
17
17
  const [openRemoveSentences, setOpenRemoveSentences] = useState(false);
@@ -24,7 +24,7 @@ export default function Actions({ document, setOpenFile, setFilter, handleClickD
24
24
  const handleResume = () => {
25
25
  SentenceService.resume(document.uid).then((r) => {
26
26
  if (!r.data) {
27
- dispatchError({ err: 'warning.syntactic.review', t });
27
+ dispatchError({ err: "warning.syntactic.review", t });
28
28
  return;
29
29
  }
30
30
  navigateSameWindow(`${import.meta.env.VITE_APP_REVISION_URL}/tree/${r.data.uid}`);
@@ -32,7 +32,7 @@ export default function Actions({ document, setOpenFile, setFilter, handleClickD
32
32
  };
33
33
  const handleReview = () => {
34
34
  const baseUrl = import.meta.env.VITE_APP_REVISION_URL;
35
- const url = document.defaultTool === 'DESIGN'
35
+ const url = document.defaultTool === "DESIGN"
36
36
  ? `${baseUrl}/box/${document.uid}`
37
37
  : `${baseUrl}/${document.uid}`;
38
38
  navigateSameWindow(url);
@@ -42,79 +42,79 @@ export default function Actions({ document, setOpenFile, setFilter, handleClickD
42
42
  };
43
43
  const handleTranscription = () => {
44
44
  if (!pageUid) {
45
- dispatchError({ err: 'error.page.required', t });
45
+ dispatchError({ err: "error.page.required", t });
46
46
  return;
47
47
  }
48
48
  setOpenRemoveSentences(true);
49
49
  };
50
50
  const handleSyncSearch = () => {
51
51
  DocumentService.syncSearch(document.uid)
52
- .then(() => dispatchMessage({ key: 'sync.search.success', t }))
53
- .catch(() => dispatchError({ err: 'error.unknown', t }));
52
+ .then(() => dispatchMessage({ key: "sync.search.success", t }))
53
+ .catch(() => dispatchError({ err: "error.unknown", t }));
54
54
  };
55
55
  const actionOptions = [
56
56
  {
57
- id: 'documents',
58
- iconName: 'list',
59
- title: t('label.documents.title'),
60
- description: t('label.documents.description'),
57
+ id: "documents",
58
+ iconName: "list",
59
+ title: t("label.documents.title"),
60
+ description: t("label.documents.description"),
61
61
  onClick: handleDocuments,
62
62
  },
63
63
  {
64
- id: 'edition',
64
+ id: "edition",
65
65
  iconName: ToolsUtils.getIcon(document.defaultTool),
66
- title: t('label.edition.title'),
67
- description: t('label.edition.description'),
66
+ title: t("label.edition.title"),
67
+ description: t("label.edition.description"),
68
68
  onClick: () => handleClickDocument(document.uid),
69
- buttonClassName: document.defaultTool === 'DESIGN' ? 'action-design' : undefined,
69
+ buttonClassName: document.defaultTool === "DESIGN" ? "action-design" : undefined,
70
70
  },
71
71
  {
72
- id: 'syntactic',
73
- iconName: 'graph_4',
74
- title: t('label.syntactic.title'),
75
- description: t('label.syntactic.description'),
72
+ id: "syntactic",
73
+ iconName: "graph_4",
74
+ title: t("label.syntactic.title"),
75
+ description: t("label.syntactic.description"),
76
76
  onClick: handleReview,
77
77
  },
78
78
  {
79
- id: 'resume',
80
- iconName: 'play_arrow',
81
- title: t('label.resume.title'),
82
- description: t('label.resume.description'),
79
+ id: "resume",
80
+ iconName: "play_arrow",
81
+ title: t("label.resume.title"),
82
+ description: t("label.resume.description"),
83
83
  onClick: handleResume,
84
84
  },
85
85
  {
86
- id: 'transcription',
87
- iconName: 'checkbook',
88
- title: t('label.transcription.title'),
89
- description: t('label.transcription.description', {
86
+ id: "transcription",
87
+ iconName: "checkbook",
88
+ title: t("label.transcription.title"),
89
+ description: t("label.transcription.description", {
90
90
  pageNumber: pageOrder,
91
91
  }),
92
92
  onClick: handleTranscription,
93
93
  },
94
94
  {
95
- id: 'automatic',
96
- iconName: 'settings_timelapse',
97
- title: t('label.automatic.title'),
98
- description: t('label.automatic.description'),
95
+ id: "automatic",
96
+ iconName: "settings_timelapse",
97
+ title: t("label.automatic.title"),
98
+ description: t("label.automatic.description"),
99
99
  onClick: () => setOpenAutomatic(true),
100
100
  },
101
101
  {
102
- id: 'sync',
103
- iconName: 'sync',
104
- title: t('label.sync.title'),
105
- description: t('label.sync.description'),
102
+ id: "sync",
103
+ iconName: "sync",
104
+ title: t("label.sync.title"),
105
+ description: t("label.sync.description"),
106
106
  onClick: handleSyncSearch,
107
107
  },
108
108
  {
109
- id: 'remove',
110
- iconName: 'delete',
111
- title: t('actions.label.remove'),
112
- description: t('actions.label.remove.description'),
109
+ id: "remove",
110
+ iconName: "delete",
111
+ title: t("actions.label.remove"),
112
+ description: t("actions.label.remove.description"),
113
113
  onClick: () => setOpenRemove(true),
114
114
  },
115
115
  ];
116
116
  const visibleActions = actionOptions.filter((action) => !hidden.has(action.id));
117
- return (_jsxs("div", { className: "file-actions-container", children: [_jsx("div", { className: "header", children: _jsx("div", { className: "title", children: t('actions.label.title') }) }), _jsxs("div", { className: "body", children: [visibleActions.map(({ id, iconName, title, description, onClick, buttonClassName }) => (_jsxs("div", { className: "action-line", onClick: onClick, children: [_jsx("div", { className: `action-button${buttonClassName ? ` ${buttonClassName}` : ''}`, children: _jsx(Icon, { name: iconName, size: "medium" }) }), _jsxs("div", { className: "action-desc", children: [_jsx("span", { className: "title", children: title }), _jsx("span", { children: description })] })] }, id))), !hidden.has('inconsistency') && (_jsx(InconsistencyActions, { document: document }))] }), openRemove && (_jsx(DocumentRemove, { document: document, setFilter: setFilter, onClose: () => setOpenRemove(false), useGrid: useGrid, setOpenFile: setOpenFile })), openAutomatic && (_jsx(AutomaticParser, { document: document, onClose: () => setOpenAutomatic(false) })), openRemoveSentences && pageUid && (_jsx(PageRemoveSentences, { pageUid: pageUid, onClose: () => setOpenRemoveSentences(false), onSuccess: () => {
117
+ return (_jsxs("div", { className: "file-actions-container", children: [_jsx("div", { className: "header", children: _jsx("div", { className: "title", children: t("actions.label.title") }) }), _jsxs("div", { className: "body", children: [visibleActions.map(({ id, iconName, title, description, onClick, buttonClassName }) => (_jsxs("div", { className: "action-line", onClick: onClick, children: [_jsx("div", { className: `action-button${buttonClassName ? ` ${buttonClassName}` : ""}`, children: _jsx(Icon, { name: iconName, size: "medium" }) }), _jsxs("div", { className: "action-desc", children: [_jsx("span", { className: "title", children: title }), _jsx("span", { children: description })] })] }, id))), !hidden.has("inconsistency") && (_jsx(InconsistencyActions, { document: document }))] }), openRemove && (_jsx(DocumentRemove, { document: document, setFilter: setFilter, onClose: () => setOpenRemove(false), useGrid: useGrid, setOpenFile: setOpenFile })), openAutomatic && (_jsx(AutomaticParser, { document: document, onClose: () => setOpenAutomatic(false) })), openRemoveSentences && pageUid && (_jsx(PageRemoveSentences, { pageUid: pageUid, onClose: () => setOpenRemoveSentences(false), onSuccess: () => {
118
118
  onPageReload?.();
119
119
  setOpenFile(false);
120
120
  } }))] }));
@@ -1,6 +1,6 @@
1
1
  .file-actions-container {
2
2
  .body {
3
- height: 90vh;
3
+ height: 94vh;
4
4
  overflow-y: auto;
5
5
  }
6
6
  }
@@ -1,8 +1,8 @@
1
- import CatalogSearchFilter from './types/CatalogSearchFilter';
2
- import Category from './types/Category';
3
- import type { DocumentDrawerActionId } from './types/DocumentDrawerActionId';
4
- import { Document } from './deps';
5
- import './style.scss';
1
+ import CatalogSearchFilter from "./types/CatalogSearchFilter";
2
+ import Category from "./types/Category";
3
+ import type { DocumentDrawerActionId } from "./types/DocumentDrawerActionId";
4
+ import { Document } from "./deps";
5
+ import "./style.scss";
6
6
  export type DocumentDrawerProps = {
7
7
  uid: string;
8
8
  setOpenFile: (b: boolean) => void;
@@ -1,32 +1,32 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import documenService from './services/DocumentService';
3
- import { Drawer, Tab, Tabs } from '@mui/material';
4
- import { useEffect, useMemo, useState } from 'react';
5
- import { useTranslation } from 'react-i18next';
6
- import { Participants, useCorpusUtils } from './deps';
7
- import { Icon } from 'tycho-storybook';
8
- import DocumentMetadata from './Metadata/DocumentMetadata';
9
- import Actions from './Actions';
10
- import DocumentExport from './DocumentExport';
11
- import DocumentLexicon from './DocumentLexicon';
12
- import Github from './Github';
13
- import ImageGallery from './ImageGallery';
14
- import Info from './Info';
15
- import Boxes from './Pages/Boxes';
16
- import Pages from './Pages/Pages';
17
- import './style.scss';
2
+ import documenService from "./services/DocumentService";
3
+ import { Drawer, Tab, Tabs } from "@mui/material";
4
+ import { useEffect, useMemo, useState } from "react";
5
+ import { useTranslation } from "react-i18next";
6
+ import { Participants, useCorpusUtils } from "./deps";
7
+ import { Icon } from "tycho-storybook";
8
+ import DocumentMetadata from "./Metadata/DocumentMetadata";
9
+ import Actions from "./Actions";
10
+ import DocumentExport from "./DocumentExport";
11
+ import DocumentLexicon from "./DocumentLexicon";
12
+ import Github from "./Github";
13
+ import ImageGallery from "./ImageGallery";
14
+ import Info from "./Info";
15
+ import Boxes from "./Pages/Boxes";
16
+ import Pages from "./Pages/Pages";
17
+ import "./style.scss";
18
18
  export default function DocumentDrawer({ uid, setOpenFile, setFilter, handleChange, handleClickDocument, useGrid, categoriesHierarchy, pageUid, pageOrder, onPageReload, hiddenActions, }) {
19
- const { t } = useTranslation('document');
19
+ const { t } = useTranslation("document");
20
20
  const { getCorpus, hasParameter } = useCorpusUtils();
21
21
  const [document, setDocument] = useState();
22
- const [activeKey, setActiveKey] = useState('actions');
22
+ const [activeKey, setActiveKey] = useState("actions");
23
23
  const hasParticipants = (document?.participants?.length ?? 0) > 0;
24
24
  const fileItems = useMemo(() => {
25
25
  if (!document)
26
26
  return [];
27
27
  let items = hasParticipants
28
28
  ? baseFileItems
29
- : baseFileItems.filter((item) => item.eventKey !== 'participants');
29
+ : baseFileItems.filter((item) => item.eventKey !== "participants");
30
30
  if (document.github) {
31
31
  items = [...items, githubFileItem];
32
32
  }
@@ -38,7 +38,7 @@ export default function DocumentDrawer({ uid, setOpenFile, setFilter, handleChan
38
38
  const renderPages = () => {
39
39
  if (!document)
40
40
  return null;
41
- if (document.defaultTool && document.defaultTool === 'DESIGN')
41
+ if (document.defaultTool && document.defaultTool === "DESIGN")
42
42
  return (_jsx(Boxes, { document: document, setDocument: setDocument, setOpenFile: setOpenFile, handleChange: handleChange }));
43
43
  return (_jsx(Pages, { document: document, setDocument: setDocument, setOpenFile: setOpenFile, handleChange: handleChange }));
44
44
  };
@@ -48,64 +48,64 @@ export default function DocumentDrawer({ uid, setOpenFile, setFilter, handleChan
48
48
  });
49
49
  }, [uid]);
50
50
  useEffect(() => {
51
- if (!hasParticipants && activeKey === 'participants') {
52
- setActiveKey('actions');
51
+ if (!hasParticipants && activeKey === "participants") {
52
+ setActiveKey("actions");
53
53
  }
54
54
  }, [activeKey, hasParticipants]);
55
55
  if (!document)
56
56
  return null;
57
- return (_jsx(Drawer, { anchor: "left", open: true, onClose: () => setOpenFile(false), className: "offcanvas-file", children: _jsxs("div", { className: "drawer-container", children: [_jsxs("div", { className: "tabs-col", children: [_jsxs("div", { className: "nav-item-close", onClick: () => setOpenFile(false), children: [_jsx("span", { className: "nav-link-icon", children: _jsx(Icon, { name: "arrow_circle_left" }) }), _jsx("span", { className: "title", children: t('menu.label.close') })] }), _jsx(Tabs, { orientation: "vertical", value: activeKey, onChange: handleTabChange, className: "nav", children: fileItems.map((item, idx) => (_jsx(Tab, { value: item.eventKey, label: _jsxs(_Fragment, { children: [_jsx("span", { className: "nav-link-icon", children: _jsx(Icon, { name: item.icon, filled: true }) }), _jsx("span", { className: "title", children: t(item.title) })] }) }, idx.valueOf()))) })] }), _jsxs("div", { className: "info-col", children: [activeKey === 'home' && (_jsx(Info, { document: document, categoriesHierarchy: categoriesHierarchy, handleChange: (updated) => {
57
+ return (_jsx(Drawer, { anchor: "left", open: true, onClose: () => setOpenFile(false), className: "offcanvas-file", children: _jsxs("div", { className: "drawer-container", children: [_jsxs("div", { className: "tabs-col", children: [_jsxs("div", { className: "nav-item-close", onClick: () => setOpenFile(false), children: [_jsx("span", { className: "nav-link-icon", children: _jsx(Icon, { name: "arrow_circle_left" }) }), _jsx("span", { className: "title", children: t("menu.label.close") })] }), _jsx(Tabs, { orientation: "vertical", value: activeKey, onChange: handleTabChange, className: "nav", children: fileItems.map((item, idx) => (_jsx(Tab, { value: item.eventKey, label: _jsxs(_Fragment, { children: [_jsx("span", { className: "nav-link-icon", children: _jsx(Icon, { name: item.icon }) }), _jsx("span", { className: "title", children: t(item.title) })] }) }, idx.valueOf()))) })] }), _jsxs("div", { className: "info-col", children: [activeKey === "home" && (_jsx(Info, { document: document, categoriesHierarchy: categoriesHierarchy, handleChange: (updated) => {
58
58
  handleChange(updated);
59
59
  setDocument(updated);
60
- } })), activeKey === 'metadata' && (_jsx(DocumentMetadata, { document: document, onDocumentChange: (updated) => {
60
+ } })), activeKey === "metadata" && (_jsx(DocumentMetadata, { document: document, onDocumentChange: (updated) => {
61
61
  handleChange(updated);
62
62
  setDocument(updated);
63
- } })), activeKey === 'lexicon' && _jsx(DocumentLexicon, { document: document }), activeKey === 'export' && _jsx(DocumentExport, { doc: document }), activeKey === 'actions' && (_jsx(Actions, { document: document, setOpenFile: setOpenFile, setFilter: setFilter, handleClickDocument: handleClickDocument, useGrid: useGrid, pageUid: pageUid, pageOrder: pageOrder, onPageReload: onPageReload, hiddenActions: hiddenActions })), activeKey === 'pages' && renderPages(), activeKey === 'gallery' && (_jsx(ImageGallery, { document: document, setDocument: setDocument, handleChange: handleChange })), activeKey === 'participants' && (_jsx(Participants, { document: document.uid, participants: document.participants || [], onChange: (r) => setDocument({ ...document, participants: r }), useChat: hasParameter(getCorpus(), 'useParticipantChat') })), activeKey === 'github' && (_jsx(Github, { document: document, setOpenFile: setOpenFile }))] })] }) }));
63
+ } })), activeKey === "lexicon" && _jsx(DocumentLexicon, { document: document }), activeKey === "export" && _jsx(DocumentExport, { doc: document }), activeKey === "actions" && (_jsx(Actions, { document: document, setOpenFile: setOpenFile, setFilter: setFilter, handleClickDocument: handleClickDocument, useGrid: useGrid, pageUid: pageUid, pageOrder: pageOrder, onPageReload: onPageReload, hiddenActions: hiddenActions })), activeKey === "pages" && renderPages(), activeKey === "gallery" && (_jsx(ImageGallery, { document: document, setDocument: setDocument, handleChange: handleChange })), activeKey === "participants" && (_jsx(Participants, { document: document.uid, participants: document.participants || [], onChange: (r) => setDocument({ ...document, participants: r }), useChat: hasParameter(getCorpus(), "useParticipantChat") })), activeKey === "github" && (_jsx(Github, { document: document, setOpenFile: setOpenFile }))] })] }) }));
64
64
  }
65
65
  const baseFileItems = [
66
66
  {
67
- eventKey: 'actions',
68
- icon: 'manufacturing',
69
- title: 'menu.label.actions',
67
+ eventKey: "actions",
68
+ icon: "manufacturing",
69
+ title: "menu.label.actions",
70
70
  },
71
71
  {
72
- eventKey: 'home',
73
- icon: 'home',
74
- title: 'menu.label.home',
72
+ eventKey: "home",
73
+ icon: "info",
74
+ title: "menu.label.home",
75
75
  },
76
76
  {
77
- eventKey: 'pages',
78
- icon: 'article',
79
- title: 'menu.label.pages',
77
+ eventKey: "pages",
78
+ icon: "article",
79
+ title: "menu.label.pages",
80
80
  },
81
81
  {
82
- eventKey: 'gallery',
83
- icon: 'photo_library',
84
- title: 'menu.label.images',
82
+ eventKey: "gallery",
83
+ icon: "photo_library",
84
+ title: "menu.label.images",
85
85
  },
86
86
  {
87
- eventKey: 'metadata',
88
- icon: 'bookmark',
89
- title: 'menu.label.metadata',
87
+ eventKey: "metadata",
88
+ icon: "bookmark",
89
+ title: "menu.label.metadata",
90
90
  },
91
91
  {
92
- eventKey: 'lexicon',
93
- icon: 'sort_by_alpha',
94
- title: 'menu.label.lexicon',
92
+ eventKey: "lexicon",
93
+ icon: "sort_by_alpha",
94
+ title: "menu.label.lexicon",
95
95
  },
96
96
  {
97
- eventKey: 'export',
98
- icon: 'file_export',
99
- title: 'menu.label.export',
97
+ eventKey: "export",
98
+ icon: "file_export",
99
+ title: "menu.label.export",
100
100
  },
101
101
  {
102
- eventKey: 'participants',
103
- icon: 'group',
104
- title: 'menu.label.participants',
102
+ eventKey: "participants",
103
+ icon: "group",
104
+ title: "menu.label.participants",
105
105
  },
106
106
  ];
107
107
  const githubFileItem = {
108
- eventKey: 'github',
109
- icon: 'code',
110
- title: 'menu.label.github',
108
+ eventKey: "github",
109
+ icon: "code",
110
+ title: "menu.label.github",
111
111
  };
@@ -1,26 +1,28 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import FileUtils from '../functions/FileUtils';
3
3
  import outputService from '../services/ExportService';
4
- import { EXPORT_TYPE_DISPLAY } from '../types/Export';
4
+ import { EXPORT_TYPE_DISPLAY, } from '../types/Export';
5
5
  import { saveAs } from 'file-saver';
6
6
  import { useState } from 'react';
7
7
  import { useTranslation } from 'react-i18next';
8
8
  import { useMessageUtils } from '../deps';
9
9
  import { Icon } from 'tycho-storybook';
10
10
  import ExportInvalidSentences from './ExportInvalidSentences';
11
+ import ExportTxtTierModal from './ExportTxtTierModal';
11
12
  import './style.scss';
12
13
  const timingCheck = 5000;
13
14
  export default function DocumentExport({ doc }) {
14
15
  const { t } = useTranslation('export');
15
16
  const { dispatchLoading, dispatchError, dispatchMessage, isLoading } = useMessageUtils();
16
17
  const [invalidSentences, setInvalidSentences] = useState();
18
+ const [openTxtTierModal, setOpenTxtTierModal] = useState(false);
17
19
  let intervalCheck = null;
18
- const process = (thisType) => {
20
+ const process = (thisType, tier) => {
19
21
  if (isLoading())
20
22
  return;
21
23
  dispatchLoading(true);
22
24
  outputService
23
- .execute(doc.uid, thisType)
25
+ .execute(doc.uid, thisType, tier)
24
26
  .then((r) => {
25
27
  intervalCheck = setInterval(() => check(r.data), timingCheck);
26
28
  })
@@ -55,6 +57,16 @@ export default function DocumentExport({ doc }) {
55
57
  handleError(err);
56
58
  });
57
59
  };
60
+ const handleExportClick = (type) => {
61
+ if (type === 'TXT') {
62
+ setOpenTxtTierModal(true);
63
+ return;
64
+ }
65
+ process(type);
66
+ };
67
+ const handleTxtTierSelect = (tier) => {
68
+ process('TXT', tier);
69
+ };
58
70
  const handleError = (err) => {
59
71
  const message = err.response.data.message || err.response.data.error;
60
72
  if (message === 'psd.invalid.sentences') {
@@ -67,5 +79,5 @@ export default function DocumentExport({ doc }) {
67
79
  });
68
80
  }
69
81
  };
70
- return (_jsxs("div", { className: "document-export-container", children: [_jsx("div", { className: "header", children: _jsx("div", { className: "title", children: t('export.label.title') }) }), _jsx("div", { className: "body", children: EXPORT_TYPE_DISPLAY.filter((t) => t.active).map((item) => (_jsxs("div", { className: "action-line", onClick: () => process(item.type), children: [_jsx("div", { className: "action-button", children: _jsx(Icon, { name: item.icon, size: "medium" }) }), _jsxs("div", { className: "action-desc", children: [_jsx("span", { className: "title", children: t(`export.label.${item.type.toLowerCase()}`) }), _jsx("span", { children: t(`export.desc.${item.type.toLowerCase()}`) })] })] }, item.icon))) }), invalidSentences && invalidSentences.length > 0 && (_jsx(ExportInvalidSentences, { sentences: invalidSentences, onClose: () => setInvalidSentences([]) }))] }));
82
+ return (_jsxs("div", { className: "document-export-container", children: [_jsx("div", { className: "header", children: _jsx("div", { className: "title", children: t('export.label.title') }) }), _jsx("div", { className: "body", children: EXPORT_TYPE_DISPLAY.filter((t) => t.active).map((item) => (_jsxs("div", { className: "action-line", onClick: () => handleExportClick(item.type), children: [_jsx("div", { className: "action-button", children: _jsx(Icon, { name: item.icon, size: "medium" }) }), _jsxs("div", { className: "action-desc", children: [_jsx("span", { className: "title", children: t(`export.label.${item.type.toLowerCase()}`) }), _jsx("span", { children: t(`export.desc.${item.type.toLowerCase()}`) })] })] }, item.icon))) }), openTxtTierModal && (_jsx(ExportTxtTierModal, { onClose: () => setOpenTxtTierModal(false), onSelect: handleTxtTierSelect })), invalidSentences && invalidSentences.length > 0 && (_jsx(ExportInvalidSentences, { sentences: invalidSentences, onClose: () => setInvalidSentences([]) }))] }));
71
83
  }
@@ -0,0 +1,8 @@
1
+ import { TxtExportTier } from '../types/Export';
2
+ import './style.scss';
3
+ type Props = {
4
+ onClose: () => void;
5
+ onSelect: (tier: TxtExportTier) => void;
6
+ };
7
+ export default function ExportTxtTierModal({ onClose, onSelect }: Props): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { TXT_EXPORT_TIER_OPTIONS } from '../types/Export';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { AppModal } from '../deps';
5
+ import { Button } from 'tycho-storybook';
6
+ import './style.scss';
7
+ export default function ExportTxtTierModal({ onClose, onSelect }) {
8
+ const { t } = useTranslation('export');
9
+ const handleSelect = (tier) => {
10
+ onSelect(tier);
11
+ onClose();
12
+ };
13
+ return (_jsxs(AppModal, { title: t('modal.title.txt.tier'), close: onClose, className: "modal-txt-tier", hideFooter: true, children: [_jsx("div", { className: "description", children: t('modal.desc.txt.tier') }), _jsx("div", { className: "tier-options", children: TXT_EXPORT_TIER_OPTIONS.map(({ tier, labelKey }) => (_jsx(Button, { text: t(labelKey), mode: "outlined", size: "medium", onClick: () => handleSelect(tier) }, tier))) })] }));
14
+ }
@@ -5,6 +5,24 @@
5
5
  }
6
6
  }
7
7
 
8
+ .modal-txt-tier {
9
+ .body {
10
+ display: flex;
11
+ flex-direction: column;
12
+ gap: 32px;
13
+
14
+ .description {
15
+ margin: 0 auto;
16
+ }
17
+
18
+ .tier-options {
19
+ display: flex;
20
+ gap: var(--spacing-200);
21
+ justify-content: center;
22
+ }
23
+ }
24
+ }
25
+
8
26
  .modal-invalid-sentences {
9
27
  .body {
10
28
  display: flex;
@@ -5,7 +5,7 @@ export const ActionsTexts = {
5
5
  'button.label.filter': 'Filter',
6
6
  'tooltip.label.list': 'Display as list',
7
7
  'tooltip.label.grid': 'Display as grid',
8
- 'label.automatic.title': 'Automatic Parsing',
8
+ 'label.automatic.title': 'Automatic parsing',
9
9
  'label.automatic.description': 'Automatically parse all sentences.',
10
10
  'label.sync.title': 'Synchronize document search',
11
11
  'label.sync.description': 'Mark this document to be synchronized again by the search service.',
@@ -16,10 +16,10 @@ export const ActionsTexts = {
16
16
  'actions.label.remove.description': 'Attention! This process is irreversible.',
17
17
  'label.resume.title': 'Resume syntactic annotation',
18
18
  'label.resume.description': 'Continue from the last reviewed sentence.',
19
- 'label.syntactic.title': 'Review Sentences',
19
+ 'label.syntactic.title': 'Review sentences',
20
20
  'label.syntactic.description': 'Review and validate syntactic annotations for sentences.',
21
- 'label.documents.title': 'Back to documents',
22
- 'label.documents.description': 'Return to the list of documents',
21
+ 'label.documents.title': 'Back to the catalog',
22
+ 'label.documents.description': 'Return to the list of documents.',
23
23
  'label.transcription.title': 'Go back to transcription',
24
24
  'label.transcription.description': 'Return page {{pageNumber}} to transcription mode. This action applies only to the current page.',
25
25
  'modal.description.sentences.remove': 'Are you sure you want to go back to transcription for this page? This will delete all sentences already edited?',
@@ -36,7 +36,7 @@ export const ActionsTexts = {
36
36
  'button.label.filter': 'Filtrar',
37
37
  'tooltip.label.list': 'Mostrar como lista',
38
38
  'tooltip.label.grid': 'Mostrar como grid',
39
- 'label.automatic.title': 'Parser Automático',
39
+ 'label.automatic.title': 'Parser automático',
40
40
  'label.automatic.description': 'Execute o parser automaticamente para todas as sentenças.',
41
41
  'label.sync.title': 'Sincronizar busca do documento',
42
42
  'label.sync.description': 'Marcar este documento para ser sincronizado novamente no serviço de busca.',
@@ -50,8 +50,8 @@ export const ActionsTexts = {
50
50
  'label.resume.description': 'Continue a partir da última sentença revisada.',
51
51
  'label.syntactic.title': 'Revisar sentenças',
52
52
  'label.syntactic.description': 'Revise e valide as anotações sintáticas das sentenças.',
53
- 'label.documents.title': 'Voltar aos Documentos',
54
- 'label.documents.description': 'Voltar à lista de documentos',
53
+ 'label.documents.title': 'Voltar ao catálogo',
54
+ 'label.documents.description': 'Voltar à lista de documentos.',
55
55
  'label.transcription.title': 'Voltar para a transcrição',
56
56
  'label.transcription.description': 'Voltar a página {{pageNumber}} para o modo de transcrição. Esta ação se aplica apenas à página atual.',
57
57
  'modal.description.sentences.remove': 'Você tem certeza que deseja voltar para a transcrição para esta página? Isso vai excluir todas as sentenças já editadas?',
@@ -67,8 +67,8 @@ export const ActionsTexts = {
67
67
  'button.label.filter': 'Filtra',
68
68
  'tooltip.label.list': 'Mostra come elenco',
69
69
  'tooltip.label.grid': 'Mostra come griglia',
70
- 'label.automatic.title': 'Analisi automatica',
71
- 'label.automatic.description': 'Analizza automaticamente tutte le frasi.',
70
+ 'label.automatic.title': 'Parser automatico',
71
+ 'label.automatic.description': 'Esegue il parser automaticamente per tutte le frasi.',
72
72
  'label.sync.title': 'Sincronizza ricerca documento',
73
73
  'label.sync.description': 'Segna questo documento per essere sincronizzato di nuovo dal servizio di ricerca.',
74
74
  'actions.label.title': 'Azioni',
@@ -80,8 +80,8 @@ export const ActionsTexts = {
80
80
  'label.resume.description': "Continua dall'ultima frase revisionata.",
81
81
  'label.syntactic.title': 'Revisiona frasi',
82
82
  'label.syntactic.description': 'Revisiona e convalida le annotazioni sintattiche delle frasi.',
83
- 'label.documents.title': 'Torna ai documenti',
84
- 'label.documents.description': 'Ritorna all\'elenco dei documenti',
83
+ 'label.documents.title': 'Torna al catalogo',
84
+ 'label.documents.description': "Ritorna all'elenco dei documenti.",
85
85
  'label.transcription.title': 'Torna alla trascrizione',
86
86
  'label.transcription.description': 'Ripristina la pagina {{pageNumber}} in modalità trascrizione. Questa azione si applica solo alla pagina corrente.',
87
87
  'modal.description.sentences.remove': 'Sei sicuro di voler tornare alla trascrizione per questa pagina? Verranno eliminate tutte le frasi già modificate.',
@@ -90,6 +90,6 @@ export const ActionsTexts = {
90
90
  'label.edition.description': 'Continua a modificare il contenuto del documento.',
91
91
  'modal.remove.title': 'Rimuovi documento',
92
92
  'modal.title.design': 'Cambia strumento di modifica',
93
- 'modal.description.design': 'Stai per cambiare lo strumento di modifica predefinito di questo documento da Design a un altro strumento. <bold>Attenzione! Le marcature sull\'immagine andranno perse. Una volta confermato, questa modifica non potrà essere annullata.</bold>',
93
+ 'modal.description.design': "Stai per cambiare lo strumento di modifica predefinito di questo documento da Design a un altro strumento. <bold>Attenzione! Le marcature sull'immagine andranno perse. Una volta confermato, questa modifica non potrà essere annullata.</bold>",
94
94
  },
95
95
  };
@@ -11,6 +11,13 @@ export declare const ExportTexts: {
11
11
  'export.desc.csv': string;
12
12
  'export.label.text': string;
13
13
  'export.desc.text': string;
14
+ 'export.label.txt': string;
15
+ 'export.desc.txt': string;
16
+ 'modal.title.txt.tier': string;
17
+ 'modal.desc.txt.tier': string;
18
+ 'modal.txt.tier.diplomatic': string;
19
+ 'modal.txt.tier.semiDiplomatic': string;
20
+ 'modal.txt.tier.modernized': string;
14
21
  'export.label.chat': string;
15
22
  'export.desc.chat': string;
16
23
  'export.label.conllu': string;
@@ -30,6 +37,13 @@ export declare const ExportTexts: {
30
37
  'export.desc.csv': string;
31
38
  'export.label.text': string;
32
39
  'export.desc.text': string;
40
+ 'export.label.txt': string;
41
+ 'export.desc.txt': string;
42
+ 'modal.title.txt.tier': string;
43
+ 'modal.desc.txt.tier': string;
44
+ 'modal.txt.tier.diplomatic': string;
45
+ 'modal.txt.tier.semiDiplomatic': string;
46
+ 'modal.txt.tier.modernized': string;
33
47
  'export.label.chat': string;
34
48
  'export.desc.chat': string;
35
49
  'export.label.conllu': string;
@@ -49,6 +63,13 @@ export declare const ExportTexts: {
49
63
  'export.desc.csv': string;
50
64
  'export.label.text': string;
51
65
  'export.desc.text': string;
66
+ 'export.label.txt': string;
67
+ 'export.desc.txt': string;
68
+ 'modal.title.txt.tier': string;
69
+ 'modal.desc.txt.tier': string;
70
+ 'modal.txt.tier.diplomatic': string;
71
+ 'modal.txt.tier.semiDiplomatic': string;
72
+ 'modal.txt.tier.modernized': string;
52
73
  'export.label.chat': string;
53
74
  'export.desc.chat': string;
54
75
  'export.label.conllu': string;
@@ -11,6 +11,13 @@ export const ExportTexts = {
11
11
  'export.desc.csv': 'Generates a text file with comma separated values (CSV), ready to be imported to Microsoft Excel.',
12
12
  'export.label.text': 'Text file',
13
13
  'export.desc.text': 'Text file',
14
+ 'export.label.txt': 'Text file',
15
+ 'export.desc.txt': 'Generates a plain text file with the document sentences at the chosen transcription layer.',
16
+ 'modal.title.txt.tier': 'Choose export type',
17
+ 'modal.desc.txt.tier': 'Select which transcription layer to use for the text export.',
18
+ 'modal.txt.tier.diplomatic': 'Diplomatic',
19
+ 'modal.txt.tier.semiDiplomatic': 'Semi-diplomatic',
20
+ 'modal.txt.tier.modernized': 'Modernized',
14
21
  'export.label.chat': 'CHAT file',
15
22
  'export.desc.chat': 'CHAT file',
16
23
  'export.label.conllu': 'CoNNL-U file',
@@ -30,6 +37,13 @@ export const ExportTexts = {
30
37
  'export.desc.csv': 'Gera um arquivo de texto com valores separados por vírgula (CSV), pronto para ser importado para o Microsoft Excel.',
31
38
  'export.label.text': 'Arquivo de texto',
32
39
  'export.desc.text': 'Arquivo de texto',
40
+ 'export.label.txt': 'Arquivo de texto',
41
+ 'export.desc.txt': 'Gera um arquivo de texto simples com as sentenças do documento na camada de transcrição escolhida.',
42
+ 'modal.title.txt.tier': 'Escolha o tipo de exportação',
43
+ 'modal.desc.txt.tier': 'Selecione qual camada de transcrição usar na exportação de texto.',
44
+ 'modal.txt.tier.diplomatic': 'Diplomática',
45
+ 'modal.txt.tier.semiDiplomatic': 'Semidiplomática',
46
+ 'modal.txt.tier.modernized': 'Modernizada',
33
47
  'export.label.chat': 'Arquivo CHAT',
34
48
  'export.desc.chat': 'Arquivo CHAT',
35
49
  'export.label.conllu': 'Arquivo CoNNL-U',
@@ -49,6 +63,13 @@ export const ExportTexts = {
49
63
  'export.desc.csv': 'Genera un file di testo con valori separati da virgola (CSV), pronto per essere importato in Microsoft Excel.',
50
64
  'export.label.text': 'File di testo',
51
65
  'export.desc.text': 'File di testo',
66
+ 'export.label.txt': 'File di testo',
67
+ 'export.desc.txt': 'Genera un file di testo semplice con le frasi del documento al livello di trascrizione scelto.',
68
+ 'modal.title.txt.tier': 'Scegli il tipo di esportazione',
69
+ 'modal.desc.txt.tier': 'Seleziona quale livello di trascrizione usare per l\'esportazione del testo.',
70
+ 'modal.txt.tier.diplomatic': 'Diplomatica',
71
+ 'modal.txt.tier.semiDiplomatic': 'Semidiplomatica',
72
+ 'modal.txt.tier.modernized': 'Modernizzata',
52
73
  'export.label.chat': 'File CHAT',
53
74
  'export.desc.chat': 'File CHAT',
54
75
  'export.label.conllu': 'File CoNLL-U',
@@ -1,7 +1,7 @@
1
1
  import { ExportType } from '../types/Export';
2
2
  import Export from '../types/Export';
3
- declare function executeForGithub(uid: string, type: ExportType): Promise<import("axios").AxiosResponse<string, any, {}>>;
4
- declare function execute(uid: string, type: ExportType): Promise<import("axios").AxiosResponse<string, any, {}>>;
3
+ declare function executeForGithub(uid: string, type: ExportType, tier?: string): Promise<import("axios").AxiosResponse<string, any, {}>>;
4
+ declare function execute(uid: string, type: ExportType, tier?: string): Promise<import("axios").AxiosResponse<string, any, {}>>;
5
5
  declare function check(uid: string): Promise<import("axios").AxiosResponse<Export, any, {}>>;
6
6
  declare const ExportService: {
7
7
  executeForGithub: typeof executeForGithub;
@@ -1,9 +1,15 @@
1
1
  import api from '../../../configs/api';
2
- function executeForGithub(uid, type) {
3
- return api.get(`${import.meta.env.VITE_APP_IO_API}/export/github/${uid}/${type}`);
2
+ function buildExportUrl(base, uid, type, tier) {
3
+ const url = `${base}/${uid}/${type}`;
4
+ if (!tier)
5
+ return url;
6
+ return `${url}?tier=${encodeURIComponent(tier)}`;
4
7
  }
5
- function execute(uid, type) {
6
- return api.get(`${import.meta.env.VITE_APP_IO_API}/export/${uid}/${type}`);
8
+ function executeForGithub(uid, type, tier) {
9
+ return api.get(buildExportUrl(`${import.meta.env.VITE_APP_IO_API}/export/github`, uid, type, tier));
10
+ }
11
+ function execute(uid, type, tier) {
12
+ return api.get(buildExportUrl(`${import.meta.env.VITE_APP_IO_API}/export`, uid, type, tier));
7
13
  }
8
14
  function check(uid) {
9
15
  return api.get(`${import.meta.env.VITE_APP_IO_API}/export/check/${uid}`);
@@ -22,4 +22,9 @@ type ExportTypeItem = {
22
22
  active: boolean;
23
23
  };
24
24
  export declare const EXPORT_TYPE_DISPLAY: ExportTypeItem[];
25
+ export type TxtExportTier = 'ORIGINAL' | 'ILLEGIBLE' | 'INFLECTION';
26
+ export declare const TXT_EXPORT_TIER_OPTIONS: {
27
+ tier: TxtExportTier;
28
+ labelKey: string;
29
+ }[];
25
30
  export default Export;
@@ -33,4 +33,14 @@ export const EXPORT_TYPE_DISPLAY = [
33
33
  icon: 'format_list_bulleted',
34
34
  active: true,
35
35
  },
36
+ {
37
+ type: 'TXT',
38
+ icon: 'description',
39
+ active: true,
40
+ },
41
+ ];
42
+ export const TXT_EXPORT_TIER_OPTIONS = [
43
+ { tier: 'ORIGINAL', labelKey: 'modal.txt.tier.diplomatic' },
44
+ { tier: 'ILLEGIBLE', labelKey: 'modal.txt.tier.semiDiplomatic' },
45
+ { tier: 'INFLECTION', labelKey: 'modal.txt.tier.modernized' },
36
46
  ];
@@ -1,5 +1,5 @@
1
- import { HelpAction } from "./HelpButton";
2
- import "./style.scss";
1
+ import { HelpAction } from './HelpButton';
2
+ import './style.scss';
3
3
  type Props = {
4
4
  onClose: () => void;
5
5
  helpActions?: HelpAction[];
@@ -1,18 +1,18 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useTranslation } from "react-i18next";
3
- import { Button } from "tycho-storybook";
4
- import AppModal from "../../../common/AppModal/AppModal";
5
- import Storage from "../../../configs/Storage";
6
- import { useTourUtils } from "../../../configs/useTourUtils";
7
- import "./style.scss";
2
+ import { useTranslation } from 'react-i18next';
3
+ import { Button } from 'tycho-storybook';
4
+ import AppModal from '../../../common/AppModal/AppModal';
5
+ import Storage from '../../../configs/Storage';
6
+ import { useTourUtils } from '../../../configs/useTourUtils';
7
+ import './style.scss';
8
8
  export default function HelpModal({ onClose, helpActions = [] }) {
9
- const { t } = useTranslation("help");
9
+ const { t } = useTranslation('help');
10
10
  const { turnOn, turnOff, status } = useTourUtils();
11
11
  const isTourActive = status();
12
12
  const isAutoOpenEnabled = Storage.getTourAutoOpen();
13
13
  const handleTutorials = () => {
14
- const origin = (import.meta.env.VITE_APP_ORIGIN ?? "").replace(/\/+$/, "");
15
- window.open(`${origin}/home/tutorials`, "_blank");
14
+ const origin = (import.meta.env.VITE_APP_ORIGIN ?? '').replace(/\/+$/, '');
15
+ window.open(`${origin}/home/tutorials`, '_blank');
16
16
  onClose();
17
17
  };
18
18
  const handleTourToggle = () => {
@@ -31,5 +31,5 @@ export default function HelpModal({ onClose, helpActions = [] }) {
31
31
  const handleAutoOpenToggle = (event) => {
32
32
  Storage.setTourAutoOpen(event.target.checked);
33
33
  };
34
- return (_jsxs(AppModal, { title: t("modal.title") || "Help Center", close: onClose, hideFooter: true, className: "help-modal", children: [_jsxs("div", { className: "item", children: [_jsx("div", { className: "title", children: t("title.tutorials") }), _jsx("div", { className: "desc", children: t("description.tutorials") }), _jsx(Button, { text: t("button.open", { title: t("title.tutorials") }), size: "small", mode: "outlined", icon: "keyboard_arrow_right", onClick: handleTutorials })] }), _jsxs("div", { className: "item", children: [_jsx("div", { className: "title", children: t("title.tour") }), _jsx("div", { className: "desc", children: t("description.tour") }), _jsxs("label", { className: "help-checkbox-label", children: [_jsx("input", { type: "checkbox", checked: isAutoOpenEnabled, onChange: handleAutoOpenToggle, className: "help-checkbox" }), _jsx("span", { children: t("checkbox.autoOpen") })] }), _jsx(Button, { text: t("button.open", { title: t("title.tour") }), size: "small", mode: "outlined", icon: "keyboard_arrow_right", onClick: handleTourToggle })] }), helpActions.map((item, idx) => (_jsxs("div", { className: "item", children: [_jsx("div", { className: "title", children: item.title }), _jsx("div", { className: "desc", children: item.desc }), _jsx(Button, { text: t("button.open", { title: item.title }), size: "small", mode: "outlined", icon: "keyboard_arrow_right", onClick: () => handleCustomAction(item) })] }, idx)))] }));
34
+ return (_jsxs(AppModal, { title: t('modal.title'), close: onClose, hideFooter: true, className: "help-modal", children: [_jsxs("div", { className: "item", children: [_jsx("div", { className: "title", children: t('title.tutorials') }), _jsx("div", { className: "desc", children: t('description.tutorials') }), _jsx(Button, { text: t('button.open', { title: t('title.tutorials') }), size: "small", mode: "outlined", icon: "keyboard_arrow_right", onClick: handleTutorials })] }), _jsxs("div", { className: "item", children: [_jsx("div", { className: "title", children: t('title.tour') }), _jsx("div", { className: "desc", children: t('description.tour') }), _jsxs("label", { className: "help-checkbox-label", children: [_jsx("input", { type: "checkbox", checked: isAutoOpenEnabled, onChange: handleAutoOpenToggle, className: "help-checkbox" }), _jsx("span", { children: t('checkbox.autoOpen') })] }), _jsx(Button, { text: t('button.open', { title: t('title.tour') }), size: "small", mode: "outlined", icon: "keyboard_arrow_right", onClick: handleTourToggle })] }), helpActions.map((item, idx) => (_jsxs("div", { className: "item", children: [_jsx("div", { className: "title", children: item.title }), _jsx("div", { className: "desc", children: item.desc }), _jsx(Button, { text: t('button.open', { title: item.title }), size: "small", mode: "outlined", icon: "keyboard_arrow_right", onClick: () => handleCustomAction(item) })] }, idx)))] }));
35
35
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tycho-components",
3
3
  "private": false,
4
- "version": "0.22.4",
4
+ "version": "0.22.6",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {