Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DMAPP-125: Chat reaction feature #128

Merged
merged 5 commits into from
Nov 8, 2024

Conversation

meKushdeepSingh
Copy link
Collaborator

[Feature integration]: Add reaction support in chat and show reply button on message long press.

@meKushdeepSingh meKushdeepSingh self-assigned this Nov 6, 2024
@meKushdeepSingh meKushdeepSingh linked an issue Nov 6, 2024 that may be closed by this pull request
Copy link

github-actions bot commented Nov 6, 2024

In the Globals.ts file, there are some mistakes in the color values. Here are the corrections:

  • Change 'rgba(53.0, 197.0, 243.0, 1.0)' to 'rgba(53, 197, 243, 1.0)'
  • Change 'rgba(103.0, 76.0, 159.0, 1.0)' to 'rgba(103, 76, 159, 1.0)'
  • Change 'rgba(255.0, 255.0, 255.0, 1.0)' to 'rgba(255, 255, 255, 1.0)'
  • Change 'rgba(250.0, 250.0, 250.0, 1)' to 'rgba(250, 250, 250, 1)'
  • Change 'rgba(231.0, 231.0, 231.0, 1)' to 'rgba(231, 231, 231, 1)'
  • Change 'rgba(225.0, 225.0, 225.0, 1)' to 'rgba(225, 225, 225, 1)'
  • Change 'rgba(160.0, 160.0, 160.0, 1)' to 'rgba(160, 160, 160, 1)'
  • Change 'rgba(100.0, 100.0, 100.0, 1)' to 'rgba(100, 100, 100, 1)'
  • Change 'rgba(0.0, 0.0, 0.0, 0.1)' to 'rgba(0, 0, 0, 0.1)'
  • Change 'rgba(0.0, 0.0, 0.0, 0.25)' to 'rgba(0, 0, 0, 0.25)'
  • Change 'rgba(0.0, 0.0, 0.0, 0.5)' to 'rgba(0, 0, 0, 0.5)'
  • Change 'rgba(0.0, 0.0, 0.0, 0.75)' to 'rgba(0, 0, 0, 0.75)'
  • Change 'rgba(50.0, 205.0, 50.0, 1.0)' to 'rgba(50, 205, 50, 1.0)'
  • Change 'rgba(48.0, 204.0, 139.0, 1.0)' to 'rgba(48, 204, 139, 1.0)'
  • Change 'rgba(34.0, 139.0, 34.0, 1.0)' to 'rgba(34, 139, 34, 1.0)'
  • Change 'rgba(255.0, 153.0, 0.0, 1.0)' to 'rgba(255, 153, 0, 1.0)'
  • Change 'rgba(237.0, 59.0, 72.0, 1.0)' to 'rgba(237, 59, 72, 1.0)'
  • Change 'rgba(208.0, 44.0, 30.0, 1.0)' to 'rgba(208, 44, 30, 1.0)'
  • Change 'rgba(159.0, 0.0, 0.0, 1.0)' to 'rgba(159, 0, 0, 1.0)'
  • Change 'rgba(129.0, 0.0, 0.0, 1.0)' to 'rgba(129, 0, 0, 1.0)'

In the MessageComponent.tsx file, there are some issues in the logic and code structure. Here are the corrections and improvements:

  1. Add a missing closing brace } for the condition:
    Change:

    const messageType =
        ? chatMessage?.messageObj?.content?.messageType
        : chatMessage?.messageType;

    To:

    const messageType = chatMessage?.messageObj?.content?.messageType || chatMessage?.messageType;
  2. Fix the missing closing brackets in the handleReply function and ensure proper if conditions.

  3. Fix the indentation and formatting for clear readability.

After making the above corrections and improvements, the code seems to be in good shape.

All looks good.

Copy link

github-actions bot commented Nov 7, 2024

In the Globals.ts file, there are some mistakes in color values where the decimals are not correctly separated from integers:

  • Instead of 'rgba(53.0, 197.0, 243.0, 1.0)', it should be 'rgba(53, 197, 243, 1)'.
  • Instead of 'rgba(255.0, 255.0, 255.0, 1.0)', it should be 'rgba(255, 255, 255, 1)'.

In MessageComponent.tsx:

  • There is a syntax error where the ternary operator is not properly formatted.
    It should be:
    const messageType = chatMessage?.messageType === 'Reply' ? chatMessage?.messageObj?.content?.messageType : chatMessage?.messageType;
  • There is a missing closing parenthesis and curly braces in the handleReply function.
  • Within the MessageComponent component, the Return statement is missing a closing parenthesis.

Other than those mentioned above, the code looks good.

All looks good.

Copy link

github-actions bot commented Nov 7, 2024

In the Globals.ts file:

  1. There are some typos in color values, e.g., 'rgba(53.0, 197.0, 243.0, 1.0)' should be 'rgba(53, 197, 243, 1)'.
  2. There is a syntax error in the MessageComponent component in MessageComponent.tsx file. On line 91, the conditional statement is missing a condition before the '?' symbol.

In the MessageComponent.tsx file:

  1. The handleMessageLongPress function on line 59 is not being used and is unnecessary.
  2. There is a missing closing bracket '}' for the handleReply function which should be after line 108.
  3. There is a logic error on line 98 where the ternary operator has a syntax error. It should be updated as follows:
    Change: const messageType = ? chatMessage?.messageObj?.content?.messageType : chatMessage?.messageType;
    To: const messageType = chatMessage?.messageObj?.content?.messageType || chatMessage?.messageType;
  4. There are missing closing brackets at the end of the file.

Overall, the code needs some fixes and improvements.

Let me tidy up the code:

// In Globals.ts:
All looks good.

// In MessageComponent.tsx:
- Remove the unnecessary 'handleMessageLongPress' function.
- Fix the syntax error in the messageType ternary operation.
- Add the missing closing bracket for the 'handleReply' function.
- Add missing closing brackets at the end of the file.

// Other files have not been reviewed for feedback.

reactionPickerId={activeReactionMessageId}
handleTapOutside={() => handleTapOutside()}
sendReaction={handleSendReaction}
chatReactions={reactionMessages?.[(item as any).cid] || []}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
chatReactions={reactionMessages?.[(item as any).cid] || []}
chatReactions={reactionMessages?.[(item as Type).cid] || []}

Comment on lines 32 to 33
sendReaction?: (reactionPayload: any) => void;
chatReactions?: any;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sendReaction?: (reactionPayload: any) => void;
chatReactions?: any;
sendReaction?: (reactionPayload:Type) => void;
chatReactions?:Type;


const Reactions: FC<ReactionsProps> = ({chatReactions, componentType}) => {
// transform to IReactions
const uniqueReactions = chatReactions.reduce((acc: any, reaction: any) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const uniqueReactions = chatReactions.reduce((acc: any, reaction: any) => {
const uniqueReactions = chatReactions.reduce((acc: Type, reaction:Type) => {

</Text>
</View>
) : (
Object.entries(uniqueReactions).map(([content, reactions]: any[]) => (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Object.entries(uniqueReactions).map(([content, reactions]: any[]) => (
Object.entries(uniqueReactions).map(([content, reactions]: Type[]) => (

@@ -78,6 +80,11 @@ const useSendMessage = (
content: message,
};

if (reactionRef !== undefined) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (reactionRef !== undefined) {
if (reactionRef) {

Copy link

github-actions bot commented Nov 7, 2024

All looks good.

Copy link

github-actions bot commented Nov 8, 2024

All looks good.

@rohitmalhotra1420 rohitmalhotra1420 merged commit a04ca92 into main Nov 8, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mobile App: Add emoji reactions for chat
2 participants