tycho-components 0.24.0 → 0.24.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5,6 +5,7 @@ export declare const HelpTexts: {
|
|
|
5
5
|
'title.tour': string;
|
|
6
6
|
'title.autoOpen': string;
|
|
7
7
|
'button.tour': string;
|
|
8
|
+
'button.updateLiveTourPreference': string;
|
|
8
9
|
'description.tutorials': string;
|
|
9
10
|
'description.tour': string;
|
|
10
11
|
'checkbox.autoOpen': string;
|
|
@@ -16,6 +17,7 @@ export declare const HelpTexts: {
|
|
|
16
17
|
'title.tour': string;
|
|
17
18
|
'title.autoOpen': string;
|
|
18
19
|
'button.tour': string;
|
|
20
|
+
'button.updateLiveTourPreference': string;
|
|
19
21
|
'description.tutorials': string;
|
|
20
22
|
'description.tour': string;
|
|
21
23
|
'checkbox.autoOpen': string;
|
|
@@ -25,6 +27,7 @@ export declare const HelpTexts: {
|
|
|
25
27
|
'modal.title': string;
|
|
26
28
|
'title.tutorials': string;
|
|
27
29
|
'button.tour': string;
|
|
30
|
+
'button.updateLiveTourPreference': string;
|
|
28
31
|
'title.tour': string;
|
|
29
32
|
'title.autoOpen': string;
|
|
30
33
|
'description.tutorials': string;
|
|
@@ -5,6 +5,7 @@ export const HelpTexts = {
|
|
|
5
5
|
'title.tour': 'Live Tour',
|
|
6
6
|
'title.autoOpen': 'Enable Auto-Open',
|
|
7
7
|
'button.tour': 'Start Live Tour',
|
|
8
|
+
'button.updateLiveTourPreference': 'Update your live tour preference',
|
|
8
9
|
'description.tutorials': 'Access our comprehensive tutorials and documentation',
|
|
9
10
|
'description.tour': 'Start an interactive tour of the platform or enable it to open automatically',
|
|
10
11
|
'checkbox.autoOpen': 'Enable Auto-Open',
|
|
@@ -16,6 +17,7 @@ export const HelpTexts = {
|
|
|
16
17
|
'title.tour': 'Tour ao Vivo',
|
|
17
18
|
'title.autoOpen': 'Ativar Abertura Automática',
|
|
18
19
|
'button.tour': 'Iniciar Tour ao Vivo',
|
|
20
|
+
'button.updateLiveTourPreference': 'Atualizar sua preferência de tour ao vivo',
|
|
19
21
|
'description.tutorials': 'Acesse nossos tutoriais abrangentes e documentação',
|
|
20
22
|
'description.tour': 'Inicie um tour interativo da plataforma ou ative para abrir automaticamente',
|
|
21
23
|
'checkbox.autoOpen': 'Ativar Abertura Automática',
|
|
@@ -25,6 +27,7 @@ export const HelpTexts = {
|
|
|
25
27
|
'modal.title': 'Centro Assistenza',
|
|
26
28
|
'title.tutorials': 'Tutorial',
|
|
27
29
|
'button.tour': 'Avvia Tour Interattivo',
|
|
30
|
+
'button.updateLiveTourPreference': 'Aggiorna la preferenza del tour interattivo',
|
|
28
31
|
'title.tour': 'Tour Interattivo',
|
|
29
32
|
'title.autoOpen': 'Abilita Apertura Automatica',
|
|
30
33
|
'description.tutorials': 'Accedi ai nostri tutorial completi e alla documentazione',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Corpus } from
|
|
2
|
-
export type PlatformTools =
|
|
1
|
+
import { Corpus } from "../configs/types/Corpus";
|
|
2
|
+
export type PlatformTools = "EDICTOR" | "TRANSLATION" | "DESIGN" | "TRANSCRIBER" | "SYNTREES";
|
|
3
3
|
export type OpenDocumentParams = {
|
|
4
4
|
page: string;
|
|
5
5
|
corpus: Corpus | undefined;
|
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
export const EDITION_TOOLS = [
|
|
2
2
|
{
|
|
3
|
-
parameter:
|
|
4
|
-
name:
|
|
5
|
-
action:
|
|
6
|
-
title:
|
|
7
|
-
icon:
|
|
8
|
-
path:
|
|
3
|
+
parameter: "useEdictor",
|
|
4
|
+
name: "EDICTOR",
|
|
5
|
+
action: "actions:actions.label.edictor",
|
|
6
|
+
title: "actions:actions.name.edictor",
|
|
7
|
+
icon: "edit_square",
|
|
8
|
+
path: "/editor",
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
|
-
parameter:
|
|
12
|
-
name:
|
|
13
|
-
action:
|
|
14
|
-
title:
|
|
15
|
-
icon:
|
|
16
|
-
path:
|
|
11
|
+
parameter: "useTranslations",
|
|
12
|
+
name: "TRANSLATION",
|
|
13
|
+
action: "actions:actions.label.translations",
|
|
14
|
+
title: "actions:actions.name.translations",
|
|
15
|
+
icon: "language_japanese_kana",
|
|
16
|
+
path: "/translation",
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
|
-
parameter:
|
|
20
|
-
name:
|
|
21
|
-
action:
|
|
22
|
-
title:
|
|
23
|
-
icon:
|
|
24
|
-
path:
|
|
19
|
+
parameter: "useDesigner",
|
|
20
|
+
name: "DESIGN",
|
|
21
|
+
action: "actions:actions.label.design",
|
|
22
|
+
title: "actions:actions.name.design",
|
|
23
|
+
icon: "design_services",
|
|
24
|
+
path: "/editor/box",
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
|
-
parameter:
|
|
28
|
-
name:
|
|
29
|
-
action:
|
|
30
|
-
title:
|
|
31
|
-
icon:
|
|
32
|
-
path:
|
|
27
|
+
parameter: "useTranscriber",
|
|
28
|
+
name: "TRANSCRIBER",
|
|
29
|
+
action: "actions:actions.label.transcriber",
|
|
30
|
+
title: "actions:actions.name.transcriber",
|
|
31
|
+
icon: "music_cast",
|
|
32
|
+
path: "/transcriber",
|
|
33
33
|
},
|
|
34
34
|
];
|
|
35
35
|
const getTitle = (defaultTool) => {
|
|
36
|
-
const tool = defaultTool ||
|
|
36
|
+
const tool = defaultTool || "EDICTOR";
|
|
37
37
|
return EDITION_TOOLS.filter((t) => t.name === tool)[0].title;
|
|
38
38
|
};
|
|
39
39
|
const getIcon = (defaultTool) => {
|
|
40
|
-
const tool = defaultTool ||
|
|
40
|
+
const tool = defaultTool || "EDICTOR";
|
|
41
41
|
return EDITION_TOOLS.filter((t) => t.name === tool)[0].icon;
|
|
42
42
|
};
|
|
43
43
|
const withCtxPath = (absolutePath, ctxPath) => {
|
|
44
44
|
if (!ctxPath)
|
|
45
45
|
return absolutePath;
|
|
46
|
-
const base = ctxPath.endsWith(
|
|
47
|
-
const path = absolutePath.startsWith(
|
|
46
|
+
const base = ctxPath.endsWith("/") ? ctxPath.slice(0, -1) : ctxPath;
|
|
47
|
+
const path = absolutePath.startsWith("/") ? absolutePath : `/${absolutePath}`;
|
|
48
48
|
return `${base}${path}`;
|
|
49
49
|
};
|
|
50
50
|
const navigateTo = (path, ctxPath, sameWindow) => {
|
|
@@ -68,21 +68,21 @@ const openDesign = (uid, ctxPath, sameWindow) => {
|
|
|
68
68
|
navigateTo(`/editor/box/${uid}`, ctxPath, sameWindow);
|
|
69
69
|
};
|
|
70
70
|
const getDocumentUrl = ({ page, corpus, hasParameter, defaultTool, ctxPath, }) => {
|
|
71
|
-
if (!corpus)
|
|
72
|
-
return undefined;
|
|
73
71
|
if (defaultTool) {
|
|
74
72
|
return withCtxPath(`${EDITION_TOOLS.find((t) => t.name === defaultTool)?.path}/${page}`, ctxPath);
|
|
75
73
|
}
|
|
76
|
-
if (
|
|
74
|
+
if (!corpus)
|
|
75
|
+
return undefined;
|
|
76
|
+
if (hasParameter(corpus, "useEdictor")) {
|
|
77
77
|
return withCtxPath(`/editor/${page}`, ctxPath);
|
|
78
78
|
}
|
|
79
|
-
else if (hasParameter(corpus,
|
|
79
|
+
else if (hasParameter(corpus, "useTranslations")) {
|
|
80
80
|
return withCtxPath(`/translation/${page}`, ctxPath);
|
|
81
81
|
}
|
|
82
|
-
else if (hasParameter(corpus,
|
|
82
|
+
else if (hasParameter(corpus, "useDesigner")) {
|
|
83
83
|
return withCtxPath(`/editor/box/${page}`, ctxPath);
|
|
84
84
|
}
|
|
85
|
-
else if (hasParameter(corpus,
|
|
85
|
+
else if (hasParameter(corpus, "useTranscriber")) {
|
|
86
86
|
return withCtxPath(`/transcriber/${page}`, ctxPath);
|
|
87
87
|
}
|
|
88
88
|
return undefined;
|
|
@@ -92,16 +92,16 @@ const redirectPage = ({ corpus, uid, hasParameter, tool, ctxPath, sameWindow, })
|
|
|
92
92
|
navigateTo(`${EDITION_TOOLS.find((t) => t.name === tool)?.path}/${uid}`, ctxPath, sameWindow);
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
|
-
if (hasParameter(corpus,
|
|
95
|
+
if (hasParameter(corpus, "useEdictor")) {
|
|
96
96
|
openEdictor(uid, ctxPath, sameWindow);
|
|
97
97
|
}
|
|
98
|
-
else if (hasParameter(corpus,
|
|
98
|
+
else if (hasParameter(corpus, "useTranslations")) {
|
|
99
99
|
openTranslations(uid, ctxPath, sameWindow);
|
|
100
100
|
}
|
|
101
|
-
else if (hasParameter(corpus,
|
|
101
|
+
else if (hasParameter(corpus, "useDesigner")) {
|
|
102
102
|
openDesign(uid, ctxPath, sameWindow);
|
|
103
103
|
}
|
|
104
|
-
else if (hasParameter(corpus,
|
|
104
|
+
else if (hasParameter(corpus, "useTranscriber")) {
|
|
105
105
|
openTranscriber(uid, ctxPath, sameWindow);
|
|
106
106
|
}
|
|
107
107
|
};
|
|
@@ -18,6 +18,9 @@ export default function HelpModal({ onClose, helpActions = [] }) {
|
|
|
18
18
|
const [autoOpenEnabled, setAutoOpenEnabled] = useState(() => getLogged()?.liveTour ?? false);
|
|
19
19
|
const [updatingLiveTour, setUpdatingLiveTour] = useState(false);
|
|
20
20
|
const isTourActive = status();
|
|
21
|
+
const currentLiveTour = getLogged()?.liveTour ?? false;
|
|
22
|
+
const preferenceChanged = autoOpenEnabled !== currentLiveTour;
|
|
23
|
+
const isDisablingAutoOpen = preferenceChanged && !autoOpenEnabled;
|
|
21
24
|
const handleTutorials = () => {
|
|
22
25
|
const origin = (import.meta.env.VITE_APP_ORIGIN ?? '').replace(/\/+$/, '');
|
|
23
26
|
window.open(`${origin}/home/tutorials`, '_blank');
|
|
@@ -32,8 +35,7 @@ export default function HelpModal({ onClose, helpActions = [] }) {
|
|
|
32
35
|
}
|
|
33
36
|
onClose();
|
|
34
37
|
};
|
|
35
|
-
|
|
36
|
-
if (autoOpenEnabled === currentLiveTour) {
|
|
38
|
+
if (!preferenceChanged) {
|
|
37
39
|
startTour();
|
|
38
40
|
return;
|
|
39
41
|
}
|
|
@@ -48,6 +50,10 @@ export default function HelpModal({ onClose, helpActions = [] }) {
|
|
|
48
50
|
})
|
|
49
51
|
.finally(() => {
|
|
50
52
|
setUpdatingLiveTour(false);
|
|
53
|
+
if (isDisablingAutoOpen) {
|
|
54
|
+
onClose();
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
51
57
|
startTour();
|
|
52
58
|
});
|
|
53
59
|
};
|
|
@@ -66,5 +72,7 @@ export default function HelpModal({ onClose, helpActions = [] }) {
|
|
|
66
72
|
},
|
|
67
73
|
...helpActions,
|
|
68
74
|
];
|
|
69
|
-
return (_jsxs(AppModal, { title: t('modal.title'), close: onClose, hideFooter: true, className: "help-modal", children: [_jsxs("div", { className: "live-tour", children: [_jsx(AppPicture, { src: liveTour }), _jsxs("div", { className: "tour-content", 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: autoOpenEnabled, onChange: handleAutoOpenChange, disabled: updatingLiveTour, className: "help-checkbox" }), _jsx("span", { children: t('checkbox.autoOpen') })] }), _jsx(Button, { text:
|
|
75
|
+
return (_jsxs(AppModal, { title: t('modal.title'), close: onClose, hideFooter: true, className: "help-modal", children: [_jsxs("div", { className: "live-tour", children: [_jsx(AppPicture, { src: liveTour }), _jsxs("div", { className: "tour-content", 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: autoOpenEnabled, onChange: handleAutoOpenChange, disabled: updatingLiveTour, className: "help-checkbox" }), _jsx("span", { children: t('checkbox.autoOpen') })] }), _jsx(Button, { text: isDisablingAutoOpen
|
|
76
|
+
? t('button.updateLiveTourPreference')
|
|
77
|
+
: t('button.tour'), size: "small", icon: "keyboard_arrow_right", onClick: handleTourToggle, disabled: updatingLiveTour, "data-tour": "guided-tour-start" })] })] }), _jsx("div", { className: "other-actions", children: actionItems.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'), size: "x-small", mode: "outlined", icon: "keyboard_arrow_right", onClick: () => handleCustomAction(item) })] }, idx))) })] }));
|
|
70
78
|
}
|