Skip to content

Commit

Permalink
remove: posthog
Browse files Browse the repository at this point in the history
  • Loading branch information
jacc committed Dec 9, 2024
1 parent c2c40bf commit d0b9299
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 63 deletions.
Binary file modified bun.lockb
Binary file not shown.
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
"@heroicons/react": "^2.0.18",
"@hookform/resolvers": "^3.9.1",
"@marsidev/react-turnstile": "^0.5.3",
"@next/bundle-analyzer": "^14.0.4",
"@planetscale/database": "^1.10.0",
"@radix-ui/react-accordion": "^1.1.2",
"@radix-ui/react-avatar": "^1.0.3",
"@radix-ui/react-checkbox": "^1.0.4",
Expand Down Expand Up @@ -54,7 +52,6 @@
"next": "^15.0.2",
"next-themes": "^0.2.1",
"postcss": "8.4.24",
"posthog-js": "^1.110.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-dropzone": "^14.2.3",
Expand Down
34 changes: 0 additions & 34 deletions src/components/top-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {
import { Separator } from "@/components/ui/separator";

import { HamburgerMenuIcon } from "@radix-ui/react-icons";
import { useFeatureFlagVariantKey } from "posthog-js/react";
import { toast } from "sonner";
import { BugReportDialog } from "./dialogs/bugreport-dialog";
import { ChangelogDialog } from "./dialogs/changelog-dialog";
Expand Down Expand Up @@ -65,43 +64,10 @@ export function Topbar() {

const { activePlayer, uploadPlayers } = useContext(PlayersContext);

const seeChangelog = useFeatureFlagVariantKey("changelog_location");

useEffect(() => {
setIsDevelopment(parseInt(process.env.NEXT_PUBLIC_DEVELOPMENT!) === 1);
}, []);

useEffect(() => {
const hasSeenChangelog = window.localStorage.getItem("has_seen_changelog");

if (hasSeenChangelog) {
return;
}

if (!seeChangelog) return;

switch (seeChangelog) {
case "control":
break;
case "toast":
toast.message("stardew.app 2.2.0 is out!", {
description: "We now support the 1.6 update!",
action: {
label: "Check it out!",
onClick: () => {
setChangelogOpen(true);
},
},
});
window.localStorage.setItem("has_seen_changelog", JSON.stringify(true));
break;
case "popup":
setChangelogOpen(true);
window.localStorage.setItem("has_seen_changelog", JSON.stringify(true));
break;
}
}, [seeChangelog]);

return (
<>
<div className="flex items-center justify-between bg-white px-7 py-3.5 dark:bg-neutral-950 sm:flex-row sm:items-center sm:space-y-0 md:h-16">
Expand Down
26 changes: 0 additions & 26 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,46 +10,20 @@ import { ThemeProvider } from "@/components/theme-provider";
import { PlayersProvider } from "@/contexts/players-context";
import { PreferencesProvider } from "@/contexts/preferences-context";

import posthog from "posthog-js";
import { useEffect, useState } from "react";
import useSWR from "swr";
import ErrorBoundary from "@/components/error-boundary";
import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar";
import { GeistSans } from "geist/font/sans";
import { AppSidebar } from "@/components/sidebar/main";

if (typeof window !== "undefined") {
// checks that we are client-side
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY!, {
api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST!,
ui_host: "https://app.posthog.com",
loaded: (posthog) => {
if (process.env.NODE_ENV === "development") posthog.debug(false); // debug mode in development
},
});
}

export default function App({ Component, pageProps }: AppProps) {
const api = useSWR<User>(
"/api",
// @ts-expect-error
(...args) => fetch(...args).then((res) => res.json()),
{ refreshInterval: 0, revalidateOnFocus: false },
);
const [hasIdentified, setHasIdentified] = useState(false);

useEffect(() => {
if (api.data && !hasIdentified) {
posthog.identify(api.data.id, {
$name: api.data.discord_name,
$username: api.data.discord_name,
});
console.log("Identified user", api.data.id, api.data.discord_name);
setHasIdentified(true);
}

return;
}, [api.data]);

return (
<ThemeProvider attribute="class" defaultTheme="system" enableSystem>
Expand Down

0 comments on commit d0b9299

Please sign in to comment.