From 07c39523e966219da57c2a4b3a0794f55c38daeb Mon Sep 17 00:00:00 2001 From: Maxim Shishmarev Date: Mon, 25 Nov 2019 17:29:07 +1100 Subject: [PATCH] Show appropriate message in group invitation dialog on no friends --- _locales/en/messages.json | 3 +++ stylesheets/_mentions.scss | 3 ++- ts/components/conversation/InviteFriendsDialog.tsx | 12 +++++++++++- ts/components/conversation/UpdateGroupDialog.tsx | 4 +++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 9e1a9346c..e02144a3a 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -2238,5 +2238,8 @@ }, "addingFriends": { "message": "Adding friends to" + }, + "noFriendsToAdd": { + "message": "no friends to add" } } diff --git a/stylesheets/_mentions.scss b/stylesheets/_mentions.scss index 9eeea12f3..882470bc5 100644 --- a/stylesheets/_mentions.scss +++ b/stylesheets/_mentions.scss @@ -49,7 +49,8 @@ } } -.create-group-dialog { +.create-group-dialog, +.invite-friends-dialog { .no-friends { text-align: center; } diff --git a/ts/components/conversation/InviteFriendsDialog.tsx b/ts/components/conversation/InviteFriendsDialog.tsx index a624dc118..ce0a9170c 100644 --- a/ts/components/conversation/InviteFriendsDialog.tsx +++ b/ts/components/conversation/InviteFriendsDialog.tsx @@ -59,6 +59,8 @@ export class InviteFriendsDialog extends React.Component { const cancelText = window.i18n('cancel'); const okText = window.i18n('ok'); + const hasFriends = this.state.friendList.length !== 0; + return (

{titleText}

@@ -70,11 +72,19 @@ export class InviteFriendsDialog extends React.Component { onMemberClicked={this.onMemberClicked} />
+ {hasFriends ? null : ( +

`(${window.i18n('noFriendsToAdd')})`

+ )}
-
diff --git a/ts/components/conversation/UpdateGroupDialog.tsx b/ts/components/conversation/UpdateGroupDialog.tsx index 53c31c4f5..0e0d2710b 100644 --- a/ts/components/conversation/UpdateGroupDialog.tsx +++ b/ts/components/conversation/UpdateGroupDialog.tsx @@ -129,7 +129,9 @@ export class UpdateGroupDialog extends React.Component { onMemberClicked={this.onMemberClicked} /> -

(no friends to add)

+

{`(${this.props.i18n( + 'noFriendsToAdd' + )})`}