From 5d8c18716a1502c1db8f95850f0f762bf4455706 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Sun, 7 Apr 2024 23:23:18 +0800 Subject: [PATCH] fix: fix custom tracker script name not display in fe problem --- README.md | 1 + src/client/components/website/WebsiteCodeBtn.tsx | 4 +++- src/server/trpc/routers/global.ts | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cdc2907..143dfc0 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ It's good to specialize in one thing, if we are experts in related abilities we - [ ] waitlist - [ ] survey - [ ] lighthouse report +- [ ] hooks ## Preview diff --git a/src/client/components/website/WebsiteCodeBtn.tsx b/src/client/components/website/WebsiteCodeBtn.tsx index ca16ebc..c2f7cda 100644 --- a/src/client/components/website/WebsiteCodeBtn.tsx +++ b/src/client/components/website/WebsiteCodeBtn.tsx @@ -11,6 +11,7 @@ import { } from '../ui/dialog'; import { useTranslation } from '@i18next-toolkit/react'; import { Typography } from 'antd'; +import { useGlobalConfig } from '@/hooks/useConfig'; interface WebsiteCodeBtnProps { websiteId: string; @@ -18,8 +19,9 @@ interface WebsiteCodeBtnProps { export const WebsiteCodeBtn: React.FC = React.memo( (props) => { const { t } = useTranslation(); + const { customTrackerScriptName = 'tracker.js' } = useGlobalConfig(); - const trackScript = ``; + const trackScript = ``; return ( diff --git a/src/server/trpc/routers/global.ts b/src/server/trpc/routers/global.ts index 871406e..80d12d9 100644 --- a/src/server/trpc/routers/global.ts +++ b/src/server/trpc/routers/global.ts @@ -22,6 +22,7 @@ export const globalRouter = router({ mapboxToken: z.string().optional(), alphaMode: z.boolean(), disableAnonymousTelemetry: z.boolean(), + customTrackerScriptName: z.string().optional(), }) ) .query(async ({ input }) => { @@ -32,6 +33,7 @@ export const globalRouter = router({ mapboxToken: env.mapboxToken, alphaMode: env.alphaMode, disableAnonymousTelemetry: env.disableAnonymousTelemetry, + customTrackerScriptName: env.customTrackerScriptName, }; }), });