tycho-components 0.2.2-SNAPSHOT-10 → 0.2.2-SNAPSHOT-12

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.
@@ -1,5 +1,4 @@
1
1
  .loading-container {
2
- height: 50vh;
3
2
  margin-top: calc(var(--spacing-xxlarge) + var(--spacing-large));
4
3
 
5
4
  display: flex;
@@ -1,26 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useEffect, useState } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
- import { useNavigate } from 'react-router-dom';
5
- import { Button } from 'tycho-storybook';
6
- import CookieStorage from '../configs/CookieStorage';
7
4
  import logo from './logo.png';
8
5
  import './style.scss';
9
6
  export default function ErrorBoundary({ children }) {
10
- const navigate = useNavigate();
11
7
  const { t } = useTranslation('base');
12
- const [show, setShow] = useState(false);
13
8
  const [state, setState] = useState({
14
9
  hasError: false,
15
10
  error: null,
16
11
  });
17
- const handleRedirect = () => {
18
- navigate('/', { replace: true });
19
- };
20
- const handleRetry = () => {
21
- const redirectUri = CookieStorage.getRedirectUri();
22
- redirectUri ? (window.location.href = redirectUri) : handleRedirect();
23
- };
24
12
  // Hook to simulate the behavior of componentDidCatch
25
13
  useEffect(() => {
26
14
  const handleError = (error) => {
@@ -45,7 +33,7 @@ export default function ErrorBoundary({ children }) {
45
33
  };
46
34
  }, []);
47
35
  if (state.hasError && state.error) {
48
- return (_jsx("div", { className: "box-container", children: _jsxs("div", { className: "box", children: [_jsx("img", { src: logo }), _jsx("div", { className: "title", children: t('label.error.found') }), _jsxs("div", { className: "buttons", children: [_jsx(Button, { text: t('label.retry'), size: "small", onClick: handleRetry }), _jsx(Button, { text: t('label.redirect'), size: "small", onClick: handleRedirect }), _jsx(Button, { text: t('label.error.details'), size: "small", onClick: () => setShow(!show) })] }), show && _jsx("pre", { className: "error-stack", children: state.error?.stack })] }) }));
36
+ return (_jsx("div", { className: "box-container", children: _jsxs("div", { className: "box", children: [_jsx("img", { src: logo }), _jsx("div", { className: "title", children: t('label.error.found') }), _jsx("h6", { children: state.error?.message }), _jsx("pre", { className: "error-stack", children: state.error?.stack })] }) }));
49
37
  }
50
38
  return _jsx(_Fragment, { children: children });
51
39
  }
@@ -7,7 +7,7 @@ export default function NotFound() {
7
7
  const navigate = useNavigate();
8
8
  const { t } = useTranslation('base');
9
9
  const handleRedirect = () => {
10
- navigate('', { replace: true });
10
+ navigate('/', { replace: true });
11
11
  };
12
12
  return (_jsx("div", { className: "box-container", children: _jsxs("div", { className: "box", children: [_jsx("img", { src: logo }), _jsx("div", { className: "title", children: t('notfound.label.disclaimer') }), _jsx("div", { className: "subtitle", onClick: handleRedirect, children: t('label.redirect') })] }) }));
13
13
  }
@@ -5,7 +5,7 @@ declare const SentenceUtils: {
5
5
  isVisible: (token: Token) => boolean;
6
6
  isFirstFromSplit: (token: Token) => boolean;
7
7
  getColspan: (thisToken: Token) => number;
8
- skipToken: (token: Token) => boolean;
8
+ skipToken: (token: Token, splits?: boolean) => boolean;
9
9
  getTag: (token: Token) => string;
10
10
  };
11
11
  export default SentenceUtils;
@@ -3,12 +3,12 @@ const getTag = (token) => {
3
3
  return token.split.t || '';
4
4
  return token.t ?? '';
5
5
  };
6
- const skipToken = (token) => {
6
+ const skipToken = (token, splits) => {
7
7
  if (token.ec)
8
8
  return true;
9
9
  if (!token.v)
10
10
  return false;
11
- if (token.v.startsWith('@') && token.split)
11
+ if (!splits && token.v.startsWith('@') && token.split)
12
12
  return true;
13
13
  return false;
14
14
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tycho-components",
3
3
  "private": false,
4
- "version": "0.2.2-SNAPSHOT-10",
4
+ "version": "0.2.2-SNAPSHOT-12",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {