1 import { Component } from 'inferno';
2 import { Link } from 'inferno-router';
3 import { UserView } from '../interfaces';
10 import { CakeDay } from './cake-day';
12 export interface UserOther {
14 preferred_username?: string;
15 id?: number; // Necessary if its federated
22 interface UserListingProps {
23 user: UserView | UserOther;
25 useApubName?: boolean;
30 export class UserListing extends Component<UserListingProps, any> {
31 constructor(props: any, context: any) {
32 super(props, context);
36 let user = this.props.user;
37 let local = user.local == null ? true : user.local;
38 let apubName: string, link: string;
41 apubName = `@${user.name}`;
42 link = `/u/${user.name}`;
44 apubName = `@${user.name}@${hostname(user.actor_id)}`;
45 link = !this.props.realLink ? `/user/${user.id}` : user.actor_id;
48 let displayName = this.props.useApubName
50 : user.preferred_username
51 ? user.preferred_username
58 className={this.props.muted ? 'text-muted' : 'text-info'}
61 {!this.props.hideAvatar && user.avatar && showAvatars() && (
63 style="width: 2rem; height: 2rem;"
64 src={pictrsAvatarThumbnail(user.avatar)}
65 class="rounded-circle mr-2"
68 <span>{displayName}</span>
71 {isCakeDay(user.published) && <CakeDay creatorName={apubName} />}