diff --git a/assets/App.tsx b/assets/App.tsx index ab54632..1f6fe05 100644 --- a/assets/App.tsx +++ b/assets/App.tsx @@ -1,4 +1,4 @@ -import {Button, ConfigProvider, Drawer, Flex, Layout, theme, Typography} from 'antd' +import {Button, ConfigProvider, Drawer, Flex, Layout, message, theme, Typography} from 'antd' import {Link, Navigate, Route, Routes, useLocation, useNavigate} from 'react-router-dom' import TextPage from './pages/TextPage' import DomainSearchPage from './pages/search/DomainSearchPage' @@ -20,7 +20,7 @@ import {MenuOutlined} from '@ant-design/icons' import TrackedDomainPage from './pages/tracking/TrackedDomainPage' import IcannRegistrarPage from "./pages/infrastructure/IcannRegistrarPage" import type {AuthContextType} from "./contexts" -import { AuthenticatedContext, ConfigurationContext} from "./contexts" +import {AuthenticatedContext, ConfigurationContext} from "./contexts" const PROJECT_LINK = 'https://github.com/maelgangloff/domain-watchdog' const LICENSE_LINK = 'https://www.gnu.org/licenses/agpl-3.0.txt' @@ -74,6 +74,7 @@ export default function App(): React.ReactElement { const [darkMode, setDarkMode] = useState(false) const windowQuery = window.matchMedia('(prefers-color-scheme:dark)') + const [messageApi, contextHolder] = message.useMessage() const authContextValue: AuthContextType = useMemo(() => ({ @@ -110,7 +111,7 @@ export default function App(): React.ReactElement { if(configuration.publicRdapLookupEnabled) return navigate('/search/domain') if (!['/login', '/tos', '/faq', '/privacy'].includes(pathname)) return navigate('/home') }) - }) + }).catch(() => messageApi.error(t`Unable to contact the server, please reload the page.`)) }, []) return ( @@ -139,6 +140,7 @@ export default function App(): React.ReactElement { minHeight: 360 }} > + {contextHolder} }/> }/> diff --git a/assets/pages/LoginPage.tsx b/assets/pages/LoginPage.tsx index 0a901e8..8d578ca 100644 --- a/assets/pages/LoginPage.tsx +++ b/assets/pages/LoginPage.tsx @@ -20,7 +20,6 @@ export default function LoginPage() { useEffect(() => { if(!configuration?.registerEnabled && configuration?.ssoLogin && configuration?.ssoAutoRedirect) { window.location.href = '/login/oauth' - return } }, [configuration]) diff --git a/translations/translations.pot b/translations/translations.pot index 6032403..08beb1c 100644 --- a/translations/translations.pot +++ b/translations/translations.pot @@ -3,31 +3,35 @@ msgstr "" "Content-Type: text/plain; charset=utf-8\n" "Plural-Forms: nplurals=2; plural=(n!=1);\n" -#: assets/App.tsx:172 -msgid "TOS" -msgstr "" - -#: assets/App.tsx:173 -msgid "Privacy Policy" +#: assets/App.tsx:114 +msgid "Unable to contact the server, please reload the page." msgstr "" #: assets/App.tsx:174 +msgid "TOS" +msgstr "" + +#: assets/App.tsx:175 +msgid "Privacy Policy" +msgstr "" + +#: assets/App.tsx:176 msgid "FAQ" msgstr "" -#: assets/App.tsx:180 +#: assets/App.tsx:182 msgid "Documentation" msgstr "" -#: assets/App.tsx:188 +#: assets/App.tsx:190 msgid "Source code" msgstr "" -#: assets/App.tsx:196 +#: assets/App.tsx:198 msgid "Submit an issue" msgstr "" -#: assets/App.tsx:201 +#: assets/App.tsx:203 #, javascript-format msgid "" "${ ProjectLink } is an open source project distributed under the ${ " @@ -87,7 +91,7 @@ msgid "Log in with SSO" msgstr "" #: assets/components/RegisterForm.tsx:54 -#: assets/pages/LoginPage.tsx:51 +#: assets/pages/LoginPage.tsx:50 msgid "Register" msgstr "" @@ -250,8 +254,8 @@ msgid "Log out" msgstr "" #: assets/components/Sider.tsx:158 -#: assets/pages/LoginPage.tsx:37 -#: assets/pages/LoginPage.tsx:51 +#: assets/pages/LoginPage.tsx:36 +#: assets/pages/LoginPage.tsx:50 msgid "Log in" msgstr "" @@ -690,7 +694,7 @@ msgstr "" msgid "Sponsored Top-Level-Domains" msgstr "" -#: assets/pages/LoginPage.tsx:37 +#: assets/pages/LoginPage.tsx:36 msgid "Create an account" msgstr ""