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!

minor updates

Blue Mousea4e819730b95
diff --git a/src/App.js b/src/App.js
index aaa401396..7b84bd4e3 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,5 +1,5 @@
import React, { useEffect, lazy, Suspense, useState } from 'react'
-import { Routes, Route, useLocation } from 'react-router-dom'
+import { Routes, Route, useLocation, Navigate } from 'react-router-dom'
import routes from 'routes'
import { useDispatch, useSelector } from 'react-redux'
import { useAlert } from 'react-alert'
@@ -130,6 +130,7 @@ const App = () => {
<Route path={routes.features} element={<Features/>} />
<Route path={routes.privacy} element={<Privacy/>} />
<Route path={routes.terms} element={<Terms/>} />
+ <Route path='*' element={<Navigate to={routes.main} />} />
</Routes>
</Suspense>
</Selfhosted>
diff --git a/src/components/Footer/index.jsx b/src/components/Footer/index.jsx
index 65542eb7e..cb3156704 100644
--- a/src/components/Footer/index.jsx
+++ b/src/components/Footer/index.jsx
@@ -62,7 +62,7 @@ const Footer = ({ minimal, authenticated }) => {
const year = new Date().getFullYear()
if (minimal) {
- return (
+ return (
<footer className='bg-gray-800 dark:bg-gray-900'>
<div className='max-w-7xl mx-auto py-8 px-4 overflow-hidden sm:px-6 lg:px-8'>
<nav className='-mx-5 -my-2 flex flex-wrap justify-center' aria-label='Footer'>
diff --git a/src/hoc/ScrollToTop.jsx b/src/hoc/ScrollToTop.jsx
index 8da7e5eca..6a42ae853 100644
--- a/src/hoc/ScrollToTop.jsx
+++ b/src/hoc/ScrollToTop.jsx
@@ -1,5 +1,5 @@
import React, { useEffect } from 'react'
-import { useLocation, useNavigate } from 'react-router-dom'
+import { useLocation } from 'react-router-dom'
/**
* A HOC which listens to history changes and scrolls to top of the page when triggered.
@@ -19,17 +19,6 @@ const ScrollToTop = ({ children }) => {
})
}, 0)
}
- // const unlisten = location.listen(({ hash }) => {
- // if (hash === '') {
- // setTimeout(() => {
- // window.scrollTo({
- // top: 0,
- // behavior: 'smooth',
- // })
- // }, 0)
- // }
- // })
- // return unlisten
}, [location])
return <>{children}</>
diff --git a/src/hoc/Selfhosted.jsx b/src/hoc/Selfhosted.jsx
index d9887e8d1..219ad33ac 100644
--- a/src/hoc/Selfhosted.jsx
+++ b/src/hoc/Selfhosted.jsx
@@ -6,7 +6,7 @@ import { isSelfhosted } from 'redux/constants'
import routes from 'routes'
const selfHostedBlacklist = [
- routes.signup, routes.reset_password, routes.new_password_form, routes.main, routes.user_settings, routes.verify, routes.change_email,
+ routes.signup, routes.reset_password, routes.new_password_form, routes.main, routes.user_settings, routes.verify, routes.change_email, routes.billing,
]
const DEFAULT_PAGE = routes.signin
@@ -14,17 +14,14 @@ const DEFAULT_PAGE = routes.signin
const Selfhosted = ({ children }) => {
const navigate = useNavigate()
const location = useLocation()
+
useEffect(() => {
if (isSelfhosted) {
- if (_includes(selfHostedBlacklist, window.location.pathname)) {
- navigate(DEFAULT_PAGE)
- }
-
if (_includes(selfHostedBlacklist, location.pathname)) {
navigate(DEFAULT_PAGE)
}
}
- }, [location])
+ }, [location, navigate])
return <>{children}</>
diff --git a/src/index.js b/src/index.js
index 30f7f6766..933802444 100644
--- a/src/index.js
+++ b/src/index.js
@@ -53,7 +53,7 @@ ReactDOM.render(
<Provider store={store}>
<BrowserRouter>
<I18nextProvider i18n={i18next}>
- <App/>
+ <App />
</I18nextProvider>
</BrowserRouter>
</Provider>
diff --git a/src/pages/MainPage/index.jsx b/src/pages/MainPage/index.jsx
index 6acc621fe..bfa2bc33d 100644
--- a/src/pages/MainPage/index.jsx
+++ b/src/pages/MainPage/index.jsx
@@ -139,7 +139,7 @@ const Main = () => {
<Trans
t={t}
i18nKey='main.signupTerms'
- components={{
+ components={{
tos: <Link to={routes.terms} className='font-medium text-gray-900 dark:text-gray-300 hover:underline' />,
pp: <Link to={routes.privacy} className='font-medium text-gray-900 dark:text-gray-300 hover:underline' />,
}}
@@ -272,4 +272,4 @@ const Main = () => {
)
}
-export default memo(withAuthentication(Main, auth.notAuthenticated))
+export default withAuthentication(memo(Main), auth.notAuthenticated)
diff --git a/src/pages/Project/Settings/ProjectSettings.jsx b/src/pages/Project/Settings/ProjectSettings.jsx
index dbd98f417..facd09609 100644
--- a/src/pages/Project/Settings/ProjectSettings.jsx
+++ b/src/pages/Project/Settings/ProjectSettings.jsx
@@ -29,12 +29,11 @@ const ProjectSettings = ({
loadProjects, isLoading, projects, showError, removeProject, user,
}) => {
const { t } = useTranslation('common')
- const location = useLocation()
const { pathname } = useLocation()
const { id } = useParams()
const project = useMemo(() => _find(projects, p => p.id === id) || {}, [projects, id])
const isSettings = !_isEmpty(id) && (_replace(routes.project_settings, ':id', id) === pathname)
- const history = useNavigate()
+ const navigate = useNavigate()
const [form, setForm] = useState({
name: '',
id: id || nanoid(),
@@ -51,13 +50,13 @@ const ProjectSettings = ({
useEffect(() => {
if (!user.isActive && !isSelfhosted) {
showError(t('project.settings.verify'))
- history(routes.dashboard)
+ navigate(routes.dashboard)
}
if (!isLoading && isSettings && !projectDeleting) {
if (_isEmpty(project) || project?.uiHidden) {
showError(t('project.noExist'))
- history(routes.dashboard)
+ navigate(routes.dashboard)
} else {
setForm({
...project,
@@ -65,7 +64,7 @@ const ProjectSettings = ({
})
}
}
- }, [user, project, isLoading, isSettings, location, showError, projectDeleting, t])
+ }, [user, project, isLoading, isSettings, showError, projectDeleting, t, navigate])
const onSubmit = async (data) => {
if (!projectSaving) {
@@ -85,7 +84,7 @@ const ProjectSettings = ({
}
loadProjects()
- history(routes.dashboard)
+ navigate(routes.dashboard)
} catch (e) {
if (isSettings) {
updateProjectFailed(e)
@@ -106,7 +105,7 @@ const ProjectSettings = ({
await deleteProject(id)
removeProject(id)
projectDeleted()
- history(routes.dashboard)
+ navigate(routes.dashboard)
} catch (e) {
deleteProjectFailed(e)
} finally {
@@ -161,7 +160,7 @@ const ProjectSettings = ({
}
const onCancel = () => {
- history(isSettings ? _replace(routes.project, ':id', id) : routes.dashboard)
+ navigate(isSettings ? _replace(routes.project, ':id', id) : routes.dashboard)
}
const title = isSettings ? `${t('project.settings.settings')} ${form.name}` : t('project.settings.create')