Files
photon-tbw/src/lib/lemmy/generic.ts
T

9 lines
387 B
TypeScript

import { fullCommunityName } from '$lib/util'
import type { Community, Person } from 'lemmy-js-client'
export const communityLink = (community: Community, prefix: string = '') =>
`${prefix}/c/${fullCommunityName(community.name, community.actor_id)}`
export const userLink = (person: Person, prefix: string = '') =>
`${prefix}/u/${person.name}@${new URL(person.actor_id).hostname}`