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;
17 export class CommunityLink extends Component<CommunityLinkProps, any> {
18 constructor(props: any, context: any) {
19 super(props, context);
23 let community = this.props.community;
24 let name_: string, link: string;
25 let local = community.local == null ? true : community.local;
27 name_ = community.name;
28 link = `/c/${community.name}`;
30 name_ = `${hostname(community.actor_id)}/${community.name}`;
31 link = `/community/${community.id}`;
33 return <Link to={link}>{name_}</Link>;