From 0295e7f75f5d850d9a4ee30f327bd54849a47e65 Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Wed, 8 Apr 2026 12:05:12 +0200 Subject: [PATCH] Add `getXShareProfileUrl` function for generating profile sharing links with pre-filled text --- common/src/socials.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/common/src/socials.ts b/common/src/socials.ts index 1173d2d1..ae2ab459 100644 --- a/common/src/socials.ts +++ b/common/src/socials.ts @@ -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, +) { + 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}` +}