Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

added 404-page

Blue Mouse76db2c1c7ff2
diff --git a/public/locales/en.json b/public/locales/en.json
index 13a74e403..57afad2b1 100644
--- a/public/locales/en.json
+++ b/public/locales/en.json
@@ -246,6 +246,12 @@
},
"contents": "Contents"
},
+ "notFoundPage": {
+ "title": "Page not found",
+ "description": "Sorry, we couldn’t find the page you’re looking for.\nPlease check the URL in the address bar and try again.",
+ "goHome": "Go back home",
+ "support": "Contact support"
+ },
"project": {
"ad": "Want these stats for your website?",
"noExist": "The selected project does not exist",
diff --git a/src/App.js b/src/App.js
index afc2e07ac..8f979374a 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,5 +1,5 @@
import React, { useEffect, lazy, Suspense, useState } from 'react'
-import { Switch, Route, Redirect, useLocation } from 'react-router-dom'
+import { Switch, Route, useLocation } from 'react-router-dom'
import routes from 'routes'
import { useDispatch, useSelector } from 'react-redux'
import { useAlert } from 'react-alert'
@@ -39,6 +39,7 @@ const ViewProject = lazy(() => import('pages/Project/View'))
const Billing = lazy(() => import('pages/Billing'))
const Privacy = lazy(() => import('pages/Privacy'))
const Terms = lazy(() => import('pages/Terms'))
+const NotFound = lazy(() => import('pages/NotFound'))
const minimalFooterPages = [
'/projects', '/dashboard', '/settings', '/contact',
@@ -174,7 +175,7 @@ const App = () => {
<Route path={routes.features} component={Features} exact />
<Route path={routes.privacy} component={Privacy} exact />
<Route path={routes.terms} component={Terms} exact />
- <Redirect to={routes.main} />
+ <Route path='*' component={NotFound} />
</Switch>
</Suspense>
</Selfhosted>
diff --git a/src/pages/NotFound/index.jsx b/src/pages/NotFound/index.jsx
new file mode 100644
index 000000000..33203a420
--- /dev/null
+++ b/src/pages/NotFound/index.jsx
@@ -0,0 +1,50 @@
+import React from 'react'
+import { Link } from 'react-router-dom'
+import { useTranslation } from 'react-i18next'
+
+import routes from 'routes'
+import Title from 'components/Title'
+
+const NotFound = () => {
+ const { t } = useTranslation('common')
+
+ return (
+ <Title title={t('notFoundPage.title')}>
+ <div className='bg-gray-50 dark:bg-gray-800 min-h-min-footer px-4 py-16 sm:px-6 sm:py-24 md:grid md:place-items-center lg:px-8'>
+ <div className='max-w-max mx-auto'>
+ <main className='sm:flex'>
+ <p className='text-4xl font-extrabold text-indigo-600 dark:text-indigo-500 sm:text-5xl'>
+ 404
+ </p>
+ <div className='sm:ml-6'>
+ <div className='sm:border-l sm:border-gray-200 sm:pl-6'>
+ <h1 className='text-4xl font-extrabold text-gray-900 dark:text-gray-50 tracking-tight sm:text-5xl'>
+ {t('notFoundPage.title')}
+ </h1>
+ <p className='mt-1 whitespace-pre-line text-base text-gray-500 dark:text-gray-300'>
+ {t('notFoundPage.description')}
+ </p>
+ </div>
+ <div className='mt-8 flex space-x-3 sm:border-l sm:border-transparent sm:pl-6'>
+ <Link
+ to={routes.main}
+ className='inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500'
+ >
+ {t('notFoundPage.goHome')}
+ </Link>
+ <Link
+ to={routes.contact}
+ className='inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md text-indigo-700 bg-indigo-100 hover:bg-indigo-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:text-gray-50 dark:bg-gray-700 dark:hover:bg-gray-600 dark:focus:ring-gray-50'
+ >
+ {t('notFoundPage.support')}
+ </Link>
+ </div>
+ </div>
+ </main>
+ </div>
+ </div>
+ </Title>
+ )
+}
+
+export default NotFound