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!

Other updates

Blaumausc60374d9fef4
diff --git a/src/App.js b/src/App.js
index 6f7e240c5..51a1f2002 100644
--- a/src/App.js
+++ b/src/App.js
@@ -13,6 +13,8 @@ import CreateNewPassword from 'pages/Auth/CreateNewPassword'
import Dashboard from 'pages/Dashboard'
import UserSettings from 'pages/UserSettings'
import VerifyEmail from 'pages/Auth/VerifyEmail'
+import NewProject from 'pages/Project/Create'
+import ViewProject from 'pages/Project/View'
import { isAuthenticated, notAuthenticated } from './hoc/protected'
import { getAccessToken } from 'utils/accessToken'
@@ -27,6 +29,8 @@ const ProtectedForgotPassword = notAuthenticated(ForgotPassword)
const ProtectedNewPasswordForm = notAuthenticated(CreateNewPassword)
const ProtectedDashboard = isAuthenticated(Dashboard)
const ProtectedUserSettings = isAuthenticated(UserSettings)
+const ProtectedNewProject = isAuthenticated(NewProject)
+const ProtectedViewProject = isAuthenticated(ViewProject)
const App = () => {
const dispatch = useDispatch()
@@ -82,6 +86,8 @@ const App = () => {
<Route path={routes.change_email} component={VerifyEmail} exact />
<Route path={routes.reset_password} component={ProtectedForgotPassword} exact />
<Route path={routes.new_password_form} component={ProtectedNewPasswordForm} exact />
+ <Route path={routes.new_project} component={ProtectedNewProject} exact />
+ <Route path={routes.project} component={ProtectedViewProject} exact />
<Redirect to={routes.main} />
</Switch>
</>
diff --git a/src/components/Header/index.jsx b/src/components/Header/index.jsx
index b543d19bc..570912db9 100644
--- a/src/components/Header/index.jsx
+++ b/src/components/Header/index.jsx
@@ -23,6 +23,7 @@ const Header = ({ authenticated }) => {
<Link to="/" className="p-2 text-dark">FAQs</Link>
<Link to="/" className="p-2 text-dark">Docs</Link>
{ authenticated && <Link to={routes.user_settings} className="p-2 text-dark">You</Link> }
+ { !authenticated && <Link to={routes.signin} className="p-2 text-dark">Sign in</Link> }
</nav>
{ authenticated
? (
diff --git a/src/components/Modal/index.jsx b/src/components/Modal/index.jsx
index b7db4e48e..b94dd9416 100644
--- a/src/components/Modal/index.jsx
+++ b/src/components/Modal/index.jsx
@@ -6,7 +6,7 @@ const NewLineText = ({ text }) => {
return text.split('\n').map(str => <p key={str}>{str}</p>)
}
-const Modal = ({ title, text, onSubmit = () => {}, onCancel, cancelText = 'Close', submitText = 'Save changes' }) => (
+const Modal = ({ title, text, onSubmit = () => {}, onCancel, cancelText, submitText = 'Save changes' }) => (
<BM show={true} onHide={onCancel}>
<BM.Header closeButton>
<BM.Title>{title}</BM.Title>
@@ -15,7 +15,7 @@ const Modal = ({ title, text, onSubmit = () => {}, onCancel, cancelText = 'Close
<NewLineText text={text} />
</BM.Body>
<BM.Footer>
- {onCancel && (
+ {onCancel && cancelText && (
<Button variant="secondary" onClick={onCancel}>
{cancelText}
</Button>
diff --git a/src/index.scss b/src/index.scss
index ec2585e8c..572199c50 100644
--- a/src/index.scss
+++ b/src/index.scss
@@ -11,3 +11,8 @@ code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}
+
+.spinner-lg {
+ width: 4rem !important;
+ height: 4rem !important;
+}
\ No newline at end of file
diff --git a/src/pages/Auth/VerifyEmail/index.jsx b/src/pages/Auth/VerifyEmail/index.jsx
index 6e6a2d3e0..f6fe41434 100644
--- a/src/pages/Auth/VerifyEmail/index.jsx
+++ b/src/pages/Auth/VerifyEmail/index.jsx
@@ -1,10 +1,8 @@
import React, { useState, useEffect } from 'react'
-import { Link } from 'react-router-dom'
import Spinner from 'react-bootstrap/Spinner'
import { useDispatch } from 'react-redux'
import { useParams } from 'react-router-dom'
-import routes from 'routes'
import { authActions } from 'actions/auth'
const VerifyEmail = () => {
@@ -31,7 +29,7 @@ const VerifyEmail = () => {
<div className="container d-flex justify-content-center">
{loading
? (
- <Spinner animation="border" role="status">
+ <Spinner animation="border" role="status" variant="primary" className="spinner-lg">
<span className="sr-only">Loading...</span>
</Spinner>
)
diff --git a/src/pages/Dashboard/Dashboard.jsx b/src/pages/Dashboard/Dashboard.jsx
index 21cda46b1..5f65060d5 100644
--- a/src/pages/Dashboard/Dashboard.jsx
+++ b/src/pages/Dashboard/Dashboard.jsx
@@ -19,13 +19,18 @@ export default () => {
<div className="container">
<div className="d-flex justify-content-between">
<h2>Dashboard</h2>
- <button className="btn btn-outline-primary">
+ <Link to={routes.new_project} className="btn btn-outline-primary h-100">
Create project
- </button>
+ </Link>
</div>
{projects.map(({ name, id }) => (
<div key={id} className="card mt-3">
- <Link to={routes.project.replace(':id', id)} className="text-decoration-none text-reset">
+ <Link
+ to={{
+ pathname: routes.project.replace(':id', id),
+ state: { name, id },
+ }}
+ className="text-decoration-none text-reset">
<div class="card-body list-group-item-action text-reset">
{name}
</div>
diff --git a/src/pages/UserSettings/UserSettings.jsx b/src/pages/UserSettings/UserSettings.jsx
index 6cd8a1e7d..856dc88b9 100644
--- a/src/pages/UserSettings/UserSettings.jsx
+++ b/src/pages/UserSettings/UserSettings.jsx
@@ -6,7 +6,7 @@ import { Mailbox } from 'react-bootstrap-icons'
import Modal from 'components/Modal'
import { isValidEmail, isValidPassword } from 'utils/validator'
-export default ({ onDelete, onExport, onSubmit, onEmailConfirm }) => {
+const UserSettings = ({ onDelete, onExport, onSubmit, onEmailConfirm }) => {
const { user } = useSelector(state => state.auth)
const [form, setForm] = useState({
@@ -129,7 +129,7 @@ export default ({ onDelete, onExport, onSubmit, onEmailConfirm }) => {
{user?.isActive || (
<div className="mt-4">
- <button className="btn btn-link" onClick={() => onEmailConfirm(setError)}>
+ <button className="btn btn-link pl-0" onClick={() => onEmailConfirm(setError)}>
<Mailbox color="#007bff" size="24" className="mr-2" />
Didn't receive a link to confirm the email address? Request a new one!
</button>
@@ -139,13 +139,12 @@ export default ({ onDelete, onExport, onSubmit, onEmailConfirm }) => {
<div className="mt-4">
<button
className="btn btn-outline-primary"
- onClick={onExport}
+ onClick={() => onExport()}
>
Request data export
</button>
- &nbsp;
<button
- className="btn btn-danger"
+ className="btn btn-danger ml-3"
onClick={() => setShowModal(true)}
>
Delete account
@@ -157,6 +156,7 @@ export default ({ onDelete, onExport, onSubmit, onEmailConfirm }) => {
onCancel={() => setShowModal(false)}
onSubmit={() => { setShowModal(false); onDelete() }}
submitText="Delete my account"
+ cancelText="Close"
title="Delete your account?"
text={'By pressing \'Delete my account\' you understand, that this action is irreversible.\nAll your data will be deleted from our servers.'}
/>
@@ -164,6 +164,7 @@ export default ({ onDelete, onExport, onSubmit, onEmailConfirm }) => {
{error &&
<Modal
onSubmit={() => { setError('') }}
+ onCancel={() => { setError('') }}
submitText="Got it"
title="Error"
text={error}
@@ -171,4 +172,6 @@ export default ({ onDelete, onExport, onSubmit, onEmailConfirm }) => {
}
</div>
)
-}
\ No newline at end of file
+}
+
+export default React.memo(UserSettings)
\ No newline at end of file
diff --git a/src/routes.js b/src/routes.js
index cfeac2a16..ee940388c 100644
--- a/src/routes.js
+++ b/src/routes.js
@@ -8,5 +8,6 @@ export default Object.freeze({
user_settings: '/settings',
verify: '/verify/:id',
change_email: '/change-email/:id',
+ new_project: '/projects/new',
project: '/projects/:id',
})
\ No newline at end of file