Browse Source

Local timeline (#1111)

* Adding a local filter. Fixes #1103

* Not showing local if there are no federated instances.
unoptim
Dessalines 2 years ago
committed by GitHub
parent
commit
6eb1b22548
  1. 2
      package.json
  2. 18
      src/components/listing-type-select.tsx
  3. 4
      src/components/main.tsx
  4. 4
      src/components/user.tsx
  5. 1
      translations/en.json
  6. 13
      yarn.lock

2
package.json

@ -37,7 +37,7 @@
"inferno-router": "^7.4.2",
"js-cookie": "^2.2.0",
"jwt-decode": "^2.2.0",
"lemmy-js-client": "^1.0.8",
"lemmy-js-client": "^1.0.9",
"markdown-it": "^11.0.0",
"markdown-it-container": "^3.0.0",
"markdown-it-emoji": "^1.4.0",

18
src/components/listing-type-select.tsx

@ -6,6 +6,7 @@ import { i18n } from '../i18next';
interface ListingTypeSelectProps {
type_: ListingType;
showLocal?: boolean;
onChange?(val: ListingType): any;
}
@ -31,6 +32,7 @@ export class ListingTypeSelect extends Component<
static getDerivedStateFromProps(props: any): ListingTypeSelectProps {
return {
type_: props.type_,
showLocal: props.showLocal,
};
}
@ -53,6 +55,22 @@ export class ListingTypeSelect extends Component<
/>
{i18n.t('subscribed')}
</label>
{this.props.showLocal && (
<label
className={`pointer btn btn-outline-secondary ${
this.state.type_ == ListingType.Local && 'active'
}`}
>
<input
id={`${this.id}-local`}
type="radio"
value={ListingType.Local}
checked={this.state.type_ == ListingType.Local}
onChange={linkEvent(this, this.handleTypeChange)}
/>
{i18n.t('local')}
</label>
)}
<label
className={`pointer btn btn-outline-secondary ${
this.state.type_ == ListingType.All && 'active'

4
src/components/main.tsx

@ -537,6 +537,10 @@ 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
}
onChange={this.handleListingTypeChange}
/>
</span>

4
src/components/user.tsx

@ -539,6 +539,10 @@ export class User extends Component<any, UserState> {
this.state.userSettingsForm.default_listing_type
]
}
showLocal={
this.state.siteRes.federated_instances &&
this.state.siteRes.federated_instances.length > 0
}
onChange={this.handleUserSettingsListingTypeChange}
/>
</form>

1
translations/en.json

@ -139,6 +139,7 @@
"month": "Month",
"year": "Year",
"all": "All",
"local": "Local",
"top": "Top",
"api": "API",
"docs": "Docs",

13
yarn.lock

@ -4938,10 +4938,10 @@ [email protected]^1.0.7:
dependencies:
chain-able "^3.0.0"
[email protected]^1.0.8:
version "1.0.8"
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-1.0.8.tgz#98e34c8e3cd07427f883f60fad376dc4d6f46e7f"
integrity sha512-YZxD3+8RGz7cRKdI8EIe5iQqQIMm5WzdNz6zZ7/CdkMtXUv6YuMOEv8HLTvBoGuaWIJwlMJ+23NIarxlT26IEw==
[email protected]^1.0.9:
version "1.0.9"
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-1.0.9.tgz#23cab713613612a524085d6bb3fc1d4042d262a8"
integrity sha512-QJc4d1HkSxjv555yH3MAOYbTfgbhmmvvuC1uhFvPwBlL5B5MTry/fWPRbtLfkYTxdZWftE+PYvLVKPr3/dFmxw==
[email protected]^3.1.0:
version "3.1.0"
@ -7017,6 +7017,11 @@ [email protected]^4.1.3:
unicode-match-property-ecmascript "^1.0.4"
unicode-match-property-value-ecmascript "^1.2.0"
[email protected]^1.7.1:
version "1.7.1"
resolved "https://registry.yarnpkg.com/register-service-worker/-/register-service-worker-1.7.1.tgz#6308347ac6c0af0f6c0b22ea5d59d25e836bc932"
integrity sha512-IdTfUZ4u8iJL8o1w8es8l6UMGPmkwHolUdT+UmM1UypC80IB4KbpuIlvwWVj8UDS7eJwkEYRcKRgfRX+oTmJsw==
[email protected]^3.0.1:
version "3.4.0"
resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-3.4.0.tgz#d7446815433f5d5ed6431cd5dca21048f66b397e"

Loading…
Cancel
Save