1 import { Component } from 'inferno';
2 import { Link } from 'inferno-router';
3 import { UserSafe } 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 UserListingProps {
11 useApubName?: boolean;
14 showApubName?: boolean;
17 export class UserListing extends Component<UserListingProps, any> {
18 constructor(props: any, context: any) {
19 super(props, context);
23 let user = this.props.user;
24 let local = user.local == null ? true : user.local;
25 let apubName: string, link: string;
28 apubName = `@${user.name}`;
29 link = `/u/${user.name}`;
31 apubName = `@${user.name}@${hostname(user.actor_id)}`;
32 link = !this.props.realLink ? `/user/${user.id}` : user.actor_id;
35 let displayName = this.props.useApubName
37 : user.preferred_username
38 ? user.preferred_username
41 if (this.props.showApubName && !local && user.preferred_username) {
42 displayName = `${displayName} (${apubName})`;
49 className={this.props.muted ? 'text-muted' : 'text-info'}
51 target={this.props.realLink ? '_blank' : ''}
53 {!this.props.hideAvatar && user.avatar && showAvatars() && (
54 <PictrsImage src={user.avatar} icon />
56 <span>{displayName}</span>
59 {isCakeDay(user.published) && <CakeDay creatorName={apubName} />}