📈 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
Using NavLink & HashLink
Blue Mouse666261fff363
diff --git a/package.json b/package.jsonindex b11affbe7..09d5db1c2 100644--- a/package.json+++ b/package.json@@ -30,6 +30,7 @@"react-helmet": "^6.1.0","react-redux": "^7.2.2","react-router-dom": "^5.2.0",+ "react-router-hash-link": "^2.4.3","react-scripts": "4.0.3","redux": "^4.0.5","redux-auth-wrapper": "^3.0.0",diff --git a/src/components/Header/index.jsx b/src/components/Header/index.jsxindex 5c7e1f9f6..a5fcfc2ef 100644--- a/src/components/Header/index.jsx+++ b/src/components/Header/index.jsx@@ -1,6 +1,6 @@import React, { memo } from 'react'-import cx from 'classnames'-import { Link, useLocation } from 'react-router-dom'+import { Link, NavLink } from 'react-router-dom'+import { HashLink } from 'react-router-hash-link'import { useDispatch } from 'react-redux'import routes from 'routes'@@ -8,7 +8,6 @@ import { authActions } from 'redux/actions/auth'const Header = ({ authenticated }) => {const dispatch = useDispatch()- const { pathname } = useLocation()const logoutHandler = () => {dispatch(authActions.logout())@@ -24,26 +23,16 @@ const Header = ({ authenticated }) => {<img className='h-10 w-auto' src='https://tailwindui.com/img/logos/workflow-mark.svg?color=white' alt='' /></Link><div className='hidden ml-10 space-x-1 lg:block'>- <Link to='/' className={cx('text-base font-medium text-white hover:text-indigo-50 py-2 px-3 hover:bg-indigo-500 rounded-md', {- 'bg-indigo-700 hover:bg-indigo-700': pathname === routes.NON_EXISTENT_YET,- })} key='Features'>Features</Link>- <Link to='/' className={cx('text-base font-medium text-white hover:text-indigo-50 py-2 px-3 hover:bg-indigo-500 rounded-md', {- 'bg-indigo-700 hover:bg-indigo-700': pathname === routes.NON_EXISTENT_YET,- })} key='Pricing'>Pricing</Link>- <Link to='/' className={cx('text-base font-medium text-white hover:text-indigo-50 py-2 px-3 hover:bg-indigo-500 rounded-md', {- 'bg-indigo-700 hover:bg-indigo-700': pathname === routes.NON_EXISTENT_YET,- })} key='FAQs'>FAQs</Link>- <Link to={routes.docs} className={cx('text-base font-medium text-white hover:text-indigo-50 py-2 px-3 hover:bg-indigo-500 rounded-md', {- 'bg-indigo-700 hover:bg-indigo-700': pathname === routes.docs,- })} key='Docs'>Docs</Link>+ <NavLink to={routes.features} className='text-base font-medium text-white hover:text-indigo-50 py-2 px-3 hover:bg-indigo-500 rounded-md' activeClassName='bg-indigo-700 hover:bg-indigo-700' key='Features'>Features</NavLink>+ <HashLink to={`${routes.main}#pricing`} className='text-base font-medium text-white hover:text-indigo-50 py-2 px-3 hover:bg-indigo-500 rounded-md' key='Pricing'>Pricing</HashLink>+ <HashLink to={`${routes.main}#faqs`} className='text-base font-medium text-white hover:text-indigo-50 py-2 px-3 hover:bg-indigo-500 rounded-md' key='FAQs'>FAQs</HashLink>+ <NavLink to={routes.docs} className='text-base font-medium text-white hover:text-indigo-50 py-2 px-3 hover:bg-indigo-500 rounded-md' activeClassName='bg-indigo-700 hover:bg-indigo-700' key='Docs'>Docs</NavLink></div></div><div className='ml-10 space-x-4'>{authenticated ? (<>- <Link to={routes.user_settings} className={cx('text-base font-medium text-white hover:text-indigo-50 py-2 px-3 hover:bg-indigo-500 rounded-md', {- 'bg-indigo-700 hover:bg-indigo-700': pathname === routes.user_settings,- })}>You</Link>+ <NavLink to={routes.user_settings} className='text-base font-medium text-white hover:text-indigo-50 py-2 px-3 hover:bg-indigo-500 rounded-md' activeClassName='bg-indigo-700 hover:bg-indigo-700'>You</NavLink><Link to={routes.dashboard} className='inline-block bg-white py-2 px-4 border border-transparent rounded-md text-base font-medium text-indigo-600 hover:bg-indigo-50'>Dashboard</Link><Link to='#' className='text-base font-medium text-white hover:text-indigo-50 py-2 px-3 hover:bg-indigo-500 rounded-md' onClick={logoutHandler}>Logout</Link></>@@ -56,18 +45,10 @@ const Header = ({ authenticated }) => {</div></div><div className='py-4 flex flex-wrap justify-center space-x-2 lg:hidden'>- <Link to='/' className={cx('text-base font-medium text-white hover:text-indigo-50 py-1 px-3 hover:bg-indigo-500 rounded-md', {- 'bg-indigo-700 hover:bg-indigo-700': pathname === routes.NON_EXISTENT_YET,- })} key='Features'>Features</Link>- <Link to='/' className={cx('text-base font-medium text-white hover:text-indigo-50 py-1 px-3 hover:bg-indigo-500 rounded-md', {- 'bg-indigo-700 hover:bg-indigo-700': pathname === routes.NON_EXISTENT_YET,- })} key='Pricing'>Pricing</Link>- <Link to='/' className={cx('text-base font-medium text-white hover:text-indigo-50 py-1 px-3 hover:bg-indigo-500 rounded-md', {- 'bg-indigo-700 hover:bg-indigo-700': pathname === routes.NON_EXISTENT_YET,- })} key='FAQs'>FAQs</Link>- <Link to='/' className={cx('text-base font-medium text-white hover:text-indigo-50 py-1 px-3 hover:bg-indigo-500 rounded-md', {- 'bg-indigo-700 hover:bg-indigo-700': pathname === routes.docs,- })} key='Docs'>Docs</Link>+ <NavLink to={routes.features} className='text-base font-medium text-white hover:text-indigo-50 py-1 px-3 hover:bg-indigo-500 rounded-md' activeClassName='bg-indigo-700 hover:bg-indigo-700' key='Features'>Features</NavLink>+ <HashLink to={`${routes.main}#pricing`} className='text-base font-medium text-white hover:text-indigo-50 py-1 px-3 hover:bg-indigo-500 rounded-md' key='Pricing'>Pricing</HashLink>+ <HashLink to={`${routes.main}#faqs`} className='text-base font-medium text-white hover:text-indigo-50 py-1 px-3 hover:bg-indigo-500 rounded-md' key='FAQs'>FAQs</HashLink>+ <NavLink to={routes.docs} className='text-base font-medium text-white hover:text-indigo-50 py-1 px-3 hover:bg-indigo-500 rounded-md' activeClassName='bg-indigo-700 hover:bg-indigo-700' key='Docs'>Docs</NavLink></div></nav></header>diff --git a/src/pages/MainPage/Pricing.jsx b/src/pages/MainPage/Pricing.jsxindex d51d4fba9..8e6149343 100644--- a/src/pages/MainPage/Pricing.jsx+++ b/src/pages/MainPage/Pricing.jsx@@ -1,4 +1,4 @@-import React, { memo } from 'react'+import React from 'react'import { Link } from 'react-router-dom'import { CheckIcon } from '@heroicons/react/solid'import _map from 'lodash/map'@@ -51,17 +51,16 @@ const tiers = [},]-const Pricing = () => {- return (- <div className='bg-white'>- <div className='max-w-7xl mx-auto py-24 px-4 sm:px-6 lg:px-8'>- <div className='sm:flex sm:flex-col sm:align-center'>- <h1 className='text-3xl font-extrabold text-gray-900 sm:text-center'>Pricing Plans</h1>- <p className='mt-5 text-xl text-gray-500 sm:text-center'>- Start out for free, no credit card needed.<br />+const Pricing = () => (+ <div id='pricing' className='bg-white'>+ <div className='max-w-7xl mx-auto py-24 px-4 sm:px-6 lg:px-8'>+ <div className='sm:flex sm:flex-col sm:align-center'>+ <h1 className='text-3xl font-extrabold text-gray-900 sm:text-center'>Pricing Plans</h1>+ <p className='mt-5 text-xl text-gray-500 sm:text-center'>+ Start out for free, no credit card needed.<br />When your business grows, you can upgrade your plan at any time.</p>- {/* <div className='relative self-center mt-6 bg-gray-100 rounded-lg p-0.5 flex sm:mt-8'>+ {/* <div className='relative self-center mt-6 bg-gray-100 rounded-lg p-0.5 flex sm:mt-8'><buttontype='button'className='relative w-1/2 bg-white border-gray-200 rounded-md shadow-sm py-2 text-sm font-medium text-gray-900 whitespace-nowrap focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:z-10 sm:w-auto sm:px-8'@@ -75,55 +74,54 @@ const Pricing = () => {Yearly billing</button></div> */}- </div>- <div className='mt-12 space-y-4 sm:mt-16 sm:space-y-0 sm:grid sm:grid-cols-2 sm:gap-6 lg:max-w-4xl lg:mx-auto xl:max-w-none xl:mx-0 xl:grid-cols-4'>- {_map(tiers, (tier) => (- <div key={tier.name} className='border border-gray-200 rounded-lg shadow-sm divide-y divide-gray-200'>- <div className='p-6'>- <h2 className='text-lg leading-6 font-medium text-gray-900'>{tier.name}</h2>- <p className='mt-4'>- {_isNil(tier.priceMonthly) ? (- <span className='text-4xl font-extrabold text-gray-900'>Free</span>- ) : (- <>- <span className='text-4xl font-extrabold text-gray-900'>${tier.priceMonthly}</span>{' '}- <span className='text-base font-medium text-gray-500'>/mo</span>- </>- )}- </p>- {_isNil(tier.priceMonthly) ? (- <Link- className='mt-8 block w-full bg-indigo-600 rounded-md py-2 text-sm font-semibold text-white text-center hover:bg-indigo-700'- to={routes.signup}- >- Get started- </Link>- ) : (- <a- href={tier.href}- className='mt-8 block w-full bg-indigo-600 rounded-md py-2 text-sm font-semibold text-white text-center hover:bg-indigo-700'- >- Buy {tier.name}- </a>- )}- </div>- <div className='pt-6 pb-8 px-6'>- <h3 className='text-xs font-medium text-gray-900 tracking-wide uppercase'>What's included</h3>- <ul className='mt-6 space-y-4'>- {_map(tier.includedFeatures, (feature) => (- <li key={feature} className='flex space-x-3'>- <CheckIcon className='flex-shrink-0 h-5 w-5 text-green-500' aria-hidden='true' />- <span className='text-sm text-gray-500'>{feature}</span>- </li>- ))}- </ul>- </div>+ </div>+ <div className='mt-12 space-y-4 sm:mt-16 sm:space-y-0 sm:grid sm:grid-cols-2 sm:gap-6 lg:max-w-4xl lg:mx-auto xl:max-w-none xl:mx-0 xl:grid-cols-4'>+ {_map(tiers, (tier) => (+ <div key={tier.name} className='border border-gray-200 rounded-lg shadow-sm divide-y divide-gray-200'>+ <div className='p-6'>+ <h2 className='text-lg leading-6 font-medium text-gray-900'>{tier.name}</h2>+ <p className='mt-4'>+ {_isNil(tier.priceMonthly) ? (+ <span className='text-4xl font-extrabold text-gray-900'>Free</span>+ ) : (+ <>+ <span className='text-4xl font-extrabold text-gray-900'>${tier.priceMonthly}</span>{' '}+ <span className='text-base font-medium text-gray-500'>/mo</span>+ </>+ )}+ </p>+ {_isNil(tier.priceMonthly) ? (+ <Link+ className='mt-8 block w-full bg-indigo-600 rounded-md py-2 text-sm font-semibold text-white text-center hover:bg-indigo-700'+ to={routes.signup}+ >+ Get started+ </Link>+ ) : (+ <a+ href={tier.href}+ className='mt-8 block w-full bg-indigo-600 rounded-md py-2 text-sm font-semibold text-white text-center hover:bg-indigo-700'+ >+ Buy {tier.name}+ </a>+ )}+ </div>+ <div className='pt-6 pb-8 px-6'>+ <h3 className='text-xs font-medium text-gray-900 tracking-wide uppercase'>What's included</h3>+ <ul className='mt-6 space-y-4'>+ {_map(tier.includedFeatures, (feature) => (+ <li key={feature} className='flex space-x-3'>+ <CheckIcon className='flex-shrink-0 h-5 w-5 text-green-500' aria-hidden='true' />+ <span className='text-sm text-gray-500'>{feature}</span>+ </li>+ ))}+ </ul></div>- ))}- </div>+ </div>+ ))}</div></div>- )-}+ </div>+)-export default memo(Pricing)+export default Pricingdiff --git a/src/pages/MainPage/index.jsx b/src/pages/MainPage/index.jsxindex c39e646b4..2cedfb27d 100644--- a/src/pages/MainPage/index.jsx+++ b/src/pages/MainPage/index.jsx@@ -1,5 +1,7 @@-import React, { memo } from 'react'+import React from 'react'+import { Link } from 'react-router-dom'+import routes from 'routes'import Title from 'components/Title'import SignUp from '../Auth/Signup/BasicSignup'import Pricing from './Pricing'@@ -83,11 +85,11 @@ const SquareDots = ({ className }) => ()const FAQs = () => (- <div className='bg-gray-50'>+ <div id='faqs' className='bg-gray-50'><div className='w-11/12 mx-auto py-16 px-4 sm:px-6 lg:py-20 lg:px-8'><div className='lg:grid lg:grid-cols-3 lg:gap-8'><div>- <h2 className='text-3xl font-extrabold text-gray-900'>Frequently asked questions</h2>+ <h2 className='text-3xl font-extrabold text-gray-900'>Get some questions answered</h2><p className='mt-4 text-lg text-gray-500'>Can’t find the answer you’re looking for? Reach out to our{' '}<a href='#/' className='font-medium text-indigo-600 hover:text-indigo-500'>@@ -129,126 +131,124 @@ const Features = () => (</div>)-const Main = () => {- return (- <Title title='Privacy Respecting Web Analytics Platform'>- <div className='relative bg-gray-800'>- <SquareDots className='absolute bottom-0 left-0 transform translate-x-0 mb-0 text-gray-700 lg:top-0 xl:transform-none lg:mt-72' />- <SquareDots className='absolute bottom-0 right-0 transform translate-x-1/2 mb-48 text-gray-700 lg:top-0 lg:mb-0 xl:transform-none xl:translate-x-0 lg:mt-16' />- <div className='relative pt-6 pb-16 sm:pb-24'>- <main className='mt-16 sm:mt-24'>- <div className='mx-auto w-11/12'>- <div className='lg:grid lg:grid-cols-12 lg:gap-8'>- <div className='px-4 sm:px-6 sm:text-center md:max-w-2xl md:mx-auto lg:col-span-6 lg:text-left lg:flex lg:items-center'>- <div>- <h1 className='mt-4 text-4xl tracking-tight font-extrabold text-white sm:mt-5 sm:leading-none lg:mt-6 lg:text-5xl xl:text-6xl'>- <span className='text-indigo-400'>Powerful</span>{' '}- <span>analytics platform that respects</span>{' '}- <span className='text-indigo-400'>user privacy</span>- </h1>- <p className='mt-3 text-base text-gray-300 sm:mt-5 sm:text-xl lg:text-lg xl:text-xl'>- Swetrix brings an advanced and customisable analytics service for your web applications.<br />+const Main = () => (+ <Title title='Privacy Respecting Web Analytics Platform'>+ <div className='relative bg-gray-800'>+ <SquareDots className='absolute bottom-0 left-0 transform translate-x-0 mb-0 text-gray-700 lg:top-0 xl:transform-none lg:mt-72' />+ <SquareDots className='absolute bottom-0 right-0 transform translate-x-1/2 mb-48 text-gray-700 lg:top-0 lg:mb-0 xl:transform-none xl:translate-x-0 lg:mt-16' />+ <div className='relative pt-6 pb-16 sm:pb-24'>+ <main className='mt-16 sm:mt-24'>+ <div className='mx-auto w-11/12'>+ <div className='lg:grid lg:grid-cols-12 lg:gap-8'>+ <div className='px-4 sm:px-6 sm:text-center md:max-w-2xl md:mx-auto lg:col-span-6 lg:text-left lg:flex lg:items-center'>+ <div>+ <h1 className='mt-4 text-4xl tracking-tight font-extrabold text-white sm:mt-5 sm:leading-none lg:mt-6 lg:text-5xl xl:text-6xl'>+ <span className='text-indigo-400'>Powerful</span>{' '}+ <span>analytics platform that respects</span>{' '}+ <span className='text-indigo-400'>user privacy</span>+ </h1>+ <p className='mt-3 text-base text-gray-300 sm:mt-5 sm:text-xl lg:text-lg xl:text-xl'>+ Swetrix brings an advanced and customisable analytics service for your web applications.<br />Track every metric your bisuness needs without invading your users privacy.</p>- </div></div>- <div className='mt-16 sm:mt-24 lg:mt-0 lg:col-span-6'>- <div className='bg-white sm:max-w-md sm:w-full sm:mx-auto sm:rounded-lg sm:overflow-hidden'>- <div className='px-4 py-8 sm:px-10'>- <p className='text-lg text-gray-900 text-center'>Sign up, it's free!</p>- <div className='mt-6'>- <SignUp />- </div>+ </div>+ <div className='mt-16 sm:mt-24 lg:mt-0 lg:col-span-6'>+ <div className='bg-white sm:max-w-md sm:w-full sm:mx-auto sm:rounded-lg sm:overflow-hidden'>+ <div className='px-4 py-8 sm:px-10'>+ <p className='text-lg text-gray-900 text-center'>Sign up, it's free!</p>+ <div className='mt-6'>+ <SignUp /></div>- <div className='px-4 py-6 bg-gray-50 border-t-2 border-gray-200 sm:px-10'>- <p className='text-xs leading-5 text-gray-500'>- By signing up, you agree to our{' '}- <a href='#/' className='font-medium text-gray-900 hover:underline'>- Terms of Service+ </div>+ <div className='px-4 py-6 bg-gray-50 border-t-2 border-gray-200 sm:px-10'>+ <p className='text-xs leading-5 text-gray-500'>+ By signing up, you agree to our{' '}+ <a href='#/' className='font-medium text-gray-900 hover:underline'>+ Terms of Service</a>- {' '}and{' '}- <a href='#/' className='font-medium text-gray-900 hover:underline'>- Privacy Policy+ {' '}and{' '}+ <a href='#/' className='font-medium text-gray-900 hover:underline'>+ Privacy Policy</a>.</p>- </div></div></div></div></div>- </main>- </div>-- <div className='relative'>- <div className='absolute inset-0 flex flex-col' aria-hidden='true'>- <div className='flex-1' />- <div className='flex-1 w-full bg-white' />- </div>- <div className='w-11/12 mx-auto px-4 sm:px-6'>- <img- className='relative rounded-lg shadow-lg'- src='/assets/test_screenshot.png'- alt='App screenshot'- /></div>+ </main>+ </div>++ <div className='relative'>+ <div className='absolute inset-0 flex flex-col' aria-hidden='true'>+ <div className='flex-1' />+ <div className='flex-1 w-full bg-white' />+ </div>+ <div className='w-11/12 mx-auto px-4 sm:px-6'>+ <img+ className='relative rounded-lg shadow-lg'+ src='/assets/test_screenshot.png'+ alt='App screenshot'+ /></div>+ </div>- <Features />- <div className='bg-indigo-600'>- <div className='w-11/12 mx-auto pb-16 pt-12 px-4 sm:px-6 lg:w-11/12 lg:px-8 lg:flex lg:items-center lg:justify-between'>- <h2 className='text-3xl sm:text-4xl font-extrabold tracking-tight text-gray-900'>- <span className='block text-white'>Want to know more technical details?</span>- <span className='block text-gray-300'>- Look at the documentation and features pags.+ <Features />+ <div className='bg-indigo-600'>+ <div className='w-11/12 mx-auto pb-16 pt-12 px-4 sm:px-6 lg:w-11/12 lg:px-8 lg:flex lg:items-center lg:justify-between'>+ <h2 className='text-3xl sm:text-4xl font-extrabold tracking-tight text-gray-900'>+ <span className='block text-white'>Want to know more technical details?</span>+ <span className='block text-gray-300'>+ Look at the documentation and features pags.</span>- </h2>- <div className='mt-6 space-y-4 sm:space-y-0 sm:flex sm:space-x-5'>- <a- href='#/'- className='flex items-center justify-center px-3 py-2 border border-transparent text-lg font-medium rounded-md shadow-sm text-indigo-800 bg-indigo-50 hover:bg-indigo-100'- >- Features- </a>- <a- href='#/'- className='flex items-center justify-center px-3 py-2 border border-transparent text-lg font-medium rounded-md shadow-sm text-indigo-800 bg-indigo-50 hover:bg-indigo-100'- >- Docs- </a>- </div>+ </h2>+ <div className='mt-6 space-y-4 sm:space-y-0 sm:flex sm:space-x-5'>+ <Link+ to={routes.features}+ className='flex items-center justify-center px-3 py-2 border border-transparent text-lg font-medium rounded-md shadow-sm text-indigo-800 bg-indigo-50 hover:bg-indigo-100'+ >+ Features+ </Link>+ <Link+ to={routes.docs}+ className='flex items-center justify-center px-3 py-2 border border-transparent text-lg font-medium rounded-md shadow-sm text-indigo-800 bg-indigo-50 hover:bg-indigo-100'+ >+ Docs+ </Link></div></div>- <Pricing />- <FAQs />+ </div>+ <Pricing />+ <FAQs />- <div className='bg-white'>- <div className='w-11/12 mx-auto pb-16 pt-12 px-4 sm:px-6 lg:w-11/12 lg:px-8 lg:flex lg:items-center lg:justify-between'>- <h2 className='text-3xl sm:text-4xl font-extrabold tracking-tight text-gray-900'>- <span className='block'>Ready to get started?</span>- <span className='block bg-gradient-to-r from-purple-600 to-indigo-600 bg-clip-text text-transparent'>- Explore our service or create an account.+ <div className='bg-white'>+ <div className='w-11/12 mx-auto pb-16 pt-12 px-4 sm:px-6 lg:w-11/12 lg:px-8 lg:flex lg:items-center lg:justify-between'>+ <h2 className='text-3xl sm:text-4xl font-extrabold tracking-tight text-gray-900'>+ <span className='block'>Ready to get started?</span>+ <span className='block bg-gradient-to-r from-purple-600 to-indigo-600 bg-clip-text text-transparent'>+ Explore our service or create an account.</span>- </h2>- <div className='mt-6 space-y-4 sm:space-y-0 sm:flex sm:space-x-5'>- <a- href='#/'- className='flex items-center justify-center bg-gradient-to-r from-purple-600 to-indigo-600 bg-origin-border px-4 py-3 border border-transparent text-base font-medium rounded-md shadow-sm text-white hover:from-purple-700 hover:to-indigo-700'- >- Learn more- </a>- <a- href='#/'- className='flex items-center justify-center px-4 py-3 border border-transparent text-base font-medium rounded-md shadow-sm text-indigo-800 bg-indigo-50 hover:bg-indigo-100'- >- Get started- </a>- </div>+ </h2>+ <div className='mt-6 space-y-4 sm:space-y-0 sm:flex sm:space-x-5'>+ <Link+ to={routes.features}+ className='flex items-center justify-center bg-gradient-to-r from-purple-600 to-indigo-600 bg-origin-border px-4 py-3 border border-transparent text-base font-medium rounded-md shadow-sm text-white hover:from-purple-700 hover:to-indigo-700'+ >+ Learn more+ </Link>+ <Link+ to={routes.signup}+ className='flex items-center justify-center px-4 py-3 border border-transparent text-base font-medium rounded-md shadow-sm text-indigo-800 bg-indigo-50 hover:bg-indigo-100'+ >+ Get started+ </Link></div></div></div>- </Title>- )-}+ </div>+ </Title>+)-export default memo(Main)+export default Maindiff --git a/src/pages/MainPage/styles.scss b/src/pages/MainPage/styles.scssdeleted file mode 100644index e69de29bb..000000000