type_: ListingType;
showLocal: boolean;
showSubscribed: boolean;
- onChange?(val: ListingType): any;
+ onChange(val: ListingType): void;
}
interface ListingTypeSelectState {
super(props, context);
}
- static getDerivedStateFromProps(props: any): ListingTypeSelectProps {
+ static getDerivedStateFromProps(
+ props: ListingTypeSelectProps
+ ): ListingTypeSelectState {
return {
type_: props.type_,
- showLocal: props.showLocal,
- showSubscribed: props.showSubscribed,
};
}
<label
title={i18n.t("subscribed_description")}
className={`btn btn-outline-secondary
- ${this.state.type_ == ListingType.Subscribed && "active"}
+ ${this.state.type_ == "Subscribed" && "active"}
${!UserService.Instance.myUserInfo ? "disabled" : "pointer"}
`}
>
<input
id={`${this.id}-subscribed`}
type="radio"
- value={ListingType.Subscribed}
- checked={this.state.type_ == ListingType.Subscribed}
+ value={"Subscribed"}
+ checked={this.state.type_ == "Subscribed"}
onChange={linkEvent(this, this.handleTypeChange)}
disabled={!UserService.Instance.myUserInfo}
/>
<label
title={i18n.t("local_description")}
className={`pointer btn btn-outline-secondary ${
- this.state.type_ == ListingType.Local && "active"
+ this.state.type_ == "Local" && "active"
}`}
>
<input
id={`${this.id}-local`}
type="radio"
- value={ListingType.Local}
- checked={this.state.type_ == ListingType.Local}
+ value={"Local"}
+ checked={this.state.type_ == "Local"}
onChange={linkEvent(this, this.handleTypeChange)}
/>
{i18n.t("local")}
<label
title={i18n.t("all_description")}
className={`pointer btn btn-outline-secondary ${
- (this.state.type_ == ListingType.All && "active") ||
- (!this.props.showLocal &&
- this.state.type_ == ListingType.Local &&
- "active")
+ (this.state.type_ == "All" && "active") ||
+ (!this.props.showLocal && this.state.type_ == "Local" && "active")
}`}
>
<input
id={`${this.id}-all`}
type="radio"
- value={ListingType.All}
- checked={this.state.type_ == ListingType.All}
+ value={"All"}
+ checked={this.state.type_ == "All"}
onChange={linkEvent(this, this.handleTypeChange)}
/>
{i18n.t("all")}
}
handleTypeChange(i: ListingTypeSelect, event: any) {
- i.props.onChange?.(event.target.value);
+ i.props.onChange(event.target.value);
}
}