)}
<label
className={`pointer btn btn-outline-secondary ${
- this.state.type_ == ListingType.All && 'active'
+ (this.state.type_ == ListingType.All && 'active') ||
+ (!this.props.showLocal &&
+ this.state.type_ == ListingType.Local &&
+ 'active')
}`}
>
<input
? Object.values(ListingType)[
UserService.Instance.user.default_listing_type
]
- : ListingType.All;
+ : ListingType.Local;
let sort: SortType = pathSplit[7]
? SortType[pathSplit[7]]
: UserService.Instance.user
<span class="mr-3">
<ListingTypeSelect
type_={this.state.listingType}
- showLocal={
- this.state.siteRes.federated_instances &&
- this.state.siteRes.federated_instances.length > 0
- }
+ showLocal={this.showLocal}
onChange={this.handleListingTypeChange}
/>
</span>
);
}
+ get showLocal(): boolean {
+ return (
+ this.isoData.site.federated_instances !== null &&
+ this.isoData.site.federated_instances.length > 0
+ );
+ }
+
get canAdmin(): boolean {
return (
UserService.Instance.user &&
? routeListingTypeToEnum(props.match.params.listing_type)
: UserService.Instance.user
? Object.values(ListingType)[UserService.Instance.user.default_listing_type]
- : ListingType.All;
+ : ListingType.Local;
}
// TODO might need to add a user setting for this too