tycho-components 0.0.18 → 0.1.0-SNAPSHOT-1
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/AppEditable/AppEditable.js +6 -3
- package/dist/AppLoading/AppLoading.d.ts +1 -2
- package/dist/AppLoading/AppLoading.js +1 -2
- package/dist/Header/Header.js +12 -3
- package/dist/Header/HeaderUser/HeaderUser.js +4 -1
- package/dist/configs/Corpus.d.ts +3 -1
- package/dist/configs/store/actions.d.ts +1 -0
- package/dist/configs/store/actions.js +4 -0
- package/dist/configs/store/reducer.js +5 -0
- package/dist/configs/store/store.js +1 -0
- package/dist/configs/store/types.d.ts +2 -0
- package/dist/configs/store/types.js +1 -0
- package/dist/configs/useCorpusUtils.js +1 -1
- package/dist/configs/useTourUtils.d.ts +5 -0
- package/dist/configs/useTourUtils.js +20 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -89,9 +89,12 @@ export default function AppEditable({ translation, fields, item, save, group, cl
|
|
|
89
89
|
case 'function':
|
|
90
90
|
return _jsx("span", { children: field.fn ? field.fn(getValue(field)) : '' });
|
|
91
91
|
case 'check':
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
const val = getValue(field);
|
|
93
|
+
return (_jsx(EasyEdit, { type: "checkbox", options: getLabelValueForList(field.options || []), onSave: (value) => handleSave(value, field), value: val === undefined || val === null
|
|
94
|
+
? undefined
|
|
95
|
+
: Array.isArray(val)
|
|
96
|
+
? val
|
|
97
|
+
: [val], ...sharedEditProps }));
|
|
95
98
|
default:
|
|
96
99
|
return null;
|
|
97
100
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import ReactLoading from 'react-loading';
|
|
3
3
|
import './style.scss';
|
|
4
|
-
function AppLoading() {
|
|
4
|
+
export default function AppLoading() {
|
|
5
5
|
return (_jsx("div", { className: "loading-container", children: _jsx(ReactLoading, { type: "spinningBubbles", color: "blue", height: 50, width: 50 }) }));
|
|
6
6
|
}
|
|
7
|
-
export default AppLoading;
|
package/dist/Header/Header.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import cx from 'classnames';
|
|
3
|
-
import { useState } from 'react';
|
|
3
|
+
import { useContext, useState } from 'react';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { IconButton } from 'tycho-storybook';
|
|
6
6
|
import { useCorpusUtils } from '../configs/useCorpusUtils';
|
|
@@ -12,10 +12,15 @@ import HeaderReplaceAll from './HeaderReplaceAll';
|
|
|
12
12
|
import HeaderUser from './HeaderUser';
|
|
13
13
|
import './styles.scss';
|
|
14
14
|
import HeaderNotifications from '../Comments/HeaderNotifications';
|
|
15
|
-
|
|
15
|
+
import { useLoggedUtils } from '../configs/useLoggedUtils';
|
|
16
|
+
import CommonContext from '../configs/CommonContext';
|
|
17
|
+
import { tour } from '../configs/store/actions';
|
|
18
|
+
const linkTutorials = 'https://www.tycho.iel.unicamp.br/home/tutorials';
|
|
16
19
|
export default function Header({ tool, navigateHome, navigateCorpora, navigateLogout, redirect, autoload, freeAccess, hideKeyboard, hideReplaceAll, customHeader, notifications, }) {
|
|
17
20
|
const { t } = useTranslation('header');
|
|
21
|
+
const { dispatch } = useContext(CommonContext);
|
|
18
22
|
const { getCorpus, hasCorpus } = useCorpusUtils();
|
|
23
|
+
const { isLogged } = useLoggedUtils();
|
|
19
24
|
const [openKeyboard, setOpenKeyboard] = useState(false);
|
|
20
25
|
const profileClass = cx('header-profile', {
|
|
21
26
|
'corpora-free': freeAccess && !hasCorpus(),
|
|
@@ -23,5 +28,9 @@ export default function Header({ tool, navigateHome, navigateCorpora, navigateLo
|
|
|
23
28
|
const homeTextsClass = cx('texts', {
|
|
24
29
|
pointer: navigateHome !== undefined,
|
|
25
30
|
});
|
|
26
|
-
|
|
31
|
+
const handleHelp = () => {
|
|
32
|
+
window.open(linkTutorials, '_blank');
|
|
33
|
+
dispatch(tour(true));
|
|
34
|
+
};
|
|
35
|
+
return (_jsxs("div", { className: "ds-header", children: [_jsx(HeaderApps, { freeAccess: freeAccess }), _jsxs("div", { className: homeTextsClass, onClick: () => navigateHome && navigateHome(), children: [_jsx("span", { className: "title", children: t('label.platform') }), _jsx("span", { className: "subtitle", children: tool })] }), customHeader, !customHeader && (_jsx(HeaderCorpora, { redirect: redirect, autoload: autoload, freeAccess: freeAccess, navigateCorpora: navigateCorpora })), _jsxs("div", { className: profileClass, children: [!hideReplaceAll && _jsx(HeaderReplaceAll, {}), !hideKeyboard && (_jsx(IconButton, { onClick: () => setOpenKeyboard(!openKeyboard), name: "keyboard", size: "medium", title: t('tooltip.keyboard') })), _jsx(IconButton, { name: "live_help", size: "medium", title: t('tooltip.tutorials'), onClick: (e) => handleHelp() }), notifications && isLogged() && (_jsx(HeaderNotifications, { uid: notifications.ref, mode: notifications.mode })), _jsx(LanguageSelector, {}), !freeAccess && _jsx(HeaderUser, { navigateLogout: navigateLogout })] }), openKeyboard && (_jsx(VirtualKeyboard, { onClose: () => setOpenKeyboard(false), closeLabel: t('button.close'), defaultLayout: getCorpus().keyboardLayout || 'english' }))] }));
|
|
27
36
|
}
|
|
@@ -12,5 +12,8 @@ export default function HeaderUser({ navigateLogout }) {
|
|
|
12
12
|
setOpen(false);
|
|
13
13
|
window.open(import.meta.env.VITE_APP_PROFILE_URL, '_blank');
|
|
14
14
|
};
|
|
15
|
-
return (_jsxs("div", { className: "header-user-container", children: [isLogged() ? (_jsx(ProfileDropdown, { src: getLogged()?.picture, title: getLogged()?.name, onClick: (b) => setOpen(b) })) : (_jsx(Avatar, { size: "small", onClick: () => (location.href = '/auth') })), open && isLogged() && (_jsxs("div", { className: "ds-dropdown-list", children: [_jsx("div", { className: "ds-dropdown-itemlist", children: _jsx("span", { className: "label", children: `${t('profile.label.hello')} ${getLogged()?.name}` }) }), _jsxs("div", { className: "ds-dropdown-itemlist d-none", children: [_jsx(Icon, { name: "colors", size: "x-small" }), _jsx("span", { className: "label", children: t('profile.label.theme') })] }), _jsxs("div", { className: "ds-dropdown-itemlist", onClick: handleProfile, children: [_jsx(Icon, { name: "person", size: "x-small" }), _jsx("span", { className: "label", children: t('profile.label.home') })] }), _jsxs("div", { className: "ds-dropdown-itemlist", children: [_jsx(Icon, { name: "live_help", size: "x-small" }), _jsx("span", { className: "label", children: t('profile.label.help') })] }), _jsxs("div", { className: "ds-dropdown-itemlist", onClick:
|
|
15
|
+
return (_jsxs("div", { className: "header-user-container", children: [isLogged() ? (_jsx(ProfileDropdown, { src: getLogged()?.picture, title: getLogged()?.name, onClick: (b) => setOpen(b) })) : (_jsx(Avatar, { size: "small", onClick: () => (location.href = '/auth') })), open && isLogged() && (_jsxs("div", { className: "ds-dropdown-list", children: [_jsx("div", { className: "ds-dropdown-itemlist", children: _jsx("span", { className: "label", children: `${t('profile.label.hello')} ${getLogged()?.name}` }) }), _jsxs("div", { className: "ds-dropdown-itemlist d-none", children: [_jsx(Icon, { name: "colors", size: "x-small" }), _jsx("span", { className: "label", children: t('profile.label.theme') })] }), _jsxs("div", { className: "ds-dropdown-itemlist", onClick: handleProfile, children: [_jsx(Icon, { name: "person", size: "x-small" }), _jsx("span", { className: "label", children: t('profile.label.home') })] }), _jsxs("div", { className: "ds-dropdown-itemlist", children: [_jsx(Icon, { name: "live_help", size: "x-small" }), _jsx("span", { className: "label", children: t('profile.label.help') })] }), _jsxs("div", { className: "ds-dropdown-itemlist", onClick: () => {
|
|
16
|
+
setOpen(false);
|
|
17
|
+
navigateLogout && navigateLogout();
|
|
18
|
+
}, children: [_jsx(Icon, { name: "logout", size: "x-small" }), _jsx("span", { className: "label", children: t('profile.label.logout') })] })] }))] }));
|
|
16
19
|
}
|
package/dist/configs/Corpus.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ export type Corpus = {
|
|
|
6
6
|
picture: string;
|
|
7
7
|
uploadDir: string;
|
|
8
8
|
parameters: Record<string, any>;
|
|
9
|
-
parser?: string;
|
|
10
9
|
active: boolean;
|
|
11
10
|
opened: boolean;
|
|
12
11
|
papers?: RelatedPaper[];
|
|
@@ -20,6 +19,9 @@ export type Corpus = {
|
|
|
20
19
|
catalog?: string[];
|
|
21
20
|
shortcut?: string;
|
|
22
21
|
numbers?: CorpusNumbers;
|
|
22
|
+
parser?: string;
|
|
23
|
+
udparser?: string;
|
|
24
|
+
lexicon?: string;
|
|
23
25
|
};
|
|
24
26
|
type CorpusNumbers = {
|
|
25
27
|
documents: number;
|
|
@@ -7,3 +7,4 @@ export declare const logged: (data: User | undefined) => StoreAction;
|
|
|
7
7
|
export declare const message: (data: ToastMessage) => StoreAction;
|
|
8
8
|
export declare const toastLoading: (data: boolean) => StoreAction;
|
|
9
9
|
export declare const silentLoading: (data: boolean) => StoreAction;
|
|
10
|
+
export declare const tour: (data: boolean) => StoreAction;
|
|
@@ -7,6 +7,7 @@ export type UserStore = {
|
|
|
7
7
|
message: ToastMessage;
|
|
8
8
|
toastLoading: boolean;
|
|
9
9
|
silentLoading: boolean;
|
|
10
|
+
tour: boolean;
|
|
10
11
|
};
|
|
11
12
|
export type StoreAction = {
|
|
12
13
|
type: string;
|
|
@@ -18,4 +19,5 @@ export declare const types: {
|
|
|
18
19
|
TOAST_LOADING: string;
|
|
19
20
|
SILENT_LOADING: string;
|
|
20
21
|
LOGGED: string;
|
|
22
|
+
TOUR: string;
|
|
21
23
|
};
|
|
@@ -14,7 +14,7 @@ export const useCorpusUtils = () => {
|
|
|
14
14
|
return state.corpus !== undefined && state.corpus.uid !== '';
|
|
15
15
|
};
|
|
16
16
|
const hasParameter = (corpus, param) => {
|
|
17
|
-
return corpus.parameters[param];
|
|
17
|
+
return corpus.parameters && corpus.parameters[param];
|
|
18
18
|
};
|
|
19
19
|
return {
|
|
20
20
|
getCorpus,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import CommonContext from './CommonContext';
|
|
3
|
+
import { tour } from './store/actions';
|
|
4
|
+
export const useTourUtils = () => {
|
|
5
|
+
const { state, dispatch } = useContext(CommonContext);
|
|
6
|
+
const turnOn = () => {
|
|
7
|
+
dispatch(tour(true));
|
|
8
|
+
};
|
|
9
|
+
const turnOff = () => {
|
|
10
|
+
dispatch(tour(false));
|
|
11
|
+
};
|
|
12
|
+
const status = () => {
|
|
13
|
+
return state.tour;
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
turnOn,
|
|
17
|
+
turnOff,
|
|
18
|
+
status,
|
|
19
|
+
};
|
|
20
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export { commonResources } from './configs/Localization';
|
|
|
34
34
|
export { useCorpusUtils } from './configs/useCorpusUtils';
|
|
35
35
|
export { useLoggedUtils } from './configs/useLoggedUtils';
|
|
36
36
|
export { useMessageUtils } from './configs/useMessageUtils';
|
|
37
|
+
export { useTourUtils } from './configs/useTourUtils';
|
|
37
38
|
export { UserStatusNames } from './configs/User';
|
|
38
39
|
export type { User, UserStatus } from './configs/User';
|
|
39
40
|
export { default as DateUtils } from './functions/DateUtils';
|
package/dist/index.js
CHANGED
|
@@ -25,6 +25,7 @@ export { commonResources } from './configs/Localization';
|
|
|
25
25
|
export { useCorpusUtils } from './configs/useCorpusUtils';
|
|
26
26
|
export { useLoggedUtils } from './configs/useLoggedUtils';
|
|
27
27
|
export { useMessageUtils } from './configs/useMessageUtils';
|
|
28
|
+
export { useTourUtils } from './configs/useTourUtils';
|
|
28
29
|
export { UserStatusNames } from './configs/User';
|
|
29
30
|
export { default as DateUtils } from './functions/DateUtils';
|
|
30
31
|
export { default as FilterUtils } from './functions/FilterUtils';
|