From a0ce939012e4f5a5746f9fe6ffb8c95b740020ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl-Gerhard=20Lindesv=C3=A4rd?= <1987198+lindesvard@users.noreply.github.com> Date: Wed, 7 May 2025 10:46:05 +0200 Subject: [PATCH] (wip) add openpanel to docs (astro) and add web analytics to nextjs (#1246) * add openpanel to docs (astro) and add web analytics to nextjs * ci: apply automated fixes * update openpanel/nextjs --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Thibault Le Ouay --- apps/docs/.env.example | 1 + apps/docs/astro.config.mjs | 10 +- apps/docs/package.json | 1 + apps/docs/src/components/Head.astro | 5 +- apps/server/.env.example | 2 +- apps/server/.env.test | 2 +- apps/web/.env.example | 2 +- apps/web/package.json | 3 +- apps/web/src/app/app/layout.tsx | 10 +- apps/web/src/app/layout.tsx | 13 +- .../posts/event-analytics-implementation.mdx | 2 +- apps/web/src/env.ts | 3 + apps/workflows/.env.test | 2 +- packages/analytics/.env.example | 2 +- packages/analytics/env.ts | 8 +- packages/analytics/src/server.ts | 4 +- packages/api/.env.test | 2 +- pnpm-lock.yaml | 363 +++--------------- 18 files changed, 108 insertions(+), 327 deletions(-) create mode 100644 apps/docs/.env.example diff --git a/apps/docs/.env.example b/apps/docs/.env.example new file mode 100644 index 00000000..d5de49be --- /dev/null +++ b/apps/docs/.env.example @@ -0,0 +1 @@ +NEXT_PUBLIC_OPENPANEL_CLIENT_ID= \ No newline at end of file diff --git a/apps/docs/astro.config.mjs b/apps/docs/astro.config.mjs index a27eb759..37c8936f 100644 --- a/apps/docs/astro.config.mjs +++ b/apps/docs/astro.config.mjs @@ -1,7 +1,7 @@ import sitemap from "@astrojs/sitemap"; import starlight from "@astrojs/starlight"; import tailwind from "@astrojs/tailwind"; -import { defineConfig } from "astro/config"; +import { defineConfig, envField } from "astro/config"; import starlightSidebarTopics from "starlight-sidebar-topics"; import Icons from "unplugin-icons/vite"; @@ -11,6 +11,14 @@ export default defineConfig({ vite: { plugins: [Icons({ compiler: "astro" })], }, + env: { + schema: { + NEXT_PUBLIC_OPENPANEL_CLIENT_ID: envField.string({ + access: "public", + context: "client", + }), + }, + }, integrations: [ sitemap(), starlight({ diff --git a/apps/docs/package.json b/apps/docs/package.json index 9f809e3a..99986023 100644 --- a/apps/docs/package.json +++ b/apps/docs/package.json @@ -16,6 +16,7 @@ "@astrojs/starlight": "0.32.6", "@astrojs/starlight-tailwind": "3.0.1", "@astrojs/tailwind": "6.0.0", + "@openpanel/astro": "1.0.1", "astro": "5.6.1", "sharp": "0.33.5", "starlight-showcases": "0.3.0", diff --git a/apps/docs/src/components/Head.astro b/apps/docs/src/components/Head.astro index 819637f4..f4e97b78 100644 --- a/apps/docs/src/components/Head.astro +++ b/apps/docs/src/components/Head.astro @@ -1,6 +1,7 @@ --- +import { NEXT_PUBLIC_OPENPANEL_CLIENT_ID } from "astro:env/client"; import Default from "@astrojs/starlight/components/Head.astro"; - +import { OpenPanelComponent } from "@openpanel/astro"; const title = Astro.locals.starlightRoute.title; const { siteTitle } = Astro.locals.starlightRoute; @@ -17,3 +18,5 @@ const url = `https://openstatus.dev/api/og?title=${siteTitle}&description=${titl