tycho-components 0.21.15 → 0.21.17
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/common/AppPlaceholder/AppPlaceholder.d.ts +2 -1
- package/dist/common/AppPlaceholder/AppPlaceholder.js +3 -2
- package/dist/features/Comments/HeaderNotifications/HeaderNotifications.js +4 -2
- package/dist/features/Comments/types/Comment.d.ts +1 -0
- package/dist/shell/Header/HeaderButtons/HeaderButtons.js +1 -1
- package/dist/shell/Header/HelpButton/HelpButton.js +1 -1
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ type Props = {
|
|
|
6
6
|
children?: React.ReactNode;
|
|
7
7
|
useMarginTop?: boolean;
|
|
8
8
|
onClick?: () => void;
|
|
9
|
+
className?: string;
|
|
9
10
|
};
|
|
10
|
-
export default function AppPlaceholder({ text, desc, children, icon, useMarginTop, onClick, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default function AppPlaceholder({ text, desc, children, icon, useMarginTop, onClick, className, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import cx from "classnames";
|
|
2
3
|
import { Icon } from "tycho-storybook";
|
|
3
4
|
import "./style.scss";
|
|
4
|
-
export default function AppPlaceholder({ text, desc, children, icon = "contract_delete", useMarginTop = false, onClick, }) {
|
|
5
|
-
return (_jsxs("div", { className:
|
|
5
|
+
export default function AppPlaceholder({ text, desc, children, icon = "contract_delete", useMarginTop = false, onClick, className, }) {
|
|
6
|
+
return (_jsxs("div", { className: cx("ds-placeholder", { "with-margin-top": useMarginTop }, className), onClick: () => onClick && onClick(), onKeyDown: () => onClick && onClick(), children: [_jsx(Icon, { name: icon, weight: "heavy", size: "x-large", filled: true }), text && _jsx("span", { className: "title", children: text }), desc && _jsx("span", { className: "desc", children: desc }), children && children] }));
|
|
6
7
|
}
|
|
@@ -14,7 +14,9 @@ export default function HeaderNotifications({ uid, mode, mobile }) {
|
|
|
14
14
|
const [comments, setComments] = useState();
|
|
15
15
|
const [tab, setTab] = useState('unread');
|
|
16
16
|
const handleOpen = (notification) => {
|
|
17
|
-
|
|
17
|
+
if (!notification.url)
|
|
18
|
+
return;
|
|
19
|
+
location.href = notification.url;
|
|
18
20
|
setOpen(false);
|
|
19
21
|
};
|
|
20
22
|
const load = () => {
|
|
@@ -31,7 +33,7 @@ export default function HeaderNotifications({ uid, mode, mobile }) {
|
|
|
31
33
|
useEffect(() => {
|
|
32
34
|
load();
|
|
33
35
|
}, [uid, tab]);
|
|
34
|
-
return (_jsxs("div", { className: "ds-dropdown-container notifications-container", children: [_jsx(IconButton, { name: "notifications_active", className: comments && comments.length > 0 ? 'shake' : '', size: "medium", onClick: () => setOpen(!open), mode: mobile ? 'outlined' : 'filled' }), open && (_jsx("div", { className: "ds-dropdown-list", children: _jsxs("div", { className: "notifications-panel", children: [_jsxs("div", { className: "header", children: [_jsx("span", { children: t('notification.title') }), _jsx(IconButton, { name: "close", size: "
|
|
36
|
+
return (_jsxs("div", { className: "ds-dropdown-container notifications-container", children: [_jsx(IconButton, { name: "notifications_active", className: comments && comments.length > 0 ? 'shake' : '', size: "medium", onClick: () => setOpen(!open), mode: mobile ? 'outlined' : 'filled' }), open && (_jsx("div", { className: "ds-dropdown-list", children: _jsxs("div", { className: "notifications-panel", children: [_jsxs("div", { className: "header", children: [_jsx("span", { children: t('notification.title') }), _jsx(IconButton, { name: "close", size: "large", mode: "ghost", onClick: () => setOpen(false) })] }), _jsxs("div", { className: "tabs", children: [_jsxs("button", { className: tab === 'unread' ? 'active-tab' : '', onClick: () => setTab('unread'), children: [t('notification.unread'), " (", comments?.length || 0, ")"] }), _jsx("button", { className: tab === 'read' ? 'active-tab' : '', onClick: () => setTab('read'), children: t('notification.all') })] }), _jsxs("div", { className: "content", children: [notifications &&
|
|
35
37
|
notifications.map((not, idx) => (_jsxs("div", { className: "item", onClick: () => handleOpen(not), children: [_jsx(Avatar, { src: not.picture, size: "small" }), _jsxs("div", { className: "message", children: [_jsx("span", { className: "text", children: _jsx(Trans, { t: t, i18nKey: "notification.text", values: {
|
|
36
38
|
user: not.name,
|
|
37
39
|
entry: not.keywords ? not.keywords['entry'] : '',
|
|
@@ -14,5 +14,5 @@ export default function HeaderButtons({ hideKeyboard, notifications, keyboardLay
|
|
|
14
14
|
const { getCorpus } = useCorpusUtils();
|
|
15
15
|
const { isLogged } = useLoggedUtils();
|
|
16
16
|
const [openKeyboard, setOpenKeyboard] = useState(false);
|
|
17
|
-
return (_jsxs("div", { className: "header-buttons", children: [!hideKeyboard && (_jsx(IconButton, { onClick: () => setOpenKeyboard(!openKeyboard), name: "keyboard", size: "
|
|
17
|
+
return (_jsxs("div", { className: "header-buttons", children: [!hideKeyboard && (_jsx(IconButton, { onClick: () => setOpenKeyboard(!openKeyboard), name: "keyboard", size: "large", title: t('tooltip.keyboard'), mode: mobile ? 'outlined' : 'filled' })), _jsx(HelpButton, { helpActions: helpActions, mobile: mobile }), notifications && isLogged() && (_jsx(Suspense, { fallback: null, children: _jsx(HeaderNotifications, { uid: notifications.ref, mode: notifications.mode, mobile: mobile }) })), _jsx(LanguageSelector, { openToTop: mobile ? true : false, mobile: mobile }), openKeyboard && (_jsx(VirtualKeyboard, { onClose: () => setOpenKeyboard(false), closeLabel: t('button.close'), defaultLayout: keyboardLayout || getCorpus().keyboardLayout || 'english' }))] }));
|
|
18
18
|
}
|
|
@@ -6,5 +6,5 @@ import HelpModal from './HelpModal';
|
|
|
6
6
|
export default function HelpButton({ helpActions, mobile }) {
|
|
7
7
|
const { t } = useTranslation('header');
|
|
8
8
|
const [open, setOpen] = useState(false);
|
|
9
|
-
return (_jsxs(_Fragment, { children: [_jsx(IconButton, { name: "live_help", size: "
|
|
9
|
+
return (_jsxs(_Fragment, { children: [_jsx(IconButton, { name: "live_help", size: "large", title: t('tooltip.tutorials'), onClick: () => setOpen(true), mode: mobile ? 'outlined' : 'filled' }), open && (_jsx(HelpModal, { onClose: () => setOpen(false), helpActions: helpActions }))] }));
|
|
10
10
|
}
|