mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-21 22:27:11 +00:00
Make /c/local the default for not-logged-in users. Fixes #52
This commit is contained in:
parent
7b95c8e184
commit
b74eecc724
|
@ -73,7 +73,10 @@ export class ListingTypeSelect extends Component<
|
|||
)}
|
||||
<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
|
||||
|
|
|
@ -188,7 +188,7 @@ export class Main extends Component<any, MainState> {
|
|||
? Object.values(ListingType)[
|
||||
UserService.Instance.user.default_listing_type
|
||||
]
|
||||
: ListingType.All;
|
||||
: ListingType.Local;
|
||||
let sort: SortType = pathSplit[7]
|
||||
? SortType[pathSplit[7]]
|
||||
: UserService.Instance.user
|
||||
|
@ -587,10 +587,7 @@ export class Main extends Component<any, MainState> {
|
|||
<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>
|
||||
|
@ -649,6 +646,13 @@ export class Main extends Component<any, MainState> {
|
|||
);
|
||||
}
|
||||
|
||||
get showLocal(): boolean {
|
||||
return (
|
||||
this.isoData.site.federated_instances !== null &&
|
||||
this.isoData.site.federated_instances.length > 0
|
||||
);
|
||||
}
|
||||
|
||||
get canAdmin(): boolean {
|
||||
return (
|
||||
UserService.Instance.user &&
|
||||
|
|
|
@ -817,7 +817,7 @@ export function getListingTypeFromProps(props: any): ListingType {
|
|||
? 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
|
||||
|
|
Loading…
Reference in a new issue