mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-25 07:36:37 +00:00
Main page done.
This commit is contained in:
parent
a5aeba3ad0
commit
8f44607956
|
@ -74,7 +74,7 @@
|
||||||
"eslint-plugin-jane": "^8.0.4",
|
"eslint-plugin-jane": "^8.0.4",
|
||||||
"husky": "^4.2.5",
|
"husky": "^4.2.5",
|
||||||
"jest": "^26.4.2",
|
"jest": "^26.4.2",
|
||||||
"lemmy-js-client": "^1.0.8",
|
"lemmy-js-client": "^1.0.9",
|
||||||
"lint-staged": "^10.1.3",
|
"lint-staged": "^10.1.3",
|
||||||
"mini-css-extract-plugin": "^0.11.0",
|
"mini-css-extract-plugin": "^0.11.0",
|
||||||
"node-sass": "^4.12.0",
|
"node-sass": "^4.12.0",
|
||||||
|
|
|
@ -23,7 +23,6 @@ export class DataTypeSelect extends Component<
|
||||||
constructor(props: any, context: any) {
|
constructor(props: any, context: any) {
|
||||||
super(props, context);
|
super(props, context);
|
||||||
this.state = this.emptyState;
|
this.state = this.emptyState;
|
||||||
console.log(this.state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static getDerivedStateFromProps(props: any): DataTypeSelectProps {
|
static getDerivedStateFromProps(props: any): DataTypeSelectProps {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { i18n } from '../i18next';
|
||||||
|
|
||||||
interface ListingTypeSelectProps {
|
interface ListingTypeSelectProps {
|
||||||
type_: ListingType;
|
type_: ListingType;
|
||||||
|
showLocal?: boolean;
|
||||||
onChange?(val: ListingType): any;
|
onChange?(val: ListingType): any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +32,7 @@ export class ListingTypeSelect extends Component<
|
||||||
static getDerivedStateFromProps(props: any): ListingTypeSelectProps {
|
static getDerivedStateFromProps(props: any): ListingTypeSelectProps {
|
||||||
return {
|
return {
|
||||||
type_: props.type_,
|
type_: props.type_,
|
||||||
|
showLocal: props.showLocal,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,6 +55,22 @@ export class ListingTypeSelect extends Component<
|
||||||
/>
|
/>
|
||||||
{i18n.t('subscribed')}
|
{i18n.t('subscribed')}
|
||||||
</label>
|
</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
|
<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'
|
||||||
|
|
|
@ -2,7 +2,6 @@ import { Component, linkEvent } from 'inferno';
|
||||||
import { Helmet } from 'inferno-helmet';
|
import { Helmet } from 'inferno-helmet';
|
||||||
import { Link } from 'inferno-router';
|
import { Link } from 'inferno-router';
|
||||||
import { Subscription } from 'rxjs';
|
import { Subscription } from 'rxjs';
|
||||||
import { retryWhen, delay, take } from 'rxjs/operators';
|
|
||||||
import {
|
import {
|
||||||
UserOperation,
|
UserOperation,
|
||||||
CommunityUser,
|
CommunityUser,
|
||||||
|
@ -56,7 +55,11 @@ import {
|
||||||
setupTippy,
|
setupTippy,
|
||||||
favIconUrl,
|
favIconUrl,
|
||||||
notifyPost,
|
notifyPost,
|
||||||
|
setIsoData,
|
||||||
|
wsSubscribe,
|
||||||
isBrowser,
|
isBrowser,
|
||||||
|
setAuth,
|
||||||
|
lemmyHttp,
|
||||||
} from '../utils';
|
} from '../utils';
|
||||||
import { i18n } from '../i18next';
|
import { i18n } from '../i18next';
|
||||||
import { T } from 'inferno-i18next';
|
import { T } from 'inferno-i18next';
|
||||||
|
@ -90,34 +93,12 @@ interface UrlParams {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Main extends Component<any, MainState> {
|
export class Main extends Component<any, MainState> {
|
||||||
|
private isoData = setIsoData(this.context);
|
||||||
private subscription: Subscription;
|
private subscription: Subscription;
|
||||||
private emptyState: MainState = {
|
private emptyState: MainState = {
|
||||||
subscribedCommunities: [],
|
subscribedCommunities: [],
|
||||||
trendingCommunities: [],
|
trendingCommunities: [],
|
||||||
siteRes: {
|
siteRes: this.isoData.site,
|
||||||
site: {
|
|
||||||
id: null,
|
|
||||||
name: null,
|
|
||||||
creator_id: null,
|
|
||||||
creator_name: null,
|
|
||||||
published: null,
|
|
||||||
number_of_users: null,
|
|
||||||
number_of_posts: null,
|
|
||||||
number_of_comments: null,
|
|
||||||
number_of_communities: null,
|
|
||||||
enable_downvotes: null,
|
|
||||||
open_registration: null,
|
|
||||||
enable_nsfw: null,
|
|
||||||
icon: null,
|
|
||||||
banner: null,
|
|
||||||
creator_preferred_username: null,
|
|
||||||
},
|
|
||||||
admins: [],
|
|
||||||
banned: [],
|
|
||||||
online: null,
|
|
||||||
version: null,
|
|
||||||
federated_instances: null,
|
|
||||||
},
|
|
||||||
showEditSite: false,
|
showEditSite: false,
|
||||||
loading: true,
|
loading: true,
|
||||||
posts: [],
|
posts: [],
|
||||||
|
@ -137,59 +118,126 @@ export class Main extends Component<any, MainState> {
|
||||||
this.handleListingTypeChange = this.handleListingTypeChange.bind(this);
|
this.handleListingTypeChange = this.handleListingTypeChange.bind(this);
|
||||||
this.handleDataTypeChange = this.handleDataTypeChange.bind(this);
|
this.handleDataTypeChange = this.handleDataTypeChange.bind(this);
|
||||||
|
|
||||||
if (isBrowser()) {
|
this.parseMessage = this.parseMessage.bind(this);
|
||||||
// TODO
|
this.subscription = wsSubscribe(this.parseMessage);
|
||||||
/* this.subscription = WebSocketService.Instance.subject */
|
|
||||||
/* .pipe(retryWhen(errors => errors.pipe(delay(3000), take(10)))) */
|
// Only fetch the data if coming from another route
|
||||||
/* .subscribe( */
|
if (this.isoData.path == this.context.router.route.match.url) {
|
||||||
/* msg => this.parseMessage(msg), */
|
if (this.state.dataType == DataType.Post) {
|
||||||
/* err => console.error(err), */
|
this.state.posts = this.isoData.routeData[0].posts;
|
||||||
/* () => console.log('complete') */
|
} else {
|
||||||
/* ); */
|
this.state.comments = this.isoData.routeData[0].comments;
|
||||||
/* WebSocketService.Instance.getSite(); */
|
|
||||||
/* if (UserService.Instance.user) { */
|
|
||||||
/* WebSocketService.Instance.getFollowedCommunities(); */
|
|
||||||
/* } */
|
|
||||||
/* let listCommunitiesForm: ListCommunitiesForm = { */
|
|
||||||
/* sort: SortType.Hot, */
|
|
||||||
/* limit: 6, */
|
|
||||||
/* }; */
|
|
||||||
/* WebSocketService.Instance.listCommunities(listCommunitiesForm); */
|
|
||||||
/* this.fetchData(); */
|
|
||||||
}
|
}
|
||||||
|
this.state.trendingCommunities = this.isoData.routeData[1].communities;
|
||||||
|
if (UserService.Instance.user) {
|
||||||
|
this.state.subscribedCommunities = this.isoData.routeData[2].communities;
|
||||||
|
}
|
||||||
|
this.state.loading = false;
|
||||||
|
} else {
|
||||||
|
this.fetchTrendingCommunities();
|
||||||
|
this.fetchData();
|
||||||
|
if (UserService.Instance.user) {
|
||||||
|
WebSocketService.Instance.getFollowedCommunities();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setupTippy();
|
||||||
|
}
|
||||||
|
|
||||||
|
fetchTrendingCommunities() {
|
||||||
|
let listCommunitiesForm: ListCommunitiesForm = {
|
||||||
|
sort: SortType.Hot,
|
||||||
|
limit: 6,
|
||||||
|
};
|
||||||
|
WebSocketService.Instance.listCommunities(listCommunitiesForm);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
|
if (isBrowser()) {
|
||||||
this.subscription.unsubscribe();
|
this.subscription.unsubscribe();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* static getDerivedStateFromProps(props: any): MainProps { */
|
static getDerivedStateFromProps(props: any): MainProps {
|
||||||
/* return { */
|
return {
|
||||||
/* listingType: getListingTypeFromProps(props), */
|
listingType: getListingTypeFromProps(props),
|
||||||
/* dataType: getDataTypeFromProps(props), */
|
dataType: getDataTypeFromProps(props),
|
||||||
/* sort: getSortTypeFromProps(props), */
|
sort: getSortTypeFromProps(props),
|
||||||
/* page: getPageFromProps(props), */
|
page: getPageFromProps(props),
|
||||||
/* }; */
|
};
|
||||||
/* } */
|
}
|
||||||
|
|
||||||
/* componentDidUpdate(_: any, lastState: MainState) { */
|
static fetchInitialData(auth: string, path: string): Promise<any>[] {
|
||||||
/* if ( */
|
let pathSplit = path.split('/');
|
||||||
/* lastState.listingType !== this.state.listingType || */
|
let dataType: DataType = pathSplit[3]
|
||||||
/* lastState.dataType !== this.state.dataType || */
|
? DataType[pathSplit[3]]
|
||||||
/* lastState.sort !== this.state.sort || */
|
: DataType.Post;
|
||||||
/* lastState.page !== this.state.page */
|
|
||||||
/* ) { */
|
// TODO figure out auth default_listingType, default_sort_type
|
||||||
/* this.setState({ loading: true }); */
|
let type_: ListingType = pathSplit[5]
|
||||||
/* this.fetchData(); */
|
? ListingType[pathSplit[5]]
|
||||||
/* } */
|
: UserService.Instance.user
|
||||||
/* } */
|
? Object.values(ListingType)[
|
||||||
|
UserService.Instance.user.default_listing_type
|
||||||
|
]
|
||||||
|
: ListingType.All;
|
||||||
|
let sort: SortType = pathSplit[7]
|
||||||
|
? SortType[pathSplit[7]]
|
||||||
|
: UserService.Instance.user
|
||||||
|
? Object.values(SortType)[UserService.Instance.user.default_sort_type]
|
||||||
|
: SortType.Active;
|
||||||
|
|
||||||
|
let page = pathSplit[9] ? Number(pathSplit[9]) : 1;
|
||||||
|
|
||||||
|
let promises: Promise<any>[] = [];
|
||||||
|
|
||||||
|
if (dataType == DataType.Post) {
|
||||||
|
let getPostsForm: GetPostsForm = {
|
||||||
|
page,
|
||||||
|
limit: fetchLimit,
|
||||||
|
sort,
|
||||||
|
type_,
|
||||||
|
};
|
||||||
|
setAuth(getPostsForm, auth);
|
||||||
|
promises.push(lemmyHttp.getPosts(getPostsForm));
|
||||||
|
} else {
|
||||||
|
let getCommentsForm: GetCommentsForm = {
|
||||||
|
page,
|
||||||
|
limit: fetchLimit,
|
||||||
|
sort,
|
||||||
|
type_,
|
||||||
|
};
|
||||||
|
setAuth(getCommentsForm, auth);
|
||||||
|
promises.push(lemmyHttp.getComments(getCommentsForm));
|
||||||
|
}
|
||||||
|
|
||||||
|
let trendingCommunitiesForm: ListCommunitiesForm = {
|
||||||
|
sort: SortType.Hot,
|
||||||
|
limit: 6,
|
||||||
|
};
|
||||||
|
promises.push(lemmyHttp.listCommunities(trendingCommunitiesForm));
|
||||||
|
|
||||||
|
if (auth) {
|
||||||
|
promises.push(lemmyHttp.getFollowedCommunities({ auth }));
|
||||||
|
}
|
||||||
|
|
||||||
|
return promises;
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidUpdate(_: any, lastState: MainState) {
|
||||||
|
if (
|
||||||
|
lastState.listingType !== this.state.listingType ||
|
||||||
|
lastState.dataType !== this.state.dataType ||
|
||||||
|
lastState.sort !== this.state.sort ||
|
||||||
|
lastState.page !== this.state.page
|
||||||
|
) {
|
||||||
|
this.setState({ loading: true });
|
||||||
|
this.fetchData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
get documentTitle(): string {
|
get documentTitle(): string {
|
||||||
if (this.state.siteRes.site.name) {
|
|
||||||
return `${this.state.siteRes.site.name}`;
|
return `${this.state.siteRes.site.name}`;
|
||||||
} else {
|
|
||||||
return 'Lemmy';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get favIcon(): string {
|
get favIcon(): string {
|
||||||
|
@ -201,7 +249,6 @@ export class Main extends Component<any, MainState> {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1 className={`text-warning`}>u stink main</h1>
|
|
||||||
<Helmet title={this.documentTitle}>
|
<Helmet title={this.documentTitle}>
|
||||||
<link
|
<link
|
||||||
id="favicon"
|
id="favicon"
|
||||||
|
@ -236,7 +283,7 @@ export class Main extends Component<any, MainState> {
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
{this.trendingCommunities()}
|
{this.trendingCommunities()}
|
||||||
{this.createCommunityButton()}
|
{this.createCommunityButton()}
|
||||||
{/*
|
{/* TODO
|
||||||
{this.subscribedCommunities()}
|
{this.subscribedCommunities()}
|
||||||
*/}
|
*/}
|
||||||
</div>
|
</div>
|
||||||
|
@ -257,7 +304,7 @@ export class Main extends Component<any, MainState> {
|
||||||
|
|
||||||
createCommunityButton() {
|
createCommunityButton() {
|
||||||
return (
|
return (
|
||||||
<Link class="btn btn-secondary btn-block" to="/create_community">
|
<Link className="btn btn-secondary btn-block" to="/create_community">
|
||||||
{i18n.t('create_a_community')}
|
{i18n.t('create_a_community')}
|
||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
|
@ -269,7 +316,7 @@ export class Main extends Component<any, MainState> {
|
||||||
<h5>
|
<h5>
|
||||||
<T i18nKey="trending_communities">
|
<T i18nKey="trending_communities">
|
||||||
#
|
#
|
||||||
<Link class="text-body" to="/communities">
|
<Link className="text-body" to="/communities">
|
||||||
#
|
#
|
||||||
</Link>
|
</Link>
|
||||||
</T>
|
</T>
|
||||||
|
@ -293,7 +340,7 @@ export class Main extends Component<any, MainState> {
|
||||||
<h5>
|
<h5>
|
||||||
<T i18nKey="subscribed_to_communities">
|
<T i18nKey="subscribed_to_communities">
|
||||||
#
|
#
|
||||||
<Link class="text-body" to="/communities">
|
<Link className="text-body" to="/communities">
|
||||||
#
|
#
|
||||||
</Link>
|
</Link>
|
||||||
</T>
|
</T>
|
||||||
|
@ -537,6 +584,10 @@ 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={
|
||||||
|
this.state.siteRes.federated_instances &&
|
||||||
|
this.state.siteRes.federated_instances.length > 0
|
||||||
|
}
|
||||||
onChange={this.handleListingTypeChange}
|
onChange={this.handleListingTypeChange}
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -84,7 +84,6 @@ export class Navbar extends Component<NavbarProps, NavbarState> {
|
||||||
// The login
|
// The login
|
||||||
// TODO this needs some work
|
// TODO this needs some work
|
||||||
if (this.props.site.my_user) {
|
if (this.props.site.my_user) {
|
||||||
console.log(this.props.site.my_user);
|
|
||||||
UserService.Instance.user = this.props.site.my_user;
|
UserService.Instance.user = this.props.site.my_user;
|
||||||
// i18n.changeLanguage(getLanguage());
|
// i18n.changeLanguage(getLanguage());
|
||||||
|
|
||||||
|
|
|
@ -42,10 +42,10 @@ export class SortSelect extends Component<SortSelectProps, SortSelectState> {
|
||||||
>
|
>
|
||||||
<option disabled>{i18n.t('sort_type')}</option>
|
<option disabled>{i18n.t('sort_type')}</option>
|
||||||
{!this.props.hideHot && (
|
{!this.props.hideHot && (
|
||||||
<>
|
|
||||||
<option value={SortType.Active}>{i18n.t('active')}</option>
|
|
||||||
<option value={SortType.Hot}>{i18n.t('hot')}</option>
|
<option value={SortType.Hot}>{i18n.t('hot')}</option>
|
||||||
</>
|
)}
|
||||||
|
{!this.props.hideHot && (
|
||||||
|
<option value={SortType.Active}>{i18n.t('active')}</option>
|
||||||
)}
|
)}
|
||||||
<option value={SortType.New}>{i18n.t('new')}</option>
|
<option value={SortType.New}>{i18n.t('new')}</option>
|
||||||
<option disabled>─────</option>
|
<option disabled>─────</option>
|
||||||
|
|
|
@ -22,10 +22,16 @@ interface IRoutePropsWithFetch extends IRouteProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const routes: IRoutePropsWithFetch[] = [
|
export const routes: IRoutePropsWithFetch[] = [
|
||||||
{ exact: true, path: `/`, component: Main },
|
{
|
||||||
|
exact: true,
|
||||||
|
path: `/`,
|
||||||
|
component: Main,
|
||||||
|
fetchInitialData: (auth, path) => Main.fetchInitialData(auth, path),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: `/home/data_type/:data_type/listing_type/:listing_type/sort/:sort/page/:page`,
|
path: `/home/data_type/:data_type/listing_type/:listing_type/sort/:sort/page/:page`,
|
||||||
component: Main,
|
component: Main,
|
||||||
|
fetchInitialData: (auth, path) => Main.fetchInitialData(auth, path),
|
||||||
},
|
},
|
||||||
{ path: `/login`, component: Login },
|
{ path: `/login`, component: Login },
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,6 +25,7 @@ import 'moment/locale/sq';
|
||||||
import 'moment/locale/km';
|
import 'moment/locale/km';
|
||||||
import 'moment/locale/ga';
|
import 'moment/locale/ga';
|
||||||
import 'moment/locale/sr';
|
import 'moment/locale/sr';
|
||||||
|
import 'moment/locale/ko';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
UserOperation,
|
UserOperation,
|
||||||
|
@ -96,6 +97,7 @@ export const languages = [
|
||||||
{ code: 'gl', name: 'Galego' },
|
{ code: 'gl', name: 'Galego' },
|
||||||
{ code: 'hu', name: 'Magyar Nyelv' },
|
{ code: 'hu', name: 'Magyar Nyelv' },
|
||||||
{ code: 'ka', name: 'ქართული ენა' },
|
{ code: 'ka', name: 'ქართული ენა' },
|
||||||
|
{ code: 'ko', name: '한국어' },
|
||||||
{ code: 'km', name: 'ភាសាខ្មែរ' },
|
{ code: 'km', name: 'ភាសាខ្មែរ' },
|
||||||
{ code: 'hi', name: 'मानक हिन्दी' },
|
{ code: 'hi', name: 'मानक हिन्दी' },
|
||||||
{ code: 'fa', name: 'فارسی' },
|
{ code: 'fa', name: 'فارسی' },
|
||||||
|
@ -428,6 +430,8 @@ export function getMomentLanguage(): string {
|
||||||
lang = 'ga';
|
lang = 'ga';
|
||||||
} else if (lang.startsWith('sr')) {
|
} else if (lang.startsWith('sr')) {
|
||||||
lang = 'sr';
|
lang = 'sr';
|
||||||
|
} else if (lang.startsWith('ko')) {
|
||||||
|
lang = 'ko';
|
||||||
} else {
|
} else {
|
||||||
lang = 'en';
|
lang = 'en';
|
||||||
}
|
}
|
||||||
|
@ -718,16 +722,20 @@ export function setupTribute() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
var tippyInstance;
|
||||||
// let tippyInstance = tippy('[data-tippy-content]');
|
if (isBrowser()) {
|
||||||
|
tippyInstance = tippy('[data-tippy-content]');
|
||||||
|
}
|
||||||
|
|
||||||
export function setupTippy() {
|
export function setupTippy() {
|
||||||
// tippyInstance.forEach(e => e.destroy());
|
if (isBrowser()) {
|
||||||
// tippyInstance = tippy('[data-tippy-content]', {
|
tippyInstance.forEach(e => e.destroy());
|
||||||
// delay: [500, 0],
|
tippyInstance = tippy('[data-tippy-content]', {
|
||||||
// // Display on "long press"
|
delay: [500, 0],
|
||||||
// touch: ['hold', 500],
|
// Display on "long press"
|
||||||
// });
|
touch: ['hold', 500],
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function userSearch(text: string, cb: any) {
|
function userSearch(text: string, cb: any) {
|
||||||
|
@ -805,32 +813,26 @@ function communitySearch(text: string, cb: any) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getListingTypeFromProps(props: any): ListingType {
|
export function getListingTypeFromProps(props: any): ListingType {
|
||||||
// TODO
|
return props.match.params.listing_type
|
||||||
return ListingType.All;
|
? routeListingTypeToEnum(props.match.params.listing_type)
|
||||||
// return props.match.params.listing_type
|
: UserService.Instance.user
|
||||||
// ? routeListingTypeToEnum(props.match.params.listing_type)
|
? Object.values(ListingType)[UserService.Instance.user.default_listing_type]
|
||||||
// : UserService.Instance.user
|
: ListingType.All;
|
||||||
// ? Object.values(ListingType)[UserService.Instance.user.default_listing_type]
|
|
||||||
// : ListingType.All;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO might need to add a user setting for this too
|
// TODO might need to add a user setting for this too
|
||||||
export function getDataTypeFromProps(props: any): DataType {
|
export function getDataTypeFromProps(props: any): DataType {
|
||||||
// TODO
|
return props.match.params.data_type
|
||||||
return DataType.Post;
|
? routeDataTypeToEnum(props.match.params.data_type)
|
||||||
// return props.match.params.data_type
|
: DataType.Post;
|
||||||
// ? routeDataTypeToEnum(props.match.params.data_type)
|
|
||||||
// : DataType.Post;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getSortTypeFromProps(props: any): SortType {
|
export function getSortTypeFromProps(props: any): SortType {
|
||||||
// TODO
|
return props.match.params.sort
|
||||||
return SortType.Active;
|
? routeSortTypeToEnum(props.match.params.sort)
|
||||||
// return props.match.params.sort
|
: UserService.Instance.user
|
||||||
// ? routeSortTypeToEnum(props.match.params.sort)
|
? Object.values(SortType)[UserService.Instance.user.default_sort_type]
|
||||||
// : UserService.Instance.user
|
: SortType.Active;
|
||||||
// ? Object.values(SortType)[UserService.Instance.user.default_sort_type]
|
|
||||||
// : SortType.Active;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getPageFromProps(props: any): number {
|
export function getPageFromProps(props: any): number {
|
||||||
|
|
|
@ -7043,10 +7043,10 @@ lcid@^1.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
invert-kv "^1.0.0"
|
invert-kv "^1.0.0"
|
||||||
|
|
||||||
lemmy-js-client@^1.0.8:
|
lemmy-js-client@^1.0.9:
|
||||||
version "1.0.8"
|
version "1.0.9"
|
||||||
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-1.0.8.tgz#98e34c8e3cd07427f883f60fad376dc4d6f46e7f"
|
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-1.0.9.tgz#23cab713613612a524085d6bb3fc1d4042d262a8"
|
||||||
integrity sha512-YZxD3+8RGz7cRKdI8EIe5iQqQIMm5WzdNz6zZ7/CdkMtXUv6YuMOEv8HLTvBoGuaWIJwlMJ+23NIarxlT26IEw==
|
integrity sha512-QJc4d1HkSxjv555yH3MAOYbTfgbhmmvvuC1uhFvPwBlL5B5MTry/fWPRbtLfkYTxdZWftE+PYvLVKPr3/dFmxw==
|
||||||
|
|
||||||
leven@^3.1.0:
|
leven@^3.1.0:
|
||||||
version "3.1.0"
|
version "3.1.0"
|
||||||
|
|
Loading…
Reference in a new issue