import { randomStr } from "@utils/helpers"; import classNames from "classnames"; import { Component, linkEvent } from "inferno"; import { ListingType } from "lemmy-js-client"; import { I18NextService, UserService } from "../../services"; interface ListingTypeSelectProps { type_: ListingType; showLocal: boolean; showSubscribed: boolean; onChange(val: ListingType): void; } interface ListingTypeSelectState { type_: ListingType; } export class ListingTypeSelect extends Component< ListingTypeSelectProps, ListingTypeSelectState > { private id = `listing-type-input-${randomStr()}`; state: ListingTypeSelectState = { type_: this.props.type_, }; constructor(props: any, context: any) { super(props, context); } static getDerivedStateFromProps( props: ListingTypeSelectProps, ): ListingTypeSelectState { return { type_: props.type_, }; } render() { return (
{this.props.showSubscribed && ( <> )} {this.props.showLocal && ( <> )}
); } handleTypeChange(i: ListingTypeSelect, event: any) { i.props.onChange(event.target.value); } }