From 272361ea5fb3361c77d7868f4bbed083b7cdeddf Mon Sep 17 00:00:00 2001 From: Matteo Guglielmetti Date: Fri, 18 Oct 2019 10:33:29 +0200 Subject: [PATCH] Adds i18n to Prev and Next buttons in modlog --- ui/src/components/modlog.tsx | 45 ++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/ui/src/components/modlog.tsx b/ui/src/components/modlog.tsx index 3af122a..1c1a7ba 100644 --- a/ui/src/components/modlog.tsx +++ b/ui/src/components/modlog.tsx @@ -8,6 +8,7 @@ import { msgOp, addTypeInfo, fetchLimit } from '../utils'; import { MomentTime } from './moment-time'; import * as moment from 'moment'; import { i18n } from '../i18next'; +import { T } from 'inferno-i18next'; interface ModlogState { combined: Array<{type_: string, data: ModRemovePost | ModLockPost | ModStickyPost | ModRemoveCommunity | ModAdd | ModBan}>, @@ -89,42 +90,42 @@ export class Modlog extends Component { {i.data.mod_user_name} - {i.type_ == 'removed_posts' && + {i.type_ == 'removed_posts' && <> - {(i.data as ModRemovePost).removed? 'Removed' : 'Restored'} + {(i.data as ModRemovePost).removed? 'Removed' : 'Restored'} Post {(i.data as ModRemovePost).post_name}
{(i.data as ModRemovePost).reason && ` reason: ${(i.data as ModRemovePost).reason}`}
} - {i.type_ == 'locked_posts' && + {i.type_ == 'locked_posts' && <> - {(i.data as ModLockPost).locked? 'Locked' : 'Unlocked'} + {(i.data as ModLockPost).locked? 'Locked' : 'Unlocked'} Post {(i.data as ModLockPost).post_name} } - {i.type_ == 'stickied_posts' && + {i.type_ == 'stickied_posts' && <> - {(i.data as ModStickyPost).stickied? 'Stickied' : 'Unstickied'} + {(i.data as ModStickyPost).stickied? 'Stickied' : 'Unstickied'} Post {(i.data as ModStickyPost).post_name} } - {i.type_ == 'removed_comments' && + {i.type_ == 'removed_comments' && <> - {(i.data as ModRemoveComment).removed? 'Removed' : 'Restored'} + {(i.data as ModRemoveComment).removed? 'Removed' : 'Restored'} Comment {(i.data as ModRemoveComment).comment_content} by {(i.data as ModRemoveComment).comment_user_name}
{(i.data as ModRemoveComment).reason && ` reason: ${(i.data as ModRemoveComment).reason}`}
} - {i.type_ == 'removed_communities' && + {i.type_ == 'removed_communities' && <> - {(i.data as ModRemoveCommunity).removed ? 'Removed' : 'Restored'} + {(i.data as ModRemoveCommunity).removed ? 'Removed' : 'Restored'} Community {(i.data as ModRemoveCommunity).community_name}
{(i.data as ModRemoveCommunity).reason && ` reason: ${(i.data as ModRemoveCommunity).reason}`}
{(i.data as ModRemoveCommunity).expires && ` expires: ${moment.utc((i.data as ModRemoveCommunity).expires).fromNow()}`}
} - {i.type_ == 'banned_from_community' && + {i.type_ == 'banned_from_community' && <> {(i.data as ModBanFromCommunity).banned ? 'Banned ' : 'Unbanned '} {(i.data as ModBanFromCommunity).other_user_name} @@ -134,7 +135,7 @@ export class Modlog extends Component {
{(i.data as ModBanFromCommunity).expires && ` expires: ${moment.utc((i.data as ModBanFromCommunity).expires).fromNow()}`}
} - {i.type_ == 'added_to_community' && + {i.type_ == 'added_to_community' && <> {(i.data as ModAddCommunity).removed ? 'Removed ' : 'Appointed '} {(i.data as ModAddCommunity).other_user_name} @@ -142,7 +143,7 @@ export class Modlog extends Component { {(i.data as ModAddCommunity).community_name} } - {i.type_ == 'banned' && + {i.type_ == 'banned' && <> {(i.data as ModBan).banned ? 'Banned ' : 'Unbanned '} {(i.data as ModBan).other_user_name} @@ -150,7 +151,7 @@ export class Modlog extends Component {
{(i.data as ModBan).expires && ` expires: ${moment.utc((i.data as ModBan).expires).fromNow()}`}
} - {i.type_ == 'added' && + {i.type_ == 'added' && <> {(i.data as ModAdd).removed ? 'Removed ' : 'Appointed '} {(i.data as ModAdd).other_user_name} @@ -170,8 +171,8 @@ export class Modlog extends Component { render() { return (
- {this.state.loading ? -
: + {this.state.loading ? +
:
{this.state.communityName && /c/{this.state.communityName} } @@ -199,21 +200,21 @@ export class Modlog extends Component { paginator() { return (
- {this.state.page > 1 && - + {this.state.page > 1 && + } - +
); } - nextPage(i: Modlog) { + nextPage(i: Modlog) { i.state.page++; i.setState(i.state); i.refetch(); } - prevPage(i: Modlog) { + prevPage(i: Modlog) { i.state.page--; i.setState(i.state); i.refetch(); @@ -239,6 +240,6 @@ export class Modlog extends Component { this.state.loading = false; window.scrollTo(0,0); this.setCombined(res); - } + } } }