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!

Created a test main page

Blue Mousef8232840f7a5
diff --git a/public/assets/test_screenshot.png b/public/assets/test_screenshot.png
new file mode 100644
index 000000000..5ac6ebfcf
Binary files /dev/null and b/public/assets/test_screenshot.png differ
diff --git a/public/index.html b/public/index.html
index 427f40281..904c3c91f 100644
--- a/public/index.html
+++ b/public/index.html
@@ -24,7 +24,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
- <title>React App</title>
+ <title>Swetrix Analytics</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
diff --git a/src/pages/Auth/Signup/BasicSignup.jsx b/src/pages/Auth/Signup/BasicSignup.jsx
new file mode 100644
index 000000000..d10ec709f
--- /dev/null
+++ b/src/pages/Auth/Signup/BasicSignup.jsx
@@ -0,0 +1,109 @@
+import React, { memo, useState, useEffect } from 'react'
+import { useDispatch } from 'react-redux'
+import { authActions } from 'redux/actions/auth'
+
+import Input from 'ui/Input'
+import Button from 'ui/Button'
+import { isValidEmail, isValidPassword } from 'utils/validator'
+
+const BasicSignup = () => {
+ const dispatch = useDispatch()
+ const [form, setForm] = useState({
+ email: '',
+ password: '',
+ repeat: '',
+ tos: true,
+ keep_signedin: true,
+ })
+ const [validated, setValidated] = useState(false)
+ const [errors, setErrors] = useState({})
+ const [beenSubmitted, setBeenSubmitted] = useState(false)
+
+ const onSubmit = (data) => {
+ delete data.repeat
+ dispatch(authActions.signupAsync(data, () => { }))
+ }
+
+ useEffect(() => {
+ validate()
+ }, [form]) // eslint-disable-line
+
+ const handleInput = (event) => {
+ const { name, value } = event.target
+
+ setForm(form => ({
+ ...form,
+ [name]: value,
+ }))
+ }
+
+ const handleSubmit = e => {
+ e.preventDefault()
+ e.stopPropagation()
+ setBeenSubmitted(true)
+
+ if (validated) {
+ onSubmit(form)
+ }
+ }
+
+ const validate = () => {
+ const allErrors = {}
+
+ if (!isValidEmail(form.email)) {
+ allErrors.email = 'Please provide a valid email.'
+ }
+
+ if (!isValidPassword(form.password)) {
+ allErrors.password = 'The password has to consist of at least 8 characters.'
+ }
+
+ if (form.password !== form.repeat || form.repeat === '') {
+ allErrors.repeat = 'Passwords have to match.'
+ }
+
+ const valid = Object.keys(allErrors).length === 0
+
+ setErrors(allErrors)
+ setValidated(valid)
+ }
+
+ return (
+ <form className='space-y-6' onSubmit={handleSubmit}>
+ <Input
+ name='email'
+ id='email'
+ type='email'
+ value={form.email}
+ placeholder='Email address'
+ onChange={handleInput}
+ error={beenSubmitted && errors.email}
+ />
+ <Input
+ name='password'
+ id='password'
+ type='password'
+ value={form.password}
+ placeholder='Password'
+ className='mt-4'
+ onChange={handleInput}
+ error={beenSubmitted && errors.password}
+ />
+ <Input
+ name='repeat'
+ id='repeat'
+ type='password'
+ value={form.repeat}
+ placeholder='Repeat password'
+ className='mt-4'
+ onChange={handleInput}
+ error={beenSubmitted && errors.repeat}
+ />
+ <Button className='w-full flex justify-center' type='submit' primary large>
+ Create your account
+ </Button>
+ </form>
+ )
+}
+
+export default memo(BasicSignup)
diff --git a/src/pages/MainPage/index.jsx b/src/pages/MainPage/index.jsx
index 3c803125e..62b336895 100644
--- a/src/pages/MainPage/index.jsx
+++ b/src/pages/MainPage/index.jsx
@@ -1,15 +1,225 @@
import React from 'react'
+import SignUp from '../Auth/Signup/BasicSignup'
+
+// const SquareDots = ({ className }) => (
+// <div className='hidden sm:block sm:absolute sm:inset-0' aria-hidden='true'>
+// <svg
+// className={className}
+// width={364}
+// height={384}
+// viewBox='0 0 364 384'
+// fill='none'
+// >
+// <defs>
+// <pattern
+// id='eab71dd9-9d7a-47bd-8044-256344ee00d0'
+// x={0}
+// y={0}
+// width={20}
+// height={20}
+// patternUnits='userSpaceOnUse'
+// >
+// <rect x={0} y={0} width={4} height={4} fill='currentColor' />
+// </pattern>
+// </defs>
+// <rect width={364} height={384} fill='url(#eab71dd9-9d7a-47bd-8044-256344ee00d0)' />
+// </svg>
+// </div>
+// )
+
+const features = [
+ {
+ id: 1,
+ name: 'Simple yet powerful',
+ description: 'View all your analytics in a simple and straightforward way. Say no more to confusing reports, metrics and notifications.',
+ },
+ {
+ id: 2,
+ name: 'Open source',
+ description: 'Our tracking script is open sourced and available for everybody to explore. We only track data that we declare.',
+ },
+ {
+ id: 3,
+ name: 'Full event tracking',
+ description: 'With us you can not only track your traffic, but also custom events such as button clicks or registrations.',
+ },
+ {
+ id: 4,
+ name: 'No cookie banners needed',
+ description: 'We don\'t do targeted advertising or profiling, and we don\'t rely on cookies at all. Our business model is to sell software, not data.',
+ },
+ {
+ id: 5,
+ name: 'We are fast',
+ description: 'We use the fastest and most advanced technology in our applications, and our analytics script loads times faster than the competitors.',
+ },
+ {
+ id: 6,
+ name: 'Compare, explore and enjoy the data',
+ description: 'You can view data by selected categories and also correlate statistics, such as separating unique users from regular page views.',
+ },
+]
+
+const faqs = [
+ {
+ question: 'Question 1?',
+ answer: 'Blah blah blah blah blah.',
+ },
+ {
+ question: 'Question 2?',
+ answer: 'Blah blah blah blah blah.',
+ },
+ {
+ question: 'Question 3?',
+ answer: 'Blah blah blah blah blah.',
+ },
+ {
+ question: 'Question 4?',
+ answer: 'Blah blah blah blah blah.',
+ },
+]
+
+const FAQs = () => (
+ <div className='bg-gray-50'>
+ <div className='max-w-7xl 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>
+ <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'>
+ customer support
+ </a>{' '}
+ team.
+ </p>
+ </div>
+ <div className='mt-12 lg:mt-0 lg:col-span-2'>
+ <dl className='space-y-12'>
+ {faqs.map((faq) => (
+ <div key={faq.question}>
+ <dt className='text-lg leading-6 font-medium text-gray-900'>{faq.question}</dt>
+ <dd className='mt-2 text-base text-gray-500'>{faq.answer}</dd>
+ </div>
+ ))}
+ </dl>
+ </div>
+ </div>
+ </div>
+ </div>
+)
+
+const Features = () => (
+ <div className='bg-white'>
+ <div className='max-w-7xl mx-auto py-16 px-4 sm:py-24 sm:px-6 lg:px-8'>
+ <h2 className='text-3xl font-extrabold text-gray-900 text-center'>Why us</h2>
+ <div className='mt-12'>
+ <dl className='space-y-10 md:space-y-0 md:grid md:grid-cols-2 md:grid-rows-2 md:gap-x-8 md:gap-y-12 lg:grid-cols-3'>
+ {features.map((faq) => (
+ <div key={faq.id}>
+ <dt className='text-lg leading-6 font-semibold text-gray-900'>{faq.name}</dt>
+ <dd className='mt-2 text-base text-gray-500'>{faq.description}</dd>
+ </div>
+ ))}
+ </dl>
+ </div>
+ </div>
+ </div>
+)
+
const Main = () => {
return (
- <>
- <div className='pricing-header px-3 py-3 pt-md-5 pb-md-4 mx-auto text-center'>
- <h1 className='display-4'>Analytics</h1>
- <p className='lead'>
- Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
- </p>
+ <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 max-w-7xl'>
+ <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 md:block'>Powerful</span>{' '}
+ <span className='md:block'>analytics platform that respects</span>{' '}
+ <span className='text-indigo-400 md:block'>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='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
+ </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='max-w-7xl 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 />
+
+ <FAQs />
+
+ <div className='bg-white'>
+ <div className='max-w-4xl mx-auto py-16 px-4 sm:px-6 sm:py-24 lg:max-w-7xl lg:px-8 lg:flex lg:items-center lg:justify-between'>
+ <h2 className='text-4xl font-extrabold tracking-tight text-gray-900 sm:text-4xl'>
+ <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>
+ </div>
</div>
- </>
+ </div>
)
}