Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion components/dashboard/ShareSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions hooks/useShareActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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();
}
Expand Down
2 changes: 2 additions & 0 deletions lib/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const SITE_URL = 'https://commitpulse.vercel.app';
export const BADGE_BASE_URL = `${SITE_URL}/api/streak`;
Loading