diff options
author | Dessalines <tyhou13@gmx.com> | 2020-02-02 14:37:19 -0500 |
---|---|---|
committer | Dessalines <tyhou13@gmx.com> | 2020-02-02 14:37:19 -0500 |
commit | caba049da12017f22a8ffa8d6b8e7f0a2cc20e6a (patch) | |
tree | 5c53177858098e4d4414896bba53f90f0ceddd78 /ui/src/components | |
parent | 96a7e99e57f8c79eead599e6de5d94016f7021e6 (diff) | |
parent | 6124133e8517165a97aa87af5485857a000951a2 (diff) |
Merge branch 'dev' into websocket_scopes
Diffstat (limited to 'ui/src/components')
26 files changed, 373 insertions, 526 deletions
diff --git a/ui/src/components/comment-form.tsx b/ui/src/components/comment-form.tsx index 7eb30f50..eaa054d8 100644 --- a/ui/src/components/comment-form.tsx +++ b/ui/src/components/comment-form.tsx @@ -15,7 +15,6 @@ import { WebSocketService, UserService } from '../services'; import autosize from 'autosize'; import Tribute from 'tributejs/src/Tribute.js'; import { i18n } from '../i18next'; -import { T } from 'inferno-i18next'; interface CommentFormProps { postId?: number; @@ -127,7 +126,7 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> { .previewMode && 'active'}`} onClick={linkEvent(this, this.handlePreviewToggle)} > - <T i18nKey="preview">#</T> + {i18n.t('preview')} </button> )} {this.props.node && ( @@ -136,7 +135,7 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> { class="btn btn-sm btn-secondary mr-2" onClick={linkEvent(this, this.handleReplyCancel)} > - <T i18nKey="cancel">#</T> + {i18n.t('cancel')} </button> )} <a @@ -144,14 +143,14 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> { target="_blank" class="d-inline-block float-right text-muted small font-weight-bold" > - <T i18nKey="formatting_help">#</T> + {i18n.t('formatting_help')} </a> <form class="d-inline-block mr-2 float-right text-muted small font-weight-bold"> <label htmlFor={`file-upload-${this.id}`} className={`${UserService.Instance.user && 'pointer'}`} > - <T i18nKey="upload_image">#</T> + {i18n.t('upload_image')} </label> <input id={`file-upload-${this.id}`} diff --git a/ui/src/components/comment-node.tsx b/ui/src/components/comment-node.tsx index 76a4c30e..3296a5c8 100644 --- a/ui/src/components/comment-node.tsx +++ b/ui/src/components/comment-node.tsx @@ -30,7 +30,6 @@ import { MomentTime } from './moment-time'; import { CommentForm } from './comment-form'; import { CommentNodes } from './comment-nodes'; import { i18n } from '../i18next'; -import { T } from 'inferno-i18next'; interface CommentNodeState { showReply: boolean; @@ -180,22 +179,22 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> { </li> {this.isMod && ( <li className="list-inline-item badge badge-light"> - <T i18nKey="mod">#</T> + {i18n.t('mod')} </li> )} {this.isAdmin && ( <li className="list-inline-item badge badge-light"> - <T i18nKey="admin">#</T> + {i18n.t('admin')} </li> )} {this.isPostCreator && ( <li className="list-inline-item badge badge-light"> - <T i18nKey="creator">#</T> + {i18n.t('creator')} </li> )} {(node.comment.banned_from_community || node.comment.banned) && ( <li className="list-inline-item badge badge-danger"> - <T i18nKey="banned">#</T> + {i18n.t('banned')} </li> )} <li className="list-inline-item"> @@ -258,7 +257,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> { class="pointer" onClick={linkEvent(this, this.handleReplyClick)} > - <T i18nKey="reply">#</T> + {i18n.t('reply')} </span> </li> <li className="list-inline-item mr-2"> @@ -276,7 +275,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> { class="pointer" onClick={linkEvent(this, this.handleEditClick)} > - <T i18nKey="edit">#</T> + {i18n.t('edit')} </span> </li> <li className="list-inline-item"> @@ -307,7 +306,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> { className="pointer" onClick={linkEvent(this, this.handleViewSource)} > - <T i18nKey="view_source">#</T> + {i18n.t('view_source')} </span> </li> <li className="list-inline-item"> @@ -315,7 +314,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> { className="text-muted" to={`/post/${node.comment.post_id}/comment/${node.comment.id}`} > - <T i18nKey="link">#</T> + {i18n.t('link')} </Link> </li> {/* Admins and mods can remove comments */} @@ -331,7 +330,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> { this.handleModRemoveShow )} > - <T i18nKey="remove">#</T> + {i18n.t('remove')} </span> ) : ( <span @@ -341,7 +340,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> { this.handleModRemoveSubmit )} > - <T i18nKey="restore">#</T> + {i18n.t('restore')} </span> )} </li> @@ -360,7 +359,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> { this.handleModBanFromCommunityShow )} > - <T i18nKey="ban">#</T> + {i18n.t('ban')} </span> ) : ( <span @@ -370,7 +369,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> { this.handleModBanFromCommunitySubmit )} > - <T i18nKey="unban">#</T> + {i18n.t('unban')} </span> )} </li> @@ -392,7 +391,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> { ) : ( <> <span class="d-inline-block mr-1"> - <T i18nKey="are_you_sure">#</T> + {i18n.t('are_you_sure')} </span> <span class="pointer d-inline-block mr-1" @@ -401,7 +400,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> { this.handleAddModToCommunity )} > - <T i18nKey="yes">#</T> + {i18n.t('yes')} </span> <span class="pointer d-inline-block" @@ -410,7 +409,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> { this.handleCancelConfirmAppointAsMod )} > - <T i18nKey="no">#</T> + {i18n.t('no')} </span> </> )} @@ -429,12 +428,12 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> { this.handleShowConfirmTransferCommunity )} > - <T i18nKey="transfer_community">#</T> + {i18n.t('transfer_community')} </span> ) : ( <> <span class="d-inline-block mr-1"> - <T i18nKey="are_you_sure">#</T> + {i18n.t('are_you_sure')} </span> <span class="pointer d-inline-block mr-1" @@ -443,7 +442,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> { this.handleTransferCommunity )} > - <T i18nKey="yes">#</T> + {i18n.t('yes')} </span> <span class="pointer d-inline-block" @@ -452,7 +451,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> { this.handleCancelShowConfirmTransferCommunity )} > - <T i18nKey="no">#</T> + {i18n.t('no')} </span> </> )} @@ -468,7 +467,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> { class="pointer" onClick={linkEvent(this, this.handleModBanShow)} > - <T i18nKey="ban_from_site">#</T> + {i18n.t('ban_from_site')} </span> ) : ( <span @@ -478,7 +477,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> { this.handleModBanSubmit )} > - <T i18nKey="unban_from_site">#</T> + {i18n.t('unban_from_site')} </span> )} </li> @@ -500,13 +499,13 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> { ) : ( <> <span class="d-inline-block mr-1"> - <T i18nKey="are_you_sure">#</T> + {i18n.t('are_you_sure')} </span> <span class="pointer d-inline-block mr-1" onClick={linkEvent(this, this.handleAddAdmin)} > - <T i18nKey="yes">#</T> + {i18n.t('yes')} </span> <span class="pointer d-inline-block" @@ -515,7 +514,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> { this.handleCancelConfirmAppointAsAdmin )} > - <T i18nKey="no">#</T> + {i18n.t('no')} </span> </> )} @@ -534,18 +533,18 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> { this.handleShowConfirmTransferSite )} > - <T i18nKey="transfer_site">#</T> + {i18n.t('transfer_site')} </span> ) : ( <> <span class="d-inline-block mr-1"> - <T i18nKey="are_you_sure">#</T> + {i18n.t('are_you_sure')} </span> <span class="pointer d-inline-block mr-1" onClick={linkEvent(this, this.handleTransferSite)} > - <T i18nKey="yes">#</T> + {i18n.t('yes')} </span> <span class="pointer d-inline-block" @@ -554,7 +553,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> { this.handleCancelShowConfirmTransferSite )} > - <T i18nKey="no">#</T> + {i18n.t('no')} </span> </> )} @@ -579,16 +578,14 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> { onInput={linkEvent(this, this.handleModRemoveReasonChange)} /> <button type="submit" class="btn btn-secondary"> - <T i18nKey="remove_comment">#</T> + {i18n.t('remove_comment')} </button> </form> )} {this.state.showBanDialog && ( <form onSubmit={linkEvent(this, this.handleModBanBothSubmit)}> <div class="form-group row"> - <label class="col-form-label"> - <T i18nKey="reason">#</T> - </label> + <label class="col-form-label">{i18n.t('reason')}</label> <input type="text" class="form-control mr-2" diff --git a/ui/src/components/communities.tsx b/ui/src/components/communities.tsx index b1da9882..8d130ae7 100644 --- a/ui/src/components/communities.tsx +++ b/ui/src/components/communities.tsx @@ -15,7 +15,6 @@ import { import { WebSocketService } from '../services'; import { wsJsonToRes, toast } from '../utils'; import { i18n } from '../i18next'; -import { T } from 'inferno-i18next'; declare const Sortable: any; @@ -83,30 +82,20 @@ export class Communities extends Component<any, CommunitiesState> { </h5> ) : ( <div> - <h5> - <T i18nKey="list_of_communities">#</T> - </h5> + <h5>{i18n.t('list_of_communities')}</h5> <div class="table-responsive"> <table id="community_table" class="table table-sm table-hover"> <thead class="pointer"> <tr> - <th> - <T i18nKey="name">#</T> - </th> - <th class="d-none d-lg-table-cell"> - <T i18nKey="title">#</T> - </th> - <th> - <T i18nKey="category">#</T> - </th> - <th class="text-right"> - <T i18nKey="subscribers">#</T> - </th> + <th>{i18n.t('name')}</th> + <th class="d-none d-lg-table-cell">{i18n.t('title')}</th> + <th>{i18n.t('category')}</th> + <th class="text-right">{i18n.t('subscribers')}</th> <th class="text-right d-none d-lg-table-cell"> - <T i18nKey="posts">#</T> + {i18n.t('posts')} </th> <th class="text-right d-none d-lg-table-cell"> - <T i18nKey="comments">#</T> + {i18n.t('comments')} </th> <th></th> </tr> @@ -139,7 +128,7 @@ export class Communities extends Component<any, CommunitiesState> { this.handleUnsubscribe )} > - <T i18nKey="unsubscribe">#</T> + {i18n.t('unsubscribe')} </span> ) : ( <span @@ -149,7 +138,7 @@ export class Communities extends Component<any, CommunitiesState> { this.handleSubscribe )} > - <T i18nKey="subscribe">#</T> + {i18n.t('subscribe')} </span> )} </td> @@ -173,15 +162,16 @@ export class Communities extends Component<any, CommunitiesState> { class="btn btn-sm btn-secondary mr-1" onClick={linkEvent(this, this.prevPage)} > - <T i18nKey="prev">#</T> + {i18n.t('prev')} </button> )} + {this.state.communities.length == communityLimit && ( <button class="btn btn-sm btn-secondary" onClick={linkEvent(this, this.nextPage)} > - <T i18nKey="next">#</T> + {i18n.t('next')} </button> )} </div> diff --git a/ui/src/components/community-form.tsx b/ui/src/components/community-form.tsx index c8d888be..aaa3e6c4 100644 --- a/ui/src/components/community-form.tsx +++ b/ui/src/components/community-form.tsx @@ -21,7 +21,6 @@ import { import Tribute from 'tributejs/src/Tribute.js'; import autosize from 'autosize'; import { i18n } from '../i18next'; -import { T } from 'inferno-i18next'; import { Community } from '../interfaces'; @@ -108,12 +107,13 @@ export class CommunityForm extends Component< return ( <form onSubmit={linkEvent(this, this.handleCreateCommunitySubmit)}> <div class="form-group row"> - <label class="col-12 col-form-label"> - <T i18nKey="name">#</T> + <label class="col-12 col-form-label" htmlFor="community-name"> + {i18n.t('name')} </label> <div class="col-12"> <input type="text" + id="community-name" class="form-control" value={this.state.communityForm.name} onInput={linkEvent(this, this.handleCommunityNameChange)} @@ -125,13 +125,15 @@ export class CommunityForm extends Component< /> </div> </div> + <div class="form-group row"> - <label class="col-12 col-form-label"> - <T i18nKey="title">#</T> + <label class="col-12 col-form-label" htmlFor="community-title"> + {i18n.t('title')} </label> <div class="col-12"> <input type="text" + id="community-title" value={this.state.communityForm.title} onInput={linkEvent(this, this.handleCommunityTitleChange)} class="form-control" @@ -142,8 +144,8 @@ export class CommunityForm extends Component< </div> </div> <div class="form-group row"> - <label class="col-12 col-form-label"> - <T i18nKey="sidebar">#</T> + <label class="col-12 col-form-label" htmlFor={this.id}> + {i18n.t('sidebar')} </label> <div class="col-12"> <textarea @@ -157,12 +159,13 @@ export class CommunityForm extends Component< </div> </div> <div class="form-group row"> - <label class="col-12 col-form-label"> - <T i18nKey="category">#</T> + <label class="col-12 col-form-label" htmlFor="community-category"> + {i18n.t('category')} </label> <div class="col-12"> <select class="form-control" + id="community-category" value={this.state.communityForm.category_id} onInput={linkEvent(this, this.handleCommunityCategoryChange)} > @@ -179,12 +182,13 @@ export class CommunityForm extends Component< <div class="form-check"> <input class="form-check-input" + id="community-nsfw" type="checkbox" checked={this.state.communityForm.nsfw} onChange={linkEvent(this, this.handleCommunityNsfwChange)} /> - <label class="form-check-label"> - <T i18nKey="nsfw">#</T> + <label class="form-check-label" htmlFor="community-nsfw"> + {i18n.t('nsfw')} </label> </div> </div> @@ -209,7 +213,7 @@ export class CommunityForm extends Component< class="btn btn-secondary" onClick={linkEvent(this, this.handleCancel)} > - <T i18nKey="cancel">#</T> + {i18n.t('cancel')} </button> )} </div> diff --git a/ui/src/components/community.tsx b/ui/src/components/community.tsx index 18767c51..9f96ac51 100644 --- a/ui/src/components/community.tsx +++ b/ui/src/components/community.tsx @@ -24,7 +24,6 @@ import { PostListings } from './post-listings'; import { SortSelect } from './sort-select'; import { Sidebar } from './sidebar'; import { wsJsonToRes, routeSortTypeToEnum, fetchLimit, toast } from '../utils'; -import { T } from 'inferno-i18next'; import { i18n } from '../i18next'; interface State { @@ -136,12 +135,12 @@ export class Community extends Component<any, State> { {this.state.community.title} {this.state.community.removed && ( <small className="ml-2 text-muted font-italic"> - <T i18nKey="removed">#</T> + {i18n.t('removed')} </small> )} {this.state.community.nsfw && ( <small className="ml-2 text-muted font-italic"> - <T i18nKey="nsfw">#</T> + {i18n.t('nsfw')} </small> )} </h5> @@ -189,7 +188,7 @@ export class Community extends Component<any, State> { class="btn btn-sm btn-secondary mr-1" onClick={linkEvent(this, this.prevPage)} > - <T i18nKey="prev">#</T> + {i18n.t('prev')} </button> )} {this.state.posts.length == fetchLimit && ( @@ -197,7 +196,7 @@ export class Community extends Component<any, State> { class="btn btn-sm btn-secondary" onClick={linkEvent(this, this.nextPage)} > - <T i18nKey="next">#</T> + {i18n.t('next')} </button> )} </div> diff --git a/ui/src/components/create-community.tsx b/ui/src/components/create-community.tsx index f16b6425..5c7a0a9b 100644 --- a/ui/src/components/create-community.tsx +++ b/ui/src/components/create-community.tsx @@ -3,7 +3,6 @@ import { CommunityForm } from './community-form'; import { Community } from '../interfaces'; import { WebSocketService } from '../services'; import { i18n } from '../i18next'; -import { T } from 'inferno-i18next'; export class CreateCommunity extends Component<any, any> { constructor(props: any, context: any) { @@ -22,9 +21,7 @@ export class CreateCommunity extends Component<any, any> { <div class="container"> <div class="row"> <div class="col-12 col-lg-6 offset-lg-3 mb-4"> - <h5> - <T i18nKey="create_community">#</T> - </h5> + <h5>{i18n.t('create_community')}</h5> <CommunityForm onCreate={this.handleCommunityCreate} /> </div> </div> diff --git a/ui/src/components/create-post.tsx b/ui/src/components/create-post.tsx index ad013d09..adbdfb58 100644 --- a/ui/src/components/create-post.tsx +++ b/ui/src/components/create-post.tsx @@ -3,7 +3,6 @@ import { PostForm } from './post-form'; import { WebSocketService } from '../services'; import { PostFormParams } from '../interfaces'; import { i18n } from '../i18next'; -import { T } from 'inferno-i18next'; export class CreatePost extends Component<any, any> { constructor(props: any, context: any) { @@ -22,9 +21,7 @@ export class CreatePost extends Component<any, any> { <div class="container"> <div class="row"> <div class="col-12 col-lg-6 offset-lg-3 mb-4"> - <h5> - <T i18nKey="create_post">#</T> - </h5> + <h5>{i18n.t('create_post')}</h5> <PostForm onCreate={this.handlePostCreate} params={this.params} /> </div> </div> diff --git a/ui/src/components/footer.tsx b/ui/src/components/footer.tsx index 5451da2c..cadb6aa3 100644 --- a/ui/src/components/footer.tsx +++ b/ui/src/components/footer.tsx @@ -2,7 +2,7 @@ import { Component } from 'inferno'; import { Link } from 'inferno-router'; import { repoUrl } from '../utils'; import { version } from '../version'; -import { T } from 'inferno-i18next'; +import { i18n } from '../i18next'; export class Footer extends Component<any, any> { constructor(props: any, context: any) { @@ -19,22 +19,22 @@ export class Footer extends Component<any, any> { </li> <li class="nav-item"> <Link class="nav-link" to="/modlog"> - <T i18nKey="modlog">#</T> + {i18n.t('modlog')} </Link> </li> <li class="nav-item"> <a class="nav-link" href={'/docs/index.html'}> - <T i18nKey="docs">#</T> + {i18n.t('docs')} </a> </li> <li class="nav-item"> <Link class="nav-link" to="/sponsors"> - <T i18nKey="donate">#</T> + {i18n.t('donate')} </Link> </li> <li class="nav-item"> <a class="nav-link" href={repoUrl}> - <T i18nKey="code">#</T> + {i18n.t('code')} </a> </li> </ul> diff --git a/ui/src/components/inbox.tsx b/ui/src/components/inbox.tsx index 5fd9dbdc..6f4d2377 100644 --- a/ui/src/components/inbox.tsx +++ b/ui/src/components/inbox.tsx @@ -122,7 +122,7 @@ export class Inbox extends Component<any, InboxState> { <ul class="list-inline mb-1 text-muted small font-weight-bold"> <li className="list-inline-item"> <span class="pointer" onClick={this.markAllAsRead}> - <T i18nKey="mark_all_as_read">#</T> + {i18n.t('mark_all_as_read')} </span> </li> </ul> @@ -147,36 +147,20 @@ export class Inbox extends Component<any, InboxState> { onChange={linkEvent(this, this.handleUnreadOrAllChange)} class="custom-select custom-select-sm w-auto mr-2" > - <option disabled> - <T i18nKey="type">#</T> - </option> - <option value={UnreadOrAll.Unread}> - <T i18nKey="unread">#</T> - </option> - <option value={UnreadOrAll.All}> - <T i18nKey="all">#</T> - </option> + <option disabled>{i18n.t('type')}</option> + <option value={UnreadOrAll.Unread}>{i18n.t('unread')}</option> + <option value={UnreadOrAll.All}>{i18n.t('all')}</option> </select> <select value={this.state.unreadType} onChange={linkEvent(this, this.handleUnreadTypeChange)} class="custom-select custom-select-sm w-auto mr-2" > - <option disabled> - <T i18nKey="type">#</T> - </option> - <option value={UnreadType.All}> - <T i18nKey="all">#</T> - </option> - |