1- import React , { useMemo } from 'react' ;
1+ import React , { useMemo , useState } from 'react' ;
22
33import type { ReactionSummary , ReactionType } from './types' ;
44
@@ -14,6 +14,8 @@ import {
1414import type { ReactionSort } from 'stream-chat' ;
1515import { defaultReactionOptions } from './reactionOptions' ;
1616import type { useProcessReactions } from './hooks/useProcessReactions' ;
17+ import { IconEmojiAdd } from '../Icons' ;
18+ import { ReactionSelector , type ReactionSelectorProps } from './ReactionSelector' ;
1719
1820export type MessageReactionsDetailProps = Partial <
1921 Pick < MessageContextValue , 'handleFetchReactions' | 'reactionDetailsSort' >
@@ -24,7 +26,7 @@ export type MessageReactionsDetailProps = Partial<
2426 sort ?: ReactionSort ;
2527 totalReactionCount ?: number ;
2628 reactionGroups ?: ReturnType < typeof useProcessReactions > [ 'reactionGroups' ] ;
27- } ;
29+ } & ReactionSelectorProps ;
2830
2931const defaultReactionDetailsSort = { created_at : - 1 } as const ;
3032
@@ -45,13 +47,16 @@ export const MessageReactionsDetailLoadingIndicator = () => {
4547
4648export function MessageReactionsDetail ( {
4749 handleFetchReactions,
50+ handleReaction,
4851 onSelectedReactionTypeChange,
52+ own_reactions,
4953 reactionDetailsSort : propReactionDetailsSort ,
5054 reactionGroups,
5155 reactions,
5256 selectedReactionType,
5357 totalReactionCount,
5458} : MessageReactionsDetailProps ) {
59+ const [ extendedReactionListOpen , setExtendedReactionListOpen ] = useState ( false ) ;
5560 const { client } = useChatContext ( ) ;
5661 const {
5762 Avatar = DefaultAvatar ,
@@ -62,6 +67,7 @@ export function MessageReactionsDetail({
6267
6368 const {
6469 handleReaction : contextHandleReaction ,
70+ message,
6571 reactionDetailsSort : contextReactionDetailsSort ,
6672 } = useMessageContext ( MessageReactionsDetail . name ) ;
6773
@@ -79,6 +85,21 @@ export function MessageReactionsDetail({
7985 sort : reactionDetailsSort ,
8086 } ) ;
8187
88+ if ( extendedReactionListOpen ) {
89+ return (
90+ < div
91+ className = 'str-chat__message-reactions-detail'
92+ data-testid = 'message-reactions-detail'
93+ >
94+ < ReactionSelector . ExtendedList
95+ dialogId = { `message-reactions-detail-${ message . id } ` }
96+ handleReaction = { handleReaction }
97+ own_reactions = { own_reactions }
98+ />
99+ </ div >
100+ ) ;
101+ }
102+
82103 return (
83104 < div
84105 className = 'str-chat__message-reactions-detail'
@@ -91,6 +112,17 @@ export function MessageReactionsDetail({
91112 ) }
92113 < div className = 'str-chat__message-reactions-detail__reaction-type-list-container' >
93114 < ul className = 'str-chat__message-reactions-detail__reaction-type-list' >
115+ < li className = 'str-chat__message-reactions-detail__reaction-type-list-item' >
116+ < button
117+ className = 'str-chat__message-reactions-detail__reaction-type-list-item-button'
118+ onClick = { ( ) => setExtendedReactionListOpen ( true ) }
119+ >
120+ < span className = 'str-chat__message-reactions-detail__reaction-type-list-item-icon' >
121+ < IconEmojiAdd />
122+ </ span >
123+ </ button >
124+ </ li >
125+
94126 { reactions . map (
95127 ( { EmojiComponent, reactionCount, reactionType } ) =>
96128 EmojiComponent && (
@@ -110,14 +142,12 @@ export function MessageReactionsDetail({
110142 < span className = 'str-chat__message-reactions-detail__reaction-type-list-item-icon' >
111143 < EmojiComponent />
112144 </ span >
113- { reactionCount > 1 && (
114- < span
115- className = 'str-chat__message-reactions-detail__reaction-type-list-item-count'
116- data-testclass = 'message-reactions-item-count'
117- >
118- { reactionCount }
119- </ span >
120- ) }
145+ < span
146+ className = 'str-chat__message-reactions-detail__reaction-type-list-item-count'
147+ data-testclass = 'message-reactions-item-count'
148+ >
149+ { reactionCount }
150+ </ span >
121151 </ button >
122152 </ li >
123153 ) ,
0 commit comments