From 3060608a45bdbb2bd08f5a2ec95f4312ff2c98a7 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 9 Aug 2019 15:52:32 -0700 Subject: [PATCH] Second front end pass. --- ui/src/components/comment-form.tsx | 2 +- ui/src/components/comment-node.tsx | 7 ++----- ui/src/components/comment-nodes.tsx | 2 +- ui/src/components/communities.tsx | 11 ++++++----- ui/src/components/community-form.tsx | 3 +-- ui/src/components/home.tsx | 0 ui/src/components/inbox.tsx | 2 +- ui/src/components/login.tsx | 2 +- ui/src/components/main.tsx | 25 +++++++++++++------------ ui/src/components/moment-time.tsx | 3 +-- ui/src/components/navbar.tsx | 1 + ui/src/components/post-listing.tsx | 4 ++-- ui/src/components/search.tsx | 6 +++--- ui/src/components/sidebar.tsx | 2 +- ui/src/components/sponsors.tsx | 2 +- ui/src/components/user.tsx | 2 +- 16 files changed, 36 insertions(+), 38 deletions(-) delete mode 100644 ui/src/components/home.tsx diff --git a/ui/src/components/comment-form.tsx b/ui/src/components/comment-form.tsx index 9f3476a8b..ed62fcf5c 100644 --- a/ui/src/components/comment-form.tsx +++ b/ui/src/components/comment-form.tsx @@ -88,7 +88,7 @@ export class CommentForm extends Component { if (i.props.node) { i.props.onReplyCancel(); } - + autosize.update(document.querySelector('textarea')); } diff --git a/ui/src/components/comment-node.tsx b/ui/src/components/comment-node.tsx index a05286ed3..a1ac93b38 100644 --- a/ui/src/components/comment-node.tsx +++ b/ui/src/components/comment-node.tsx @@ -195,10 +195,10 @@ export class CommentNode extends Component { {/* TODO hold off on expires until later */} {/*
*/} {/* */} - {/* */} + {/* */} {/*
*/}
- +
} @@ -389,9 +389,6 @@ export class CommentNode extends Component { handleModBanBothSubmit(i: CommentNode) { event.preventDefault(); - console.log(BanType[i.state.banType]); - console.log(i.props.node.comment.banned); - if (i.state.banType == BanType.Community) { let form: BanFromCommunityForm = { user_id: i.props.node.comment.creator_id, diff --git a/ui/src/components/comment-nodes.tsx b/ui/src/components/comment-nodes.tsx index da67bbc7f..fca323e39 100644 --- a/ui/src/components/comment-nodes.tsx +++ b/ui/src/components/comment-nodes.tsx @@ -32,7 +32,7 @@ export class CommentNodes extends Component + /> )} ) diff --git a/ui/src/components/communities.tsx b/ui/src/components/communities.tsx index 066d524a2..f10dd10d6 100644 --- a/ui/src/components/communities.tsx +++ b/ui/src/components/communities.tsx @@ -5,6 +5,7 @@ import { retryWhen, delay, take } from 'rxjs/operators'; import { UserOperation, Community, ListCommunitiesResponse, CommunityResponse, FollowCommunityForm, ListCommunitiesForm, SortType } from '../interfaces'; import { WebSocketService } from '../services'; import { msgOp } from '../utils'; +import { i18n } from '../i18next'; import { T } from 'inferno-i18next'; declare const Sortable: any; @@ -27,12 +28,12 @@ export class Communities extends Component { super(props, context); this.state = this.emptyState; this.subscription = WebSocketService.Instance.subject - .pipe(retryWhen(errors => errors.pipe(delay(3000), take(10)))) - .subscribe( - (msg) => this.parseMessage(msg), + .pipe(retryWhen(errors => errors.pipe(delay(3000), take(10)))) + .subscribe( + (msg) => this.parseMessage(msg), (err) => console.error(err), () => console.log('complete') - ); + ); this.refetch(); @@ -47,7 +48,7 @@ export class Communities extends Component { } componentDidMount() { - document.title = `Communities - ${WebSocketService.Instance.site.name}`; + document.title = `${i18n.t('communities')} - ${WebSocketService.Instance.site.name}`; } // Necessary for back button for some reason diff --git a/ui/src/components/community-form.tsx b/ui/src/components/community-form.tsx index f6520fc6b..5db2fcb63 100644 --- a/ui/src/components/community-form.tsx +++ b/ui/src/components/community-form.tsx @@ -171,8 +171,7 @@ export class CommunityForm extends Component { { checked={this.state.type_ == ListingType.All} onChange={linkEvent(this, this.handleTypeChange)} /> - All + {i18n.t('all')} ) @@ -316,9 +317,9 @@ export class Main extends Component { return (
{this.state.page > 1 && - + } - +
); } diff --git a/ui/src/components/moment-time.tsx b/ui/src/components/moment-time.tsx index b35ceea85..021cf5f76 100644 --- a/ui/src/components/moment-time.tsx +++ b/ui/src/components/moment-time.tsx @@ -1,6 +1,6 @@ import { Component } from 'inferno'; import * as moment from 'moment'; -import 'moment/locale/de.js'; +// import 'moment/locale/de.js'; import { getLanguage } from '../utils'; import { i18n } from '../i18next'; @@ -16,7 +16,6 @@ export class MomentTime extends Component { constructor(props: any, context: any) { super(props, context); - // console.log(moment.locales()); moment.locale(getLanguage()); } diff --git a/ui/src/components/navbar.tsx b/ui/src/components/navbar.tsx index ac23e361d..5738483db 100644 --- a/ui/src/components/navbar.tsx +++ b/ui/src/components/navbar.tsx @@ -155,6 +155,7 @@ export class Navbar extends Component { parseMessage(msg: any) { let op: UserOperation = msgOp(msg); if (msg.error) { + // TODO if (msg.error == "Not logged in.") { UserService.Instance.logout(); location.reload(); diff --git a/ui/src/components/post-listing.tsx b/ui/src/components/post-listing.tsx index dc8f4cfae..ff70783cb 100644 --- a/ui/src/components/post-listing.tsx +++ b/ui/src/components/post-listing.tsx @@ -76,7 +76,7 @@ export class PostListing extends Component {
{post.url ? {post.name} : - {post.name} + {post.name} }
{post.url && @@ -176,7 +176,7 @@ export class PostListing extends Component { } {this.state.showRemoveDialog &&
- +
} diff --git a/ui/src/components/search.tsx b/ui/src/components/search.tsx index 67202dba1..ae29fd0b6 100644 --- a/ui/src/components/search.tsx +++ b/ui/src/components/search.tsx @@ -54,7 +54,7 @@ export class Search extends Component { } componentDidMount() { - document.title = `Search - ${WebSocketService.Instance.site.name}`; + document.title = `${i18n.t('search')} - ${WebSocketService.Instance.site.name}`; } render() { @@ -62,7 +62,7 @@ export class Search extends Component {
-
Search
+
#
{this.selects()} {this.searchForm()} {this.state.type_ == SearchType.Both && @@ -85,7 +85,7 @@ export class Search extends Component { searchForm() { return (
- + diff --git a/ui/src/components/sponsors.tsx b/ui/src/components/sponsors.tsx index 898efa2cf..3fd55c2fb 100644 --- a/ui/src/components/sponsors.tsx +++ b/ui/src/components/sponsors.tsx @@ -65,7 +65,7 @@ export class Sponsors extends Component { bitcoin() { return (
-
Crypto
+
#
diff --git a/ui/src/components/user.tsx b/ui/src/components/user.tsx index 4193175c7..f0034a473 100644 --- a/ui/src/components/user.tsx +++ b/ui/src/components/user.tsx @@ -219,7 +219,7 @@ export class User extends Component { return (
{user.name}
-
Joined
+
{i18n.t('joined')}
#