From 9dc19044b96f39d9f13cdb6338d06543485f3836 Mon Sep 17 00:00:00 2001 From: Mikunj Date: Fri, 9 Nov 2018 14:42:14 +1100 Subject: [PATCH] Handle the case where the user is sending a friend request. Fix up styling for outgoing message. --- _locales/en/messages.json | 39 ++++++++++++++++++-- stylesheets/_modules.scss | 18 ++++++++- ts/components/conversation/FriendRequest.tsx | 20 +++++----- 3 files changed, 64 insertions(+), 13 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 2e0f1c161..b154a964d 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1578,7 +1578,7 @@ } } }, - "friendRequestPending": { + "incomingFriendRequestPending": { "message": "$name$ sent you a friend request", "description": "Shown in the conversation history when the user recieves a friend request", @@ -1589,7 +1589,7 @@ } } }, - "friendRequestAccepted": { + "incomingFriendRequestAccepted": { "message": "You accepted $name$'s friend request", "description": "Shown in the conversation history when the user accepts a friend request", @@ -1600,7 +1600,7 @@ } } }, - "friendRequestDeclined": { + "incomingFriendRequestDeclined": { "message": "You declined $name$'s friend request", "description": "Shown in the conversation history when the user declines a friend request", @@ -1610,5 +1610,38 @@ "example": "Bob" } } + }, + "outgoingFriendRequestPending": { + "message": "You sent $name$ a friend request", + "description": + "Shown in the conversation history when the user sends a friend request", + "placeholders": { + "name": { + "content": "$1", + "example": "Bob" + } + } + }, + "outgoingFriendRequestAccepted": { + "message": "$name$ accepted your friend request", + "description": + "Shown in the conversation history when the users friend request is accepted", + "placeholders": { + "name": { + "content": "$1", + "example": "Bob" + } + } + }, + "outgoingFriendRequestDeclined": { + "message": "$name$ declined your friend request", + "description": + "Shown in the conversation history when the users friend request is declined", + "placeholders": { + "name": { + "content": "$1", + "example": "Bob" + } + } } } diff --git a/stylesheets/_modules.scss b/stylesheets/_modules.scss index 07472eb0d..8951f6570 100644 --- a/stylesheets/_modules.scss +++ b/stylesheets/_modules.scss @@ -1027,10 +1027,14 @@ .module-friend-request__buttonContainer { margin-top: 8px; justify-content: space-around; - border-top: 1px solid $color-white-07; + border-top: 1px solid $color-gray-90; padding-top: 4px; } +.module-friend-request__buttonContainer--incoming { + border-top: 1px solid $color-white-07; +} + .module-friend-request__buttonContainer button { flex: 0.5; padding: 8px; @@ -1038,16 +1042,28 @@ border: 0; overflow: hidden; outline:none; + color: $color-gray-90; +} + +.module-friend-request__buttonContainer--incoming button { color: $color-white; } .module-friend-request__buttonContainer button:first-of-type { + border-right: 1px solid $color-gray-90; +} + +.module-friend-request__buttonContainer--incoming button:first-of-type { border-right: 1px solid $color-white-07; } .module-friend-request__text { padding-top: 6px; padding-bottom: 4px; + color: $color-gray-60; +} + +.module-friend-request__text--incoming { color: $color-white-08; } diff --git a/ts/components/conversation/FriendRequest.tsx b/ts/components/conversation/FriendRequest.tsx index cf08c09b0..88a15a0e9 100644 --- a/ts/components/conversation/FriendRequest.tsx +++ b/ts/components/conversation/FriendRequest.tsx @@ -25,22 +25,22 @@ interface Props { export class FriendRequest extends React.Component { public getStringId() { - const { status } = this.props; + const { type, status } = this.props; switch (status) { case 'pending': - return 'friendRequestPending'; + return `${type}FriendRequestPending`; case 'accepted': - return 'friendRequestAccepted'; + return `${type}FriendRequestAccepted`; case 'declined': - return 'friendRequestDeclined'; + return `${type}FriendRequestDeclined`; default: throw new Error(`Invalid friend request status: ${status}`); } } public renderText() { - const { text, i18n } = this.props; + const { type, text, i18n } = this.props; if (!text) { return null; @@ -49,7 +49,7 @@ export class FriendRequest extends React.Component { return (
@@ -84,9 +84,9 @@ export class FriendRequest extends React.Component { } public renderButtons() { - const { onAccept, onDecline } = this.props; + const { type, onAccept, onDecline } = this.props; return ( -
+
@@ -96,12 +96,14 @@ export class FriendRequest extends React.Component { public render() { const { type, status} = this.props; + const shouldRenderButtons = (status === 'pending' && type === 'incoming'); + return (
{this.renderContents()} - {(status === 'pending') && this.renderButtons()} + {shouldRenderButtons && this.renderButtons()}