UNPKG

@rocket.chat/onboarding-ui

Version:

Set of components and functions for the onboarding experience on Rocket.Chat

28 lines 1.88 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const jsx_runtime_1 = require("react/jsx-runtime"); const fuselage_1 = require("@rocket.chat/fuselage"); const layout_1 = require("@rocket.chat/layout"); const react_1 = require("react"); const react_i18next_1 = require("react-i18next"); const RedirectPage = ({ title, countDownSeconds, onRedirect, }) => { const { t } = (0, react_i18next_1.useTranslation)(); const [seconds, setSeconds] = (0, react_1.useState)(countDownSeconds); (0, react_1.useEffect)(() => { if (seconds === 0) return; const timer = setInterval(() => { setSeconds((prev) => Math.max(0, prev - 1)); }, 1000); return () => { clearInterval(timer); }; }, []); (0, react_1.useEffect)(() => { if (seconds === 0) onRedirect(); }, [seconds]); return ((0, jsx_runtime_1.jsx)(layout_1.BackgroundLayer, { children: (0, jsx_runtime_1.jsx)(fuselage_1.Box, { display: 'flex', flexDirection: 'column', alignItems: 'center', textAlign: 'center', width: '100%', maxWidth: 768, paddingBlock: 32, paddingInline: 16, children: (0, jsx_runtime_1.jsxs)(fuselage_1.Margins, { blockEnd: 32, children: [(0, jsx_runtime_1.jsx)(layout_1.LayoutLogo, {}), (0, jsx_runtime_1.jsx)(fuselage_1.Box, { fontScale: 'hero', children: title }), (0, jsx_runtime_1.jsx)(fuselage_1.Box, { fontScale: 'p1b', children: t('page.redirect.subtitle', { seconds }) }), (0, jsx_runtime_1.jsx)(fuselage_1.Box, { fontScale: 'c1', children: (0, jsx_runtime_1.jsxs)(react_i18next_1.Trans, { i18nKey: 'page.redirect.redirectNotWorking', children: ["Redirect not working?", (0, jsx_runtime_1.jsx)(layout_1.ActionLink, { onClick: onRedirect, children: "Open workspace" })] }) })] }) }) })); }; exports.default = RedirectPage; //# sourceMappingURL=RedirectPage.js.map