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!

Fixed showing Pricing / Billing in footer depending on user auth status

Blue Mouse57b14911cbd3
diff --git a/src/App.js b/src/App.js
index 9edc7b030..62ed2f400 100644
--- a/src/App.js
+++ b/src/App.js
@@ -120,7 +120,7 @@ const App = () => {
<Redirect to={routes.main} />
</Switch>
</ScrollToTop>
- <Footer minimal={isMinimalFooter} />
+ <Footer minimal={isMinimalFooter} authenticated={authenticated} />
</>
)
)
diff --git a/src/components/Footer/index.jsx b/src/components/Footer/index.jsx
index 0a6d460e1..6d085cf71 100644
--- a/src/components/Footer/index.jsx
+++ b/src/components/Footer/index.jsx
@@ -9,9 +9,9 @@ import routes from 'routes'
const navigation = {
support: [
- { name: 'Pricing', href: `${routes.main}#pricing` },
- { name: 'Documentation', href: routes.docs },
- { name: 'Guides', href: `${routes.docs}#docs-ht` },
+ (authenticated) => (authenticated ? { name: 'Billing', href: routes.billing } : { name: 'Pricing', href: `${routes.main}#pricing` }),
+ () => ({ name: 'Documentation', href: routes.docs }),
+ () => ({ name: 'Guides', href: `${routes.docs}#docs-ht` }),
],
company: [
{ name: 'About', href: '#' },
@@ -38,7 +38,7 @@ const navigation = {
],
}
-const Footer = ({ minimal }) => {
+const Footer = ({ minimal, authenticated }) => {
if (minimal) {
return (
<footer className='bg-gray-800'>
@@ -119,13 +119,17 @@ const Footer = ({ minimal }) => {
<div className='mt-12 md:mt-0'>
<h3 className='text-sm font-semibold text-gray-400 tracking-wider uppercase'>Support</h3>
<ul className='mt-4 space-y-4'>
- {_map(navigation.support, (item) => (
- <li key={item.name}>
- <HashLink to={item.href} className='text-base text-gray-300 hover:text-white'>
- {item.name}
- </HashLink>
- </li>
- ))}
+ {_map(navigation.support, (func) => {
+ const item = func(authenticated)
+
+ return (
+ <li key={item.name}>
+ <HashLink to={item.href} className='text-base text-gray-300 hover:text-white'>
+ {item.name}
+ </HashLink>
+ </li>
+ )
+ })}
</ul>
</div>
</div>
@@ -166,6 +170,7 @@ const Footer = ({ minimal }) => {
}
Footer.propTypes = {
+ authenticated: PropTypes.bool.isRequired,
minimal: PropTypes.bool,
}