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!

Added a minified footer and added it on dashboard & project pages

Blue Mousea0f1d92c5a92
diff --git a/src/App.js b/src/App.js
index 02d8a3721..44f80d155 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,8 +1,10 @@
import React, { useEffect } from 'react'
-import { Switch, Route, Redirect } from 'react-router-dom'
+import { Switch, Route, Redirect, useLocation } from 'react-router-dom'
import routes from 'routes'
import { useDispatch, useSelector } from 'react-redux'
import { useAlert } from 'react-alert'
+import _some from 'lodash/some'
+import _includes from 'lodash/includes'
import Header from 'components/Header'
import Footer from 'components/Footer'
@@ -35,14 +37,21 @@ const ProtectedUserSettings = isAuthenticated(UserSettings)
const ProtectedProjectSettings = isAuthenticated(ProjectSettings)
const ProtectedViewProject = isAuthenticated(ViewProject)
+const minimalFooterPages = [
+ '/projects', '/dashboard',
+]
+
const App = () => {
const dispatch = useDispatch()
+ const location = useLocation()
const alert = useAlert()
const { loading, authenticated } = useSelector(state => state.auth)
const { error } = useSelector(state => state.errors)
const { message, type } = useSelector(state => state.alerts)
const accessToken = getAccessToken()
+ console.log(location.pathname)
+
useEffect(() => {
(async () => {
if (accessToken) {
@@ -79,6 +88,8 @@ const App = () => {
}
}, [message, type]) // eslint-disable-line
+ const isMinimalFooter = _some(minimalFooterPages, (page) => _includes(location.pathname, page))
+
return (
(!accessToken || !loading) && (
<>
@@ -100,7 +111,7 @@ const App = () => {
<Route path={routes.features} component={Features} exact />
<Redirect to={routes.main} />
</Switch>
- <Footer />
+ <Footer minimal={isMinimalFooter} />
</>
)
)
diff --git a/src/components/Footer/index.jsx b/src/components/Footer/index.jsx
index e914ee0e6..5ba38621b 100644
--- a/src/components/Footer/index.jsx
+++ b/src/components/Footer/index.jsx
@@ -1,6 +1,7 @@
import React, { memo } from 'react'
import { Link } from 'react-router-dom'
import _map from 'lodash/map'
+import PropTypes from 'prop-types'
const navigation = {
support: [
@@ -33,7 +34,43 @@ const navigation = {
],
}
-const Footer = () => {
+const Footer = ({ minimal }) => {
+ if (minimal) {
+ return (
+ <footer className='bg-gray-800'>
+ <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'>
+ <div className='px-5 py-2'>
+ <a href='#/' className='text-base text-gray-300 hover:text-white'>
+ About
+ </a>
+ </div>
+ <div className='px-5 py-2'>
+ <a href='#/' className='text-base text-gray-300 hover:text-white'>
+ Privacy Policy
+ </a>
+ </div>
+ <div className='px-5 py-2'>
+ <a href='#/' className='text-base text-gray-300 hover:text-white'>
+ Terms of Service
+ </a>
+ </div>
+ <div className='px-5 py-2'>
+ <a href='#/' className='text-base text-gray-300 hover:text-white'>
+ Docs
+ </a>
+ </div>
+ <div className='px-5 py-2'>
+ <a href='#/' className='text-base text-gray-300 hover:text-white'>
+ Blog
+ </a>
+ </div>
+ </nav>
+ </div>
+ </footer>
+ )
+ }
+
return (
<footer className='bg-gray-800' aria-labelledby='footer-heading'>
<h2 id='footer-heading' className='sr-only'>
@@ -108,4 +145,12 @@ const Footer = () => {
)
}
+Footer.propTypes = {
+ minimal: PropTypes.bool,
+}
+
+Footer.defaultProps = {
+ minimal: false,
+}
+
export default memo(Footer)
diff --git a/src/pages/Dashboard/Dashboard.jsx b/src/pages/Dashboard/Dashboard.jsx
index 31c51044d..ace461da2 100644
--- a/src/pages/Dashboard/Dashboard.jsx
+++ b/src/pages/Dashboard/Dashboard.jsx
@@ -125,7 +125,7 @@ const Dashboard = ({ projects, isLoading, error }) => {
if (!isLoading) {
return (
<Title title='Dashboard'>
- <div className='min-h-page bg-gray-50 flex flex-col py-6 px-4 sm:px-6 lg:px-8'>
+ <div className='min-h-min-footer bg-gray-50 flex flex-col py-6 px-4 sm:px-6 lg:px-8'>
<div className='max-w-7xl w-full mx-auto'>
<div className='flex justify-between'>
<h2 className='mt-2 text-3xl font-extrabold text-gray-900'>Dashboard</h2>
@@ -152,7 +152,7 @@ const Dashboard = ({ projects, isLoading, error }) => {
return (
<Title title='Dashboard'>
- <div className='min-h-page'>
+ <div className='min-h-min-footer'>
<Loader />
</div>
</Title>
diff --git a/src/pages/Project/Settings/ProjectSettings.jsx b/src/pages/Project/Settings/ProjectSettings.jsx
index 0d23187b4..f9e1d225a 100644
--- a/src/pages/Project/Settings/ProjectSettings.jsx
+++ b/src/pages/Project/Settings/ProjectSettings.jsx
@@ -153,7 +153,7 @@ const ProjectSettings = ({
return (
<Title title={title}>
- <div className='min-h-page bg-gray-50 flex flex-col py-6 px-4 sm:px-6 lg:px-8'>
+ <div className='min-h-min-footer bg-gray-50 flex flex-col py-6 px-4 sm:px-6 lg:px-8'>
<form className='max-w-7xl w-full mx-auto' onSubmit={handleSubmit}>
<h2 className='mt-2 text-3xl font-extrabold text-gray-900'>
{title}
diff --git a/src/pages/Project/View/ViewProject.jsx b/src/pages/Project/View/ViewProject.jsx
index 3b1c45c51..d7f8e71e2 100644
--- a/src/pages/Project/View/ViewProject.jsx
+++ b/src/pages/Project/View/ViewProject.jsx
@@ -200,7 +200,7 @@ const ViewProject = ({
if (!isLoading) {
return (
<Title title={name}>
- <div className='min-h-page bg-gray-50 py-6 px-4 sm:px-6 lg:px-8' ref={dashboardRef}>
+ <div className='min-h-min-footer bg-gray-50 py-6 px-4 sm:px-6 lg:px-8' ref={dashboardRef}>
<div className='flex flex-col md:flex-row items-center md:items-start justify-between h-10'>
<h2 className='text-3xl font-extrabold text-gray-900 break-words'>{name}</h2>
<div className='flex mt-3 md:mt-0'>
diff --git a/tailwind.config.js b/tailwind.config.js
index e3f2f8c8f..2019b09f8 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -10,7 +10,8 @@ module.exports = {
}
},
minHeight: {
- 'page': 'calc(100vh - 74px)', // header height -> 80px
+ 'page': 'calc(100vh - 74px)', // header height -> 74px
+ 'min-footer': 'calc(100vh - 162px)', // 74px + 88px footer height
}
},
variants: {