1 import { Component } from "inferno";
2 import { Link } from "inferno-router";
3 import { PersonSafe } 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 == null ? true : 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
44 if (this.props.showApubName && !local && person.display_name) {
45 displayName = `${displayName} (${apubName})`;
50 {!this.props.realLink ? (
53 className={this.props.muted ? "text-muted" : "text-info"}
56 {this.avatarAndName(displayName)}
61 className={this.props.muted ? "text-muted" : "text-info"}
65 {this.avatarAndName(displayName)}
69 {isCakeDay(person.published) && <CakeDay creatorName={apubName} />}
74 avatarAndName(displayName: string) {
75 let person = this.props.person;
78 {!this.props.hideAvatar && person.avatar && showAvatars() && (
79 <PictrsImage src={person.avatar} icon />
81 <span>{displayName}</span>