Add getXShareProfileUrl function for generating profile sharing links with pre-filled text

This commit is contained in:
MartinBraquet
2026-04-08 12:05:12 +02:00
parent ea2735f688
commit 0295e7f75f

View File

@@ -1,4 +1,5 @@
import {discordLink} from 'common/constants'
import {DEPLOYED_WEB_URL} from 'common/envs/constants'
export const SITE_ORDER = [
'site', // personal site
@@ -120,3 +121,18 @@ export const PLATFORM_LABELS: {[key in Site]: string} = {
workdoc: 'Work Doc',
connectiondoc: 'Connection Doc',
}
export function getXShareProfileUrl(
username: string,
t: (key: string, fallback: string, vars?: Record<string, string | number>) => string,
) {
const encodedText = encodeURIComponent(
t(
'share_profile.x_share_profile',
"I'm on a platform that matches people by values, not photos.\nNo ads. No algorithms. No swiping. Just depth.",
) + '\n@compassmeet',
)
const encodedUrl = encodeURIComponent(`${DEPLOYED_WEB_URL}/${username}`)
return `https://x.com/intent/tweet?text=${encodedText}&url=${encodedUrl}`
}