1 import { Component } from "inferno";
2 import { Link } from "inferno-router";
3 import { PersonSafe } from "lemmy-js-client";
4 import { showAvatars, hostname, isCakeDay } from "../utils";
5 import { CakeDay } from "./cake-day";
6 import { PictrsImage } from "./pictrs-image";
8 interface PersonListingProps {
11 useApubName?: boolean;
14 showApubName?: boolean;
17 export class PersonListing extends Component<PersonListingProps, any> {
18 constructor(props: any, context: any) {
19 super(props, context);
23 let person = this.props.person;
24 let local = person.local == null ? true : person.local;
25 let apubName: string, link: string;
28 apubName = `@${person.name}`;
29 link = `/u/${person.name}`;
31 apubName = `@${person.name}@${hostname(person.actor_id)}`;
32 link = !this.props.realLink ? `/user/${person.id}` : person.actor_id;
35 let displayName = this.props.useApubName
41 if (this.props.showApubName && !local && person.display_name) {
42 displayName = `${displayName} (${apubName})`;
49 className={this.props.muted ? "text-muted" : "text-info"}
52 {!this.props.hideAvatar && person.avatar && showAvatars() && (
53 <PictrsImage src={person.avatar} icon />
55 <span>{displayName}</span>
58 {isCakeDay(person.published) && <CakeDay creatorName={apubName} />}