tycho-components 0.21.16 → 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.
@@ -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
- navigate(`/edit/${notification.entry}`);
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: "small", 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 &&
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'] : '',
@@ -26,6 +26,7 @@ export type Comment = {
26
26
  type?: string;
27
27
  reply?: string;
28
28
  coordinates?: string[];
29
+ url?: string;
29
30
  };
30
31
  export type UserComment = {
31
32
  uid: string;
@@ -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: "medium", 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' }))] }));
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: "medium", title: t('tooltip.tutorials'), onClick: () => setOpen(true), mode: mobile ? 'outlined' : 'filled' }), open && (_jsx(HelpModal, { onClose: () => setOpen(false), helpActions: helpActions }))] }));
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
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tycho-components",
3
3
  "private": false,
4
- "version": "0.21.16",
4
+ "version": "0.21.17",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {