From 2f9a052f89fe8d34fedcd2219e644dd51cda5505 Mon Sep 17 00:00:00 2001
From: Richard <richard@tripaneer.com>
Date: Fri, 31 Jan 2020 21:52:27 +0100
Subject: usability features

This are all the commits from another PR combined into a single commit.
---
 ui/src/components/sidebar.tsx | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

(limited to 'ui/src/components/sidebar.tsx')

diff --git a/ui/src/components/sidebar.tsx b/ui/src/components/sidebar.tsx
index 089dd558..809ec91e 100644
--- a/ui/src/components/sidebar.tsx
+++ b/ui/src/components/sidebar.tsx
@@ -72,7 +72,7 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
               <span>{community.title}</span>
               {community.removed && (
                 <small className="ml-2 text-muted font-italic">
-                  <T i18nKey="removed">#</T>
+                  { i18n.t('removed') }
                 </small>
               )}
               {community.deleted && (
@@ -92,7 +92,7 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
                       class="pointer"
                       onClick={linkEvent(this, this.handleEditClick)}
                     >
-                      <T i18nKey="edit">#</T>
+                      { i18n.t('edit') }
                     </span>
                   </li>
                   {this.amCreator && (
@@ -116,14 +116,14 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
                       class="pointer"
                       onClick={linkEvent(this, this.handleModRemoveShow)}
                     >
-                      <T i18nKey="remove">#</T>
+                      { i18n.t('remove') }
                     </span>
                   ) : (
                     <span
                       class="pointer"
                       onClick={linkEvent(this, this.handleModRemoveSubmit)}
                     >
-                      <T i18nKey="restore">#</T>
+                      { i18n.t('restore') }
                     </span>
                   )}
                 </li>
@@ -132,11 +132,12 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
             {this.state.showRemoveDialog && (
               <form onSubmit={linkEvent(this, this.handleModRemoveSubmit)}>
                 <div class="form-group row">
-                  <label class="col-form-label">
-                    <T i18nKey="reason">#</T>
+                  <label class="col-form-label" for="remove-reason">
+                    { i18n.t('reason') }
                   </label>
                   <input
                     type="text"
+                    id="remove-reason"
                     class="form-control mr-2"
                     placeholder={i18n.t('optional')}
                     value={this.state.removeReason}
@@ -150,7 +151,7 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
                 {/* </div> */}
                 <div class="form-group row">
                   <button type="submit" class="btn btn-secondary">
-                    <T i18nKey="remove_community">#</T>
+                    { i18n.t('remove_community') }
                   </button>
                 </div>
               </form>
@@ -218,7 +219,7 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
                 'no-click'}`}
               to={`/create_post?community=${community.name}`}
             >
-              <T i18nKey="create_a_post">#</T>
+              { i18n.t('create_a_post') }
             </Link>
             <div>
               {community.subscribed ? (
@@ -226,14 +227,14 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
                   class="btn btn-sm btn-secondary btn-block"
                   onClick={linkEvent(community.id, this.handleUnsubscribe)}
                 >
-                  <T i18nKey="unsubscribe">#</T>
+                  { i18n.t('unsubscribe') }
                 </button>
               ) : (
                 <button
                   class="btn btn-sm btn-secondary btn-block"
                   onClick={linkEvent(community.id, this.handleSubscribe)}
                 >
-                  <T i18nKey="subscribe">#</T>
+                  { i18n.t('subscribe') }
                 </button>
               )}
             </div>
-- 
cgit v1.2.3


From ac943f8951fe7da86aaa9f41ee879ab670786c86 Mon Sep 17 00:00:00 2001
From: Dessalines <tyhou13@gmx.com>
Date: Sun, 2 Feb 2020 13:50:44 -0500
Subject: Finishing up interpolation rework.

---
 ui/src/components/sidebar.tsx | 52 +++++++++++++++++--------------------------
 1 file changed, 21 insertions(+), 31 deletions(-)

(limited to 'ui/src/components/sidebar.tsx')

diff --git a/ui/src/components/sidebar.tsx b/ui/src/components/sidebar.tsx
index 809ec91e..fe0b28ba 100644
--- a/ui/src/components/sidebar.tsx
+++ b/ui/src/components/sidebar.tsx
@@ -16,7 +16,6 @@ import {
 } from '../utils';
 import { CommunityForm } from './community-form';
 import { i18n } from '../i18next';
-import { T } from 'inferno-i18next';
 
 interface SidebarProps {
   community: Community;
@@ -72,12 +71,12 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
               <span>{community.title}</span>
               {community.removed && (
                 <small className="ml-2 text-muted font-italic">
-                  { i18n.t('removed') }
+                  {i18n.t('removed')}
                 </small>
               )}
               {community.deleted && (
                 <small className="ml-2 text-muted font-italic">
-                  <T i18nKey="deleted">#</T>
+                  {i18n.t('deleted')}
                 </small>
               )}
             </h5>
@@ -92,7 +91,7 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
                       class="pointer"
                       onClick={linkEvent(this, this.handleEditClick)}
                     >
-                      { i18n.t('edit') }
+                      {i18n.t('edit')}
                     </span>
                   </li>
                   {this.amCreator && (
@@ -116,14 +115,14 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
                       class="pointer"
                       onClick={linkEvent(this, this.handleModRemoveShow)}
                     >
-                      { i18n.t('remove') }
+                      {i18n.t('remove')}
                     </span>
                   ) : (
                     <span
                       class="pointer"
                       onClick={linkEvent(this, this.handleModRemoveSubmit)}
                     >
-                      { i18n.t('restore') }
+                      {i18n.t('restore')}
                     </span>
                   )}
                 </li>
@@ -132,8 +131,8 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
             {this.state.showRemoveDialog && (
               <form onSubmit={linkEvent(this, this.handleModRemoveSubmit)}>
                 <div class="form-group row">
-                  <label class="col-form-label" for="remove-reason">
-                    { i18n.t('reason') }
+                  <label class="col-form-label" htmlFor="remove-reason">
+                    {i18n.t('reason')}
                   </label>
                   <input
                     type="text"
@@ -151,7 +150,7 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
                 {/* </div> */}
                 <div class="form-group row">
                   <button type="submit" class="btn btn-secondary">
-                    { i18n.t('remove_community') }
+                    {i18n.t('remove_community')}
                   </button>
                 </div>
               </form>
@@ -163,35 +162,26 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
                 </Link>
               </li>
               <li className="list-inline-item badge badge-secondary">
-                <T
-                  i18nKey="number_of_subscribers"
-                  interpolation={{ count: community.number_of_subscribers }}
-                >
-                  #
-                </T>
+                {i18n.t('number_of_subscribers', {
+                  count: community.number_of_subscribers,
+                })}
               </li>
               <li className="list-inline-item badge badge-secondary">
-                <T
-                  i18nKey="number_of_posts"
-                  interpolation={{ count: community.number_of_posts }}
-                >
-                  #
-                </T>
+                {i18n.t('number_of_posts', {
+                  count: community.number_of_posts,
+                })}
               </li>
               <li className="list-inline-item badge badge-secondary">
-                <T
-                  i18nKey="number_of_comments"
-                  interpolation={{ count: community.number_of_comments }}
-                >
-                  #
-                </T>
+                {i18n.t('number_of_comments', {
+                  count: community.number_of_comments,
+                })}
               </li>
               <li className="list-inline-item">
                 <Link
                   className="badge badge-secondary"
                   to={`/modlog/community/${this.props.community.id}`}
                 >
-                  <T i18nKey="modlog">#</T>
+                  {i18n.t('modlog')}
                 </Link>
               </li>
             </ul>
@@ -219,7 +209,7 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
                 'no-click'}`}
               to={`/create_post?community=${community.name}`}
             >
-              { i18n.t('create_a_post') }
+              {i18n.t('create_a_post')}
             </Link>
             <div>
               {community.subscribed ? (
@@ -227,14 +217,14 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
                   class="btn btn-sm btn-secondary btn-block"
                   onClick={linkEvent(community.id, this.handleUnsubscribe)}
                 >
-                  { i18n.t('unsubscribe') }
+                  {i18n.t('unsubscribe')}
                 </button>
               ) : (
                 <button
                   class="btn btn-sm btn-secondary btn-block"
                   onClick={linkEvent(community.id, this.handleSubscribe)}
                 >
-                  { i18n.t('subscribe') }
+                  {i18n.t('subscribe')}
                 </button>
               )}
             </div>
-- 
cgit v1.2.3

