diff --git a/.vscode/settings.json b/.vscode/settings.json index 53c760db0..b9a963aad 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -10,6 +10,7 @@ "cSpell.words": [ "superjson", "homarr", - "trpc" + "trpc", + "Umami" ] } \ No newline at end of file diff --git a/README.md b/README.md index 2eb9f8222..3a88af411 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # THIS PROJECT IS STILL UNSTABLE AND WE DO NOT PROVIDE ANY SUPPORT FOR ISSUES THAT OCCURE. + ## PLEASE DO NOT OPEN ANY ISSUES OR DISCUSSIONS + ### EVERYTHING IS SUBJECT TO CHANGE Please use [this](https://github.com/ajnart/homarr) version of Homarr when you want to use it diff --git a/apps/nextjs/package.json b/apps/nextjs/package.json index 529e259ca..cb3f9b643 100644 --- a/apps/nextjs/package.json +++ b/apps/nextjs/package.json @@ -14,6 +14,7 @@ "with-env": "dotenv -e ../../.env --" }, "dependencies": { + "@homarr/analytics": "workspace:^0.1.0", "@homarr/api": "workspace:^0.1.0", "@homarr/auth": "workspace:^0.1.0", "@homarr/common": "workspace:^0.1.0", diff --git a/apps/nextjs/src/app/[locale]/layout.tsx b/apps/nextjs/src/app/[locale]/layout.tsx index 35414e252..86db1c66c 100644 --- a/apps/nextjs/src/app/[locale]/layout.tsx +++ b/apps/nextjs/src/app/[locale]/layout.tsx @@ -11,6 +11,7 @@ import { auth } from "@homarr/auth/next"; import { ModalProvider } from "@homarr/modals"; import { Notifications } from "@homarr/notifications"; +import { Analytics } from "~/components/layout/analytics"; import { JotaiProvider } from "./_client-providers/jotai"; import { NextInternationalProvider } from "./_client-providers/next-international"; import { AuthProvider } from "./_client-providers/session"; @@ -76,6 +77,7 @@ export default function Layout(props: { children: React.ReactNode; params: { loc + diff --git a/apps/nextjs/src/app/[locale]/manage/settings/_components/analytics.settings.tsx b/apps/nextjs/src/app/[locale]/manage/settings/_components/analytics.settings.tsx index dfe86b363..7ac93b917 100644 --- a/apps/nextjs/src/app/[locale]/manage/settings/_components/analytics.settings.tsx +++ b/apps/nextjs/src/app/[locale]/manage/settings/_components/analytics.settings.tsx @@ -96,18 +96,23 @@ const SwitchSetting = ({ title: string; text: ReactNode; }) => { + const disabled = formKey !== "enableGeneral" && !form.values.enableGeneral; const handleClick = React.useCallback(() => { + if (disabled) { + return; + } form.setFieldValue(formKey, !form.values[formKey]); - }, [form, formKey]); + }, [form, formKey, disabled]); + return ( - - + + {title} {text} - - - + + + ); }; diff --git a/apps/nextjs/src/components/layout/analytics.tsx b/apps/nextjs/src/components/layout/analytics.tsx new file mode 100644 index 000000000..76e76e2d2 --- /dev/null +++ b/apps/nextjs/src/components/layout/analytics.tsx @@ -0,0 +1,14 @@ +import Script from "next/script"; + +import { UMAMI_WEBSITE_ID } from "@homarr/analytics"; +import { api } from "@homarr/api/server"; + +export const Analytics = async () => { + const analytics = await api.serverSettings.getAnalytics(); + + if (analytics.enableGeneral) { + return