Skip to content

Commit 744818b

Browse files
committed
Add site analytics script to frontend root
- Remove TweakCN live preview injection - Load the new analytics script from the root document
1 parent 74c0293 commit 744818b

3 files changed

Lines changed: 8 additions & 14 deletions

File tree

apps/frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "frontend",
3-
"version": "0.1.19",
3+
"version": "0.1.20",
44
"private": true,
55
"type": "module",
66
"scripts": {

apps/frontend/src/routes/__root.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ import appCss from "../styles.css?url";
1616

1717
import type { QueryClient } from "@tanstack/react-query";
1818

19-
declare const __TWEAKCN_LIVE_PREVIEW_SRC__: string;
20-
2119
const brandName = "Emergencias CR";
2220
const defaultTitle = "Emergencias CR";
2321
const description =
@@ -69,6 +67,13 @@ export const Route = createRootRouteWithContext<{
6967
{ rel: "stylesheet", href: appCss },
7068
{ rel: "icon", href: "/favicon.svg", type: "image/svg+xml" },
7169
{ rel: "manifest", href: "/manifest.json" }
70+
],
71+
scripts: [
72+
{
73+
defer: true,
74+
src: "https://u.alech.dev/script.js",
75+
"data-website-id": "876f9c97-a6a7-4262-b125-b763e4126706"
76+
}
7277
]
7378
}),
7479

@@ -110,12 +115,6 @@ function RootDocument({ children }: { children: React.ReactNode }) {
110115
className="dark">
111116
<head>
112117
<HeadContent />
113-
{__TWEAKCN_LIVE_PREVIEW_SRC__ ? (
114-
<script
115-
crossOrigin="anonymous"
116-
src={__TWEAKCN_LIVE_PREVIEW_SRC__}
117-
/>
118-
) : null}
119118
</head>
120119
<body className={`font-sans antialiased${isIncidentesPage ? " no-page-rails" : ""}`}>
121120
<Header />

apps/frontend/vite.config.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,9 @@ import viteTsConfigPaths from "vite-tsconfig-paths";
77

88
const config = defineConfig(({ mode }) => {
99
const env = loadEnv(mode, process.cwd(), "VITE_");
10-
const tweakcnLivePreviewSrc =
11-
mode === "development" ? "https://tweakcn.com/live-preview.min.js" : "";
1210

1311
return {
1412
base: env.VITE_BASE ?? "/",
15-
define: {
16-
__TWEAKCN_LIVE_PREVIEW_SRC__: JSON.stringify(tweakcnLivePreviewSrc)
17-
},
1813
plugins: [
1914
devtools(),
2015
tanstackStart(),

0 commit comments

Comments
 (0)