Add 'datingdoc', 'friendshipdoc', 'connectiondoc', 'workdoc'

This commit is contained in:
MartinBraquet
2025-09-25 22:49:54 +02:00
parent 475f0af78a
commit 60eb0c6978
3 changed files with 36 additions and 12 deletions

View File

@@ -15,6 +15,10 @@ export const SITE_ORDER = [
'patreon',
'okcupid',
'calendly',
'datingdoc',
'friendshipdoc',
'connectiondoc',
'workdoc',
'spotify',
] as const
@@ -44,6 +48,10 @@ const stripper: { [key in Site]: (input: string) => string } = {
.replace(/\/$/, ''),
okcupid: (s) => s.replace(/^(https?:\/\/)/, ''),
calendly: (s) => s,
datingdoc: (s) => s,
friendshipdoc: (s) => s,
workdoc: (s) => s,
connectiondoc: (s) => s,
bluesky: (s) =>
s
.replace(/^(https?:\/\/)?(www\.)?bsky\.app\/profile\//, '')
@@ -99,6 +107,10 @@ const urler: { [key in Site]: (handle: string) => string } = {
paypal: (s) => `https://paypal.com/paypalme/${s}`,
patreon: (s) => `https://patreon.com/${s}`,
calendly: (s) => (s.startsWith('http') ? s : `https://${s}`),
datingdoc: (s) => (s.startsWith('http') ? s : `https://${s}`),
friendshipdoc: (s) => (s.startsWith('http') ? s : `https://${s}`),
workdoc: (s) => (s.startsWith('http') ? s : `https://${s}`),
connectiondoc: (s) => (s.startsWith('http') ? s : `https://${s}`),
}
export const PLATFORM_LABELS: { [key in Site]: string } = {
@@ -117,4 +129,8 @@ export const PLATFORM_LABELS: { [key in Site]: string } = {
patreon: 'Patreon',
okcupid: 'OkCupid',
calendly: 'Calendly',
datingdoc: 'Dating Doc',
friendshipdoc: 'Friendship Doc',
workdoc: 'Work Doc',
connectiondoc: 'Connection Doc',
}

View File

@@ -1,7 +1,7 @@
import { LinkIcon } from '@heroicons/react/solid'
import { Site } from 'common/socials'
import { ReactNode } from 'react'
import { LuBookmark, LuHeart } from 'react-icons/lu'
import {DocumentReportIcon, LinkIcon} from '@heroicons/react/solid'
import {Site} from 'common/socials'
import {ReactNode} from 'react'
import {LuBookmark, LuHandshake, LuHeart, LuUsers} from 'react-icons/lu'
import {
TbBrandBluesky,
TbBrandDiscord,
@@ -34,6 +34,10 @@ export const PLATFORM_ICONS: {
patreon: TbBrandPatreon,
paypal: TbBrandPaypal,
okcupid: LuHeart,
datingdoc: LuHeart,
friendshipdoc: LuUsers,
workdoc: DocumentReportIcon,
connectiondoc: LuHandshake,
calendly: TbCalendar,
}
@@ -43,7 +47,7 @@ export const SocialIcon = (props: {
size?: number;
color?: string;
}) => {
const { site, ...rest } = props
const {site, ...rest} = props
const Icon = PLATFORM_ICONS[site as Site] || PLATFORM_ICONS.site
return <Icon {...rest} />

View File

@@ -1,22 +1,26 @@
import {Row} from '../layout/row'
import clsx from 'clsx'
import {getSocialUrl, SITE_ORDER, Socials} from 'common/socials'
import {getSocialUrl, PLATFORM_LABELS, Site, SITE_ORDER, Socials} from 'common/socials'
import {sortBy} from 'lodash'
import {SocialIcon} from './social'
const LABEL_TO_RENDER: Record<string, string> = {
okcupid: 'OkCupid',
calendly: 'Calendly',
}
const LABELS_TO_RENDER = [
'okcupid',
'calendly',
'datingdoc',
'friendshipdoc',
'connectiondoc',
'workdoc',
]
export function UserHandles(props: { links: Socials; className?: string }) {
const {links, className} = props
const display = sortBy(
Object.entries(links),
([platform]) => -[...SITE_ORDER].reverse().indexOf(platform as any)
([platform]) => -[...SITE_ORDER].reverse().indexOf(platform as Site)
).map(([platform, label]) => {
const renderedLabel = LABEL_TO_RENDER[platform] || label
const renderedLabel: string = LABELS_TO_RENDER.includes(platform) ? PLATFORM_LABELS[platform as Site] : label
return {
platform,
label: renderedLabel,