Skip to content

Commit

Permalink
Updated plausible analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
bring-shrubbery committed Oct 4, 2024
1 parent ade634a commit dea9eec
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 18 deletions.
1 change: 1 addition & 0 deletions apps/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"monaco-editor": "^0.51.0",
"monaco-themes": "^0.4.4",
"next": "14.2.11",
"next-plausible": "^3.12.2",
"next-themes": "^0.3.0",
"postcss": "catalog:",
"react": "catalog:react18",
Expand Down
7 changes: 7 additions & 0 deletions apps/nextjs/src/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { Allotment } from "allotment";
import { useAtom } from "jotai";
import LIGHT_THEME from "monaco-themes/themes/IDLE.json";
import DARK_THEME from "monaco-themes/themes/idleFingers.json";
import { usePlausible } from "next-plausible";
import { useTheme } from "next-themes";
import { convert } from "svg-to-swiftui-core";
import urlJoin from "url-join";
Expand All @@ -25,6 +26,8 @@ export const App = ({
}: {
exampleList: { example: string; content: string }[];
}) => {
const plausible = usePlausible();

const svgRef = useRef<editor.IStandaloneCodeEditor | null>(null);
const [svgValue, setSvgValue] = useState<string | undefined>("");

Expand Down Expand Up @@ -58,12 +61,16 @@ export const App = ({
});

setResult(res);

plausible("convert_success");
} catch (e) {
toast({
title: "Conversion error",
description: String(e),
variant: "destructive",
});

plausible("convert_fail", { props: { svgCode } });
}
};

Expand Down
13 changes: 0 additions & 13 deletions apps/nextjs/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,6 @@ export default function RootLayout({
}: PropsWithChildren<{ announcement: ReactNode }>) {
return (
<html lang="en" suppressHydrationWarning>
<head>
<script
defer
data-domain="svg-to-swiftui.quassum.com"
src="https://plausible.io/js/script.hash.outbound-links.pageview-props.tagged-events.js"
/>
<script
dangerouslySetInnerHTML={{
__html: `window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }`,
}}
/>
</head>

<body
className={cn(
"h-screen w-full bg-background font-sans text-foreground antialiased",
Expand Down
5 changes: 4 additions & 1 deletion apps/nextjs/src/app/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import type { PropsWithChildren } from "react";
import { Provider as JotaiProvider } from "jotai";
import PlausibleProvider from "next-plausible";
import { ThemeProvider } from "next-themes";

export function Providers({ children }: PropsWithChildren) {
Expand All @@ -13,7 +14,9 @@ export function Providers({ children }: PropsWithChildren) {
enableSystem
disableTransitionOnChange
>
{children}
<PlausibleProvider domain="svg-to-swiftui.quassum.com">
{children}
</PlausibleProvider>
</ThemeProvider>
</JotaiProvider>
);
Expand Down
24 changes: 20 additions & 4 deletions pnpm-lock.yaml

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

0 comments on commit dea9eec

Please sign in to comment.