diff --git a/common/src/socials.ts b/common/src/socials.ts index 0e9586aa..5c5ba6d4 100644 --- a/common/src/socials.ts +++ b/common/src/socials.ts @@ -43,10 +43,7 @@ const stripper: { [key in Site]: (input: string) => string } = { .replace(/^(https?:\/\/)?(www\.)?(\w+\.)?patreon\.com\//, '') .replace(/\/$/, ''), okcupid: (s) => s.replace(/^(https?:\/\/)/, ''), - calendly: (s) => - s - .replace(/^(https?:\/\/)?(www\.)?(\w+\.)?calendly\.com\//, '') - .replace(/\/$/, ''), + calendly: (s) => s, bluesky: (s) => s .replace(/^(https?:\/\/)?(www\.)?bsky\.app\/profile\//, '') @@ -101,7 +98,7 @@ const urler: { [key in Site]: (handle: string) => string } = { spotify: (s) => `https://open.spotify.com/user/${s}`, paypal: (s) => `https://paypal.com/paypalme/${s}`, patreon: (s) => `https://patreon.com/${s}`, - calendly: (s) => `https://calendly.com/${s}`, + calendly: (s) => (s.startsWith('http') ? s : `https://${s}`), } export const PLATFORM_LABELS: { [key in Site]: string } = { diff --git a/web/components/user/user-handles.tsx b/web/components/user/user-handles.tsx index 663b5e6d..ed64efe8 100644 --- a/web/components/user/user-handles.tsx +++ b/web/components/user/user-handles.tsx @@ -4,6 +4,11 @@ import {getSocialUrl, SITE_ORDER, Socials} from 'common/socials' import {sortBy} from 'lodash' import {SocialIcon} from './social' +const LABEL_TO_RENDER: Record = { + okcupid: 'OkCupid', + calendly: 'Calendly', +} + export function UserHandles(props: { links: Socials; className?: string }) { const {links, className} = props @@ -11,8 +16,7 @@ export function UserHandles(props: { links: Socials; className?: string }) { Object.entries(links), ([platform]) => -[...SITE_ORDER].reverse().indexOf(platform as any) ).map(([platform, label]) => { - let renderedLabel = label - if (platform === 'okcupid') renderedLabel = 'OkCupid' + const renderedLabel = LABEL_TO_RENDER[platform] || label return { platform, label: renderedLabel,