-
u stink main
{
{this.trendingCommunities()}
{this.createCommunityButton()}
- {/*
+ {/* TODO
{this.subscribedCommunities()}
*/}
@@ -257,7 +304,7 @@ export class Main extends Component {
createCommunityButton() {
return (
-
+
{i18n.t('create_a_community')}
);
@@ -269,7 +316,7 @@ export class Main extends Component {
#
-
+
#
@@ -293,7 +340,7 @@ export class Main extends Component {
#
-
+
#
@@ -537,6 +584,10 @@ export class Main extends Component {
0
+ }
onChange={this.handleListingTypeChange}
/>
diff --git a/src/shared/components/navbar.tsx b/src/shared/components/navbar.tsx
index 56829b5e..5c7c4387 100644
--- a/src/shared/components/navbar.tsx
+++ b/src/shared/components/navbar.tsx
@@ -84,7 +84,6 @@ export class Navbar extends Component {
// The login
// TODO this needs some work
if (this.props.site.my_user) {
- console.log(this.props.site.my_user);
UserService.Instance.user = this.props.site.my_user;
// i18n.changeLanguage(getLanguage());
diff --git a/src/shared/components/sort-select.tsx b/src/shared/components/sort-select.tsx
index 1f0fb055..7ba8a5fd 100644
--- a/src/shared/components/sort-select.tsx
+++ b/src/shared/components/sort-select.tsx
@@ -42,10 +42,10 @@ export class SortSelect extends Component {
>
{!this.props.hideHot && (
- <>
-
-
- >
+
+ )}
+ {!this.props.hideHot && (
+
)}
diff --git a/src/shared/routes.ts b/src/shared/routes.ts
index 2b3eb757..1b43edab 100644
--- a/src/shared/routes.ts
+++ b/src/shared/routes.ts
@@ -22,10 +22,16 @@ interface IRoutePropsWithFetch extends IRouteProps {
}
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`,
component: Main,
+ fetchInitialData: (auth, path) => Main.fetchInitialData(auth, path),
},
{ path: `/login`, component: Login },
{
diff --git a/src/shared/utils.ts b/src/shared/utils.ts
index 315b0e98..3617fb68 100644
--- a/src/shared/utils.ts
+++ b/src/shared/utils.ts
@@ -25,6 +25,7 @@ import 'moment/locale/sq';
import 'moment/locale/km';
import 'moment/locale/ga';
import 'moment/locale/sr';
+import 'moment/locale/ko';
import {
UserOperation,
@@ -96,6 +97,7 @@ export const languages = [
{ code: 'gl', name: 'Galego' },
{ code: 'hu', name: 'Magyar Nyelv' },
{ code: 'ka', name: 'ქართული ენა' },
+ { code: 'ko', name: '한국어' },
{ code: 'km', name: 'ភាសាខ្មែរ' },
{ code: 'hi', name: 'मानक हिन्दी' },
{ code: 'fa', name: 'فارسی' },
@@ -428,6 +430,8 @@ export function getMomentLanguage(): string {
lang = 'ga';
} else if (lang.startsWith('sr')) {
lang = 'sr';
+ } else if (lang.startsWith('ko')) {
+ lang = 'ko';
} else {
lang = 'en';
}
@@ -718,16 +722,20 @@ export function setupTribute() {
});
}
-// TODO
-// let tippyInstance = tippy('[data-tippy-content]');
+var tippyInstance;
+if (isBrowser()) {
+ tippyInstance = tippy('[data-tippy-content]');
+}
export function setupTippy() {
- // tippyInstance.forEach(e => e.destroy());
- // tippyInstance = tippy('[data-tippy-content]', {
- // delay: [500, 0],
- // // Display on "long press"
- // touch: ['hold', 500],
- // });
+ if (isBrowser()) {
+ tippyInstance.forEach(e => e.destroy());
+ tippyInstance = tippy('[data-tippy-content]', {
+ delay: [500, 0],
+ // Display on "long press"
+ touch: ['hold', 500],
+ });
+ }
}
function userSearch(text: string, cb: any) {
@@ -805,32 +813,26 @@ function communitySearch(text: string, cb: any) {
}
export function getListingTypeFromProps(props: any): ListingType {
- // TODO
- return ListingType.All;
- // return props.match.params.listing_type
- // ? routeListingTypeToEnum(props.match.params.listing_type)
- // : UserService.Instance.user
- // ? Object.values(ListingType)[UserService.Instance.user.default_listing_type]
- // : ListingType.All;
+ return props.match.params.listing_type
+ ? routeListingTypeToEnum(props.match.params.listing_type)
+ : UserService.Instance.user
+ ? Object.values(ListingType)[UserService.Instance.user.default_listing_type]
+ : ListingType.All;
}
// TODO might need to add a user setting for this too
export function getDataTypeFromProps(props: any): DataType {
- // TODO
- return DataType.Post;
- // return props.match.params.data_type
- // ? routeDataTypeToEnum(props.match.params.data_type)
- // : DataType.Post;
+ return props.match.params.data_type
+ ? routeDataTypeToEnum(props.match.params.data_type)
+ : DataType.Post;
}
export function getSortTypeFromProps(props: any): SortType {
- // TODO
- return SortType.Active;
- // return props.match.params.sort
- // ? routeSortTypeToEnum(props.match.params.sort)
- // : UserService.Instance.user
- // ? Object.values(SortType)[UserService.Instance.user.default_sort_type]
- // : SortType.Active;
+ return props.match.params.sort
+ ? routeSortTypeToEnum(props.match.params.sort)
+ : UserService.Instance.user
+ ? Object.values(SortType)[UserService.Instance.user.default_sort_type]
+ : SortType.Active;
}
export function getPageFromProps(props: any): number {
diff --git a/yarn.lock b/yarn.lock
index d61a002a..bd7f562e 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -7043,10 +7043,10 @@ lcid@^1.0.0:
dependencies:
invert-kv "^1.0.0"
-lemmy-js-client@^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==
+lemmy-js-client@^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==
leven@^3.1.0:
version "3.1.0"