📈 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!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
general improvements, fixes and optimisations
Blue Mouse8f3c80d96c32
diff --git a/package.json b/package.jsonindex 3fe9ff6f2..426d739a4 100644--- a/package.json+++ b/package.json@@ -5,11 +5,11 @@"dependencies": {"@headlessui/react": "^1.4.3","@heroicons/react": "^1.0.5",- "@sentry/react": "^6.16.1",- "@sentry/tracing": "^6.16.1",+ "@sentry/react": "^6.17.3",+ "@sentry/tracing": "^6.17.3","@tailwindcss/forms": "^0.4.0","axios": "^0.25.0",- "billboard.js": "^3.3.0",+ "billboard.js": "^3.3.1","clsx": "^1.1.1","d3": "^7.3.0","dayjs": "^1.10.7",@@ -17,9 +17,9 @@"dom-to-image": "^2.6.0","file-saver": "^2.0.5","i18n-iso-countries": "^7.2.0",- "i18next": "^21.6.6",- "i18next-browser-languagedetector": "^6.1.2",- "i18next-http-backend": "^1.3.1",+ "i18next": "^21.6.10",+ "i18next-browser-languagedetector": "^6.1.3",+ "i18next-http-backend": "^1.3.2","lodash": "^4.17.21","nanoid": "^3.2.0","prismjs": "^1.26.0",@@ -28,7 +28,7 @@"react-alert": "^7.0.3","react-dom": "^17.0.2","react-flagkit": "^2.0.4",- "react-helmet": "^6.1.0",+ "react-helmet-async": "^1.2.2","react-i18next": "^11.15.3","react-redux": "^7.2.6","react-router-dom": "^5.3.0",@@ -72,6 +72,6 @@"cross-env": "^7.0.3","postcss": "^8.4.5","source-map-explorer": "^2.5.2",- "tailwindcss": "^3.0.15"+ "tailwindcss": "^3.0.18"}}diff --git a/public/index.html b/public/index.htmlindex a0f7d6f48..848d98742 100644--- a/public/index.html+++ b/public/index.html@@ -3,6 +3,7 @@<head><meta charset="utf-8" />+ <title>Swetrix Analytics</title><link rel="icon" href="%PUBLIC_URL%/favicon.ico" /><meta name="viewport" content="width=device-width, initial-scale=1" /><meta name="theme-color" content="#818cf8" />@@ -20,7 +21,6 @@<link rel="manifest" href="%PUBLIC_URL%/manifest.json" /><link href="/index.css" rel="stylesheet" /><script src="%PUBLIC_URL%/env.js"></script>- <title>Swetrix Analytics</title></head><body>diff --git a/src/App.js b/src/App.jsindex b5ef2627b..f7492b344 100644--- a/src/App.js+++ b/src/App.js@@ -46,7 +46,17 @@ const Fallback = ({ isMinimalFooter }) => {const [showLoader, setShowLoader] = useState(false)useEffect(() => {- setTimeout(() => setShowLoader(true), 1000)+ let isMounted = true++ setTimeout(() => {+ if (isMounted) {+ setShowLoader(true)+ }+ }, 1000)++ return () => {+ isMounted = false+ }}, [])return (diff --git a/src/components/Title.jsx b/src/components/Title.jsxindex 588b298c6..526e0a4b4 100644--- a/src/components/Title.jsx+++ b/src/components/Title.jsx@@ -1,5 +1,5 @@import React from 'react'-import { Helmet } from 'react-helmet'+import { Helmet } from 'react-helmet-async'import _isEmpty from 'lodash/isEmpty'import PropTypes from 'prop-types'@@ -17,10 +17,12 @@ const Title = ({ title, children }) => {)}+ const displayTitle = `${title} ${TITLE_SUFFIX}`+return (<><Helmet>- <title>{title} {TITLE_SUFFIX}</title>+ <title>{displayTitle}</title></Helmet>{children}</>diff --git a/src/index.js b/src/index.jsindex 933802444..09b66acdb 100644--- a/src/index.js+++ b/src/index.js@@ -4,6 +4,7 @@ import { BrowserRouter } from 'react-router-dom'import { store } from 'redux/store'import { Provider } from 'react-redux'import { I18nextProvider } from 'react-i18next'+import { HelmetProvider } from 'react-helmet-async'import { transitions, positions, Provider as AlertProvider } from 'react-alert'import * as Swetrix from 'swetrix'import * as Sentry from '@sentry/react'@@ -51,11 +52,13 @@ ReactDOM.render(<Sentry.ErrorBoundary fallback={<p>The app crashed, sorry about that.. :(<br />Please, tell us about it at [email protected]<br /><br />To continue using the website, please reload the page.</p>}><AlertProvider template={AlertTemplate} {...options}><Provider store={store}>- <BrowserRouter>- <I18nextProvider i18n={i18next}>- <App />- </I18nextProvider>- </BrowserRouter>+ <HelmetProvider>+ <BrowserRouter>+ <I18nextProvider i18n={i18next}>+ <App />+ </I18nextProvider>+ </BrowserRouter>+ </HelmetProvider></Provider></AlertProvider></Sentry.ErrorBoundary>diff --git a/src/pages/Auth/Signin/Signin.jsx b/src/pages/Auth/Signin/Signin.jsxindex b3fd65320..9a958e7e9 100644--- a/src/pages/Auth/Signin/Signin.jsx+++ b/src/pages/Auth/Signin/Signin.jsx@@ -33,8 +33,10 @@ const Signin = ({ login }) => {const onSubmit = data => {if (!isLoading) {setIsLoading(true)- login(data, () => {- setIsLoading(false)+ login(data, (result) => {+ if (!result) {+ setIsLoading(false)+ }})}}diff --git a/src/pages/Auth/Signup/Signup.jsx b/src/pages/Auth/Signup/Signup.jsxindex ed4882071..02c73f752 100644--- a/src/pages/Auth/Signup/Signup.jsx+++ b/src/pages/Auth/Signup/Signup.jsx@@ -38,8 +38,10 @@ const Signup = ({ signup }) => {const onSubmit = data => {if (!isLoading) {setIsLoading(true)- signup(data, t, () => {- setIsLoading(false)+ signup(data, t, (result) => {+ if (!result) {+ setIsLoading(false)+ }})}}diff --git a/src/pages/Docs/Docs.jsx b/src/pages/Docs/Docs.jsxindex 8847f3bc8..dc55de333 100644--- a/src/pages/Docs/Docs.jsx+++ b/src/pages/Docs/Docs.jsx@@ -158,7 +158,7 @@ const Docs = () => {<Code text={track} language='javascript' /><CSection id='docs-tv' name='trackViews' />- <p className='text-lg text-gray-900 dark:text-gray-50 tracking-tight'>+ <div className='text-lg text-gray-900 dark:text-gray-50 tracking-tight'>{t('docs.tv.call')}<div className='mb-5'><ul className='ml-10'>@@ -179,18 +179,18 @@ const Docs = () => {b: <b />,}}/>- </p>+ </div><Code text={trackPVAPI} language='javascript' /><hr className='mt-10 mb-4' />- <p className='text-lg text-gray-900 dark:text-gray-50 tracking-tight'>+ <div className='text-lg text-gray-900 dark:text-gray-50 tracking-tight'><i>Last updated: December 11, 2021. (v1.3.0)</i><br /><div>- Added ability to specify the <a className='hover:underline text-gray-700 dark:text-gray-300' href='#docs-init'>custom API URL</a> parameter.</div>- </p>+ </div></div></div></div>diff --git a/src/pages/Project/View/ViewProject.jsx b/src/pages/Project/View/ViewProject.jsxindex c0e47b55d..bebad7a6c 100644--- a/src/pages/Project/View/ViewProject.jsx+++ b/src/pages/Project/View/ViewProject.jsx@@ -260,7 +260,7 @@ const ViewProject = ({}return () => clearInterval(interval)- }, [project.id, setLiveStatsForProject])+ }, [project.id, setLiveStatsForProject]) // eslint-disable-line react-hooks/exhaustive-depsuseEffect(() => {if (!isLoading && _isEmpty(project)) {diff --git a/src/redux/sagas/auth/workers/deleteUserAccount.js b/src/redux/sagas/auth/workers/deleteUserAccount.jsindex ecd024836..825203a78 100644--- a/src/redux/sagas/auth/workers/deleteUserAccount.js+++ b/src/redux/sagas/auth/workers/deleteUserAccount.js@@ -7,8 +7,8 @@ import { deleteUser } from 'api'export default function* deleteUserAccountWorker({ payload: { errorCallback, successCallback } }) {try {yield call(deleteUser)- yield put(authActions.deleteAccountSuccess())yield call(successCallback)+ yield put(authActions.deleteAccountSuccess())yield put(alertsActions.accountDeleted('Your account has been deleted'))} catch (e) {errorCallback(JSON.parse(e.message))diff --git a/src/redux/sagas/auth/workers/signup.js b/src/redux/sagas/auth/workers/signup.jsindex 181e3ba32..4ae2a5979 100644--- a/src/redux/sagas/auth/workers/signup.js+++ b/src/redux/sagas/auth/workers/signup.js@@ -11,8 +11,6 @@ export default function* signupWorder({ payload: { data: rawData, callback, t }const { repeat, ...data } = rawDataconst response = yield call(signup, data)- console.log(response)-yield put(authActions.signupSuccess(response.user))yield call(setAccessToken, response.access_token)yield put(UIActions.loadProjects())diff --git a/src/ui/Dropdown.jsx b/src/ui/Dropdown.jsxindex 29a6b074f..bfa80ffab 100644--- a/src/ui/Dropdown.jsx+++ b/src/ui/Dropdown.jsx@@ -59,7 +59,9 @@ const Dropdown = ({)Dropdown.propTypes = {- title: PropTypes.string.isRequired,+ title: PropTypes.oneOfType([+ PropTypes.string, PropTypes.node,+ ]).isRequired,onSelect: PropTypes.func.isRequired,items: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.object,diff --git a/src/ui/Tooltip.jsx b/src/ui/Tooltip.jsxindex 7862b690e..5476f5b7c 100644--- a/src/ui/Tooltip.jsx+++ b/src/ui/Tooltip.jsx@@ -4,13 +4,13 @@ import { QuestionMarkCircleIcon } from '@heroicons/react/solid'import cx from 'clsx'const Tooltip = ({ text, className }) => (- <div class={cx('w-5 h-5 relative flex flex-col items-center group', className)}>+ <div className={cx('w-5 h-5 relative flex flex-col items-center group', className)}><QuestionMarkCircleIcon className='w-5 h-5 text-gray-700 dark:text-gray-300' />- <div class='absolute bottom-0 flex-col items-center hidden mb-6 group-hover:flex'>- <span class='opacity-95 relative w-60 z-10 p-2 text-xs leading-none text-white whitespace-no-wrap bg-gray-700 shadow-lg rounded-md'>+ <div className='absolute bottom-0 flex-col items-center hidden mb-6 group-hover:flex'>+ <span className='opacity-95 relative w-60 z-10 p-2 text-xs leading-none text-white whitespace-no-wrap bg-gray-700 shadow-lg rounded-md'>{text}</span>- <div class='w-3 h-3 -mt-2 rotate-45 bg-gray-700 opacity-95'></div>+ <div className='w-3 h-3 -mt-2 rotate-45 bg-gray-700 opacity-95'></div></div></div>)