feat: issue & comment reaction (#1690)

* feat: developed reaction selector component

* feat add reaction on issue & issue comment

refactor: reaction selector component, made hooks to abstracted reaction logic & state by making custom hook

* fix: emoji.helper.tsx function

* refactor: reaction not working on inbox issue
This commit is contained in:
Dakshesh Jain 2023-07-27 18:55:03 +05:30 committed by GitHub
parent 5cfea3948f
commit 0cc4468091
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 686 additions and 0 deletions

View file

@ -36,3 +36,18 @@ export const renderEmoji = (
);
else return isNaN(parseInt(emoji)) ? emoji : String.fromCodePoint(parseInt(emoji));
};
export const groupReactions: (reactions: any[], key: string) => { [key: string]: any[] } = (
reactions: any,
key: string
) => {
const groupedReactions = reactions.reduce((acc: any, reaction: any) => {
if (!acc[reaction[key]]) {
acc[reaction[key]] = [];
}
acc[reaction[key]].push(reaction);
return acc;
}, {} as { [key: string]: any[] });
return groupedReactions;
};