import { Component, linkEvent } from "inferno"; import { Link } from "inferno-router"; import { PersonView, Site, SiteAggregates } from "lemmy-js-client"; import { i18n } from "../../i18next"; import { mdToHtml, numToSI } from "../../utils"; import { BannerIconHeader } from "../common/banner-icon-header"; import { Icon } from "../common/icon"; import { PersonListing } from "../person/person-listing"; interface SiteSidebarProps { site: Site; showLocal: boolean; counts?: SiteAggregates; admins?: PersonView[]; online?: number; } interface SiteSidebarState { collapsed: boolean; } export class SiteSidebar extends Component { state: SiteSidebarState = { collapsed: false, }; constructor(props: any, context: any) { super(props, context); } render() { return (
{this.siteName()}
{!this.state.collapsed && ( <> {this.siteInfo()} )}
); } siteName() { return (
{this.props.site.name}
); } siteInfo() { let site = this.props.site; return (
{site.description &&
{site.description}
} {site.sidebar && this.siteSidebar(site.sidebar)} {this.props.counts && this.badges(this.props.counts)} {this.props.admins && this.admins(this.props.admins)}
); } siteSidebar(sidebar: string) { return (
); } admins(admins: PersonView[]) { return ( ); } badges(siteAggregates: SiteAggregates) { let counts = siteAggregates; let online = this.props.online ?? 1; return ( ); } handleCollapseSidebar(i: SiteSidebar) { i.setState({ collapsed: !i.state.collapsed }); } }