mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-25 07:36:37 +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
|
<label
|
||||||
className={`pointer btn btn-outline-secondary ${
|
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
|
<input
|
||||||
|
|
|
@ -188,7 +188,7 @@ export class Main extends Component<any, MainState> {
|
||||||
? Object.values(ListingType)[
|
? Object.values(ListingType)[
|
||||||
UserService.Instance.user.default_listing_type
|
UserService.Instance.user.default_listing_type
|
||||||
]
|
]
|
||||||
: ListingType.All;
|
: ListingType.Local;
|
||||||
let sort: SortType = pathSplit[7]
|
let sort: SortType = pathSplit[7]
|
||||||
? SortType[pathSplit[7]]
|
? SortType[pathSplit[7]]
|
||||||
: UserService.Instance.user
|
: UserService.Instance.user
|
||||||
|
@ -587,10 +587,7 @@ export class Main extends Component<any, MainState> {
|
||||||
<span class="mr-3">
|
<span class="mr-3">
|
||||||
<ListingTypeSelect
|
<ListingTypeSelect
|
||||||
type_={this.state.listingType}
|
type_={this.state.listingType}
|
||||||
showLocal={
|
showLocal={this.showLocal}
|
||||||
this.state.siteRes.federated_instances &&
|
|
||||||
this.state.siteRes.federated_instances.length > 0
|
|
||||||
}
|
|
||||||
onChange={this.handleListingTypeChange}
|
onChange={this.handleListingTypeChange}
|
||||||
/>
|
/>
|
||||||
</span>
|
</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 {
|
get canAdmin(): boolean {
|
||||||
return (
|
return (
|
||||||
UserService.Instance.user &&
|
UserService.Instance.user &&
|
||||||
|
|
|
@ -817,7 +817,7 @@ export function getListingTypeFromProps(props: any): ListingType {
|
||||||
? routeListingTypeToEnum(props.match.params.listing_type)
|
? routeListingTypeToEnum(props.match.params.listing_type)
|
||||||
: UserService.Instance.user
|
: UserService.Instance.user
|
||||||
? Object.values(ListingType)[UserService.Instance.user.default_listing_type]
|
? Object.values(ListingType)[UserService.Instance.user.default_listing_type]
|
||||||
: ListingType.All;
|
: ListingType.Local;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO might need to add a user setting for this too
|
// TODO might need to add a user setting for this too
|
||||||
|
|
Loading…
Reference in a new issue