diff --git a/components/dashboard/ShareSheet.tsx b/components/dashboard/ShareSheet.tsx index 1c8788eb1..b91ec67c8 100644 --- a/components/dashboard/ShareSheet.tsx +++ b/components/dashboard/ShareSheet.tsx @@ -15,6 +15,7 @@ import { Check, Code, Copy, Download, ExternalLink, Loader2, Sparkles, X } from import type { DashboardExportData } from '@/types/dashboard'; import { useShareActions } from '@/hooks/useShareActions'; import { useTranslation } from '@/context/TranslationContext'; +import { SITE_URL } from '@/lib/constants'; type OptionState = 'idle' | 'loading' | 'success' | 'error'; @@ -147,7 +148,7 @@ export default function ShareSheet({ username, isOpen, onClose, exportData }: Sh const [mdCopied, setMdCopied] = useState(false); const [toast, setToast] = useState<{ msg: string; id: number } | null>(null); - const profileUrl = `https://commitpulse.vercel.app/dashboard/${username}`; + const profileUrl = `${SITE_URL}/dashboard/${username}`; const handleWhatsApp = () => { const text = encodeURIComponent(profileUrl); diff --git a/hooks/useShareActions.ts b/hooks/useShareActions.ts index 75060de48..a8181e663 100644 --- a/hooks/useShareActions.ts +++ b/hooks/useShareActions.ts @@ -3,8 +3,9 @@ import { copyToClipboard } from '@/utils/clipboard'; import { useState, useRef, useEffect } from 'react'; import { toPng, toCanvas } from 'html-to-image'; import type { DashboardExportData } from '@/types/dashboard'; -import { getDashboardUrl, getOrigin } from '@/utils/urls'; +import { getDashboardUrl } from '@/utils/urls'; import { activityToTowers, generateMonolithSTL } from '@/lib/export3d'; +import { BADGE_BASE_URL } from '@/lib/constants'; type OptionState = 'idle' | 'loading' | 'success' | 'error'; @@ -45,7 +46,7 @@ function sanitizeFilenameSegment(value: string): string { } function buildStreakSvgUrl(username: string): string { - const url = new URL('/api/streak', getOrigin()); + const url = new URL(BADGE_BASE_URL); url.searchParams.set('user', sanitizeUsernameForUrl(username)); return url.toString(); } diff --git a/lib/constants.ts b/lib/constants.ts new file mode 100644 index 000000000..b17bfa993 --- /dev/null +++ b/lib/constants.ts @@ -0,0 +1,2 @@ +export const SITE_URL = 'https://commitpulse.vercel.app'; +export const BADGE_BASE_URL = `${SITE_URL}/api/streak`;