import React from "react" import { Link } from "react-router" import Button from "misago/components/button" import DropdownToggle from "misago/components/dropdown-toggle" import Nav from "misago/components/threads/nav" import ajax from "misago/services/ajax" import posting from "misago/services/posting" import snackbar from "misago/services/snackbar" import store from "misago/services/store" import misago from "misago" export default class extends React.Component { constructor(props) { super(props) this.state = { isBusy: false } } startThread = () => { posting.open( this.props.startThread || { mode: "START", config: misago.get("THREAD_EDITOR_API"), submit: misago.get("THREADS_API"), category: this.props.route.category.id } ) } hasGoBackButton() { return !!this.props.route.category.parent } getGoBackButton() { if (!this.props.route.category.parent) return null const parent = this.props.categories[this.props.route.category.parent] return (
keyboard_arrow_left
) } getStartThreadButton() { if (!this.props.user.id) return null return ( ) } render() { let headerClassName = "col-xs-12" if (this.hasGoBackButton()) { headerClassName += " col-sm-10 col-lg-11 sm-align-row-buttons" } const isAuthenticated = !!this.props.user.id return (
{this.getGoBackButton()}

{this.props.title}

{isAuthenticated && (
{this.getStartThreadButton()}
)}
) } } export function ParentCategory({ categories, category }) { if (!category) return null const parent = categories[category] return ( chevron_left {parent.parent ? parent.name : gettext("Threads")} ) }