Skip to content

Commit

Permalink
refactor umami to own component and disable it by default
Browse files Browse the repository at this point in the history
  • Loading branch information
mroxso committed Aug 4, 2024
1 parent 8c207f7 commit 65386d6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
1 change: 1 addition & 0 deletions lumina/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
NEXT_PUBLIC_ENABLE_UMAMI=false
NEXT_PUBLIC_UMAMI_WEBSITE_ID=YOUR_CODE_HERE
NEXT_PUBLIC_UMAMI_URL=YOUR_URL_HERE
9 changes: 2 additions & 7 deletions lumina/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import BottomBar from "@/components/BottomBar";
import { Inter } from "next/font/google";
import { Toaster } from "@/components/ui/toaster"
import Script from "next/script";
import Umami from "@/components/Umami";

export const metadata: Metadata = {
title: "LUMINA",
Expand All @@ -27,7 +28,6 @@ export default function RootLayout({
<Head>
<link rel="icon" href="/icon?<generated>" type="image/png" sizes="32x32" />
<link rel="manifest" href="/manifest.json" />
{/* <script defer src="https://umami.softwerk.cloud/script.js" data-website-id="d0495d49-1f04-4501-8711-3bdcb4f7f7bd"></script> */}
</Head>
<body className={inter.className}>
<ThemeProvider
Expand All @@ -38,12 +38,7 @@ export default function RootLayout({
>
<TopNavigation />
<Toaster />
<Script
src={`${process.env.NEXT_PUBLIC_UMAMI_URL}/script.js`}
strategy="afterInteractive"
data-website-id={process.env.NEXT_PUBLIC_UMAMI_WEBSITE_ID}
defer
/>
<Umami />
<div className="main-content pb-14">
{children}
</div>
Expand Down
19 changes: 19 additions & 0 deletions lumina/components/Umami.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import Script from "next/script";
import React from "react";

const Umami = () => {
if(process.env.NEXT_PUBLIC_ENABLE_UMAMI == "true") {
return (
<Script
src={`${process.env.NEXT_PUBLIC_UMAMI_URL}/script.js`}
strategy="afterInteractive"
data-website-id={process.env.NEXT_PUBLIC_UMAMI_WEBSITE_ID}
defer
/>
);
} else {
return null;
}
};

export default Umami;

0 comments on commit 65386d6

Please sign in to comment.