1 import { Component } from 'inferno';
2 import { Link } from 'inferno-router';
3 import { Community } from '../interfaces';
4 import { hostname } from '../utils';
6 interface CommunityOther {
8 id?: number; // Necessary if its federated
13 interface CommunityLinkProps {
14 community: Community | CommunityOther;
18 export class CommunityLink extends Component<CommunityLinkProps, any> {
19 constructor(props: any, context: any) {
20 super(props, context);
24 let community = this.props.community;
25 let name_: string, link: string;
26 let local = community.local == null ? true : community.local;
28 name_ = community.name;
29 link = `/c/${community.name}`;
31 name_ = `${community.name}@${hostname(community.actor_id)}`;
32 link = !this.props.realLink
33 ? `/community/${community.id}`
36 return <Link to={link}>{name_}</Link>;