1 import { Component } from "inferno";
2 import { Link } from "inferno-router";
3 import { Person } from "lemmy-js-client";
4 import { hostname, isCakeDay, relTags, showAvatars } from "../../utils";
5 import { PictrsImage } from "../common/pictrs-image";
6 import { CakeDay } from "./cake-day";
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;
25 let apubName: string, link: string;
28 apubName = `@${person.name}`;
29 link = `/u/${person.name}`;
31 let domain = hostname(person.actor_id);
32 apubName = `@${person.name}@${domain}`;
33 link = !this.props.realLink
34 ? `/u/${person.name}@${domain}`
38 let displayName = this.props.useApubName
40 : person.display_name ?? apubName;
42 if (this.props.showApubName && !local && person.display_name) {
43 displayName = `${displayName} (${apubName})`;
48 {!this.props.realLink ? (
51 className={this.props.muted ? "text-muted" : "text-info"}
54 {this.avatarAndName(displayName)}
59 className={this.props.muted ? "text-muted" : "text-info"}
63 {this.avatarAndName(displayName)}
67 {isCakeDay(person.published) && <CakeDay creatorName={apubName} />}
72 avatarAndName(displayName: string) {
73 let avatar = this.props.person.avatar;
77 !this.props.hideAvatar &&
78 !this.props.person.banned &&
79 showAvatars() && <PictrsImage src={avatar} icon />}
80 <span>{displayName}</span>