tycho-components 0.0.18-r5 → 0.1.0-SNAPSHOT
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/Header/Header.js +10 -3
- 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/package.json +1 -1
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';
|
|
@@ -13,9 +13,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
|
-
|
|
16
|
+
import CommonContext from '../configs/CommonContext';
|
|
17
|
+
import { tour } from '../configs/store/actions';
|
|
18
|
+
const linkTutorials = 'https://www.tycho.iel.unicamp.br/home/tutorials';
|
|
17
19
|
export default function Header({ tool, navigateHome, navigateCorpora, navigateLogout, redirect, autoload, freeAccess, hideKeyboard, hideReplaceAll, customHeader, notifications, }) {
|
|
18
20
|
const { t } = useTranslation('header');
|
|
21
|
+
const { dispatch } = useContext(CommonContext);
|
|
19
22
|
const { getCorpus, hasCorpus } = useCorpusUtils();
|
|
20
23
|
const { isLogged } = useLoggedUtils();
|
|
21
24
|
const [openKeyboard, setOpenKeyboard] = useState(false);
|
|
@@ -25,5 +28,9 @@ export default function Header({ tool, navigateHome, navigateCorpora, navigateLo
|
|
|
25
28
|
const homeTextsClass = cx('texts', {
|
|
26
29
|
pointer: navigateHome !== undefined,
|
|
27
30
|
});
|
|
28
|
-
|
|
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' }))] }));
|
|
29
36
|
}
|
|
@@ -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
|
};
|