Skip to content

Commit

Permalink
Add PostHog... maybe\?
Browse files Browse the repository at this point in the history
  • Loading branch information
jamilbk committed Jun 9, 2023
1 parent 19c97b2 commit 67b342c
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 123 deletions.
1 change: 1 addition & 0 deletions website/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ yarn-error.log*

# local env files
.env*.local
.env

# vercel
.vercel
Expand Down
1 change: 1 addition & 0 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"highlight.js": "^11.8.0",
"next": "13.4.4",
"postcss": "8.4.23",
"posthog-js": "^1.67.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-markdown": "^8.0.7",
Expand Down
13 changes: 13 additions & 0 deletions website/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions website/src/app/blog/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ export default function Page() {
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
fillRule="evenodd"
d="M2 5a2 2 0 012-2h8a2 2 0 012 2v10a2 2 0 002 2H4a2 2 0 01-2-2V5zm3 1h6v4H5V6zm6 6H5v2h6v-2z"
clip-rule="evenodd"
clipRule="evenodd"
></path>
<path d="M15 7h1a2 2 0 012 2v5.5a1.5 1.5 0 01-3 0V7z"></path>
</svg>
Expand Down Expand Up @@ -86,9 +86,9 @@ export default function Page() {
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
fillRule="evenodd"
d="M2 5a2 2 0 012-2h8a2 2 0 012 2v10a2 2 0 002 2H4a2 2 0 01-2-2V5zm3 1h6v4H5V6zm6 6H5v2h6v-2z"
clip-rule="evenodd"
clipRule="evenodd"
></path>
<path d="M15 7h1a2 2 0 012 2v5.5a1.5 1.5 0 01-3 0V7z"></path>
</svg>
Expand Down
31 changes: 31 additions & 0 deletions website/src/app/providers.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"use client";

import posthog from "posthog-js";
import { PostHogProvider } from "posthog-js/react";
import { usePathname, useSearchParams } from "next/navigation";
import { useEffect } from "react";

if (typeof window !== "undefined") {
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY, {
api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST,
});
}

export default function PHProvider({ children }) {
const pathname = usePathname();
const searchParams = useSearchParams();
// Track pageviews
useEffect(() => {
if (pathname) {
let url = window.origin + pathname;
if (searchParams.toString()) {
url = url + `?${searchParams.toString()}`;
}
posthog.capture("$pageview", {
$current_url: url,
});
}
}, [pathname, searchParams]);

return <PostHogProvider client={posthog}>{children}</PostHogProvider>;
}
114 changes: 4 additions & 110 deletions website/src/components/Blog/Post/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,114 +66,8 @@ export default function Post({
</article>
</div>
</main>
<aside
aria-label="Related articles"
className="py-8 lg:py-24 bg-gray-50 dark:bg-gray-800"
>
<div className="px-4 mx-auto max-w-screen-xl">
<h2 className="mb-8 text-2xl font-bold text-gray-900 dark:text-white">
Related articles
</h2>
<div className="grid gap-12 sm:grid-cols-2 lg:grid-cols-4">
<article className="max-w-xs">
<a href="#">
<Image
src="https://flowbite.s3.amazonaws.com/blocks/marketing-ui/article/blog-1.png"
className="mb-5 rounded-lg"
width={100}
height={100}
alt="Image 1"
/>
</a>
<h2 className="mb-2 text-xl font-bold leading-tight text-gray-900 dark:text-white">
<a href="#">Our first office</a>
</h2>
<p className="mb-4 font-light text-gray-500 dark:text-gray-400">
Over the past year, Volosoft has undergone many changes! After
months of preparation.
</p>
<a
href="#"
className="inline-flex items-center font-medium underline underline-offset-4 text-primary-600 dark:text-primary-500 hover:no-underline"
>
Read in 2 minutes
</a>
</article>
<article className="max-w-xs">
<a href="#">
<Image
src="https://flowbite.s3.amazonaws.com/blocks/marketing-ui/article/blog-2.png"
className="mb-5 rounded-lg"
alt="Image 2"
width={100}
height={100}
/>
</a>
<h2 className="mb-2 text-xl font-bold leading-tight text-gray-900 dark:text-white">
<a href="#">Enterprise design tips</a>
</h2>
<p className="mb-4 font-light text-gray-500 dark:text-gray-400">
Over the past year, Volosoft has undergone many changes! After
months of preparation.
</p>
<a
href="#"
className="inline-flex items-center font-medium underline underline-offset-4 text-primary-600 dark:text-primary-500 hover:no-underline"
>
Read in 12 minutes
</a>
</article>
<article className="max-w-xs">
<a href="#">
<Image
src="https://flowbite.s3.amazonaws.com/blocks/marketing-ui/article/blog-3.png"
className="mb-5 rounded-lg"
alt="Image 3"
width={100}
height={100}
/>
</a>
<h2 className="mb-2 text-xl font-bold leading-tight text-gray-900 dark:text-white">
<a href="#">We partnered with Google</a>
</h2>
<p className="mb-4 font-light text-gray-500 dark:text-gray-400">
Over the past year, Volosoft has undergone many changes! After
months of preparation.
</p>
<a
href="#"
className="inline-flex items-center font-medium underline underline-offset-4 text-primary-600 dark:text-primary-500 hover:no-underline"
>
Read in 8 minutes
</a>
</article>
<article className="max-w-xs">
<a href="#">
<Image
width={100}
height={100}
src="https://flowbite.s3.amazonaws.com/blocks/marketing-ui/article/blog-4.png"
className="mb-5 rounded-lg"
alt="Image 4"
/>
</a>
<h2 className="mb-2 text-xl font-bold leading-tight text-gray-900 dark:text-white">
<a href="#">Our first project with React</a>
</h2>
<p className="mb-4 font-light text-gray-500 dark:text-gray-400">
Over the past year, Volosoft has undergone many changes! After
months of preparation.
</p>
<a
href="#"
className="inline-flex items-center font-medium underline underline-offset-4 text-primary-600 dark:text-primary-500 hover:no-underline"
>
Read in 4 minutes
</a>
</article>
</div>
</div>
</aside>

{/* TODO: Related articles (see flowbite blocks) */}

<section className="bg-white dark:bg-gray-900">
<div className="py-8 px-4 mx-auto max-w-screen-xl lg:py-16 lg:px-6">
Expand All @@ -182,8 +76,8 @@ export default function Post({
Sign up for our newsletter
</h2>
<p className="mx-auto mb-8 max-w-2xl font-light text-gray-500 md:mb-12 sm:text-xl dark:text-gray-400">
Stay up to date with the roadmap progress, announcements and
exclusive discounts feel free to sign up with your email.
Sign up with your email to receive roadmap updates, how-tos, and
product announcements from the Firezone team.
</p>
<form action="#">
<div className="items-center mx-auto mb-3 space-y-4 max-w-screen-sm sm:flex sm:space-y-0">
Expand Down
2 changes: 1 addition & 1 deletion website/src/components/DocsSidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function DocsSidebar() {
id="docs-sidebar"
aria-label="Sidebar"
aria-hidden="true"
className="sticky top-0 w-64 h-screen pt-24 transition-transform -translate-x-full bg-white border-r border-gray-200 md:translate-x-0 dark:bg-gray-800 dark:border-gray-700"
className="sticky left-0 top-0 w-64 h-screen pt-24 transition-transform -translate-x-full bg-white border-r border-gray-200 md:translate-x-0 dark:bg-gray-800 dark:border-gray-700"
>
<SearchForm />
<div className="pt-3 mt-5 h-full overflow-y-auto bg-white dark:bg-gray-800 pr-3">
Expand Down
7 changes: 6 additions & 1 deletion website/src/components/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,16 @@ export default function Footer() {
Blog
</Link>
</li>
<li>
<li className="mb-4">
<Link href="/contact/sales" className="hover:underline">
Contact
</Link>
</li>
<li>
<Link href="/contact/newsletter" className="hover:underline">
Newsletter
</Link>
</li>
</ul>
</div>
<div>
Expand Down
17 changes: 10 additions & 7 deletions website/src/components/RootLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Metadata } from "next";
import "@/app/globals.css";
import "highlight.js/styles/default.css";
import RootNavbar from "@/components/RootNavbar";
import Providers from "@/app/Providers";
import Footer from "@/components/Footer";
import { Source_Sans_Pro } from "next/font/google";
const source_sans_pro = Source_Sans_Pro({
Expand All @@ -16,13 +17,15 @@ export default function RootLayout({
}) {
return (
<html lang="en">
<body className={source_sans_pro.className}>
<div className="h-auto antialiased">
<RootNavbar />
{children}
<Footer />
</div>
</body>
<Providers>
<body className={source_sans_pro.className}>
<div className="h-auto antialiased">
<RootNavbar />
{children}
<Footer />
</div>
</body>
</Providers>
</html>
);
}

0 comments on commit 67b342c

Please sign in to comment.