mirror of
https://github.com/lumina-rocks/lumina.git
synced 2026-06-04 09:41:32 +02:00
refactor umami to own component and disable it by default
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
NEXT_PUBLIC_ENABLE_UMAMI=false
|
||||
NEXT_PUBLIC_UMAMI_WEBSITE_ID=YOUR_CODE_HERE
|
||||
NEXT_PUBLIC_UMAMI_URL=YOUR_URL_HERE
|
||||
@@ -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",
|
||||
@@ -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
|
||||
@@ -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>
|
||||
|
||||
19
lumina/components/Umami.tsx
Normal file
19
lumina/components/Umami.tsx
Normal file
@@ -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;
|
||||
Reference in New Issue
Block a user